github.com/safedep/dry@v0.0.0-20241016050132-a15651f0548b/apiguard/tykgen/api_oasapis.go (about)

     1  
     2  /*
     3   * Tyk Gateway API
     4   *
     5   * The Tyk Gateway API is the primary means for integrating your application with the Tyk API Gateway system. This API is very small, and has no granular permissions system. It is intended to be used purely for internal automation and integration.  **Warning: Under no circumstances should outside parties be granted access to this API.**  The Tyk Gateway API is capable of:  * Managing session objects (key generation) * Managing and listing policies * Managing and listing API Definitions (only when not using the Dashboard) * Hot reloads / reloading a cluster configuration * OAuth client creation (only when not using the Dashboard)   In order to use the Gateway API, you'll need to set the `secret` parameter in your tyk.conf file.  The shared secret you set should then be sent along as a header with each Gateway API Request in order for it to be successful:  ``` x-tyk-authorization: <your-secret> ``` <br/> <b>The Tyk Gateway API is subsumed by the Tyk Dashboard API in Pro installations.</b>
     6   *
     7   * API version: 5.5.0
     8   * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
     9   */
    10  package swagger
    11  
    12  import (
    13  	"context"
    14  	"io/ioutil"
    15  	"net/http"
    16  	"net/url"
    17  	"strings"
    18  	"fmt"
    19  	"github.com/antihax/optional"
    20  )
    21  
    22  // Linger please
    23  var (
    24  	_ context.Context
    25  )
    26  
    27  type OASAPIsApiService service
    28  /*
    29  OASAPIsApiService
    30  Create API with OAS format  A single Tyk node can have its API Definitions queried, deleted and updated remotely. This functionality enables you to remotely update your Tyk definitions without having to manage the files manually.
    31   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
    32   * @param optional nil or *OASAPIsApiCreateApiOASOpts - Optional Parameters:
    33       * @param "Body" (optional.Interface of Schema) - 
    34       * @param "BaseApiId" (optional.String) -  The base API which the new version will be linked to.
    35       * @param "BaseApiVersionName" (optional.String) -  The version name of the base API while creating the first version. This doesn&#x27;t have to be sent for the next versions but if it is set, it will override base API version name.
    36       * @param "NewVersionName" (optional.String) -  The version name of the created version.
    37       * @param "SetDefault" (optional.Bool) -  If true, the new version is set as default version.
    38  @return ApiModifyKeySuccess
    39  */
    40  
    41  type OASAPIsApiCreateApiOASOpts struct {
    42      Body optional.Interface
    43      BaseApiId optional.String
    44      BaseApiVersionName optional.String
    45      NewVersionName optional.String
    46      SetDefault optional.Bool
    47  }
    48  
    49  func (a *OASAPIsApiService) CreateApiOAS(ctx context.Context, localVarOptionals *OASAPIsApiCreateApiOASOpts) (ApiModifyKeySuccess, *http.Response, error) {
    50  	var (
    51  		localVarHttpMethod = strings.ToUpper("Post")
    52  		localVarPostBody   interface{}
    53  		localVarFileName   string
    54  		localVarFileBytes  []byte
    55  		localVarReturnValue ApiModifyKeySuccess
    56  	)
    57  
    58  	// create path and map variables
    59  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas"
    60  
    61  	localVarHeaderParams := make(map[string]string)
    62  	localVarQueryParams := url.Values{}
    63  	localVarFormParams := url.Values{}
    64  
    65  	if localVarOptionals != nil && localVarOptionals.BaseApiId.IsSet() {
    66  		localVarQueryParams.Add("base_api_id", parameterToString(localVarOptionals.BaseApiId.Value(), ""))
    67  	}
    68  	if localVarOptionals != nil && localVarOptionals.BaseApiVersionName.IsSet() {
    69  		localVarQueryParams.Add("base_api_version_name", parameterToString(localVarOptionals.BaseApiVersionName.Value(), ""))
    70  	}
    71  	if localVarOptionals != nil && localVarOptionals.NewVersionName.IsSet() {
    72  		localVarQueryParams.Add("new_version_name", parameterToString(localVarOptionals.NewVersionName.Value(), ""))
    73  	}
    74  	if localVarOptionals != nil && localVarOptionals.SetDefault.IsSet() {
    75  		localVarQueryParams.Add("set_default", parameterToString(localVarOptionals.SetDefault.Value(), ""))
    76  	}
    77  	// to determine the Content-Type header
    78  	localVarHttpContentTypes := []string{"application/json"}
    79  
    80  	// set Content-Type header
    81  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
    82  	if localVarHttpContentType != "" {
    83  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
    84  	}
    85  
    86  	// to determine the Accept header
    87  	localVarHttpHeaderAccepts := []string{"application/json"}
    88  
    89  	// set Accept header
    90  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
    91  	if localVarHttpHeaderAccept != "" {
    92  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
    93  	}
    94  	// body params
    95  	if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
    96  		
    97  		localVarOptionalBody:= localVarOptionals.Body.Value()
    98  		localVarPostBody = &localVarOptionalBody
    99  	}
   100  	if ctx != nil {
   101  		// API Key Authentication
   102  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   103  			var key string
   104  			if auth.Prefix != "" {
   105  				key = auth.Prefix + " " + auth.Key
   106  			} else {
   107  				key = auth.Key
   108  			}
   109  			localVarHeaderParams["X-Tyk-Authorization"] = key
   110  			
   111  		}
   112  	}
   113  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   114  	if err != nil {
   115  		return localVarReturnValue, nil, err
   116  	}
   117  
   118  	localVarHttpResponse, err := a.client.callAPI(r)
   119  	if err != nil || localVarHttpResponse == nil {
   120  		return localVarReturnValue, localVarHttpResponse, err
   121  	}
   122  
   123  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   124  	localVarHttpResponse.Body.Close()
   125  	if err != nil {
   126  		return localVarReturnValue, localVarHttpResponse, err
   127  	}
   128  
   129  	if localVarHttpResponse.StatusCode < 300 {
   130  		// If we succeed, return the data, otherwise pass on to decode error.
   131  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   132  		if err == nil { 
   133  			return localVarReturnValue, localVarHttpResponse, err
   134  		}
   135  	}
   136  
   137  	if localVarHttpResponse.StatusCode >= 300 {
   138  		newErr := GenericSwaggerError{
   139  			body: localVarBody,
   140  			error: localVarHttpResponse.Status,
   141  		}
   142  		if localVarHttpResponse.StatusCode == 200 {
   143  			var v ApiModifyKeySuccess
   144  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   145  				if err != nil {
   146  					newErr.error = err.Error()
   147  					return localVarReturnValue, localVarHttpResponse, newErr
   148  				}
   149  				newErr.model = v
   150  				return localVarReturnValue, localVarHttpResponse, newErr
   151  		}
   152  		if localVarHttpResponse.StatusCode == 400 {
   153  			var v ApiStatusMessage
   154  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   155  				if err != nil {
   156  					newErr.error = err.Error()
   157  					return localVarReturnValue, localVarHttpResponse, newErr
   158  				}
   159  				newErr.model = v
   160  				return localVarReturnValue, localVarHttpResponse, newErr
   161  		}
   162  		return localVarReturnValue, localVarHttpResponse, newErr
   163  	}
   164  
   165  	return localVarReturnValue, localVarHttpResponse, nil
   166  }
   167  /*
   168  OASAPIsApiService
   169  Deleting an API definition will remove the file from the file store, the API definition will NOT be unloaded, a separate reload request will need to be made to disable the API endpoint.
   170   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   171   * @param apiID The API ID
   172  @return ApiStatusMessage
   173  */
   174  func (a *OASAPIsApiService) DeleteOASApi(ctx context.Context, apiID string) (ApiStatusMessage, *http.Response, error) {
   175  	var (
   176  		localVarHttpMethod = strings.ToUpper("Delete")
   177  		localVarPostBody   interface{}
   178  		localVarFileName   string
   179  		localVarFileBytes  []byte
   180  		localVarReturnValue ApiStatusMessage
   181  	)
   182  
   183  	// create path and map variables
   184  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/{apiID}"
   185  	localVarPath = strings.Replace(localVarPath, "{"+"apiID"+"}", fmt.Sprintf("%v", apiID), -1)
   186  
   187  	localVarHeaderParams := make(map[string]string)
   188  	localVarQueryParams := url.Values{}
   189  	localVarFormParams := url.Values{}
   190  
   191  	// to determine the Content-Type header
   192  	localVarHttpContentTypes := []string{}
   193  
   194  	// set Content-Type header
   195  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   196  	if localVarHttpContentType != "" {
   197  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   198  	}
   199  
   200  	// to determine the Accept header
   201  	localVarHttpHeaderAccepts := []string{"application/json"}
   202  
   203  	// set Accept header
   204  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   205  	if localVarHttpHeaderAccept != "" {
   206  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   207  	}
   208  	if ctx != nil {
   209  		// API Key Authentication
   210  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   211  			var key string
   212  			if auth.Prefix != "" {
   213  				key = auth.Prefix + " " + auth.Key
   214  			} else {
   215  				key = auth.Key
   216  			}
   217  			localVarHeaderParams["X-Tyk-Authorization"] = key
   218  			
   219  		}
   220  	}
   221  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   222  	if err != nil {
   223  		return localVarReturnValue, nil, err
   224  	}
   225  
   226  	localVarHttpResponse, err := a.client.callAPI(r)
   227  	if err != nil || localVarHttpResponse == nil {
   228  		return localVarReturnValue, localVarHttpResponse, err
   229  	}
   230  
   231  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   232  	localVarHttpResponse.Body.Close()
   233  	if err != nil {
   234  		return localVarReturnValue, localVarHttpResponse, err
   235  	}
   236  
   237  	if localVarHttpResponse.StatusCode < 300 {
   238  		// If we succeed, return the data, otherwise pass on to decode error.
   239  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   240  		if err == nil { 
   241  			return localVarReturnValue, localVarHttpResponse, err
   242  		}
   243  	}
   244  
   245  	if localVarHttpResponse.StatusCode >= 300 {
   246  		newErr := GenericSwaggerError{
   247  			body: localVarBody,
   248  			error: localVarHttpResponse.Status,
   249  		}
   250  		if localVarHttpResponse.StatusCode == 200 {
   251  			var v ApiStatusMessage
   252  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   253  				if err != nil {
   254  					newErr.error = err.Error()
   255  					return localVarReturnValue, localVarHttpResponse, newErr
   256  				}
   257  				newErr.model = v
   258  				return localVarReturnValue, localVarHttpResponse, newErr
   259  		}
   260  		if localVarHttpResponse.StatusCode == 400 {
   261  			var v ApiStatusMessage
   262  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   263  				if err != nil {
   264  					newErr.error = err.Error()
   265  					return localVarReturnValue, localVarHttpResponse, newErr
   266  				}
   267  				newErr.model = v
   268  				return localVarReturnValue, localVarHttpResponse, newErr
   269  		}
   270  		return localVarReturnValue, localVarHttpResponse, newErr
   271  	}
   272  
   273  	return localVarReturnValue, localVarHttpResponse, nil
   274  }
   275  /*
   276  OASAPIsApiService
   277  Download all OAS format APIs, when used without the Tyk Dashboard.
   278   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   279   * @param apiID The API ID
   280   * @param optional nil or *OASAPIsApiDownloadApiOASPublicOpts - Optional Parameters:
   281       * @param "Mode" (optional.String) -  Mode of OAS export, by default mode could be empty which means to export OAS spec including OAS Tyk extension.  When mode&#x3D;public, OAS spec excluding Tyk extension is exported
   282  @return OasSchemaResponse
   283  */
   284  
   285  type OASAPIsApiDownloadApiOASPublicOpts struct {
   286      Mode optional.String
   287  }
   288  
   289  func (a *OASAPIsApiService) DownloadApiOASPublic(ctx context.Context, apiID string, localVarOptionals *OASAPIsApiDownloadApiOASPublicOpts) (OasSchemaResponse, *http.Response, error) {
   290  	var (
   291  		localVarHttpMethod = strings.ToUpper("Get")
   292  		localVarPostBody   interface{}
   293  		localVarFileName   string
   294  		localVarFileBytes  []byte
   295  		localVarReturnValue OasSchemaResponse
   296  	)
   297  
   298  	// create path and map variables
   299  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/{apiID}/export"
   300  	localVarPath = strings.Replace(localVarPath, "{"+"apiID"+"}", fmt.Sprintf("%v", apiID), -1)
   301  
   302  	localVarHeaderParams := make(map[string]string)
   303  	localVarQueryParams := url.Values{}
   304  	localVarFormParams := url.Values{}
   305  
   306  	if localVarOptionals != nil && localVarOptionals.Mode.IsSet() {
   307  		localVarQueryParams.Add("mode", parameterToString(localVarOptionals.Mode.Value(), ""))
   308  	}
   309  	// to determine the Content-Type header
   310  	localVarHttpContentTypes := []string{}
   311  
   312  	// set Content-Type header
   313  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   314  	if localVarHttpContentType != "" {
   315  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   316  	}
   317  
   318  	// to determine the Accept header
   319  	localVarHttpHeaderAccepts := []string{"application/json"}
   320  
   321  	// set Accept header
   322  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   323  	if localVarHttpHeaderAccept != "" {
   324  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   325  	}
   326  	if ctx != nil {
   327  		// API Key Authentication
   328  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   329  			var key string
   330  			if auth.Prefix != "" {
   331  				key = auth.Prefix + " " + auth.Key
   332  			} else {
   333  				key = auth.Key
   334  			}
   335  			localVarHeaderParams["X-Tyk-Authorization"] = key
   336  			
   337  		}
   338  	}
   339  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   340  	if err != nil {
   341  		return localVarReturnValue, nil, err
   342  	}
   343  
   344  	localVarHttpResponse, err := a.client.callAPI(r)
   345  	if err != nil || localVarHttpResponse == nil {
   346  		return localVarReturnValue, localVarHttpResponse, err
   347  	}
   348  
   349  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   350  	localVarHttpResponse.Body.Close()
   351  	if err != nil {
   352  		return localVarReturnValue, localVarHttpResponse, err
   353  	}
   354  
   355  	if localVarHttpResponse.StatusCode < 300 {
   356  		// If we succeed, return the data, otherwise pass on to decode error.
   357  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   358  		if err == nil { 
   359  			return localVarReturnValue, localVarHttpResponse, err
   360  		}
   361  	}
   362  
   363  	if localVarHttpResponse.StatusCode >= 300 {
   364  		newErr := GenericSwaggerError{
   365  			body: localVarBody,
   366  			error: localVarHttpResponse.Status,
   367  		}
   368  		if localVarHttpResponse.StatusCode == 200 {
   369  			var v OasSchemaResponse
   370  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   371  				if err != nil {
   372  					newErr.error = err.Error()
   373  					return localVarReturnValue, localVarHttpResponse, newErr
   374  				}
   375  				newErr.model = v
   376  				return localVarReturnValue, localVarHttpResponse, newErr
   377  		}
   378  		return localVarReturnValue, localVarHttpResponse, newErr
   379  	}
   380  
   381  	return localVarReturnValue, localVarHttpResponse, nil
   382  }
   383  /*
   384  OASAPIsApiService
   385  Download all OAS format APIs, when used without the Tyk Dashboard.
   386   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   387   * @param optional nil or *OASAPIsApiDownloadApisOASPublicOpts - Optional Parameters:
   388       * @param "Mode" (optional.String) -  The mode of OAS export. By default the mode is not set which means the OAS spec is exported including the OAS Tyk extension.   If the mode is set to public, the OAS spec excluding the Tyk extension is exported.
   389  @return []OasSchemaResponse
   390  */
   391  
   392  type OASAPIsApiDownloadApisOASPublicOpts struct {
   393      Mode optional.String
   394  }
   395  
   396  func (a *OASAPIsApiService) DownloadApisOASPublic(ctx context.Context, localVarOptionals *OASAPIsApiDownloadApisOASPublicOpts) ([]OasSchemaResponse, *http.Response, error) {
   397  	var (
   398  		localVarHttpMethod = strings.ToUpper("Get")
   399  		localVarPostBody   interface{}
   400  		localVarFileName   string
   401  		localVarFileBytes  []byte
   402  		localVarReturnValue []OasSchemaResponse
   403  	)
   404  
   405  	// create path and map variables
   406  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/export"
   407  
   408  	localVarHeaderParams := make(map[string]string)
   409  	localVarQueryParams := url.Values{}
   410  	localVarFormParams := url.Values{}
   411  
   412  	if localVarOptionals != nil && localVarOptionals.Mode.IsSet() {
   413  		localVarQueryParams.Add("mode", parameterToString(localVarOptionals.Mode.Value(), ""))
   414  	}
   415  	// to determine the Content-Type header
   416  	localVarHttpContentTypes := []string{}
   417  
   418  	// set Content-Type header
   419  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   420  	if localVarHttpContentType != "" {
   421  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   422  	}
   423  
   424  	// to determine the Accept header
   425  	localVarHttpHeaderAccepts := []string{"application/json"}
   426  
   427  	// set Accept header
   428  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   429  	if localVarHttpHeaderAccept != "" {
   430  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   431  	}
   432  	if ctx != nil {
   433  		// API Key Authentication
   434  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   435  			var key string
   436  			if auth.Prefix != "" {
   437  				key = auth.Prefix + " " + auth.Key
   438  			} else {
   439  				key = auth.Key
   440  			}
   441  			localVarHeaderParams["X-Tyk-Authorization"] = key
   442  			
   443  		}
   444  	}
   445  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   446  	if err != nil {
   447  		return localVarReturnValue, nil, err
   448  	}
   449  
   450  	localVarHttpResponse, err := a.client.callAPI(r)
   451  	if err != nil || localVarHttpResponse == nil {
   452  		return localVarReturnValue, localVarHttpResponse, err
   453  	}
   454  
   455  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   456  	localVarHttpResponse.Body.Close()
   457  	if err != nil {
   458  		return localVarReturnValue, localVarHttpResponse, err
   459  	}
   460  
   461  	if localVarHttpResponse.StatusCode < 300 {
   462  		// If we succeed, return the data, otherwise pass on to decode error.
   463  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   464  		if err == nil { 
   465  			return localVarReturnValue, localVarHttpResponse, err
   466  		}
   467  	}
   468  
   469  	if localVarHttpResponse.StatusCode >= 300 {
   470  		newErr := GenericSwaggerError{
   471  			body: localVarBody,
   472  			error: localVarHttpResponse.Status,
   473  		}
   474  		if localVarHttpResponse.StatusCode == 200 {
   475  			var v []OasSchemaResponse
   476  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   477  				if err != nil {
   478  					newErr.error = err.Error()
   479  					return localVarReturnValue, localVarHttpResponse, newErr
   480  				}
   481  				newErr.model = v
   482  				return localVarReturnValue, localVarHttpResponse, newErr
   483  		}
   484  		return localVarReturnValue, localVarHttpResponse, newErr
   485  	}
   486  
   487  	return localVarReturnValue, localVarHttpResponse, nil
   488  }
   489  /*
   490  OASAPIsApiService
   491  Create a new OAS format API, without x-tyk-gateway. For use with an existing OAS API that you want to expose via your Tyk Gateway. (New)
   492   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   493   * @param optional nil or *OASAPIsApiImportOASOpts - Optional Parameters:
   494       * @param "Body" (optional.Interface of Schema) - 
   495       * @param "UpstreamURL" (optional.String) -  Upstream URL for the API
   496       * @param "ListenPath" (optional.String) -  Listen path for the API
   497       * @param "CustomDomain" (optional.String) -  Custom domain for the API
   498       * @param "ApiID" (optional.String) -  ID of the API
   499       * @param "AllowList" (optional.Interface of BooleanQueryParam) -  Enable allowList middleware for all endpoints
   500       * @param "MockResponse" (optional.Interface of BooleanQueryParam) -  Enable mockResponse middleware for all endpoints having responses configured.
   501       * @param "ValidateRequest" (optional.Interface of BooleanQueryParam) -  Enable validateRequest middleware for all endpoints having a request body with media type application/json
   502       * @param "Authentication" (optional.Interface of BooleanQueryParam) -  Enable or disable authentication in your Tyk Gateway as per your OAS document.
   503  @return ApiModifyKeySuccess
   504  */
   505  
   506  type OASAPIsApiImportOASOpts struct {
   507      Body optional.Interface
   508      UpstreamURL optional.String
   509      ListenPath optional.String
   510      CustomDomain optional.String
   511      ApiID optional.String
   512      AllowList optional.Interface
   513      MockResponse optional.Interface
   514      ValidateRequest optional.Interface
   515      Authentication optional.Interface
   516  }
   517  
   518  func (a *OASAPIsApiService) ImportOAS(ctx context.Context, localVarOptionals *OASAPIsApiImportOASOpts) (ApiModifyKeySuccess, *http.Response, error) {
   519  	var (
   520  		localVarHttpMethod = strings.ToUpper("Post")
   521  		localVarPostBody   interface{}
   522  		localVarFileName   string
   523  		localVarFileBytes  []byte
   524  		localVarReturnValue ApiModifyKeySuccess
   525  	)
   526  
   527  	// create path and map variables
   528  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/import"
   529  
   530  	localVarHeaderParams := make(map[string]string)
   531  	localVarQueryParams := url.Values{}
   532  	localVarFormParams := url.Values{}
   533  
   534  	if localVarOptionals != nil && localVarOptionals.UpstreamURL.IsSet() {
   535  		localVarQueryParams.Add("upstreamURL", parameterToString(localVarOptionals.UpstreamURL.Value(), ""))
   536  	}
   537  	if localVarOptionals != nil && localVarOptionals.ListenPath.IsSet() {
   538  		localVarQueryParams.Add("listenPath", parameterToString(localVarOptionals.ListenPath.Value(), ""))
   539  	}
   540  	if localVarOptionals != nil && localVarOptionals.CustomDomain.IsSet() {
   541  		localVarQueryParams.Add("customDomain", parameterToString(localVarOptionals.CustomDomain.Value(), ""))
   542  	}
   543  	if localVarOptionals != nil && localVarOptionals.ApiID.IsSet() {
   544  		localVarQueryParams.Add("apiID", parameterToString(localVarOptionals.ApiID.Value(), ""))
   545  	}
   546  	if localVarOptionals != nil && localVarOptionals.AllowList.IsSet() {
   547  		localVarQueryParams.Add("allowList", parameterToString(localVarOptionals.AllowList.Value(), ""))
   548  	}
   549  	if localVarOptionals != nil && localVarOptionals.MockResponse.IsSet() {
   550  		localVarQueryParams.Add("mockResponse", parameterToString(localVarOptionals.MockResponse.Value(), ""))
   551  	}
   552  	if localVarOptionals != nil && localVarOptionals.ValidateRequest.IsSet() {
   553  		localVarQueryParams.Add("validateRequest", parameterToString(localVarOptionals.ValidateRequest.Value(), ""))
   554  	}
   555  	if localVarOptionals != nil && localVarOptionals.Authentication.IsSet() {
   556  		localVarQueryParams.Add("authentication", parameterToString(localVarOptionals.Authentication.Value(), ""))
   557  	}
   558  	// to determine the Content-Type header
   559  	localVarHttpContentTypes := []string{"application/json"}
   560  
   561  	// set Content-Type header
   562  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   563  	if localVarHttpContentType != "" {
   564  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   565  	}
   566  
   567  	// to determine the Accept header
   568  	localVarHttpHeaderAccepts := []string{"application/json"}
   569  
   570  	// set Accept header
   571  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   572  	if localVarHttpHeaderAccept != "" {
   573  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   574  	}
   575  	// body params
   576  	if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
   577  		
   578  		localVarOptionalBody:= localVarOptionals.Body.Value()
   579  		localVarPostBody = &localVarOptionalBody
   580  	}
   581  	if ctx != nil {
   582  		// API Key Authentication
   583  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   584  			var key string
   585  			if auth.Prefix != "" {
   586  				key = auth.Prefix + " " + auth.Key
   587  			} else {
   588  				key = auth.Key
   589  			}
   590  			localVarHeaderParams["X-Tyk-Authorization"] = key
   591  			
   592  		}
   593  	}
   594  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   595  	if err != nil {
   596  		return localVarReturnValue, nil, err
   597  	}
   598  
   599  	localVarHttpResponse, err := a.client.callAPI(r)
   600  	if err != nil || localVarHttpResponse == nil {
   601  		return localVarReturnValue, localVarHttpResponse, err
   602  	}
   603  
   604  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   605  	localVarHttpResponse.Body.Close()
   606  	if err != nil {
   607  		return localVarReturnValue, localVarHttpResponse, err
   608  	}
   609  
   610  	if localVarHttpResponse.StatusCode < 300 {
   611  		// If we succeed, return the data, otherwise pass on to decode error.
   612  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   613  		if err == nil { 
   614  			return localVarReturnValue, localVarHttpResponse, err
   615  		}
   616  	}
   617  
   618  	if localVarHttpResponse.StatusCode >= 300 {
   619  		newErr := GenericSwaggerError{
   620  			body: localVarBody,
   621  			error: localVarHttpResponse.Status,
   622  		}
   623  		if localVarHttpResponse.StatusCode == 200 {
   624  			var v ApiModifyKeySuccess
   625  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   626  				if err != nil {
   627  					newErr.error = err.Error()
   628  					return localVarReturnValue, localVarHttpResponse, newErr
   629  				}
   630  				newErr.model = v
   631  				return localVarReturnValue, localVarHttpResponse, newErr
   632  		}
   633  		if localVarHttpResponse.StatusCode == 400 {
   634  			var v ApiStatusMessage
   635  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   636  				if err != nil {
   637  					newErr.error = err.Error()
   638  					return localVarReturnValue, localVarHttpResponse, newErr
   639  				}
   640  				newErr.model = v
   641  				return localVarReturnValue, localVarHttpResponse, newErr
   642  		}
   643  		if localVarHttpResponse.StatusCode == 500 {
   644  			var v ApiStatusMessage
   645  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   646  				if err != nil {
   647  					newErr.error = err.Error()
   648  					return localVarReturnValue, localVarHttpResponse, newErr
   649  				}
   650  				newErr.model = v
   651  				return localVarReturnValue, localVarHttpResponse, newErr
   652  		}
   653  		return localVarReturnValue, localVarHttpResponse, newErr
   654  	}
   655  
   656  	return localVarReturnValue, localVarHttpResponse, nil
   657  }
   658  /*
   659  OASAPIsApiService
   660  Get API definition in OAS format Only if used without the Tyk Dashboard
   661   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   662   * @param apiID The API ID
   663   * @param optional nil or *OASAPIsApiListApiOASOpts - Optional Parameters:
   664       * @param "Mode" (optional.String) -  Mode of OAS get, by default mode could be empty which means to get OAS spec including OAS Tyk extension.  When mode&#x3D;public, OAS spec excluding Tyk extension will be returned in the response
   665  @return OasSchemaResponse
   666  */
   667  
   668  type OASAPIsApiListApiOASOpts struct {
   669      Mode optional.String
   670  }
   671  
   672  func (a *OASAPIsApiService) ListApiOAS(ctx context.Context, apiID string, localVarOptionals *OASAPIsApiListApiOASOpts) (OasSchemaResponse, *http.Response, error) {
   673  	var (
   674  		localVarHttpMethod = strings.ToUpper("Get")
   675  		localVarPostBody   interface{}
   676  		localVarFileName   string
   677  		localVarFileBytes  []byte
   678  		localVarReturnValue OasSchemaResponse
   679  	)
   680  
   681  	// create path and map variables
   682  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/{apiID}"
   683  	localVarPath = strings.Replace(localVarPath, "{"+"apiID"+"}", fmt.Sprintf("%v", apiID), -1)
   684  
   685  	localVarHeaderParams := make(map[string]string)
   686  	localVarQueryParams := url.Values{}
   687  	localVarFormParams := url.Values{}
   688  
   689  	if localVarOptionals != nil && localVarOptionals.Mode.IsSet() {
   690  		localVarQueryParams.Add("mode", parameterToString(localVarOptionals.Mode.Value(), ""))
   691  	}
   692  	// to determine the Content-Type header
   693  	localVarHttpContentTypes := []string{}
   694  
   695  	// set Content-Type header
   696  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   697  	if localVarHttpContentType != "" {
   698  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   699  	}
   700  
   701  	// to determine the Accept header
   702  	localVarHttpHeaderAccepts := []string{"application/json"}
   703  
   704  	// set Accept header
   705  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   706  	if localVarHttpHeaderAccept != "" {
   707  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   708  	}
   709  	if ctx != nil {
   710  		// API Key Authentication
   711  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   712  			var key string
   713  			if auth.Prefix != "" {
   714  				key = auth.Prefix + " " + auth.Key
   715  			} else {
   716  				key = auth.Key
   717  			}
   718  			localVarHeaderParams["X-Tyk-Authorization"] = key
   719  			
   720  		}
   721  	}
   722  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   723  	if err != nil {
   724  		return localVarReturnValue, nil, err
   725  	}
   726  
   727  	localVarHttpResponse, err := a.client.callAPI(r)
   728  	if err != nil || localVarHttpResponse == nil {
   729  		return localVarReturnValue, localVarHttpResponse, err
   730  	}
   731  
   732  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   733  	localVarHttpResponse.Body.Close()
   734  	if err != nil {
   735  		return localVarReturnValue, localVarHttpResponse, err
   736  	}
   737  
   738  	if localVarHttpResponse.StatusCode < 300 {
   739  		// If we succeed, return the data, otherwise pass on to decode error.
   740  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   741  		if err == nil { 
   742  			return localVarReturnValue, localVarHttpResponse, err
   743  		}
   744  	}
   745  
   746  	if localVarHttpResponse.StatusCode >= 300 {
   747  		newErr := GenericSwaggerError{
   748  			body: localVarBody,
   749  			error: localVarHttpResponse.Status,
   750  		}
   751  		if localVarHttpResponse.StatusCode == 200 {
   752  			var v OasSchemaResponse
   753  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   754  				if err != nil {
   755  					newErr.error = err.Error()
   756  					return localVarReturnValue, localVarHttpResponse, newErr
   757  				}
   758  				newErr.model = v
   759  				return localVarReturnValue, localVarHttpResponse, newErr
   760  		}
   761  		return localVarReturnValue, localVarHttpResponse, newErr
   762  	}
   763  
   764  	return localVarReturnValue, localVarHttpResponse, nil
   765  }
   766  /*
   767  OASAPIsApiService
   768  List all OAS format APIs, when used without the Tyk Dashboard.
   769   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   770   * @param optional nil or *OASAPIsApiListApisOASOpts - Optional Parameters:
   771       * @param "Mode" (optional.String) -  Mode of OAS get, by default mode could be empty which means to get OAS spec including OAS Tyk extension.  When mode&#x3D;public, OAS spec excluding Tyk extension will be returned in the response
   772  @return []OasSchemaResponse
   773  */
   774  
   775  type OASAPIsApiListApisOASOpts struct {
   776      Mode optional.String
   777  }
   778  
   779  func (a *OASAPIsApiService) ListApisOAS(ctx context.Context, localVarOptionals *OASAPIsApiListApisOASOpts) ([]OasSchemaResponse, *http.Response, error) {
   780  	var (
   781  		localVarHttpMethod = strings.ToUpper("Get")
   782  		localVarPostBody   interface{}
   783  		localVarFileName   string
   784  		localVarFileBytes  []byte
   785  		localVarReturnValue []OasSchemaResponse
   786  	)
   787  
   788  	// create path and map variables
   789  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas"
   790  
   791  	localVarHeaderParams := make(map[string]string)
   792  	localVarQueryParams := url.Values{}
   793  	localVarFormParams := url.Values{}
   794  
   795  	if localVarOptionals != nil && localVarOptionals.Mode.IsSet() {
   796  		localVarQueryParams.Add("mode", parameterToString(localVarOptionals.Mode.Value(), ""))
   797  	}
   798  	// to determine the Content-Type header
   799  	localVarHttpContentTypes := []string{}
   800  
   801  	// set Content-Type header
   802  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   803  	if localVarHttpContentType != "" {
   804  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   805  	}
   806  
   807  	// to determine the Accept header
   808  	localVarHttpHeaderAccepts := []string{"application/json"}
   809  
   810  	// set Accept header
   811  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   812  	if localVarHttpHeaderAccept != "" {
   813  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   814  	}
   815  	if ctx != nil {
   816  		// API Key Authentication
   817  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   818  			var key string
   819  			if auth.Prefix != "" {
   820  				key = auth.Prefix + " " + auth.Key
   821  			} else {
   822  				key = auth.Key
   823  			}
   824  			localVarHeaderParams["X-Tyk-Authorization"] = key
   825  			
   826  		}
   827  	}
   828  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   829  	if err != nil {
   830  		return localVarReturnValue, nil, err
   831  	}
   832  
   833  	localVarHttpResponse, err := a.client.callAPI(r)
   834  	if err != nil || localVarHttpResponse == nil {
   835  		return localVarReturnValue, localVarHttpResponse, err
   836  	}
   837  
   838  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   839  	localVarHttpResponse.Body.Close()
   840  	if err != nil {
   841  		return localVarReturnValue, localVarHttpResponse, err
   842  	}
   843  
   844  	if localVarHttpResponse.StatusCode < 300 {
   845  		// If we succeed, return the data, otherwise pass on to decode error.
   846  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   847  		if err == nil { 
   848  			return localVarReturnValue, localVarHttpResponse, err
   849  		}
   850  	}
   851  
   852  	if localVarHttpResponse.StatusCode >= 300 {
   853  		newErr := GenericSwaggerError{
   854  			body: localVarBody,
   855  			error: localVarHttpResponse.Status,
   856  		}
   857  		if localVarHttpResponse.StatusCode == 200 {
   858  			var v []OasSchemaResponse
   859  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   860  				if err != nil {
   861  					newErr.error = err.Error()
   862  					return localVarReturnValue, localVarHttpResponse, newErr
   863  				}
   864  				newErr.model = v
   865  				return localVarReturnValue, localVarHttpResponse, newErr
   866  		}
   867  		return localVarReturnValue, localVarHttpResponse, newErr
   868  	}
   869  
   870  	return localVarReturnValue, localVarHttpResponse, nil
   871  }
   872  /*
   873  OASAPIsApiService
   874  Listing versions of an OAS API
   875   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   876   * @param apiID The API ID
   877   * @param optional nil or *OASAPIsApiListOASApiVersionsOpts - Optional Parameters:
   878       * @param "SearchText" (optional.String) -  Search for API version name
   879       * @param "AccessType" (optional.String) -  Filter for internal or external API versions
   880  @return InlineResponse200
   881  */
   882  
   883  type OASAPIsApiListOASApiVersionsOpts struct {
   884      SearchText optional.String
   885      AccessType optional.String
   886  }
   887  
   888  func (a *OASAPIsApiService) ListOASApiVersions(ctx context.Context, apiID string, localVarOptionals *OASAPIsApiListOASApiVersionsOpts) (InlineResponse200, *http.Response, error) {
   889  	var (
   890  		localVarHttpMethod = strings.ToUpper("Get")
   891  		localVarPostBody   interface{}
   892  		localVarFileName   string
   893  		localVarFileBytes  []byte
   894  		localVarReturnValue InlineResponse200
   895  	)
   896  
   897  	// create path and map variables
   898  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/{apiID}/versions"
   899  	localVarPath = strings.Replace(localVarPath, "{"+"apiID"+"}", fmt.Sprintf("%v", apiID), -1)
   900  
   901  	localVarHeaderParams := make(map[string]string)
   902  	localVarQueryParams := url.Values{}
   903  	localVarFormParams := url.Values{}
   904  
   905  	if localVarOptionals != nil && localVarOptionals.SearchText.IsSet() {
   906  		localVarQueryParams.Add("searchText", parameterToString(localVarOptionals.SearchText.Value(), ""))
   907  	}
   908  	if localVarOptionals != nil && localVarOptionals.AccessType.IsSet() {
   909  		localVarQueryParams.Add("accessType", parameterToString(localVarOptionals.AccessType.Value(), ""))
   910  	}
   911  	// to determine the Content-Type header
   912  	localVarHttpContentTypes := []string{}
   913  
   914  	// set Content-Type header
   915  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   916  	if localVarHttpContentType != "" {
   917  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   918  	}
   919  
   920  	// to determine the Accept header
   921  	localVarHttpHeaderAccepts := []string{"application/json"}
   922  
   923  	// set Accept header
   924  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   925  	if localVarHttpHeaderAccept != "" {
   926  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   927  	}
   928  	if ctx != nil {
   929  		// API Key Authentication
   930  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   931  			var key string
   932  			if auth.Prefix != "" {
   933  				key = auth.Prefix + " " + auth.Key
   934  			} else {
   935  				key = auth.Key
   936  			}
   937  			localVarHeaderParams["X-Tyk-Authorization"] = key
   938  			
   939  		}
   940  	}
   941  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   942  	if err != nil {
   943  		return localVarReturnValue, nil, err
   944  	}
   945  
   946  	localVarHttpResponse, err := a.client.callAPI(r)
   947  	if err != nil || localVarHttpResponse == nil {
   948  		return localVarReturnValue, localVarHttpResponse, err
   949  	}
   950  
   951  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   952  	localVarHttpResponse.Body.Close()
   953  	if err != nil {
   954  		return localVarReturnValue, localVarHttpResponse, err
   955  	}
   956  
   957  	if localVarHttpResponse.StatusCode < 300 {
   958  		// If we succeed, return the data, otherwise pass on to decode error.
   959  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   960  		if err == nil { 
   961  			return localVarReturnValue, localVarHttpResponse, err
   962  		}
   963  	}
   964  
   965  	if localVarHttpResponse.StatusCode >= 300 {
   966  		newErr := GenericSwaggerError{
   967  			body: localVarBody,
   968  			error: localVarHttpResponse.Status,
   969  		}
   970  		if localVarHttpResponse.StatusCode == 200 {
   971  			var v InlineResponse200
   972  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   973  				if err != nil {
   974  					newErr.error = err.Error()
   975  					return localVarReturnValue, localVarHttpResponse, newErr
   976  				}
   977  				newErr.model = v
   978  				return localVarReturnValue, localVarHttpResponse, newErr
   979  		}
   980  		return localVarReturnValue, localVarHttpResponse, newErr
   981  	}
   982  
   983  	return localVarReturnValue, localVarHttpResponse, nil
   984  }
   985  /*
   986  OASAPIsApiService Patch a single OAS API by ID
   987  Update API with OAS format. You can use this endpoint to update OAS part of the tyk API definition. This endpoint allows you to configure tyk OAS extension based on query params provided(similar to import)
   988   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   989   * @param apiID The API ID
   990   * @param optional nil or *OASAPIsApiPatchApiOASOpts - Optional Parameters:
   991       * @param "Body" (optional.Interface of Schema) - 
   992       * @param "UpstreamURL" (optional.String) -  Upstream URL for the API
   993       * @param "ListenPath" (optional.String) -  Listen path for the API
   994       * @param "CustomDomain" (optional.String) -  Custom domain for the API
   995       * @param "ValidateRequest" (optional.Interface of BooleanQueryParam) -  Enable validateRequest middleware for all endpoints having a request body with media type application/json
   996       * @param "AllowList" (optional.Interface of BooleanQueryParam) -  Enable allowList middleware for all endpoints
   997       * @param "MockResponse" (optional.Interface of BooleanQueryParam) -  Enable mockResponse middleware for all endpoints having responses configured.
   998       * @param "Authentication" (optional.Interface of BooleanQueryParam) -  Enable or disable authentication in your Tyk Gateway as per your OAS document.
   999  @return ApiModifyKeySuccess
  1000  */
  1001  
  1002  type OASAPIsApiPatchApiOASOpts struct {
  1003      Body optional.Interface
  1004      UpstreamURL optional.String
  1005      ListenPath optional.String
  1006      CustomDomain optional.String
  1007      ValidateRequest optional.Interface
  1008      AllowList optional.Interface
  1009      MockResponse optional.Interface
  1010      Authentication optional.Interface
  1011  }
  1012  
  1013  func (a *OASAPIsApiService) PatchApiOAS(ctx context.Context, apiID string, localVarOptionals *OASAPIsApiPatchApiOASOpts) (ApiModifyKeySuccess, *http.Response, error) {
  1014  	var (
  1015  		localVarHttpMethod = strings.ToUpper("Patch")
  1016  		localVarPostBody   interface{}
  1017  		localVarFileName   string
  1018  		localVarFileBytes  []byte
  1019  		localVarReturnValue ApiModifyKeySuccess
  1020  	)
  1021  
  1022  	// create path and map variables
  1023  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/{apiID}"
  1024  	localVarPath = strings.Replace(localVarPath, "{"+"apiID"+"}", fmt.Sprintf("%v", apiID), -1)
  1025  
  1026  	localVarHeaderParams := make(map[string]string)
  1027  	localVarQueryParams := url.Values{}
  1028  	localVarFormParams := url.Values{}
  1029  
  1030  	if localVarOptionals != nil && localVarOptionals.UpstreamURL.IsSet() {
  1031  		localVarQueryParams.Add("upstreamURL", parameterToString(localVarOptionals.UpstreamURL.Value(), ""))
  1032  	}
  1033  	if localVarOptionals != nil && localVarOptionals.ListenPath.IsSet() {
  1034  		localVarQueryParams.Add("listenPath", parameterToString(localVarOptionals.ListenPath.Value(), ""))
  1035  	}
  1036  	if localVarOptionals != nil && localVarOptionals.CustomDomain.IsSet() {
  1037  		localVarQueryParams.Add("customDomain", parameterToString(localVarOptionals.CustomDomain.Value(), ""))
  1038  	}
  1039  	if localVarOptionals != nil && localVarOptionals.ValidateRequest.IsSet() {
  1040  		localVarQueryParams.Add("validateRequest", parameterToString(localVarOptionals.ValidateRequest.Value(), ""))
  1041  	}
  1042  	if localVarOptionals != nil && localVarOptionals.AllowList.IsSet() {
  1043  		localVarQueryParams.Add("allowList", parameterToString(localVarOptionals.AllowList.Value(), ""))
  1044  	}
  1045  	if localVarOptionals != nil && localVarOptionals.MockResponse.IsSet() {
  1046  		localVarQueryParams.Add("mockResponse", parameterToString(localVarOptionals.MockResponse.Value(), ""))
  1047  	}
  1048  	if localVarOptionals != nil && localVarOptionals.Authentication.IsSet() {
  1049  		localVarQueryParams.Add("authentication", parameterToString(localVarOptionals.Authentication.Value(), ""))
  1050  	}
  1051  	// to determine the Content-Type header
  1052  	localVarHttpContentTypes := []string{"application/json"}
  1053  
  1054  	// set Content-Type header
  1055  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
  1056  	if localVarHttpContentType != "" {
  1057  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
  1058  	}
  1059  
  1060  	// to determine the Accept header
  1061  	localVarHttpHeaderAccepts := []string{"application/json"}
  1062  
  1063  	// set Accept header
  1064  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
  1065  	if localVarHttpHeaderAccept != "" {
  1066  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
  1067  	}
  1068  	// body params
  1069  	if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
  1070  		
  1071  		localVarOptionalBody:= localVarOptionals.Body.Value()
  1072  		localVarPostBody = &localVarOptionalBody
  1073  	}
  1074  	if ctx != nil {
  1075  		// API Key Authentication
  1076  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
  1077  			var key string
  1078  			if auth.Prefix != "" {
  1079  				key = auth.Prefix + " " + auth.Key
  1080  			} else {
  1081  				key = auth.Key
  1082  			}
  1083  			localVarHeaderParams["X-Tyk-Authorization"] = key
  1084  			
  1085  		}
  1086  	}
  1087  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
  1088  	if err != nil {
  1089  		return localVarReturnValue, nil, err
  1090  	}
  1091  
  1092  	localVarHttpResponse, err := a.client.callAPI(r)
  1093  	if err != nil || localVarHttpResponse == nil {
  1094  		return localVarReturnValue, localVarHttpResponse, err
  1095  	}
  1096  
  1097  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
  1098  	localVarHttpResponse.Body.Close()
  1099  	if err != nil {
  1100  		return localVarReturnValue, localVarHttpResponse, err
  1101  	}
  1102  
  1103  	if localVarHttpResponse.StatusCode < 300 {
  1104  		// If we succeed, return the data, otherwise pass on to decode error.
  1105  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
  1106  		if err == nil { 
  1107  			return localVarReturnValue, localVarHttpResponse, err
  1108  		}
  1109  	}
  1110  
  1111  	if localVarHttpResponse.StatusCode >= 300 {
  1112  		newErr := GenericSwaggerError{
  1113  			body: localVarBody,
  1114  			error: localVarHttpResponse.Status,
  1115  		}
  1116  		if localVarHttpResponse.StatusCode == 200 {
  1117  			var v ApiModifyKeySuccess
  1118  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
  1119  				if err != nil {
  1120  					newErr.error = err.Error()
  1121  					return localVarReturnValue, localVarHttpResponse, newErr
  1122  				}
  1123  				newErr.model = v
  1124  				return localVarReturnValue, localVarHttpResponse, newErr
  1125  		}
  1126  		if localVarHttpResponse.StatusCode == 400 {
  1127  			var v ApiStatusMessage
  1128  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
  1129  				if err != nil {
  1130  					newErr.error = err.Error()
  1131  					return localVarReturnValue, localVarHttpResponse, newErr
  1132  				}
  1133  				newErr.model = v
  1134  				return localVarReturnValue, localVarHttpResponse, newErr
  1135  		}
  1136  		if localVarHttpResponse.StatusCode == 500 {
  1137  			var v ApiStatusMessage
  1138  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
  1139  				if err != nil {
  1140  					newErr.error = err.Error()
  1141  					return localVarReturnValue, localVarHttpResponse, newErr
  1142  				}
  1143  				newErr.model = v
  1144  				return localVarReturnValue, localVarHttpResponse, newErr
  1145  		}
  1146  		return localVarReturnValue, localVarHttpResponse, newErr
  1147  	}
  1148  
  1149  	return localVarReturnValue, localVarHttpResponse, nil
  1150  }
  1151  /*
  1152  OASAPIsApiService
  1153  Updating an API definition uses the same signature an object as a &#x60;POST&#x60;, however it will first ensure that the API ID that is being updated is the same as the one in the object being &#x60;PUT&#x60;.   Updating will completely replace the file descriptor and will not change an API Definition that has already been loaded, the hot-reload endpoint will need to be called to push the new definition to live. 
  1154   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  1155   * @param apiID The API ID
  1156   * @param optional nil or *OASAPIsApiUpdateApiOASOpts - Optional Parameters:
  1157       * @param "Body" (optional.Interface of Schema) - 
  1158  @return ApiModifyKeySuccess
  1159  */
  1160  
  1161  type OASAPIsApiUpdateApiOASOpts struct {
  1162      Body optional.Interface
  1163  }
  1164  
  1165  func (a *OASAPIsApiService) UpdateApiOAS(ctx context.Context, apiID string, localVarOptionals *OASAPIsApiUpdateApiOASOpts) (ApiModifyKeySuccess, *http.Response, error) {
  1166  	var (
  1167  		localVarHttpMethod = strings.ToUpper("Put")
  1168  		localVarPostBody   interface{}
  1169  		localVarFileName   string
  1170  		localVarFileBytes  []byte
  1171  		localVarReturnValue ApiModifyKeySuccess
  1172  	)
  1173  
  1174  	// create path and map variables
  1175  	localVarPath := a.client.cfg.BasePath + "/tyk/apis/oas/{apiID}"
  1176  	localVarPath = strings.Replace(localVarPath, "{"+"apiID"+"}", fmt.Sprintf("%v", apiID), -1)
  1177  
  1178  	localVarHeaderParams := make(map[string]string)
  1179  	localVarQueryParams := url.Values{}
  1180  	localVarFormParams := url.Values{}
  1181  
  1182  	// to determine the Content-Type header
  1183  	localVarHttpContentTypes := []string{"application/json"}
  1184  
  1185  	// set Content-Type header
  1186  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
  1187  	if localVarHttpContentType != "" {
  1188  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
  1189  	}
  1190  
  1191  	// to determine the Accept header
  1192  	localVarHttpHeaderAccepts := []string{"application/json"}
  1193  
  1194  	// set Accept header
  1195  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
  1196  	if localVarHttpHeaderAccept != "" {
  1197  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
  1198  	}
  1199  	// body params
  1200  	if localVarOptionals != nil && localVarOptionals.Body.IsSet() {
  1201  		
  1202  		localVarOptionalBody:= localVarOptionals.Body.Value()
  1203  		localVarPostBody = &localVarOptionalBody
  1204  	}
  1205  	if ctx != nil {
  1206  		// API Key Authentication
  1207  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
  1208  			var key string
  1209  			if auth.Prefix != "" {
  1210  				key = auth.Prefix + " " + auth.Key
  1211  			} else {
  1212  				key = auth.Key
  1213  			}
  1214  			localVarHeaderParams["X-Tyk-Authorization"] = key
  1215  			
  1216  		}
  1217  	}
  1218  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
  1219  	if err != nil {
  1220  		return localVarReturnValue, nil, err
  1221  	}
  1222  
  1223  	localVarHttpResponse, err := a.client.callAPI(r)
  1224  	if err != nil || localVarHttpResponse == nil {
  1225  		return localVarReturnValue, localVarHttpResponse, err
  1226  	}
  1227  
  1228  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
  1229  	localVarHttpResponse.Body.Close()
  1230  	if err != nil {
  1231  		return localVarReturnValue, localVarHttpResponse, err
  1232  	}
  1233  
  1234  	if localVarHttpResponse.StatusCode < 300 {
  1235  		// If we succeed, return the data, otherwise pass on to decode error.
  1236  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
  1237  		if err == nil { 
  1238  			return localVarReturnValue, localVarHttpResponse, err
  1239  		}
  1240  	}
  1241  
  1242  	if localVarHttpResponse.StatusCode >= 300 {
  1243  		newErr := GenericSwaggerError{
  1244  			body: localVarBody,
  1245  			error: localVarHttpResponse.Status,
  1246  		}
  1247  		if localVarHttpResponse.StatusCode == 200 {
  1248  			var v ApiModifyKeySuccess
  1249  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
  1250  				if err != nil {
  1251  					newErr.error = err.Error()
  1252  					return localVarReturnValue, localVarHttpResponse, newErr
  1253  				}
  1254  				newErr.model = v
  1255  				return localVarReturnValue, localVarHttpResponse, newErr
  1256  		}
  1257  		if localVarHttpResponse.StatusCode == 400 {
  1258  			var v ApiStatusMessage
  1259  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
  1260  				if err != nil {
  1261  					newErr.error = err.Error()
  1262  					return localVarReturnValue, localVarHttpResponse, newErr
  1263  				}
  1264  				newErr.model = v
  1265  				return localVarReturnValue, localVarHttpResponse, newErr
  1266  		}
  1267  		return localVarReturnValue, localVarHttpResponse, newErr
  1268  	}
  1269  
  1270  	return localVarReturnValue, localVarHttpResponse, nil
  1271  }