Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public static async ValueTask <Maybe <string> > AsMaybeOfString(this GanymedeHttpResponse httpResponse)
        {
            if (httpResponse.IsSuccessStatusCode)
            {
                return(Maybe <string> .Some(await httpResponse.AsString()));
            }

            return(Maybe <string> .None);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public static async ValueTask <T> As <T>(this ValueTask <GanymedeHttpResponse> httpResponse)
        {
            GanymedeHttpResponse response = await httpResponse;

            return(await response.As <T>());
        }
Ejemplo n.º 6
0
        public static async ValueTask <Maybe <string> > AsMaybeOfString(this ValueTask <GanymedeHttpResponse> httpResponse)
        {
            GanymedeHttpResponse response = await httpResponse;

            return(await response.AsMaybeOfString());
        }
Ejemplo n.º 7
0
 public static async ValueTask <string> AsString(this GanymedeHttpResponse httpResponse)
 {
     return(await httpResponse.ResponseMessage.Content.ReadAsStringAsync());
 }
Ejemplo n.º 8
0
        public async Task <string> Get()
        {
            GanymedeHttpResponse s = await NewRequest.ForResource("Get").Send();

            return(await s.AsString());
        }