Exemplo n.º 1
0
        /// <summary>
        /// Update or insert current tip configuration for a store
        /// </summary>
        /// <exception cref="Flipdish.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="storeId">Store Id</param>
        /// <param name="updateConfig">Update Configuration</param>
        /// <returns>Task of RestApiResultTipConfiguration</returns>
        public async System.Threading.Tasks.Task <RestApiResultTipConfiguration> TipConfigUpsertAsync(int?storeId, UpdateTipConfiguration updateConfig)
        {
            ApiResponse <RestApiResultTipConfiguration> localVarResponse = await TipConfigUpsertAsyncWithHttpInfo(storeId, updateConfig);

            return(localVarResponse.Data);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update or insert current tip configuration for a store
        /// </summary>
        /// <exception cref="Flipdish.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="storeId">Store Id</param>
        /// <param name="updateConfig">Update Configuration</param>
        /// <returns>Task of ApiResponse (RestApiResultTipConfiguration)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <RestApiResultTipConfiguration> > TipConfigUpsertAsyncWithHttpInfo(int?storeId, UpdateTipConfiguration updateConfig)
        {
            // verify the required parameter 'storeId' is set
            if (storeId == null)
            {
                throw new ApiException(400, "Missing required parameter 'storeId' when calling TipsApi->TipConfigUpsert");
            }
            // verify the required parameter 'updateConfig' is set
            if (updateConfig == null)
            {
                throw new ApiException(400, "Missing required parameter 'updateConfig' when calling TipsApi->TipConfigUpsert");
            }

            var    localVarPath         = "/api/v1.0/stores/{storeId}/tipconfig";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.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"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

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

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

            if (storeId != null)
            {
                localVarPathParams.Add("storeId", this.Configuration.ApiClient.ParameterToString(storeId));                  // path parameter
            }
            if (updateConfig != null && updateConfig.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(updateConfig); // http body (model) parameter
            }
            else
            {
                localVarPostBody = updateConfig; // byte array
            }

            // authentication (oauth2) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }

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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <RestApiResultTipConfiguration>(localVarStatusCode,
                                                                   localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                   (RestApiResultTipConfiguration)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(RestApiResultTipConfiguration))));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Update or insert current tip configuration for a store
        /// </summary>
        /// <exception cref="Flipdish.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="storeId">Store Id</param>
        /// <param name="updateConfig">Update Configuration</param>
        /// <returns>RestApiResultTipConfiguration</returns>
        public RestApiResultTipConfiguration TipConfigUpsert(int?storeId, UpdateTipConfiguration updateConfig)
        {
            ApiResponse <RestApiResultTipConfiguration> localVarResponse = TipConfigUpsertWithHttpInfo(storeId, updateConfig);

            return(localVarResponse.Data);
        }