805 lines
29 KiB
Go
805 lines
29 KiB
Go
/*
|
|
* 3DS OUTSCALE API
|
|
*
|
|
* Welcome to the 3DS OUTSCALE's API documentation.<br /><br /> The 3DS OUTSCALE API enables you to manage your resources in the 3DS OUTSCALE Cloud. This documentation describes the different actions available along with code examples.<br /><br /> Note that the 3DS OUTSCALE Cloud is compatible with Amazon Web Services (AWS) APIs, but some resources have different names in AWS than in the 3DS OUTSCALE API. You can find a list of the differences [here](https://wiki.outscale.net/display/EN/3DS+OUTSCALE+APIs+Reference).<br /><br /> You can also manage your resources using the [Cockpit](https://wiki.outscale.net/display/EN/About+Cockpit) web interface.
|
|
*
|
|
* API version: 1.8
|
|
* Contact: support@outscale.com
|
|
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
|
*/
|
|
|
|
package osc
|
|
|
|
import (
|
|
_context "context"
|
|
"github.com/antihax/optional"
|
|
_ioutil "io/ioutil"
|
|
_nethttp "net/http"
|
|
_neturl "net/url"
|
|
)
|
|
|
|
// Linger please
|
|
var (
|
|
_ _context.Context
|
|
)
|
|
|
|
// AccountApiService AccountApi service
|
|
type AccountApiService service
|
|
|
|
// CheckAuthenticationOpts Optional parameters for the method 'CheckAuthentication'
|
|
type CheckAuthenticationOpts struct {
|
|
CheckAuthenticationRequest optional.Interface
|
|
}
|
|
|
|
/*
|
|
CheckAuthentication Method for CheckAuthentication
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *CheckAuthenticationOpts - Optional Parameters:
|
|
* @param "CheckAuthenticationRequest" (optional.Interface of CheckAuthenticationRequest) -
|
|
@return CheckAuthenticationResponse
|
|
*/
|
|
func (a *AccountApiService) CheckAuthentication(ctx _context.Context, localVarOptionals *CheckAuthenticationOpts) (CheckAuthenticationResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue CheckAuthenticationResponse
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/CheckAuthentication"
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
if localVarOptionals != nil && localVarOptionals.CheckAuthenticationRequest.IsSet() {
|
|
localVarOptionalCheckAuthenticationRequest, localVarOptionalCheckAuthenticationRequestok := localVarOptionals.CheckAuthenticationRequest.Value().(CheckAuthenticationRequest)
|
|
if !localVarOptionalCheckAuthenticationRequestok {
|
|
return localVarReturnValue, nil, reportError("checkAuthenticationRequest should be CheckAuthenticationRequest")
|
|
}
|
|
localVarPostBody = &localVarOptionalCheckAuthenticationRequest
|
|
}
|
|
|
|
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["Authorization"] = key
|
|
}
|
|
}
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
var v CheckAuthenticationResponse
|
|
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
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
// CreateAccountOpts Optional parameters for the method 'CreateAccount'
|
|
type CreateAccountOpts struct {
|
|
CreateAccountRequest optional.Interface
|
|
}
|
|
|
|
/*
|
|
CreateAccount Method for CreateAccount
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *CreateAccountOpts - Optional Parameters:
|
|
* @param "CreateAccountRequest" (optional.Interface of CreateAccountRequest) -
|
|
@return CreateAccountResponse
|
|
*/
|
|
func (a *AccountApiService) CreateAccount(ctx _context.Context, localVarOptionals *CreateAccountOpts) (CreateAccountResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue CreateAccountResponse
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/CreateAccount"
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
if localVarOptionals != nil && localVarOptionals.CreateAccountRequest.IsSet() {
|
|
localVarOptionalCreateAccountRequest, localVarOptionalCreateAccountRequestok := localVarOptionals.CreateAccountRequest.Value().(CreateAccountRequest)
|
|
if !localVarOptionalCreateAccountRequestok {
|
|
return localVarReturnValue, nil, reportError("createAccountRequest should be CreateAccountRequest")
|
|
}
|
|
localVarPostBody = &localVarOptionalCreateAccountRequest
|
|
}
|
|
|
|
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["Authorization"] = key
|
|
}
|
|
}
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
var v CreateAccountResponse
|
|
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
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
// ReadAccountsOpts Optional parameters for the method 'ReadAccounts'
|
|
type ReadAccountsOpts struct {
|
|
ReadAccountsRequest optional.Interface
|
|
}
|
|
|
|
/*
|
|
ReadAccounts Method for ReadAccounts
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *ReadAccountsOpts - Optional Parameters:
|
|
* @param "ReadAccountsRequest" (optional.Interface of ReadAccountsRequest) -
|
|
@return ReadAccountsResponse
|
|
*/
|
|
func (a *AccountApiService) ReadAccounts(ctx _context.Context, localVarOptionals *ReadAccountsOpts) (ReadAccountsResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue ReadAccountsResponse
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/ReadAccounts"
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
if localVarOptionals != nil && localVarOptionals.ReadAccountsRequest.IsSet() {
|
|
localVarOptionalReadAccountsRequest, localVarOptionalReadAccountsRequestok := localVarOptionals.ReadAccountsRequest.Value().(ReadAccountsRequest)
|
|
if !localVarOptionalReadAccountsRequestok {
|
|
return localVarReturnValue, nil, reportError("readAccountsRequest should be ReadAccountsRequest")
|
|
}
|
|
localVarPostBody = &localVarOptionalReadAccountsRequest
|
|
}
|
|
|
|
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["Authorization"] = key
|
|
}
|
|
}
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
var v ReadAccountsResponse
|
|
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
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
// ReadConsumptionAccountOpts Optional parameters for the method 'ReadConsumptionAccount'
|
|
type ReadConsumptionAccountOpts struct {
|
|
ReadConsumptionAccountRequest optional.Interface
|
|
}
|
|
|
|
/*
|
|
ReadConsumptionAccount Method for ReadConsumptionAccount
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *ReadConsumptionAccountOpts - Optional Parameters:
|
|
* @param "ReadConsumptionAccountRequest" (optional.Interface of ReadConsumptionAccountRequest) -
|
|
@return ReadConsumptionAccountResponse
|
|
*/
|
|
func (a *AccountApiService) ReadConsumptionAccount(ctx _context.Context, localVarOptionals *ReadConsumptionAccountOpts) (ReadConsumptionAccountResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue ReadConsumptionAccountResponse
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/ReadConsumptionAccount"
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
if localVarOptionals != nil && localVarOptionals.ReadConsumptionAccountRequest.IsSet() {
|
|
localVarOptionalReadConsumptionAccountRequest, localVarOptionalReadConsumptionAccountRequestok := localVarOptionals.ReadConsumptionAccountRequest.Value().(ReadConsumptionAccountRequest)
|
|
if !localVarOptionalReadConsumptionAccountRequestok {
|
|
return localVarReturnValue, nil, reportError("readConsumptionAccountRequest should be ReadConsumptionAccountRequest")
|
|
}
|
|
localVarPostBody = &localVarOptionalReadConsumptionAccountRequest
|
|
}
|
|
|
|
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["Authorization"] = key
|
|
}
|
|
}
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
var v ReadConsumptionAccountResponse
|
|
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
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
// ResetAccountPasswordOpts Optional parameters for the method 'ResetAccountPassword'
|
|
type ResetAccountPasswordOpts struct {
|
|
ResetAccountPasswordRequest optional.Interface
|
|
}
|
|
|
|
/*
|
|
ResetAccountPassword Method for ResetAccountPassword
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *ResetAccountPasswordOpts - Optional Parameters:
|
|
* @param "ResetAccountPasswordRequest" (optional.Interface of ResetAccountPasswordRequest) -
|
|
@return ResetAccountPasswordResponse
|
|
*/
|
|
func (a *AccountApiService) ResetAccountPassword(ctx _context.Context, localVarOptionals *ResetAccountPasswordOpts) (ResetAccountPasswordResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue ResetAccountPasswordResponse
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/ResetAccountPassword"
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
if localVarOptionals != nil && localVarOptionals.ResetAccountPasswordRequest.IsSet() {
|
|
localVarOptionalResetAccountPasswordRequest, localVarOptionalResetAccountPasswordRequestok := localVarOptionals.ResetAccountPasswordRequest.Value().(ResetAccountPasswordRequest)
|
|
if !localVarOptionalResetAccountPasswordRequestok {
|
|
return localVarReturnValue, nil, reportError("resetAccountPasswordRequest should be ResetAccountPasswordRequest")
|
|
}
|
|
localVarPostBody = &localVarOptionalResetAccountPasswordRequest
|
|
}
|
|
|
|
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["Authorization"] = key
|
|
}
|
|
}
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
var v ResetAccountPasswordResponse
|
|
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
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
// SendResetPasswordEmailOpts Optional parameters for the method 'SendResetPasswordEmail'
|
|
type SendResetPasswordEmailOpts struct {
|
|
SendResetPasswordEmailRequest optional.Interface
|
|
}
|
|
|
|
/*
|
|
SendResetPasswordEmail Method for SendResetPasswordEmail
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *SendResetPasswordEmailOpts - Optional Parameters:
|
|
* @param "SendResetPasswordEmailRequest" (optional.Interface of SendResetPasswordEmailRequest) -
|
|
@return SendResetPasswordEmailResponse
|
|
*/
|
|
func (a *AccountApiService) SendResetPasswordEmail(ctx _context.Context, localVarOptionals *SendResetPasswordEmailOpts) (SendResetPasswordEmailResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue SendResetPasswordEmailResponse
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/SendResetPasswordEmail"
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
if localVarOptionals != nil && localVarOptionals.SendResetPasswordEmailRequest.IsSet() {
|
|
localVarOptionalSendResetPasswordEmailRequest, localVarOptionalSendResetPasswordEmailRequestok := localVarOptionals.SendResetPasswordEmailRequest.Value().(SendResetPasswordEmailRequest)
|
|
if !localVarOptionalSendResetPasswordEmailRequestok {
|
|
return localVarReturnValue, nil, reportError("sendResetPasswordEmailRequest should be SendResetPasswordEmailRequest")
|
|
}
|
|
localVarPostBody = &localVarOptionalSendResetPasswordEmailRequest
|
|
}
|
|
|
|
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["Authorization"] = key
|
|
}
|
|
}
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
var v SendResetPasswordEmailResponse
|
|
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
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|
|
|
|
// UpdateAccountOpts Optional parameters for the method 'UpdateAccount'
|
|
type UpdateAccountOpts struct {
|
|
UpdateAccountRequest optional.Interface
|
|
}
|
|
|
|
/*
|
|
UpdateAccount Method for UpdateAccount
|
|
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
* @param optional nil or *UpdateAccountOpts - Optional Parameters:
|
|
* @param "UpdateAccountRequest" (optional.Interface of UpdateAccountRequest) -
|
|
@return UpdateAccountResponse
|
|
*/
|
|
func (a *AccountApiService) UpdateAccount(ctx _context.Context, localVarOptionals *UpdateAccountOpts) (UpdateAccountResponse, *_nethttp.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = _nethttp.MethodPost
|
|
localVarPostBody interface{}
|
|
localVarFormFileName string
|
|
localVarFileName string
|
|
localVarFileBytes []byte
|
|
localVarReturnValue UpdateAccountResponse
|
|
)
|
|
|
|
// create path and map variables
|
|
localVarPath := a.client.cfg.BasePath + "/UpdateAccount"
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := _neturl.Values{}
|
|
localVarFormParams := _neturl.Values{}
|
|
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{"application/json"}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
// body params
|
|
if localVarOptionals != nil && localVarOptionals.UpdateAccountRequest.IsSet() {
|
|
localVarOptionalUpdateAccountRequest, localVarOptionalUpdateAccountRequestok := localVarOptionals.UpdateAccountRequest.Value().(UpdateAccountRequest)
|
|
if !localVarOptionalUpdateAccountRequestok {
|
|
return localVarReturnValue, nil, reportError("updateAccountRequest should be UpdateAccountRequest")
|
|
}
|
|
localVarPostBody = &localVarOptionalUpdateAccountRequest
|
|
}
|
|
|
|
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["Authorization"] = key
|
|
}
|
|
}
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, 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 {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
if localVarHTTPResponse.StatusCode == 200 {
|
|
var v UpdateAccountResponse
|
|
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
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|