/* * A Bit of Everything * * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * API version: 1.0 * Contact: none@example.com * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git) */ package abe import ( "context" "io/ioutil" "net/http" "net/url" "strings" ) // Linger please var ( _ context.Context ) type CamelCaseServiceNameApiService service /* CamelCaseServiceNameApiService * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @return interface{} */ func (a *CamelCaseServiceNameApiService) CamelCaseServiceNameEmpty(ctx context.Context) (interface{}, *http.Response, error) { var ( localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFileName string localVarFileBytes []byte localVarReturnValue interface{} ) // create path and map variables localVarPath := a.client.cfg.BasePath + "/v2/example/empty" localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} // to determine the Content-Type header localVarHttpContentTypes := []string{"application/json", "application/x-foo-mime"} // set Content-Type header localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes) if localVarHttpContentType != "" { localVarHeaderParams["Content-Type"] = localVarHttpContentType } // to determine the Accept header localVarHttpHeaderAccepts := []string{"application/json", "application/x-foo-mime"} // set Accept header localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts) if localVarHttpHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHttpHeaderAccept } if ctx != nil { // API Key Authentication if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok { var key string if auth.Prefix != "" { key = auth.Prefix + " " + auth.Key } else { key = auth.Key } localVarHeaderParams["X-API-Key"] = key } } r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err } localVarHttpResponse, err := a.client.callAPI(r) if err != nil || localVarHttpResponse == nil { return localVarReturnValue, localVarHttpResponse, err } localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body) localVarHttpResponse.Body.Close() if err != nil { return localVarReturnValue, localVarHttpResponse, err } if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err == nil { return localVarReturnValue, localVarHttpResponse, err } } if localVarHttpResponse.StatusCode >= 300 { newErr := GenericSwaggerError{ body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 403 { var v interface{} err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 404 { var v string err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 418 { var v ExamplepbNumericEnum err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } if localVarHttpResponse.StatusCode == 0 { var v RuntimeError err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); if err != nil { newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr } newErr.model = v return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, nil }