Ejemplo n.º 1
0
        /// <inheritdoc/>
        public string AddToCalendar(AddToCalendarRequest addToCalendarRequest)
        {
            Preconditions.NotNull("addToCalendarRequest", addToCalendarRequest);

            addToCalendarRequest.ClientId     = this.clientId;
            addToCalendarRequest.ClientSecret = this.clientSecret;

            var request = new HttpRequest();

            request.Method = "POST";
            request.Url    = this.urlProvider.AddToCalendarUrl;
            request.SetJsonBody(addToCalendarRequest);

            var response = this.HttpClient.GetJsonResponse <AddToCalendarResponse>(request);

            return(response.Url);
        }
Ejemplo n.º 2
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));
                }
                }
            }
        }