Exemple #1
0
        /// <summary>
        /// BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs.  If a given Order ID does not exist, the ID is ignored instead of generating an error.
        /// </summary>
        /// <exception cref="Square.Connect.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="locationId">The ID of the orders&#39; associated location.</param>
        /// <param name="body">An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <returns>Task of BatchRetrieveOrdersResponse</returns>
        public async System.Threading.Tasks.Task <BatchRetrieveOrdersResponse> BatchRetrieveOrdersAsync(string locationId, BatchRetrieveOrdersRequest body)
        {
            ApiResponse <BatchRetrieveOrdersResponse> localVarResponse = await BatchRetrieveOrdersAsyncWithHttpInfo(locationId, body);

            return(localVarResponse.Data);
        }
Exemple #2
0
        /// <summary>
        /// BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs.  If a given Order ID does not exist, the ID is ignored instead of generating an error.
        /// </summary>
        /// <exception cref="Square.Connect.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="locationId">The ID of the orders&#39; associated location.</param>
        /// <param name="body">An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <returns>Task of ApiResponse (BatchRetrieveOrdersResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <BatchRetrieveOrdersResponse> > BatchRetrieveOrdersAsyncWithHttpInfo(string locationId, BatchRetrieveOrdersRequest body)
        {
            // verify the required parameter 'locationId' is set
            if (locationId == null)
            {
                throw new ApiException(400, "Missing required parameter 'locationId' when calling OrdersApi->BatchRetrieveOrders");
            }
            // verify the required parameter 'body' is set
            if (body == null)
            {
                throw new ApiException(400, "Missing required parameter 'body' when calling OrdersApi->BatchRetrieveOrders");
            }

            var    localVarPath         = "/v2/locations/{location_id}/orders/batch-retrieve";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <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"
            };
            String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

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

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

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

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

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

            int localVarStatusCode = (int)localVarResponse.StatusCode;

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

            return(new ApiResponse <BatchRetrieveOrdersResponse>(localVarStatusCode,
                                                                 localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                                 (BatchRetrieveOrdersResponse)Configuration.ApiClient.Deserialize(localVarResponse, typeof(BatchRetrieveOrdersResponse))));
        }
Exemple #3
0
        /// <summary>
        /// BatchRetrieveOrders Retrieves a set of [Order](#type-order)s by their IDs.  If a given Order ID does not exist, the ID is ignored instead of generating an error.
        /// </summary>
        /// <exception cref="Square.Connect.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="locationId">The ID of the orders&#39; associated location.</param>
        /// <param name="body">An object containing the fields to POST for the request.  See the corresponding object definition for field details.</param>
        /// <returns>BatchRetrieveOrdersResponse</returns>
        public BatchRetrieveOrdersResponse BatchRetrieveOrders(string locationId, BatchRetrieveOrdersRequest body)
        {
            ApiResponse <BatchRetrieveOrdersResponse> localVarResponse = BatchRetrieveOrdersWithHttpInfo(locationId, body);

            return(localVarResponse.Data);
        }