Пример #1
0
        //<summary>
        // Adds to a calendar
        //</summary>
        //<returns>
        // Success
        //</returns>
        //<param name="id"></param>
        //<param name="request">Start &amp; end date for request</param>
        public async Task <APIResponse <object> > Room_PostAddToCalendarAsync(string id, AddToCalendarRequest request)
        {
            {
                var response = await httpClient.PostAsync(new Uri(url + "/api/room/" + id + "/calendar/add", UriKind.Absolute), new SwaggerHTTPClientOptions(TimeSpan.FromSeconds(30)), new StringContent(JsonConvert.SerializeObject(request)));

                if (response == null)
                {
                    return(new APIResponse <object>(false));
                }

                switch ((int)response.StatusCode)
                {
                case 201:
                {
                    var data = JsonConvert.DeserializeObject <object>(await response.Content.ReadAsStringAsync());
                    return(new APIResponse <object>(data, response.StatusCode));
                }

                case 409:
                {
                    return(new APIResponse <object>(response.StatusCode));
                }

                default:
                {
                    return(new APIResponse <object>(response.StatusCode));
                }
                }
            }
        }
Пример #2
0
        //<summary>
        // Gets previously entered reviews
        //</summary>
        //<returns>
        // Success
        //</returns>
        //<param name="request">email or token for lookup</param>
        public async Task <APIResponse <RatingSession[]> > Rating_PostGetRatingAsync(GetRatings request)
        {
            {
                var response = await httpClient.PostAsync(new Uri(url + "/api/rating/history", UriKind.Absolute), new SwaggerHTTPClientOptions(TimeSpan.FromSeconds(30)), new StringContent(JsonConvert.SerializeObject(request)));

                if (response == null)
                {
                    return(new APIResponse <RatingSession[]>(false));
                }

                switch ((int)response.StatusCode)
                {
                case 200:
                {
                    var data = JsonConvert.DeserializeObject <RatingSession[]>(await response.Content.ReadAsStringAsync());
                    return(new APIResponse <RatingSession[]>(data, response.StatusCode));
                }

                case 400:
                {
                    return(new APIResponse <RatingSession[]>(response.StatusCode));
                }

                case 404:
                {
                    return(new APIResponse <RatingSession[]>(response.StatusCode));
                }

                default:
                {
                    return(new APIResponse <RatingSession[]>(response.StatusCode));
                }
                }
            }
        }
Пример #3
0
        //<remarks>
        // Creates a new pet in the store.  Duplicates are allowed
        //</remarks>
        //<returns>
        // pet response
        //</returns>
        //<param name="pet">Pet to add to the store</param>
        public async Task <APIResponse <Pet> > addPetAsync(PetInput pet)
        {
            {
                var response = await httpClient.PostAsync(new Uri(url + "/pets", UriKind.Absolute), new SwaggerHTTPClientOptions(TimeSpan.FromSeconds(30)), new StringContent(JsonConvert.SerializeObject(pet)));

                if (response == null)
                {
                    return(new APIResponse <Pet>(false));
                }

                switch ((int)response.StatusCode)
                {
                case 200:
                {
                    var data = JsonConvert.DeserializeObject <Pet>(await response.Content.ReadAsStringAsync());
                    return(new APIResponse <Pet>(data, response.StatusCode));
                }

                case 200:
                {
                    var data = JsonConvert.DeserializeObject <Pet>(await response.Content.ReadAsStringAsync());
                    return(new APIResponse <Pet>(data, response.StatusCode));
                }

                default:
                {
                    return(new APIResponse <Pet>(response.StatusCode));
                }
                }
            }
        }