github.com/launchdarkly/api-client-go@v5.3.0+incompatible/api_user_settings.go (about)

     1  
     2  /*
     3   * LaunchDarkly REST API
     4   *
     5   * Build custom integrations with the LaunchDarkly REST API
     6   *
     7   * API version: 5.3.0
     8   * Contact: support@launchdarkly.com
     9   * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
    10   */
    11  
    12  package ldapi
    13  
    14  import (
    15  	"context"
    16  	"io/ioutil"
    17  	"net/http"
    18  	"net/url"
    19  	"strings"
    20  	"fmt"
    21  )
    22  
    23  // Linger please
    24  var (
    25  	_ context.Context
    26  )
    27  
    28  type UserSettingsApiService service
    29  
    30  /*
    31  UserSettingsApiService Get expiring dates on flags for user
    32   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
    33   * @param projectKey The project key, used to tie the flags together under one project so they can be managed together.
    34   * @param environmentKey The environment key, used to tie together flag configuration and users under one environment so they can be managed together.
    35   * @param userKey The user's key.
    36  
    37  @return UserTargetingExpirationOnFlagsForUser
    38  */
    39  func (a *UserSettingsApiService) GetExpiringUserTargetsForUser(ctx context.Context, projectKey string, environmentKey string, userKey string) (UserTargetingExpirationOnFlagsForUser, *http.Response, error) {
    40  	var (
    41  		localVarHttpMethod = strings.ToUpper("Get")
    42  		localVarPostBody   interface{}
    43  		localVarFileName   string
    44  		localVarFileBytes  []byte
    45  		localVarReturnValue UserTargetingExpirationOnFlagsForUser
    46  	)
    47  
    48  	// create path and map variables
    49  	localVarPath := a.client.cfg.BasePath + "/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}"
    50  	localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
    51  	localVarPath = strings.Replace(localVarPath, "{"+"environmentKey"+"}", fmt.Sprintf("%v", environmentKey), -1)
    52  	localVarPath = strings.Replace(localVarPath, "{"+"userKey"+"}", fmt.Sprintf("%v", userKey), -1)
    53  
    54  	localVarHeaderParams := make(map[string]string)
    55  	localVarQueryParams := url.Values{}
    56  	localVarFormParams := url.Values{}
    57  
    58  	// to determine the Content-Type header
    59  	localVarHttpContentTypes := []string{"application/json"}
    60  
    61  	// set Content-Type header
    62  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
    63  	if localVarHttpContentType != "" {
    64  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
    65  	}
    66  
    67  	// to determine the Accept header
    68  	localVarHttpHeaderAccepts := []string{"application/json"}
    69  
    70  	// set Accept header
    71  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
    72  	if localVarHttpHeaderAccept != "" {
    73  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
    74  	}
    75  	if ctx != nil {
    76  		// API Key Authentication
    77  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
    78  			var key string
    79  			if auth.Prefix != "" {
    80  				key = auth.Prefix + " " + auth.Key
    81  			} else {
    82  				key = auth.Key
    83  			}
    84  			localVarHeaderParams["Authorization"] = key
    85  			
    86  		}
    87  	}
    88  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
    89  	if err != nil {
    90  		return localVarReturnValue, nil, err
    91  	}
    92  
    93  	localVarHttpResponse, err := a.client.callAPI(r)
    94  	if err != nil || localVarHttpResponse == nil {
    95  		return localVarReturnValue, localVarHttpResponse, err
    96  	}
    97  
    98  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
    99  	localVarHttpResponse.Body.Close()
   100  	if err != nil {
   101  		return localVarReturnValue, localVarHttpResponse, err
   102  	}
   103  
   104  	if localVarHttpResponse.StatusCode < 300 {
   105  		// If we succeed, return the data, otherwise pass on to decode error.
   106  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   107  		return localVarReturnValue, localVarHttpResponse, err
   108  	}
   109  
   110  	if localVarHttpResponse.StatusCode >= 300 {
   111  		newErr := GenericSwaggerError{
   112  			body: localVarBody,
   113  			error: localVarHttpResponse.Status,
   114  		}
   115  		
   116  		if localVarHttpResponse.StatusCode == 200 {
   117  			var v UserTargetingExpirationOnFlagsForUser
   118  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   119  				if err != nil {
   120  					newErr.error = err.Error()
   121  					return localVarReturnValue, localVarHttpResponse, newErr
   122  				}
   123  				newErr.model = v
   124  				return localVarReturnValue, localVarHttpResponse, newErr
   125  		}
   126  		
   127  		return localVarReturnValue, localVarHttpResponse, newErr
   128  	}
   129  
   130  	return localVarReturnValue, localVarHttpResponse, nil
   131  }
   132  
   133  /*
   134  UserSettingsApiService Fetch a single flag setting for a user by key.
   135   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   136   * @param projectKey The project key, used to tie the flags together under one project so they can be managed together.
   137   * @param environmentKey The environment key, used to tie together flag configuration and users under one environment so they can be managed together.
   138   * @param userKey The user&#39;s key.
   139   * @param featureFlagKey The feature flag&#39;s key. The key identifies the flag in your code.
   140  
   141  @return UserFlagSetting
   142  */
   143  func (a *UserSettingsApiService) GetUserFlagSetting(ctx context.Context, projectKey string, environmentKey string, userKey string, featureFlagKey string) (UserFlagSetting, *http.Response, error) {
   144  	var (
   145  		localVarHttpMethod = strings.ToUpper("Get")
   146  		localVarPostBody   interface{}
   147  		localVarFileName   string
   148  		localVarFileBytes  []byte
   149  		localVarReturnValue UserFlagSetting
   150  	)
   151  
   152  	// create path and map variables
   153  	localVarPath := a.client.cfg.BasePath + "/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}"
   154  	localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
   155  	localVarPath = strings.Replace(localVarPath, "{"+"environmentKey"+"}", fmt.Sprintf("%v", environmentKey), -1)
   156  	localVarPath = strings.Replace(localVarPath, "{"+"userKey"+"}", fmt.Sprintf("%v", userKey), -1)
   157  	localVarPath = strings.Replace(localVarPath, "{"+"featureFlagKey"+"}", fmt.Sprintf("%v", featureFlagKey), -1)
   158  
   159  	localVarHeaderParams := make(map[string]string)
   160  	localVarQueryParams := url.Values{}
   161  	localVarFormParams := url.Values{}
   162  
   163  	// to determine the Content-Type header
   164  	localVarHttpContentTypes := []string{"application/json"}
   165  
   166  	// set Content-Type header
   167  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   168  	if localVarHttpContentType != "" {
   169  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   170  	}
   171  
   172  	// to determine the Accept header
   173  	localVarHttpHeaderAccepts := []string{"application/json"}
   174  
   175  	// set Accept header
   176  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   177  	if localVarHttpHeaderAccept != "" {
   178  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   179  	}
   180  	if ctx != nil {
   181  		// API Key Authentication
   182  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   183  			var key string
   184  			if auth.Prefix != "" {
   185  				key = auth.Prefix + " " + auth.Key
   186  			} else {
   187  				key = auth.Key
   188  			}
   189  			localVarHeaderParams["Authorization"] = key
   190  			
   191  		}
   192  	}
   193  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   194  	if err != nil {
   195  		return localVarReturnValue, nil, err
   196  	}
   197  
   198  	localVarHttpResponse, err := a.client.callAPI(r)
   199  	if err != nil || localVarHttpResponse == nil {
   200  		return localVarReturnValue, localVarHttpResponse, err
   201  	}
   202  
   203  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   204  	localVarHttpResponse.Body.Close()
   205  	if err != nil {
   206  		return localVarReturnValue, localVarHttpResponse, err
   207  	}
   208  
   209  	if localVarHttpResponse.StatusCode < 300 {
   210  		// If we succeed, return the data, otherwise pass on to decode error.
   211  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   212  		return localVarReturnValue, localVarHttpResponse, err
   213  	}
   214  
   215  	if localVarHttpResponse.StatusCode >= 300 {
   216  		newErr := GenericSwaggerError{
   217  			body: localVarBody,
   218  			error: localVarHttpResponse.Status,
   219  		}
   220  		
   221  		if localVarHttpResponse.StatusCode == 200 {
   222  			var v UserFlagSetting
   223  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   224  				if err != nil {
   225  					newErr.error = err.Error()
   226  					return localVarReturnValue, localVarHttpResponse, newErr
   227  				}
   228  				newErr.model = v
   229  				return localVarReturnValue, localVarHttpResponse, newErr
   230  		}
   231  		
   232  		return localVarReturnValue, localVarHttpResponse, newErr
   233  	}
   234  
   235  	return localVarReturnValue, localVarHttpResponse, nil
   236  }
   237  
   238  /*
   239  UserSettingsApiService Fetch a single flag setting for a user by key.
   240   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   241   * @param projectKey The project key, used to tie the flags together under one project so they can be managed together.
   242   * @param environmentKey The environment key, used to tie together flag configuration and users under one environment so they can be managed together.
   243   * @param userKey The user&#39;s key.
   244  
   245  @return UserFlagSettings
   246  */
   247  func (a *UserSettingsApiService) GetUserFlagSettings(ctx context.Context, projectKey string, environmentKey string, userKey string) (UserFlagSettings, *http.Response, error) {
   248  	var (
   249  		localVarHttpMethod = strings.ToUpper("Get")
   250  		localVarPostBody   interface{}
   251  		localVarFileName   string
   252  		localVarFileBytes  []byte
   253  		localVarReturnValue UserFlagSettings
   254  	)
   255  
   256  	// create path and map variables
   257  	localVarPath := a.client.cfg.BasePath + "/users/{projectKey}/{environmentKey}/{userKey}/flags"
   258  	localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
   259  	localVarPath = strings.Replace(localVarPath, "{"+"environmentKey"+"}", fmt.Sprintf("%v", environmentKey), -1)
   260  	localVarPath = strings.Replace(localVarPath, "{"+"userKey"+"}", fmt.Sprintf("%v", userKey), -1)
   261  
   262  	localVarHeaderParams := make(map[string]string)
   263  	localVarQueryParams := url.Values{}
   264  	localVarFormParams := url.Values{}
   265  
   266  	// to determine the Content-Type header
   267  	localVarHttpContentTypes := []string{"application/json"}
   268  
   269  	// set Content-Type header
   270  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   271  	if localVarHttpContentType != "" {
   272  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   273  	}
   274  
   275  	// to determine the Accept header
   276  	localVarHttpHeaderAccepts := []string{"application/json"}
   277  
   278  	// set Accept header
   279  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   280  	if localVarHttpHeaderAccept != "" {
   281  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   282  	}
   283  	if ctx != nil {
   284  		// API Key Authentication
   285  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   286  			var key string
   287  			if auth.Prefix != "" {
   288  				key = auth.Prefix + " " + auth.Key
   289  			} else {
   290  				key = auth.Key
   291  			}
   292  			localVarHeaderParams["Authorization"] = key
   293  			
   294  		}
   295  	}
   296  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   297  	if err != nil {
   298  		return localVarReturnValue, nil, err
   299  	}
   300  
   301  	localVarHttpResponse, err := a.client.callAPI(r)
   302  	if err != nil || localVarHttpResponse == nil {
   303  		return localVarReturnValue, localVarHttpResponse, err
   304  	}
   305  
   306  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   307  	localVarHttpResponse.Body.Close()
   308  	if err != nil {
   309  		return localVarReturnValue, localVarHttpResponse, err
   310  	}
   311  
   312  	if localVarHttpResponse.StatusCode < 300 {
   313  		// If we succeed, return the data, otherwise pass on to decode error.
   314  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   315  		return localVarReturnValue, localVarHttpResponse, err
   316  	}
   317  
   318  	if localVarHttpResponse.StatusCode >= 300 {
   319  		newErr := GenericSwaggerError{
   320  			body: localVarBody,
   321  			error: localVarHttpResponse.Status,
   322  		}
   323  		
   324  		if localVarHttpResponse.StatusCode == 200 {
   325  			var v UserFlagSettings
   326  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   327  				if err != nil {
   328  					newErr.error = err.Error()
   329  					return localVarReturnValue, localVarHttpResponse, newErr
   330  				}
   331  				newErr.model = v
   332  				return localVarReturnValue, localVarHttpResponse, newErr
   333  		}
   334  		
   335  		return localVarReturnValue, localVarHttpResponse, newErr
   336  	}
   337  
   338  	return localVarReturnValue, localVarHttpResponse, nil
   339  }
   340  
   341  /*
   342  UserSettingsApiService Update, add, or delete expiring user targets for a single user on all flags
   343   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   344   * @param projectKey The project key, used to tie the flags together under one project so they can be managed together.
   345   * @param environmentKey The environment key, used to tie together flag configuration and users under one environment so they can be managed together.
   346   * @param userKey The user&#39;s key.
   347   * @param semanticPatchWithComment Requires a Semantic Patch representation of the desired changes to the resource. &#39;https://apidocs.launchdarkly.com/reference#updates-via-semantic-patches&#39;. The addition of comments is also supported.
   348  
   349  @return UserTargetingExpirationOnFlagsForUser
   350  */
   351  func (a *UserSettingsApiService) PatchExpiringUserTargetsForFlags(ctx context.Context, projectKey string, environmentKey string, userKey string, semanticPatchWithComment interface{}) (UserTargetingExpirationOnFlagsForUser, *http.Response, error) {
   352  	var (
   353  		localVarHttpMethod = strings.ToUpper("Patch")
   354  		localVarPostBody   interface{}
   355  		localVarFileName   string
   356  		localVarFileBytes  []byte
   357  		localVarReturnValue UserTargetingExpirationOnFlagsForUser
   358  	)
   359  
   360  	// create path and map variables
   361  	localVarPath := a.client.cfg.BasePath + "/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey}"
   362  	localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
   363  	localVarPath = strings.Replace(localVarPath, "{"+"environmentKey"+"}", fmt.Sprintf("%v", environmentKey), -1)
   364  	localVarPath = strings.Replace(localVarPath, "{"+"userKey"+"}", fmt.Sprintf("%v", userKey), -1)
   365  
   366  	localVarHeaderParams := make(map[string]string)
   367  	localVarQueryParams := url.Values{}
   368  	localVarFormParams := url.Values{}
   369  
   370  	// to determine the Content-Type header
   371  	localVarHttpContentTypes := []string{"application/json"}
   372  
   373  	// set Content-Type header
   374  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   375  	if localVarHttpContentType != "" {
   376  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   377  	}
   378  
   379  	// to determine the Accept header
   380  	localVarHttpHeaderAccepts := []string{"application/json"}
   381  
   382  	// set Accept header
   383  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   384  	if localVarHttpHeaderAccept != "" {
   385  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   386  	}
   387  	// body params
   388  	localVarPostBody = &semanticPatchWithComment
   389  	if ctx != nil {
   390  		// API Key Authentication
   391  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   392  			var key string
   393  			if auth.Prefix != "" {
   394  				key = auth.Prefix + " " + auth.Key
   395  			} else {
   396  				key = auth.Key
   397  			}
   398  			localVarHeaderParams["Authorization"] = key
   399  			
   400  		}
   401  	}
   402  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   403  	if err != nil {
   404  		return localVarReturnValue, nil, err
   405  	}
   406  
   407  	localVarHttpResponse, err := a.client.callAPI(r)
   408  	if err != nil || localVarHttpResponse == nil {
   409  		return localVarReturnValue, localVarHttpResponse, err
   410  	}
   411  
   412  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   413  	localVarHttpResponse.Body.Close()
   414  	if err != nil {
   415  		return localVarReturnValue, localVarHttpResponse, err
   416  	}
   417  
   418  	if localVarHttpResponse.StatusCode < 300 {
   419  		// If we succeed, return the data, otherwise pass on to decode error.
   420  		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   421  		return localVarReturnValue, localVarHttpResponse, err
   422  	}
   423  
   424  	if localVarHttpResponse.StatusCode >= 300 {
   425  		newErr := GenericSwaggerError{
   426  			body: localVarBody,
   427  			error: localVarHttpResponse.Status,
   428  		}
   429  		
   430  		if localVarHttpResponse.StatusCode == 200 {
   431  			var v UserTargetingExpirationOnFlagsForUser
   432  			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
   433  				if err != nil {
   434  					newErr.error = err.Error()
   435  					return localVarReturnValue, localVarHttpResponse, newErr
   436  				}
   437  				newErr.model = v
   438  				return localVarReturnValue, localVarHttpResponse, newErr
   439  		}
   440  		
   441  		return localVarReturnValue, localVarHttpResponse, newErr
   442  	}
   443  
   444  	return localVarReturnValue, localVarHttpResponse, nil
   445  }
   446  
   447  /*
   448  UserSettingsApiService Specifically enable or disable a feature flag for a user based on their key.
   449   * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
   450   * @param projectKey The project key, used to tie the flags together under one project so they can be managed together.
   451   * @param environmentKey The environment key, used to tie together flag configuration and users under one environment so they can be managed together.
   452   * @param userKey The user&#39;s key.
   453   * @param featureFlagKey The feature flag&#39;s key. The key identifies the flag in your code.
   454   * @param userSettingsBody
   455  
   456  
   457  */
   458  func (a *UserSettingsApiService) PutFlagSetting(ctx context.Context, projectKey string, environmentKey string, userKey string, featureFlagKey string, userSettingsBody UserSettingsBody) (*http.Response, error) {
   459  	var (
   460  		localVarHttpMethod = strings.ToUpper("Put")
   461  		localVarPostBody   interface{}
   462  		localVarFileName   string
   463  		localVarFileBytes  []byte
   464  		
   465  	)
   466  
   467  	// create path and map variables
   468  	localVarPath := a.client.cfg.BasePath + "/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey}"
   469  	localVarPath = strings.Replace(localVarPath, "{"+"projectKey"+"}", fmt.Sprintf("%v", projectKey), -1)
   470  	localVarPath = strings.Replace(localVarPath, "{"+"environmentKey"+"}", fmt.Sprintf("%v", environmentKey), -1)
   471  	localVarPath = strings.Replace(localVarPath, "{"+"userKey"+"}", fmt.Sprintf("%v", userKey), -1)
   472  	localVarPath = strings.Replace(localVarPath, "{"+"featureFlagKey"+"}", fmt.Sprintf("%v", featureFlagKey), -1)
   473  
   474  	localVarHeaderParams := make(map[string]string)
   475  	localVarQueryParams := url.Values{}
   476  	localVarFormParams := url.Values{}
   477  
   478  	// to determine the Content-Type header
   479  	localVarHttpContentTypes := []string{"application/json"}
   480  
   481  	// set Content-Type header
   482  	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
   483  	if localVarHttpContentType != "" {
   484  		localVarHeaderParams["Content-Type"] = localVarHttpContentType
   485  	}
   486  
   487  	// to determine the Accept header
   488  	localVarHttpHeaderAccepts := []string{"application/json"}
   489  
   490  	// set Accept header
   491  	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
   492  	if localVarHttpHeaderAccept != "" {
   493  		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
   494  	}
   495  	// body params
   496  	localVarPostBody = &userSettingsBody
   497  	if ctx != nil {
   498  		// API Key Authentication
   499  		if auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {
   500  			var key string
   501  			if auth.Prefix != "" {
   502  				key = auth.Prefix + " " + auth.Key
   503  			} else {
   504  				key = auth.Key
   505  			}
   506  			localVarHeaderParams["Authorization"] = key
   507  			
   508  		}
   509  	}
   510  	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
   511  	if err != nil {
   512  		return nil, err
   513  	}
   514  
   515  	localVarHttpResponse, err := a.client.callAPI(r)
   516  	if err != nil || localVarHttpResponse == nil {
   517  		return localVarHttpResponse, err
   518  	}
   519  
   520  	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
   521  	localVarHttpResponse.Body.Close()
   522  	if err != nil {
   523  		return localVarHttpResponse, err
   524  	}
   525  
   526  
   527  	if localVarHttpResponse.StatusCode >= 300 {
   528  		newErr := GenericSwaggerError{
   529  			body: localVarBody,
   530  			error: localVarHttpResponse.Status,
   531  		}
   532  		
   533  		return localVarHttpResponse, newErr
   534  	}
   535  
   536  	return localVarHttpResponse, nil
   537  }
   538