|
| 1 | +/** -------------------------------------------------------------------------------------------------------------------- |
| 2 | +* <copyright company="Aspose" file="post_repair_request.go"> |
| 3 | +* Copyright (c) 2023 Aspose.Cells Cloud |
| 4 | +* </copyright> |
| 5 | +* <summary> |
| 6 | +* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | +* of this software and associated documentation files (the "Software"), to deal |
| 8 | +* in the Software without restriction, including without limitation the rights |
| 9 | +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 10 | +* copies of the Software, and to permit persons to whom the Software is |
| 11 | +* furnished to do so, subject to the following conditions: |
| 12 | +* |
| 13 | +* The above copyright notice and this permission notice shall be included in all |
| 14 | +* copies or substantial portions of the Software. |
| 15 | +* |
| 16 | +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | +* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | +* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | +* SOFTWARE. |
| 23 | +* </summary> |
| 24 | +-------------------------------------------------------------------------------------------------------------------- **/ |
| 25 | + |
| 26 | +package asposecellscloud |
| 27 | + |
| 28 | +import ( |
| 29 | + "net/url" |
| 30 | + "net/http" |
| 31 | + "strings" |
| 32 | +) |
| 33 | + |
| 34 | +type PostRepairRequest struct { |
| 35 | + Format string `json:"format,omitempty" xml:"format"` |
| 36 | + File map[string]string `json:"File,omitempty" xml:"File"` |
| 37 | +} |
| 38 | + |
| 39 | +func (data *PostRepairRequest) CreateRequestData( client *APIClient) (localVarRequest *http.Request, err error) { |
| 40 | + var ( |
| 41 | + localVarHttpMethod = strings.ToUpper("POST") |
| 42 | + localVarPostBody interface{} |
| 43 | + localVarFileName string |
| 44 | + localVarFileBytes []byte |
| 45 | + ) |
| 46 | + |
| 47 | + // create path and map variables |
| 48 | + localVarPath := client.cfg.BasePath + "/" + client.cfg.Version + "/cells/repair" |
| 49 | + |
| 50 | + localVarHeaderParams := make(map[string]string) |
| 51 | + localVarQueryParams := url.Values{} |
| 52 | + localVarFormParams := url.Values{} |
| 53 | + |
| 54 | + // query params : format |
| 55 | + if data.Format != "" { |
| 56 | + localVarQueryParams.Add("format", parameterToString(data.Format, "")) |
| 57 | + } |
| 58 | + |
| 59 | + |
| 60 | + localVarHttpContentTypes := []string{"multipart/form-data"} |
| 61 | + |
| 62 | + // set Content-Type header |
| 63 | + localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) |
| 64 | + if localVarHttpContentType != "" { |
| 65 | + localVarHeaderParams["Content-Type"] = localVarHttpContentType |
| 66 | + } |
| 67 | + |
| 68 | + // to determine the Accept header |
| 69 | + localVarHttpHeaderAccepts := []string{"application/json"} |
| 70 | + |
| 71 | + // set Accept header |
| 72 | + localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) |
| 73 | + if localVarHttpHeaderAccept != "" { |
| 74 | + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept |
| 75 | + } |
| 76 | + for name, path := range data.File { |
| 77 | + localVarFormParams["@"+name] = []string{path} |
| 78 | + } |
| 79 | + |
| 80 | + r, err := client.prepareRequest(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) |
| 81 | + return r,err |
| 82 | +} |
0 commit comments