Skip to content

Commit d976a34

Browse files
committed
Added some docs
1 parent b63dddd commit d976a34

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

FirebaseAdmin/FirebaseAdmin.Tests/FirebaseAppTest.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,11 @@ public void GetOrInitService()
214214
public void GetSdkVersion()
215215
{
216216
var version = FirebaseApp.GetSdkVersion();
217-
Assert.Equal(3, version.Split(".").Length);
217+
218+
var segments = version.Split(".");
219+
Assert.Equal(3, segments.Length);
220+
int result;
221+
Assert.All(segments, (segment) => int.TryParse(segment, out result));
218222
}
219223

220224
public void Dispose()

FirebaseAdmin/FirebaseAdmin/FirebaseApp.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ internal static void DeleteAll()
262262
}
263263
}
264264

265+
/// <summary>
266+
/// Returns the current version of the .NET assembly.
267+
/// </summary>
268+
/// <returns>A version string in major.minor.patch format.</returns>
265269
internal static string GetSdkVersion()
266270
{
267271
return typeof(FirebaseApp).GetTypeInfo().Assembly.GetName().Version.ToString(3);

FirebaseAdmin/FirebaseAdmin/Messaging/FirebaseMessagingClient.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public async Task<string> SendAsync(
101101
};
102102
try
103103
{
104-
var response = await this.PostAsync(request, cancellationToken).ConfigureAwait(false);
104+
var response = await this.SendRequestAsync(request, cancellationToken).ConfigureAwait(false);
105105
var json = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
106106
if (!response.IsSuccessStatusCode)
107107
{
@@ -175,7 +175,7 @@ private static FirebaseException CreateExceptionFor(RequestError requestError)
175175
return new FirebaseException(requestError.ToString());
176176
}
177177

178-
private async Task<HttpResponseMessage> PostAsync(object body, CancellationToken cancellationToken)
178+
private async Task<HttpResponseMessage> SendRequestAsync(object body, CancellationToken cancellationToken)
179179
{
180180
var request = new HttpRequestMessage()
181181
{
@@ -187,7 +187,10 @@ private async Task<HttpResponseMessage> PostAsync(object body, CancellationToken
187187
return await this.httpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);
188188
}
189189

190-
private async Task<BatchResponse> SendBatchRequestAsync(IEnumerable<Message> messages, bool dryRun, CancellationToken cancellationToken)
190+
private async Task<BatchResponse> SendBatchRequestAsync(
191+
IEnumerable<Message> messages,
192+
bool dryRun,
193+
CancellationToken cancellationToken)
191194
{
192195
var responses = new List<SendResponse>();
193196

@@ -206,15 +209,19 @@ private async Task<BatchResponse> SendBatchRequestAsync(IEnumerable<Message> mes
206209
}
207210
else
208211
{
209-
responses.Add(SendResponse.FromException(new FirebaseException($"Unexpected batch response. Response status code was {message.StatusCode}.")));
212+
responses.Add(SendResponse.FromException(new FirebaseException(
213+
$"Unexpected batch response. Response status code was {message.StatusCode}.")));
210214
}
211215
});
212216

213217
await batch.ExecuteAsync(cancellationToken).ConfigureAwait(false);
214218
return new BatchResponse(responses);
215219
}
216220

217-
private BatchRequest CreateBatchRequest(IEnumerable<Message> messages, bool dryRun, BatchRequest.OnResponse<SingleMessageResponse> callback)
221+
private BatchRequest CreateBatchRequest(
222+
IEnumerable<Message> messages,
223+
bool dryRun,
224+
BatchRequest.OnResponse<SingleMessageResponse> callback)
218225
{
219226
var batch = new BatchRequest(this.fcmClientService, FcmBatchUrl);
220227

0 commit comments

Comments
 (0)