@@ -20,16 +20,16 @@ namespace WebUntisAPI.Client.Models.Messages
2020 public struct Attachment
2121 {
2222 /// <summary>
23- /// The file name of the attachment
23+ /// The attachment id
2424 /// </summary>
25- [ JsonProperty ( "name " ) ]
26- public string Name { get ; set ; }
25+ [ JsonProperty ( "id " ) ]
26+ public string Id { get ; set ; }
2727
2828 /// <summary>
29- /// The attachment id
29+ /// The file name of the attachment
3030 /// </summary>
31- [ JsonProperty ( "id " ) ]
32- internal readonly string _id ;
31+ [ JsonProperty ( "name " ) ]
32+ public string Name { get ; set ; }
3333
3434 /// <summary>
3535 /// Get the content of the attachment as stream with a progress report
@@ -44,7 +44,7 @@ public struct Attachment
4444 /// <exception cref="HttpRequestException">Thrown when an error happened while the http request</exception>
4545 public async Task < Stream > DownloadContentAsStreamAsync ( WebUntisClient client , TimeSpan timeout , IProgress < double > progress = null , CancellationToken ct = default )
4646 {
47- string storageResponseString = await client . MakeAPIGetRequestAsync ( $ "/WebUntis/api/rest/view/v1/messages/{ _id } /attachmentstorageurl", ct ) ;
47+ string storageResponseString = await client . MakeAPIGetRequestAsync ( $ "/WebUntis/api/rest/view/v1/messages/{ Id } /attachmentstorageurl", ct ) ;
4848
4949 JObject data = JObject . Parse ( storageResponseString ) ;
5050 JArray headerArray = data . Value < JArray > ( "additionalHeaders" ) ;
@@ -85,7 +85,7 @@ public async Task<Stream> DownloadContentAsStreamAsync(WebUntisClient client, Ti
8585
8686 content . Write ( buffer , 0 , bytesRead ) ;
8787 totalRecievedBytes += bytesRead ;
88- progress . Report ( ( double ) totalRecievedBytes / totalBytes * 100d ) ;
88+ progress ? . Report ( ( double ) totalRecievedBytes / totalBytes * 100d ) ;
8989 }
9090 }
9191
0 commit comments