public static async ValueTask <T> As <T>(this GanymedeHttpResponse httpResponse) { Maybe <T> deserialized = await httpResponse.ResponseMessage .RequestMessage.GetContentDeserializer() .Deserialize <T>(httpResponse.ResponseMessage.Content); return(deserialized.Value); }
public static async ValueTask <Maybe <string> > AsMaybeOfString(this GanymedeHttpResponse httpResponse) { if (httpResponse.IsSuccessStatusCode) { return(Maybe <string> .Some(await httpResponse.AsString())); } return(Maybe <string> .None); }
public static async ValueTask <Maybe <T> > AsMaybeOf <T>(this GanymedeHttpResponse httpResponse) { if (httpResponse.IsSuccessStatusCode) { return(await httpResponse .ResponseMessage .RequestMessage.GetContentDeserializer() .Deserialize <T>(httpResponse.ResponseMessage.Content)); } return(Maybe <T> .None); }
public async Task <IdentityModel> Signin(AuthModel model) { model.client_id = _options.ClientId; model.client_secret = _options.ClientSecret; GanymedeHttpResponse result = await NewRequest.ForResource("signin") .ConfigureRequestContent(a => a.SerializeContent(model, "application/x-www-form-urlencoded")) .Send().AsTask(); return(null); }
public static async ValueTask <T> As <T>(this ValueTask <GanymedeHttpResponse> httpResponse) { GanymedeHttpResponse response = await httpResponse; return(await response.As <T>()); }
public static async ValueTask <Maybe <string> > AsMaybeOfString(this ValueTask <GanymedeHttpResponse> httpResponse) { GanymedeHttpResponse response = await httpResponse; return(await response.AsMaybeOfString()); }
public static async ValueTask <string> AsString(this GanymedeHttpResponse httpResponse) { return(await httpResponse.ResponseMessage.Content.ReadAsStringAsync()); }
public async Task <string> Get() { GanymedeHttpResponse s = await NewRequest.ForResource("Get").Send(); return(await s.AsString()); }