Example #1
0
        /// <summary>
        /// Update an organisation.    Requires &#39;OrganisationAdmin&#39; permission.
        /// </summary>
        /// <exception cref="ChronoSheetsAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="request">An Update Organsation Request object containing updated fields.  Make sure to specify the Organsation Id in the request object so that ChronoSheets knows which Organsation to update</param>
        /// <param name="xChronosheetsAuth">The ChronoSheets Auth Token</param>
        /// <returns>Task of CSApiResponseUpdateOrganisationResponse</returns>
        public async System.Threading.Tasks.Task <CSApiResponseUpdateOrganisationResponse> OrganisationUpdateOrganisationAsync(CSUpdateOrganisationRequest request, string xChronosheetsAuth)
        {
            ApiResponse <CSApiResponseUpdateOrganisationResponse> localVarResponse = await OrganisationUpdateOrganisationAsyncWithHttpInfo(request, xChronosheetsAuth);

            return(localVarResponse.Data);
        }
Example #2
0
        /// <summary>
        /// Update an organisation.    Requires &#39;OrganisationAdmin&#39; permission.
        /// </summary>
        /// <exception cref="ChronoSheetsAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="request">An Update Organsation Request object containing updated fields.  Make sure to specify the Organsation Id in the request object so that ChronoSheets knows which Organsation to update</param>
        /// <param name="xChronosheetsAuth">The ChronoSheets Auth Token</param>
        /// <returns>Task of ApiResponse (CSApiResponseUpdateOrganisationResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <CSApiResponseUpdateOrganisationResponse> > OrganisationUpdateOrganisationAsyncWithHttpInfo(CSUpdateOrganisationRequest request, string xChronosheetsAuth)
        {
            // verify the required parameter 'request' is set
            if (request == null)
            {
                throw new ApiException(400, "Missing required parameter 'request' when calling OrganisationApi->OrganisationUpdateOrganisation");
            }
            // verify the required parameter 'xChronosheetsAuth' is set
            if (xChronosheetsAuth == null)
            {
                throw new ApiException(400, "Missing required parameter 'xChronosheetsAuth' when calling OrganisationApi->OrganisationUpdateOrganisation");
            }

            var    localVarPath         = "/api/Organisation/UpdateOrganisation";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml",
                "application/x-www-form-urlencoded",
                "multipart/form-data"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json",
                "text/json",
                "application/xml",
                "text/xml",
                "multipart/form-data"
            };
            String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (xChronosheetsAuth != null)
            {
                localVarHeaderParams.Add("x-chronosheets-auth", Configuration.ApiClient.ParameterToString(xChronosheetsAuth));                            // header parameter
            }
            if (request != null && request.GetType() != typeof(byte[]))
            {
                localVarPostBody = Configuration.ApiClient.Serialize(request); // http body (model) parameter
            }
            else
            {
                localVarPostBody = request; // byte array
            }


            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                       Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                       localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("OrganisationUpdateOrganisation", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <CSApiResponseUpdateOrganisationResponse>(localVarStatusCode,
                                                                             localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                             (CSApiResponseUpdateOrganisationResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(CSApiResponseUpdateOrganisationResponse))));
        }
Example #3
0
        /// <summary>
        /// Update an organisation.    Requires &#39;OrganisationAdmin&#39; permission.
        /// </summary>
        /// <exception cref="ChronoSheetsAPI.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="request">An Update Organsation Request object containing updated fields.  Make sure to specify the Organsation Id in the request object so that ChronoSheets knows which Organsation to update</param>
        /// <param name="xChronosheetsAuth">The ChronoSheets Auth Token</param>
        /// <returns>CSApiResponseUpdateOrganisationResponse</returns>
        public CSApiResponseUpdateOrganisationResponse OrganisationUpdateOrganisation(CSUpdateOrganisationRequest request, string xChronosheetsAuth)
        {
            ApiResponse <CSApiResponseUpdateOrganisationResponse> localVarResponse = OrganisationUpdateOrganisationWithHttpInfo(request, xChronosheetsAuth);

            return(localVarResponse.Data);
        }