private static async Task <NotificationResult> GetErrorResult(HttpResponseMessage response) { var content = await response.Content.ReadAsStringAsync(); FcmResponse fcmResponse = TryGetFcmResponse(content); NotificationErrorCode errorCode = GetErrorCodeFromResponse(fcmResponse); return(NotificationResult.WithError(errorCode, $"{response.StatusCode}:{fcmResponse?.Error.Message}; Details: {content}")); }
private async Task <NotificationResult> GetErrorResult(HttpResponseMessage response) { var content = await response.Content.ReadAsStringAsync(); ApnsError apnsError = TryGetApnsError(content); NotificationErrorCode errorCode = GetErrorCodeFromResponse(response, apnsError); return(NotificationResult.WithError(errorCode, $"{response.StatusCode}:{content}")); }
private async Task <NotificationResult> SendViaHttpV1(string requestBody) { string token; try { token = await GetAccessToken(); } catch (TokenResponseException e) { return(NotificationResult.WithError(NotificationErrorCode.AccessDenied, e.Message)); } return(await SendRequest(requestBody, token, notificationUri, true)); }