From 970419f959dab31de013da68907750c17890d6fc Mon Sep 17 00:00:00 2001 From: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com> Date: Fri, 23 Dec 2022 13:45:24 +0200 Subject: [PATCH 1/3] fix: swagger reference & client regeneration Signed-off-by: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com> --- client/.openapi-generator-ignore | 1 + client/.openapi-generator/FILES | 20 +- client/.openapi-generator/VERSION | 2 +- client/README.md | 26 +- client/api/openapi.yaml | 223 ++++-- client/api_default.go | 623 ---------------- client/api_payments.go | 878 +++++++++++++++++++++-- client/client.go | 191 +++-- client/configuration.go | 36 +- client/docs/BankingCircleConfig.md | 154 ++++ client/docs/ConnectorBaseInfo.md | 102 +++ client/docs/CurrencyCloudConfig.md | 164 +++++ client/docs/DummyPayConfig.md | 133 ++++ client/docs/ListConnectorsResponse.md | 61 ++ client/docs/ListPaymentsResponse.md | 20 +- client/docs/ModulrConfig.md | 128 ++++ client/docs/Payment.md | 164 ++++- client/docs/PaymentsApi.md | 565 ++++++++++++++- client/docs/StripeConfig.md | 56 +- client/docs/StripeTask.md | 90 ++- client/docs/WiseConfig.md | 61 ++ client/git_push.sh | 4 +- client/go.mod | 1 - client/go.sum | 2 - client/model_banking_circle_config.go | 214 ++++++ client/model_connector_base_info.go | 164 +++++ client/model_currency_cloud_config.go | 229 ++++++ client/model_dummy_pay_config.go | 197 +++++ client/model_get_payment_response.go | 17 +- client/model_list_connectors_response.go | 121 ++++ client/model_list_payments_response.go | 35 +- client/model_modulr_config.go | 189 +++++ client/model_payment.go | 179 +++-- client/model_stripe_config.go | 97 +-- client/model_stripe_task.go | 152 ++-- client/model_wise_config.go | 121 ++++ client/utils.go | 19 + main.go | 2 +- swagger.yml | 2 +- 39 files changed, 4315 insertions(+), 1128 deletions(-) delete mode 100644 client/api_default.go create mode 100644 client/docs/BankingCircleConfig.md create mode 100644 client/docs/ConnectorBaseInfo.md create mode 100644 client/docs/CurrencyCloudConfig.md create mode 100644 client/docs/DummyPayConfig.md create mode 100644 client/docs/ListConnectorsResponse.md create mode 100644 client/docs/ModulrConfig.md create mode 100644 client/docs/WiseConfig.md create mode 100644 client/model_banking_circle_config.go create mode 100644 client/model_connector_base_info.go create mode 100644 client/model_currency_cloud_config.go create mode 100644 client/model_dummy_pay_config.go create mode 100644 client/model_list_connectors_response.go create mode 100644 client/model_modulr_config.go create mode 100644 client/model_wise_config.go diff --git a/client/.openapi-generator-ignore b/client/.openapi-generator-ignore index 7484ee59..e6441656 100644 --- a/client/.openapi-generator-ignore +++ b/client/.openapi-generator-ignore @@ -21,3 +21,4 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md +test/ diff --git a/client/.openapi-generator/FILES b/client/.openapi-generator/FILES index f9ee23c9..0b5c8f31 100644 --- a/client/.openapi-generator/FILES +++ b/client/.openapi-generator/FILES @@ -2,28 +2,36 @@ .travis.yml README.md api/openapi.yaml -api_default.go api_payments.go client.go configuration.go -docs/ConnectorConfig.md -docs/ConnectorTask.md -docs/DefaultApi.md +docs/BankingCircleConfig.md +docs/ConnectorBaseInfo.md +docs/CurrencyCloudConfig.md +docs/DummyPayConfig.md docs/GetPaymentResponse.md +docs/ListConnectorsResponse.md docs/ListPaymentsResponse.md +docs/ModulrConfig.md docs/Payment.md docs/PaymentsApi.md docs/StripeConfig.md docs/StripeTask.md +docs/WiseConfig.md git_push.sh go.mod go.sum -model_connector_config.go -model_connector_task.go +model_banking_circle_config.go +model_connector_base_info.go +model_currency_cloud_config.go +model_dummy_pay_config.go model_get_payment_response.go +model_list_connectors_response.go model_list_payments_response.go +model_modulr_config.go model_payment.go model_stripe_config.go model_stripe_task.go +model_wise_config.go response.go utils.go diff --git a/client/.openapi-generator/VERSION b/client/.openapi-generator/VERSION index 7b7e20b5..d6b4ec4a 100644 --- a/client/.openapi-generator/VERSION +++ b/client/.openapi-generator/VERSION @@ -1 +1 @@ -6.1.1-SNAPSHOT \ No newline at end of file +6.3.0-SNAPSHOT \ No newline at end of file diff --git a/client/README.md b/client/README.md index 8552d217..c8f06ed3 100644 --- a/client/README.md +++ b/client/README.md @@ -6,7 +6,7 @@ No description provided (generated by Openapi Generator https://github.com/opena This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. - API version: 1.0.0 -- Package version: latest +- Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation @@ -15,7 +15,6 @@ Install the following dependencies: ```shell go get github.com/stretchr/testify/assert -go get golang.org/x/oauth2 go get golang.org/x/net/context ``` @@ -78,25 +77,32 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*DefaultApi* | [**GetConnectorTask**](docs/DefaultApi.md#getconnectortask) | **Get** /connectors/{connector}/tasks/{taskId} | Read a specific task of the connector -*DefaultApi* | [**InstallConnector**](docs/DefaultApi.md#installconnector) | **Post** /connectors/{connector} | Install connector -*DefaultApi* | [**ListConnectorTasks**](docs/DefaultApi.md#listconnectortasks) | **Get** /connectors/{connector}/tasks | List connector tasks -*DefaultApi* | [**ReadConnectorConfig**](docs/DefaultApi.md#readconnectorconfig) | **Get** /connectors/{connector}/config | Read connector config -*DefaultApi* | [**ResetConnector**](docs/DefaultApi.md#resetconnector) | **Post** /connectors/{connector}/reset | Reset connector -*DefaultApi* | [**UninstallConnector**](docs/DefaultApi.md#uninstallconnector) | **Delete** /connectors/{connector} | Uninstall connector +*PaymentsApi* | [**GetAllConnectors**](docs/PaymentsApi.md#getallconnectors) | **Get** /connectors | Get all installed connectors +*PaymentsApi* | [**GetAllConnectorsConfigs**](docs/PaymentsApi.md#getallconnectorsconfigs) | **Get** /connectors/configs | Get all available connectors configs +*PaymentsApi* | [**GetConnectorTask**](docs/PaymentsApi.md#getconnectortask) | **Get** /connectors/{connector}/tasks/{taskId} | Read a specific task of the connector *PaymentsApi* | [**GetPayment**](docs/PaymentsApi.md#getpayment) | **Get** /payments/{paymentId} | Returns a payment. +*PaymentsApi* | [**InstallConnector**](docs/PaymentsApi.md#installconnector) | **Post** /connectors/{connector} | Install connector +*PaymentsApi* | [**ListConnectorTasks**](docs/PaymentsApi.md#listconnectortasks) | **Get** /connectors/{connector}/tasks | List connector tasks *PaymentsApi* | [**ListPayments**](docs/PaymentsApi.md#listpayments) | **Get** /payments | Returns a list of payments. +*PaymentsApi* | [**ReadConnectorConfig**](docs/PaymentsApi.md#readconnectorconfig) | **Get** /connectors/{connector}/config | Read connector config +*PaymentsApi* | [**ResetConnector**](docs/PaymentsApi.md#resetconnector) | **Post** /connectors/{connector}/reset | Reset connector +*PaymentsApi* | [**UninstallConnector**](docs/PaymentsApi.md#uninstallconnector) | **Delete** /connectors/{connector} | Uninstall connector ## Documentation For Models - - [ConnectorConfig](docs/ConnectorConfig.md) - - [ConnectorTask](docs/ConnectorTask.md) + - [BankingCircleConfig](docs/BankingCircleConfig.md) + - [ConnectorBaseInfo](docs/ConnectorBaseInfo.md) + - [CurrencyCloudConfig](docs/CurrencyCloudConfig.md) + - [DummyPayConfig](docs/DummyPayConfig.md) - [GetPaymentResponse](docs/GetPaymentResponse.md) + - [ListConnectorsResponse](docs/ListConnectorsResponse.md) - [ListPaymentsResponse](docs/ListPaymentsResponse.md) + - [ModulrConfig](docs/ModulrConfig.md) - [Payment](docs/Payment.md) - [StripeConfig](docs/StripeConfig.md) - [StripeTask](docs/StripeTask.md) + - [WiseConfig](docs/WiseConfig.md) ## Documentation For Authorization diff --git a/client/api/openapi.yaml b/client/api/openapi.yaml index 0fb33eb7..1d19ec2e 100644 --- a/client/api/openapi.yaml +++ b/client/api/openapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.0 +openapi: 3.1.0 info: title: Payments API version: 1.0.0 @@ -16,8 +16,7 @@ paths: in: query name: limit required: false - schema: - type: integer + schema: {} style: form - description: "How many payments to skip, pagination can be achieved in conjunction\ \ with 'limit' parameter." @@ -26,8 +25,7 @@ paths: in: query name: skip required: false - schema: - type: integer + schema: {} style: form - description: Field used to sort payments (Default is by date). example: status @@ -36,9 +34,7 @@ paths: name: sort required: false schema: - items: - type: string - type: array + items: {} style: form responses: "200": @@ -49,7 +45,7 @@ paths: description: A JSON array of payments summary: Returns a list of payments. tags: - - payments + - Payments /payments/{paymentId}: get: operationId: getPayment @@ -60,8 +56,7 @@ paths: in: path name: paymentId required: true - schema: - type: string + schema: {} style: simple responses: "200": @@ -72,7 +67,35 @@ paths: description: A payment summary: Returns a payment. tags: - - payments + - Payments + /connectors: + get: + description: Get all installed connectors + operationId: getAllConnectors + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ListConnectorsResponse' + description: List of installed connectors + summary: Get all installed connectors + tags: + - Payments + /connectors/configs: + get: + description: Get all available connectors configs + operationId: getAllConnectorsConfigs + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/ConnectorConfig' + description: List of available connectors configs + summary: Get all available connectors configs + tags: + - Payments /connectors/{connector}: delete: description: Uninstall connector @@ -86,12 +109,13 @@ paths: schema: enum: - stripe - type: string style: simple responses: "204": description: Connector has been uninstalled summary: Uninstall connector + tags: + - Payments post: description: Install connector operationId: installConnector @@ -104,7 +128,10 @@ paths: schema: enum: - stripe - type: string + - dummypay + - wise + - modulr + - currencycloud style: simple requestBody: content: @@ -116,6 +143,8 @@ paths: "204": description: Connector has been installed summary: Install connector + tags: + - Payments /connectors/{connector}/config: get: description: Read connector config @@ -129,7 +158,6 @@ paths: schema: enum: - stripe - type: string style: simple responses: "200": @@ -139,6 +167,8 @@ paths: $ref: '#/components/schemas/ConnectorConfig' description: Connector config summary: Read connector config + tags: + - Payments /connectors/{connector}/reset: post: description: Reset connector. Will remove the connector and ALL PAYMENTS generated @@ -153,12 +183,13 @@ paths: schema: enum: - stripe - type: string style: simple responses: "204": description: Connector has been reset summary: Reset connector + tags: + - Payments /connectors/{connector}/tasks: get: description: List all tasks associated with this connector. @@ -172,7 +203,6 @@ paths: schema: enum: - stripe - type: string style: simple responses: "200": @@ -181,9 +211,10 @@ paths: schema: items: $ref: '#/components/schemas/ConnectorTask' - type: array description: Task list summary: List connector tasks + tags: + - Payments /connectors/{connector}/tasks/{taskId}: get: description: Get a specific task associated to the connector @@ -197,7 +228,6 @@ paths: schema: enum: - stripe - type: string style: simple - description: The task id example: task1 @@ -205,8 +235,7 @@ paths: in: path name: taskId required: true - schema: - type: string + schema: {} style: simple responses: "200": @@ -216,11 +245,18 @@ paths: $ref: '#/components/schemas/ConnectorTask' description: The specified task summary: Read a specific task of the connector + tags: + - Payments components: schemas: ConnectorConfig: oneOf: - $ref: '#/components/schemas/StripeConfig' + - $ref: '#/components/schemas/DummyPayConfig' + - $ref: '#/components/schemas/WiseConfig' + - $ref: '#/components/schemas/ModulrConfig' + - $ref: '#/components/schemas/CurrencyCloudConfig' + - $ref: '#/components/schemas/BankingCircleConfig' ConnectorTask: oneOf: - $ref: '#/components/schemas/StripeTask' @@ -231,98 +267,126 @@ components: description: The frequency at which the connector will try to fetch new BalanceTransaction objects from Stripe api example: 60s - type: string apiKey: example: XXX - type: string pageSize: default: 10 description: | Number of BalanceTransaction to fetch at each polling interval. example: 50 - type: number required: - apiKey - type: object StripeTask: properties: oldestId: description: The id of the oldest BalanceTransaction fetched from stripe for this account - type: string oldestDate: description: The creation date of the oldest BalanceTransaction fetched from stripe for this account format: date-time - type: string moreRecentId: description: The id of the more recent BalanceTransaction fetched from stripe for this account - type: string moreRecentDate: description: The creation date of the more recent BalanceTransaction fetched from stripe for this account format: date-time - type: string - noMoreHistory: - description: Indicate that there no more history to fetch on this account - type: boolean - type: object + noMoreHistory: {} + DummyPayConfig: + properties: + filePollingPeriod: + default: 10s + description: The frequency at which the connector will try to fetch new + payment objects from the directory + example: 60s + fileGenerationPeriod: + default: 10s + description: The frequency at which the connector will create new payment + objects in the directory + example: 60s + directory: + example: /tmp/dummypay + required: + - directory + WiseConfig: + properties: + apiKey: + example: XXX + required: + - apiKey + ModulrConfig: + properties: + apiKey: + example: XXX + apiSecret: + example: XXX + endpoint: + example: XXX + required: + - apiKey + - apiSecret + BankingCircleConfig: + properties: + username: + example: XXX + password: + example: XXX + endpoint: + example: XXX + authorizationEndpoint: + example: XXX + required: + - authorizationEndpoint + - endpoint + - password + - username + CurrencyCloudConfig: + properties: + apiKey: + example: XXX + loginID: + description: Username of the API Key holder + example: XXX + pollingPeriod: + description: The frequency at which the connector will fetch transactions + example: 60s + endpoint: + description: The endpoint to use for the API. Defaults to https://devapi.currencycloud.com + example: XXX + required: + - apiKey + - loginID ListPaymentsResponse: example: - data: - - reference: reference - date: 2000-01-23T04:56:07.000+00:00 - amount: 100 - scheme: visa - provider: provider - raw: "" - id: XXX - type: pay-in - asset: USD - status: status - - reference: reference - date: 2000-01-23T04:56:07.000+00:00 - amount: 100 - scheme: visa - provider: provider - raw: "" - id: XXX - type: pay-in - asset: USD - status: status + data: "" properties: data: items: $ref: '#/components/schemas/Payment' - type: array required: - data - type: object GetPaymentResponse: properties: data: $ref: '#/components/schemas/Payment' required: - data - type: object Payment: example: - reference: reference - date: 2000-01-23T04:56:07.000+00:00 + reference: "" + date: "" amount: 100 - scheme: visa - provider: provider + scheme: "" + provider: "" raw: "" id: XXX - type: pay-in + type: "" asset: USD - status: status + status: "" properties: - provider: - type: string - reference: - type: string + provider: {} + reference: {} scheme: enum: - visa @@ -337,27 +401,20 @@ components: - ach - rtp - other - type: string - status: - type: string + status: {} type: enum: - pay-in - payout - other - type: string id: example: XXX - type: string amount: example: 100 - type: integer asset: example: USD - type: string date: format: date-time - type: string raw: nullable: true required: @@ -369,4 +426,18 @@ components: - scheme - status - type - type: object + ListConnectorsResponse: + example: + data: "" + properties: + data: + items: + $ref: '#/components/schemas/ConnectorBaseInfo' + required: + - data + ConnectorBaseInfo: + properties: + provider: + example: stripe + disabled: + example: false diff --git a/client/api_default.go b/client/api_default.go deleted file mode 100644 index ae417333..00000000 --- a/client/api_default.go +++ /dev/null @@ -1,623 +0,0 @@ -/* -Payments API - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - -API version: 1.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "bytes" - "context" - "io/ioutil" - "net/http" - "net/url" - "strings" -) - -// DefaultApiService DefaultApi service -type DefaultApiService service - -type ApiGetConnectorTaskRequest struct { - ctx context.Context - ApiService *DefaultApiService - connector string - taskId string -} - -func (r ApiGetConnectorTaskRequest) Execute() (*ConnectorTask, *http.Response, error) { - return r.ApiService.GetConnectorTaskExecute(r) -} - -/* -GetConnectorTask Read a specific task of the connector - -Get a specific task associated to the connector - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param connector The connector code - @param taskId The task id - @return ApiGetConnectorTaskRequest -*/ -func (a *DefaultApiService) GetConnectorTask(ctx context.Context, connector string, taskId string) ApiGetConnectorTaskRequest { - return ApiGetConnectorTaskRequest{ - ApiService: a, - ctx: ctx, - connector: connector, - taskId: taskId, - } -} - -// Execute executes the request -// @return ConnectorTask -func (a *DefaultApiService) GetConnectorTaskExecute(r ApiGetConnectorTaskRequest) (*ConnectorTask, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ConnectorTask - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetConnectorTask") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/connectors/{connector}/tasks/{taskId}" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", url.PathEscape(parameterToString(r.taskId, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // 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 - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - 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 -} - -type ApiInstallConnectorRequest struct { - ctx context.Context - ApiService *DefaultApiService - connector string - connectorConfig *ConnectorConfig -} - -func (r ApiInstallConnectorRequest) ConnectorConfig(connectorConfig ConnectorConfig) ApiInstallConnectorRequest { - r.connectorConfig = &connectorConfig - return r -} - -func (r ApiInstallConnectorRequest) Execute() (*http.Response, error) { - return r.ApiService.InstallConnectorExecute(r) -} - -/* -InstallConnector Install connector - -Install connector - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param connector The connector code - @return ApiInstallConnectorRequest -*/ -func (a *DefaultApiService) InstallConnector(ctx context.Context, connector string) ApiInstallConnectorRequest { - return ApiInstallConnectorRequest{ - ApiService: a, - ctx: ctx, - connector: connector, - } -} - -// Execute executes the request -func (a *DefaultApiService) InstallConnectorExecute(r ApiInstallConnectorRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.InstallConnector") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/connectors/{connector}" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - if r.connectorConfig == nil { - return nil, reportError("connectorConfig is required and must be specified") - } - - // 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{} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - // body params - localVarPostBody = r.connectorConfig - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type ApiListConnectorTasksRequest struct { - ctx context.Context - ApiService *DefaultApiService - connector string -} - -func (r ApiListConnectorTasksRequest) Execute() ([]ConnectorTask, *http.Response, error) { - return r.ApiService.ListConnectorTasksExecute(r) -} - -/* -ListConnectorTasks List connector tasks - -List all tasks associated with this connector. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param connector The connector code - @return ApiListConnectorTasksRequest -*/ -func (a *DefaultApiService) ListConnectorTasks(ctx context.Context, connector string) ApiListConnectorTasksRequest { - return ApiListConnectorTasksRequest{ - ApiService: a, - ctx: ctx, - connector: connector, - } -} - -// Execute executes the request -// @return []ConnectorTask -func (a *DefaultApiService) ListConnectorTasksExecute(r ApiListConnectorTasksRequest) ([]ConnectorTask, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue []ConnectorTask - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListConnectorTasks") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/connectors/{connector}/tasks" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // 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 - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - 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 -} - -type ApiReadConnectorConfigRequest struct { - ctx context.Context - ApiService *DefaultApiService - connector string -} - -func (r ApiReadConnectorConfigRequest) Execute() (*ConnectorConfig, *http.Response, error) { - return r.ApiService.ReadConnectorConfigExecute(r) -} - -/* -ReadConnectorConfig Read connector config - -Read connector config - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param connector The connector code - @return ApiReadConnectorConfigRequest -*/ -func (a *DefaultApiService) ReadConnectorConfig(ctx context.Context, connector string) ApiReadConnectorConfigRequest { - return ApiReadConnectorConfigRequest{ - ApiService: a, - ctx: ctx, - connector: connector, - } -} - -// Execute executes the request -// @return ConnectorConfig -func (a *DefaultApiService) ReadConnectorConfigExecute(r ApiReadConnectorConfigRequest) (*ConnectorConfig, *http.Response, error) { - var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ConnectorConfig - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ReadConnectorConfig") - if err != nil { - return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/connectors/{connector}/config" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // 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 - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return localVarReturnValue, nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarReturnValue, localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - 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 -} - -type ApiResetConnectorRequest struct { - ctx context.Context - ApiService *DefaultApiService - connector string -} - -func (r ApiResetConnectorRequest) Execute() (*http.Response, error) { - return r.ApiService.ResetConnectorExecute(r) -} - -/* -ResetConnector Reset connector - -Reset connector. Will remove the connector and ALL PAYMENTS generated with it. - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param connector The connector code - @return ApiResetConnectorRequest -*/ -func (a *DefaultApiService) ResetConnector(ctx context.Context, connector string) ApiResetConnectorRequest { - return ApiResetConnectorRequest{ - ApiService: a, - ctx: ctx, - connector: connector, - } -} - -// Execute executes the request -func (a *DefaultApiService) ResetConnectorExecute(r ApiResetConnectorRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ResetConnector") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/connectors/{connector}/reset" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} - -type ApiUninstallConnectorRequest struct { - ctx context.Context - ApiService *DefaultApiService - connector string -} - -func (r ApiUninstallConnectorRequest) Execute() (*http.Response, error) { - return r.ApiService.UninstallConnectorExecute(r) -} - -/* -UninstallConnector Uninstall connector - -Uninstall connector - - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param connector The connector code - @return ApiUninstallConnectorRequest -*/ -func (a *DefaultApiService) UninstallConnector(ctx context.Context, connector string) ApiUninstallConnectorRequest { - return ApiUninstallConnectorRequest{ - ApiService: a, - ctx: ctx, - connector: connector, - } -} - -// Execute executes the request -func (a *DefaultApiService) UninstallConnectorExecute(r ApiUninstallConnectorRequest) (*http.Response, error) { - var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile - ) - - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UninstallConnector") - if err != nil { - return nil, &GenericOpenAPIError{error: err.Error()} - } - - localVarPath := localBasePath + "/connectors/{connector}" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) - - localVarHeaderParams := make(map[string]string) - localVarQueryParams := url.Values{} - localVarFormParams := url.Values{} - - // to determine the Content-Type header - localVarHTTPContentTypes := []string{} - - // set Content-Type header - localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) - if localVarHTTPContentType != "" { - localVarHeaderParams["Content-Type"] = localVarHTTPContentType - } - - // to determine the Accept header - localVarHTTPHeaderAccepts := []string{} - - // set Accept header - localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) - if localVarHTTPHeaderAccept != "" { - localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept - } - req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) - if err != nil { - return nil, err - } - - localVarHTTPResponse, err := a.client.callAPI(req) - if err != nil || localVarHTTPResponse == nil { - return localVarHTTPResponse, err - } - - localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) - localVarHTTPResponse.Body.Close() - localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) - if err != nil { - return localVarHTTPResponse, err - } - - if localVarHTTPResponse.StatusCode >= 300 { - newErr := &GenericOpenAPIError{ - body: localVarBody, - error: localVarHTTPResponse.Status, - } - return localVarHTTPResponse, newErr - } - - return localVarHTTPResponse, nil -} diff --git a/client/api_payments.go b/client/api_payments.go index a9c8833d..ad8de49a 100644 --- a/client/api_payments.go +++ b/client/api_payments.go @@ -16,55 +16,566 @@ import ( "io/ioutil" "net/http" "net/url" - "reflect" "strings" ) + // PaymentsApiService PaymentsApi service type PaymentsApiService service -type ApiGetPaymentRequest struct { - ctx context.Context +type ApiGetAllConnectorsRequest struct { + ctx context.Context + ApiService *PaymentsApiService +} + +func (r ApiGetAllConnectorsRequest) Execute() (*ListConnectorsResponse, *http.Response, error) { + return r.ApiService.GetAllConnectorsExecute(r) +} + +/* +GetAllConnectors Get all installed connectors + +Get all installed connectors + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetAllConnectorsRequest +*/ +func (a *PaymentsApiService) GetAllConnectors(ctx context.Context) ApiGetAllConnectorsRequest { + return ApiGetAllConnectorsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return ListConnectorsResponse +func (a *PaymentsApiService) GetAllConnectorsExecute(r ApiGetAllConnectorsRequest) (*ListConnectorsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListConnectorsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetAllConnectors") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connectors" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + 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 +} + +type ApiGetAllConnectorsConfigsRequest struct { + ctx context.Context + ApiService *PaymentsApiService +} + +func (r ApiGetAllConnectorsConfigsRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.GetAllConnectorsConfigsExecute(r) +} + +/* +GetAllConnectorsConfigs Get all available connectors configs + +Get all available connectors configs + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiGetAllConnectorsConfigsRequest +*/ +func (a *PaymentsApiService) GetAllConnectorsConfigs(ctx context.Context) ApiGetAllConnectorsConfigsRequest { + return ApiGetAllConnectorsConfigsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// @return interface{} +func (a *PaymentsApiService) GetAllConnectorsConfigsExecute(r ApiGetAllConnectorsConfigsRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetAllConnectorsConfigs") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connectors/configs" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + 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 +} + +type ApiGetConnectorTaskRequest struct { + ctx context.Context + ApiService *PaymentsApiService + connector interface{} + taskId interface{} +} + +func (r ApiGetConnectorTaskRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.GetConnectorTaskExecute(r) +} + +/* +GetConnectorTask Read a specific task of the connector + +Get a specific task associated to the connector + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connector The connector code + @param taskId The task id + @return ApiGetConnectorTaskRequest +*/ +func (a *PaymentsApiService) GetConnectorTask(ctx context.Context, connector interface{}, taskId interface{}) ApiGetConnectorTaskRequest { + return ApiGetConnectorTaskRequest{ + ApiService: a, + ctx: ctx, + connector: connector, + taskId: taskId, + } +} + +// Execute executes the request +// @return interface{} +func (a *PaymentsApiService) GetConnectorTaskExecute(r ApiGetConnectorTaskRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetConnectorTask") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connectors/{connector}/tasks/{taskId}" + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", url.PathEscape(parameterValueToString(r.taskId, "taskId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + 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 +} + +type ApiGetPaymentRequest struct { + ctx context.Context + ApiService *PaymentsApiService + paymentId interface{} +} + +func (r ApiGetPaymentRequest) Execute() (*Payment, *http.Response, error) { + return r.ApiService.GetPaymentExecute(r) +} + +/* +GetPayment Returns a payment. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param paymentId The payment id + @return ApiGetPaymentRequest +*/ +func (a *PaymentsApiService) GetPayment(ctx context.Context, paymentId interface{}) ApiGetPaymentRequest { + return ApiGetPaymentRequest{ + ApiService: a, + ctx: ctx, + paymentId: paymentId, + } +} + +// Execute executes the request +// @return Payment +func (a *PaymentsApiService) GetPaymentExecute(r ApiGetPaymentRequest) (*Payment, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Payment + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetPayment") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/payments/{paymentId}" + localVarPath = strings.Replace(localVarPath, "{"+"paymentId"+"}", url.PathEscape(parameterValueToString(r.paymentId, "paymentId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + 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 +} + +type ApiInstallConnectorRequest struct { + ctx context.Context + ApiService *PaymentsApiService + connector interface{} + body *interface{} +} + +func (r ApiInstallConnectorRequest) Body(body interface{}) ApiInstallConnectorRequest { + r.body = &body + return r +} + +func (r ApiInstallConnectorRequest) Execute() (*http.Response, error) { + return r.ApiService.InstallConnectorExecute(r) +} + +/* +InstallConnector Install connector + +Install connector + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connector The connector code + @return ApiInstallConnectorRequest +*/ +func (a *PaymentsApiService) InstallConnector(ctx context.Context, connector interface{}) ApiInstallConnectorRequest { + return ApiInstallConnectorRequest{ + ApiService: a, + ctx: ctx, + connector: connector, + } +} + +// Execute executes the request +func (a *PaymentsApiService) InstallConnectorExecute(r ApiInstallConnectorRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.InstallConnector") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connectors/{connector}" + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.body == nil { + return nil, reportError("body is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.body + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiListConnectorTasksRequest struct { + ctx context.Context ApiService *PaymentsApiService - paymentId string + connector interface{} } -func (r ApiGetPaymentRequest) Execute() (*Payment, *http.Response, error) { - return r.ApiService.GetPaymentExecute(r) +func (r ApiListConnectorTasksRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.ListConnectorTasksExecute(r) } /* -GetPayment Returns a payment. +ListConnectorTasks List connector tasks + +List all tasks associated with this connector. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param paymentId The payment id - @return ApiGetPaymentRequest + @param connector The connector code + @return ApiListConnectorTasksRequest */ -func (a *PaymentsApiService) GetPayment(ctx context.Context, paymentId string) ApiGetPaymentRequest { - return ApiGetPaymentRequest{ +func (a *PaymentsApiService) ListConnectorTasks(ctx context.Context, connector interface{}) ApiListConnectorTasksRequest { + return ApiListConnectorTasksRequest{ ApiService: a, - ctx: ctx, - paymentId: paymentId, + ctx: ctx, + connector: connector, } } // Execute executes the request -// @return Payment -func (a *PaymentsApiService) GetPaymentExecute(r ApiGetPaymentRequest) (*Payment, *http.Response, error) { +// @return interface{} +func (a *PaymentsApiService) ListConnectorTasksExecute(r ApiListConnectorTasksRequest) (interface{}, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Payment + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} ) - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetPayment") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ListConnectorTasks") if err != nil { return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } - localVarPath := localBasePath + "/payments/{paymentId}" - localVarPath = strings.Replace(localVarPath, "{"+"paymentId"+"}", url.PathEscape(parameterToString(r.paymentId, "")), -1) + localVarPath := localBasePath + "/connectors/{connector}/tasks" + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -125,27 +636,27 @@ func (a *PaymentsApiService) GetPaymentExecute(r ApiGetPaymentRequest) (*Payment } type ApiListPaymentsRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - limit *int32 - skip *int32 - sort *[]string + limit *interface{} + skip *interface{} + sort *interface{} } // Limit the number of payments to return, pagination can be achieved in conjunction with 'skip' parameter. -func (r ApiListPaymentsRequest) Limit(limit int32) ApiListPaymentsRequest { +func (r ApiListPaymentsRequest) Limit(limit interface{}) ApiListPaymentsRequest { r.limit = &limit return r } // How many payments to skip, pagination can be achieved in conjunction with 'limit' parameter. -func (r ApiListPaymentsRequest) Skip(skip int32) ApiListPaymentsRequest { +func (r ApiListPaymentsRequest) Skip(skip interface{}) ApiListPaymentsRequest { r.skip = &skip return r } // Field used to sort payments (Default is by date). -func (r ApiListPaymentsRequest) Sort(sort []string) ApiListPaymentsRequest { +func (r ApiListPaymentsRequest) Sort(sort interface{}) ApiListPaymentsRequest { r.sort = &sort return r } @@ -163,7 +674,7 @@ ListPayments Returns a list of payments. func (a *PaymentsApiService) ListPayments(ctx context.Context) ApiListPaymentsRequest { return ApiListPaymentsRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } @@ -171,10 +682,10 @@ func (a *PaymentsApiService) ListPayments(ctx context.Context) ApiListPaymentsRe // @return ListPaymentsResponse func (a *PaymentsApiService) ListPaymentsExecute(r ApiListPaymentsRequest) (*ListPaymentsResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListPaymentsResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListPaymentsResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ListPayments") @@ -189,22 +700,117 @@ func (a *PaymentsApiService) ListPaymentsExecute(r ApiListPaymentsRequest) (*Lis localVarFormParams := url.Values{} if r.limit != nil { - localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) + parameterAddToQuery(localVarQueryParams, "limit", r.limit, "") } if r.skip != nil { - localVarQueryParams.Add("skip", parameterToString(*r.skip, "")) + parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") } if r.sort != nil { - t := *r.sort - if reflect.TypeOf(t).Kind() == reflect.Slice { - s := reflect.ValueOf(t) - for i := 0; i < s.Len(); i++ { - localVarQueryParams.Add("sort", parameterToString(s.Index(i), "multi")) - } - } else { - localVarQueryParams.Add("sort", parameterToString(t, "multi")) + parameterAddToQuery(localVarQueryParams, "sort", r.sort, "") + } + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // 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 + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + 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 +} + +type ApiReadConnectorConfigRequest struct { + ctx context.Context + ApiService *PaymentsApiService + connector interface{} +} + +func (r ApiReadConnectorConfigRequest) Execute() (interface{}, *http.Response, error) { + return r.ApiService.ReadConnectorConfigExecute(r) +} + +/* +ReadConnectorConfig Read connector config + +Read connector config + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connector The connector code + @return ApiReadConnectorConfigRequest +*/ +func (a *PaymentsApiService) ReadConnectorConfig(ctx context.Context, connector interface{}) ApiReadConnectorConfigRequest { + return ApiReadConnectorConfigRequest{ + ApiService: a, + ctx: ctx, + connector: connector, + } +} + +// Execute executes the request +// @return interface{} +func (a *PaymentsApiService) ReadConnectorConfigExecute(r ApiReadConnectorConfigRequest) (interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ReadConnectorConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} } + + localVarPath := localBasePath + "/connectors/{connector}/config" + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -258,3 +864,187 @@ func (a *PaymentsApiService) ListPaymentsExecute(r ApiListPaymentsRequest) (*Lis return localVarReturnValue, localVarHTTPResponse, nil } + +type ApiResetConnectorRequest struct { + ctx context.Context + ApiService *PaymentsApiService + connector interface{} +} + +func (r ApiResetConnectorRequest) Execute() (*http.Response, error) { + return r.ApiService.ResetConnectorExecute(r) +} + +/* +ResetConnector Reset connector + +Reset connector. Will remove the connector and ALL PAYMENTS generated with it. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connector The connector code + @return ApiResetConnectorRequest +*/ +func (a *PaymentsApiService) ResetConnector(ctx context.Context, connector interface{}) ApiResetConnectorRequest { + return ApiResetConnectorRequest{ + ApiService: a, + ctx: ctx, + connector: connector, + } +} + +// Execute executes the request +func (a *PaymentsApiService) ResetConnectorExecute(r ApiResetConnectorRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ResetConnector") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connectors/{connector}/reset" + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiUninstallConnectorRequest struct { + ctx context.Context + ApiService *PaymentsApiService + connector interface{} +} + +func (r ApiUninstallConnectorRequest) Execute() (*http.Response, error) { + return r.ApiService.UninstallConnectorExecute(r) +} + +/* +UninstallConnector Uninstall connector + +Uninstall connector + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param connector The connector code + @return ApiUninstallConnectorRequest +*/ +func (a *PaymentsApiService) UninstallConnector(ctx context.Context, connector interface{}) ApiUninstallConnectorRequest { + return ApiUninstallConnectorRequest{ + ApiService: a, + ctx: ctx, + connector: connector, + } +} + +// Execute executes the request +func (a *PaymentsApiService) UninstallConnectorExecute(r ApiUninstallConnectorRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.UninstallConnector") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connectors/{connector}" + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} diff --git a/client/client.go b/client/client.go index 0d3758bf..92ad8f41 100644 --- a/client/client.go +++ b/client/client.go @@ -33,12 +33,13 @@ import ( "time" "unicode/utf8" - "golang.org/x/oauth2" ) var ( jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) ) // APIClient manages communication with the Payments API API v1.0.0 @@ -49,8 +50,6 @@ type APIClient struct { // API Services - DefaultApi *DefaultApiService - PaymentsApi *PaymentsApiService } @@ -70,7 +69,6 @@ func NewAPIClient(cfg *Configuration) *APIClient { c.common.client = c // API Services - c.DefaultApi = (*DefaultApiService)(&c.common) c.PaymentsApi = (*PaymentsApiService)(&c.common) return c @@ -123,33 +121,106 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { // Check the type is as expected. if reflect.TypeOf(obj).String() != expected { - return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String()) + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) } return nil } -// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. -func parameterToString(obj interface{}, collectionFormat string) string { - var delimiter string - - switch collectionFormat { - case "pipes": - delimiter = "|" - case "ssv": - delimiter = " " - case "tsv": - delimiter = "\t" - case "csv": - delimiter = "," +func parameterValueToString( obj interface{}, key string ) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param,ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap,err := param.ToMap() + if err != nil { + return "" } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToQuery adds the provided object to the url query supporting deep object syntax +func parameterAddToQuery(queryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" - if reflect.TypeOf(obj).Kind() == reflect.Slice { - return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") - } else if t, ok := obj.(time.Time); ok { - return t.Format(time.RFC3339) + case reflect.Struct: + if t,ok := obj.(MappedNullable); ok { + dataMap,err := t.ToMap() + if err != nil { + return + } + parameterAddToQuery(queryParams, keyPrefix, dataMap, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToQuery(queryParams, keyPrefix, t.Format(time.RFC3339), collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i:=0;i ListConnectorsResponse GetAllConnectors(ctx).Execute() + +Get all installed connectors + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.GetAllConnectors(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.GetAllConnectors``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAllConnectors`: ListConnectorsResponse + fmt.Fprintf(os.Stdout, "Response from `PaymentsApi.GetAllConnectors`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAllConnectorsRequest struct via the builder pattern + + +### Return type + +[**ListConnectorsResponse**](ListConnectorsResponse.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetAllConnectorsConfigs + +> interface{} GetAllConnectorsConfigs(ctx).Execute() + +Get all available connectors configs + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.GetAllConnectorsConfigs(context.Background()).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.GetAllConnectorsConfigs``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetAllConnectorsConfigs`: interface{} + fmt.Fprintf(os.Stdout, "Response from `PaymentsApi.GetAllConnectorsConfigs`: %v\n", resp) +} +``` + +### Path Parameters + +This endpoint does not need any parameter. + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetAllConnectorsConfigsRequest struct via the builder pattern + + +### Return type + +**interface{}** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetConnectorTask + +> interface{} GetConnectorTask(ctx, connector, taskId).Execute() + +Read a specific task of the connector + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + connector := TODO // interface{} | The connector code + taskId := TODO // interface{} | The task id + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.GetConnectorTask(context.Background(), connector, taskId).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.GetConnectorTask``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `GetConnectorTask`: interface{} + fmt.Fprintf(os.Stdout, "Response from `PaymentsApi.GetConnectorTask`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**connector** | [**interface{}**](.md) | The connector code | +**taskId** | [**interface{}**](.md) | The task id | + +### Other Parameters + +Other parameters are passed through a pointer to a apiGetConnectorTaskRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + + +### Return type + +**interface{}** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## GetPayment > Payment GetPayment(ctx, paymentId).Execute() @@ -28,7 +231,7 @@ import ( ) func main() { - paymentId := "XXX" // string | The payment id + paymentId := TODO // interface{} | The payment id configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -48,7 +251,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**paymentId** | **string** | The payment id | +**paymentId** | [**interface{}**](.md) | The payment id | ### Other Parameters @@ -77,6 +280,146 @@ No authorization required [[Back to README]](../README.md) +## InstallConnector + +> InstallConnector(ctx, connector).Body(body).Execute() + +Install connector + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + connector := TODO // interface{} | The connector code + body := interface{}(987) // interface{} | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.InstallConnector(context.Background(), connector).Body(body).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.InstallConnector``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**connector** | [**interface{}**](.md) | The connector code | + +### Other Parameters + +Other parameters are passed through a pointer to a apiInstallConnectorRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + **body** | **interface{}** | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ListConnectorTasks + +> interface{} ListConnectorTasks(ctx, connector).Execute() + +List connector tasks + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + connector := TODO // interface{} | The connector code + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.ListConnectorTasks(context.Background(), connector).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.ListConnectorTasks``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ListConnectorTasks`: interface{} + fmt.Fprintf(os.Stdout, "Response from `PaymentsApi.ListConnectorTasks`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**connector** | [**interface{}**](.md) | The connector code | + +### Other Parameters + +Other parameters are passed through a pointer to a apiListConnectorTasksRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +**interface{}** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## ListPayments > ListPaymentsResponse ListPayments(ctx).Limit(limit).Skip(skip).Sort(sort).Execute() @@ -96,9 +439,9 @@ import ( ) func main() { - limit := int32(10) // int32 | Limit the number of payments to return, pagination can be achieved in conjunction with 'skip' parameter. (optional) - skip := int32(100) // int32 | How many payments to skip, pagination can be achieved in conjunction with 'limit' parameter. (optional) - sort := []string{"Inner_example"} // []string | Field used to sort payments (Default is by date). (optional) + limit := TODO // interface{} | Limit the number of payments to return, pagination can be achieved in conjunction with 'skip' parameter. (optional) + skip := TODO // interface{} | How many payments to skip, pagination can be achieved in conjunction with 'limit' parameter. (optional) + sort := TODO // interface{} | Field used to sort payments (Default is by date). (optional) configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -123,9 +466,9 @@ Other parameters are passed through a pointer to a apiListPaymentsRequest struct Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **limit** | **int32** | Limit the number of payments to return, pagination can be achieved in conjunction with 'skip' parameter. | - **skip** | **int32** | How many payments to skip, pagination can be achieved in conjunction with 'limit' parameter. | - **sort** | **[]string** | Field used to sort payments (Default is by date). | + **limit** | [**interface{}**](interface{}.md) | Limit the number of payments to return, pagination can be achieved in conjunction with 'skip' parameter. | + **skip** | [**interface{}**](interface{}.md) | How many payments to skip, pagination can be achieved in conjunction with 'limit' parameter. | + **sort** | [**interface{}**](interface{}.md) | Field used to sort payments (Default is by date). | ### Return type @@ -144,3 +487,209 @@ No authorization required [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +## ReadConnectorConfig + +> interface{} ReadConnectorConfig(ctx, connector).Execute() + +Read connector config + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + connector := TODO // interface{} | The connector code + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.ReadConnectorConfig(context.Background(), connector).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.ReadConnectorConfig``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + // response from `ReadConnectorConfig`: interface{} + fmt.Fprintf(os.Stdout, "Response from `PaymentsApi.ReadConnectorConfig`: %v\n", resp) +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**connector** | [**interface{}**](.md) | The connector code | + +### Other Parameters + +Other parameters are passed through a pointer to a apiReadConnectorConfigRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + +**interface{}** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## ResetConnector + +> ResetConnector(ctx, connector).Execute() + +Reset connector + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + connector := TODO // interface{} | The connector code + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.ResetConnector(context.Background(), connector).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.ResetConnector``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**connector** | [**interface{}**](.md) | The connector code | + +### Other Parameters + +Other parameters are passed through a pointer to a apiResetConnectorRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UninstallConnector + +> UninstallConnector(ctx, connector).Execute() + +Uninstall connector + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + connector := TODO // interface{} | The connector code + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.UninstallConnector(context.Background(), connector).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.UninstallConnector``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**connector** | [**interface{}**](.md) | The connector code | + +### Other Parameters + +Other parameters are passed through a pointer to a apiUninstallConnectorRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + diff --git a/client/docs/StripeConfig.md b/client/docs/StripeConfig.md index 03ec502b..3625362e 100644 --- a/client/docs/StripeConfig.md +++ b/client/docs/StripeConfig.md @@ -4,15 +4,15 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**PollingPeriod** | Pointer to **string** | The frequency at which the connector will try to fetch new BalanceTransaction objects from Stripe api | [optional] [default to "120s"] -**ApiKey** | **string** | | -**PageSize** | Pointer to **float32** | Number of BalanceTransaction to fetch at each polling interval. | [optional] [default to 10] +**PollingPeriod** | Pointer to **interface{}** | The frequency at which the connector will try to fetch new BalanceTransaction objects from Stripe api | [optional] [default to 120s] +**ApiKey** | **interface{}** | | +**PageSize** | Pointer to **interface{}** | Number of BalanceTransaction to fetch at each polling interval. | [optional] [default to 10] ## Methods ### NewStripeConfig -`func NewStripeConfig(apiKey string, ) *StripeConfig` +`func NewStripeConfig(apiKey interface{}, ) *StripeConfig` NewStripeConfig instantiates a new StripeConfig object This constructor will assign default values to properties that have it defined, @@ -29,20 +29,20 @@ but it doesn't guarantee that properties required by API are set ### GetPollingPeriod -`func (o *StripeConfig) GetPollingPeriod() string` +`func (o *StripeConfig) GetPollingPeriod() interface{}` GetPollingPeriod returns the PollingPeriod field if non-nil, zero value otherwise. ### GetPollingPeriodOk -`func (o *StripeConfig) GetPollingPeriodOk() (*string, bool)` +`func (o *StripeConfig) GetPollingPeriodOk() (*interface{}, bool)` GetPollingPeriodOk returns a tuple with the PollingPeriod field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPollingPeriod -`func (o *StripeConfig) SetPollingPeriod(v string)` +`func (o *StripeConfig) SetPollingPeriod(v interface{})` SetPollingPeriod sets PollingPeriod field to given value. @@ -52,42 +52,62 @@ SetPollingPeriod sets PollingPeriod field to given value. HasPollingPeriod returns a boolean if a field has been set. +### SetPollingPeriodNil + +`func (o *StripeConfig) SetPollingPeriodNil(b bool)` + + SetPollingPeriodNil sets the value for PollingPeriod to be an explicit nil + +### UnsetPollingPeriod +`func (o *StripeConfig) UnsetPollingPeriod()` + +UnsetPollingPeriod ensures that no value is present for PollingPeriod, not even an explicit nil ### GetApiKey -`func (o *StripeConfig) GetApiKey() string` +`func (o *StripeConfig) GetApiKey() interface{}` GetApiKey returns the ApiKey field if non-nil, zero value otherwise. ### GetApiKeyOk -`func (o *StripeConfig) GetApiKeyOk() (*string, bool)` +`func (o *StripeConfig) GetApiKeyOk() (*interface{}, bool)` GetApiKeyOk returns a tuple with the ApiKey field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetApiKey -`func (o *StripeConfig) SetApiKey(v string)` +`func (o *StripeConfig) SetApiKey(v interface{})` SetApiKey sets ApiKey field to given value. +### SetApiKeyNil + +`func (o *StripeConfig) SetApiKeyNil(b bool)` + + SetApiKeyNil sets the value for ApiKey to be an explicit nil + +### UnsetApiKey +`func (o *StripeConfig) UnsetApiKey()` + +UnsetApiKey ensures that no value is present for ApiKey, not even an explicit nil ### GetPageSize -`func (o *StripeConfig) GetPageSize() float32` +`func (o *StripeConfig) GetPageSize() interface{}` GetPageSize returns the PageSize field if non-nil, zero value otherwise. ### GetPageSizeOk -`func (o *StripeConfig) GetPageSizeOk() (*float32, bool)` +`func (o *StripeConfig) GetPageSizeOk() (*interface{}, bool)` GetPageSizeOk returns a tuple with the PageSize field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetPageSize -`func (o *StripeConfig) SetPageSize(v float32)` +`func (o *StripeConfig) SetPageSize(v interface{})` SetPageSize sets PageSize field to given value. @@ -97,6 +117,16 @@ SetPageSize sets PageSize field to given value. HasPageSize returns a boolean if a field has been set. +### SetPageSizeNil + +`func (o *StripeConfig) SetPageSizeNil(b bool)` + + SetPageSizeNil sets the value for PageSize to be an explicit nil + +### UnsetPageSize +`func (o *StripeConfig) UnsetPageSize()` + +UnsetPageSize ensures that no value is present for PageSize, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/client/docs/StripeTask.md b/client/docs/StripeTask.md index 55bc6ccb..56cfee01 100644 --- a/client/docs/StripeTask.md +++ b/client/docs/StripeTask.md @@ -4,11 +4,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**OldestId** | Pointer to **string** | The id of the oldest BalanceTransaction fetched from stripe for this account | [optional] -**OldestDate** | Pointer to **time.Time** | The creation date of the oldest BalanceTransaction fetched from stripe for this account | [optional] -**MoreRecentId** | Pointer to **string** | The id of the more recent BalanceTransaction fetched from stripe for this account | [optional] -**MoreRecentDate** | Pointer to **time.Time** | The creation date of the more recent BalanceTransaction fetched from stripe for this account | [optional] -**NoMoreHistory** | Pointer to **bool** | Indicate that there no more history to fetch on this account | [optional] +**OldestId** | Pointer to **interface{}** | The id of the oldest BalanceTransaction fetched from stripe for this account | [optional] +**OldestDate** | Pointer to **interface{}** | The creation date of the oldest BalanceTransaction fetched from stripe for this account | [optional] +**MoreRecentId** | Pointer to **interface{}** | The id of the more recent BalanceTransaction fetched from stripe for this account | [optional] +**MoreRecentDate** | Pointer to **interface{}** | The creation date of the more recent BalanceTransaction fetched from stripe for this account | [optional] +**NoMoreHistory** | Pointer to **interface{}** | | [optional] ## Methods @@ -31,20 +31,20 @@ but it doesn't guarantee that properties required by API are set ### GetOldestId -`func (o *StripeTask) GetOldestId() string` +`func (o *StripeTask) GetOldestId() interface{}` GetOldestId returns the OldestId field if non-nil, zero value otherwise. ### GetOldestIdOk -`func (o *StripeTask) GetOldestIdOk() (*string, bool)` +`func (o *StripeTask) GetOldestIdOk() (*interface{}, bool)` GetOldestIdOk returns a tuple with the OldestId field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetOldestId -`func (o *StripeTask) SetOldestId(v string)` +`func (o *StripeTask) SetOldestId(v interface{})` SetOldestId sets OldestId field to given value. @@ -54,22 +54,32 @@ SetOldestId sets OldestId field to given value. HasOldestId returns a boolean if a field has been set. +### SetOldestIdNil + +`func (o *StripeTask) SetOldestIdNil(b bool)` + + SetOldestIdNil sets the value for OldestId to be an explicit nil + +### UnsetOldestId +`func (o *StripeTask) UnsetOldestId()` + +UnsetOldestId ensures that no value is present for OldestId, not even an explicit nil ### GetOldestDate -`func (o *StripeTask) GetOldestDate() time.Time` +`func (o *StripeTask) GetOldestDate() interface{}` GetOldestDate returns the OldestDate field if non-nil, zero value otherwise. ### GetOldestDateOk -`func (o *StripeTask) GetOldestDateOk() (*time.Time, bool)` +`func (o *StripeTask) GetOldestDateOk() (*interface{}, bool)` GetOldestDateOk returns a tuple with the OldestDate field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetOldestDate -`func (o *StripeTask) SetOldestDate(v time.Time)` +`func (o *StripeTask) SetOldestDate(v interface{})` SetOldestDate sets OldestDate field to given value. @@ -79,22 +89,32 @@ SetOldestDate sets OldestDate field to given value. HasOldestDate returns a boolean if a field has been set. +### SetOldestDateNil + +`func (o *StripeTask) SetOldestDateNil(b bool)` + + SetOldestDateNil sets the value for OldestDate to be an explicit nil + +### UnsetOldestDate +`func (o *StripeTask) UnsetOldestDate()` + +UnsetOldestDate ensures that no value is present for OldestDate, not even an explicit nil ### GetMoreRecentId -`func (o *StripeTask) GetMoreRecentId() string` +`func (o *StripeTask) GetMoreRecentId() interface{}` GetMoreRecentId returns the MoreRecentId field if non-nil, zero value otherwise. ### GetMoreRecentIdOk -`func (o *StripeTask) GetMoreRecentIdOk() (*string, bool)` +`func (o *StripeTask) GetMoreRecentIdOk() (*interface{}, bool)` GetMoreRecentIdOk returns a tuple with the MoreRecentId field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetMoreRecentId -`func (o *StripeTask) SetMoreRecentId(v string)` +`func (o *StripeTask) SetMoreRecentId(v interface{})` SetMoreRecentId sets MoreRecentId field to given value. @@ -104,22 +124,32 @@ SetMoreRecentId sets MoreRecentId field to given value. HasMoreRecentId returns a boolean if a field has been set. +### SetMoreRecentIdNil + +`func (o *StripeTask) SetMoreRecentIdNil(b bool)` + + SetMoreRecentIdNil sets the value for MoreRecentId to be an explicit nil + +### UnsetMoreRecentId +`func (o *StripeTask) UnsetMoreRecentId()` + +UnsetMoreRecentId ensures that no value is present for MoreRecentId, not even an explicit nil ### GetMoreRecentDate -`func (o *StripeTask) GetMoreRecentDate() time.Time` +`func (o *StripeTask) GetMoreRecentDate() interface{}` GetMoreRecentDate returns the MoreRecentDate field if non-nil, zero value otherwise. ### GetMoreRecentDateOk -`func (o *StripeTask) GetMoreRecentDateOk() (*time.Time, bool)` +`func (o *StripeTask) GetMoreRecentDateOk() (*interface{}, bool)` GetMoreRecentDateOk returns a tuple with the MoreRecentDate field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetMoreRecentDate -`func (o *StripeTask) SetMoreRecentDate(v time.Time)` +`func (o *StripeTask) SetMoreRecentDate(v interface{})` SetMoreRecentDate sets MoreRecentDate field to given value. @@ -129,22 +159,32 @@ SetMoreRecentDate sets MoreRecentDate field to given value. HasMoreRecentDate returns a boolean if a field has been set. +### SetMoreRecentDateNil + +`func (o *StripeTask) SetMoreRecentDateNil(b bool)` + + SetMoreRecentDateNil sets the value for MoreRecentDate to be an explicit nil + +### UnsetMoreRecentDate +`func (o *StripeTask) UnsetMoreRecentDate()` + +UnsetMoreRecentDate ensures that no value is present for MoreRecentDate, not even an explicit nil ### GetNoMoreHistory -`func (o *StripeTask) GetNoMoreHistory() bool` +`func (o *StripeTask) GetNoMoreHistory() interface{}` GetNoMoreHistory returns the NoMoreHistory field if non-nil, zero value otherwise. ### GetNoMoreHistoryOk -`func (o *StripeTask) GetNoMoreHistoryOk() (*bool, bool)` +`func (o *StripeTask) GetNoMoreHistoryOk() (*interface{}, bool)` GetNoMoreHistoryOk returns a tuple with the NoMoreHistory field if it's non-nil, zero value otherwise and a boolean to check if the value has been set. ### SetNoMoreHistory -`func (o *StripeTask) SetNoMoreHistory(v bool)` +`func (o *StripeTask) SetNoMoreHistory(v interface{})` SetNoMoreHistory sets NoMoreHistory field to given value. @@ -154,6 +194,16 @@ SetNoMoreHistory sets NoMoreHistory field to given value. HasNoMoreHistory returns a boolean if a field has been set. +### SetNoMoreHistoryNil + +`func (o *StripeTask) SetNoMoreHistoryNil(b bool)` + + SetNoMoreHistoryNil sets the value for NoMoreHistory to be an explicit nil + +### UnsetNoMoreHistory +`func (o *StripeTask) UnsetNoMoreHistory()` + +UnsetNoMoreHistory ensures that no value is present for NoMoreHistory, not even an explicit nil [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/client/docs/WiseConfig.md b/client/docs/WiseConfig.md new file mode 100644 index 00000000..6519b1e8 --- /dev/null +++ b/client/docs/WiseConfig.md @@ -0,0 +1,61 @@ +# WiseConfig + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ApiKey** | **interface{}** | | + +## Methods + +### NewWiseConfig + +`func NewWiseConfig(apiKey interface{}, ) *WiseConfig` + +NewWiseConfig instantiates a new WiseConfig object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewWiseConfigWithDefaults + +`func NewWiseConfigWithDefaults() *WiseConfig` + +NewWiseConfigWithDefaults instantiates a new WiseConfig object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + +### GetApiKey + +`func (o *WiseConfig) GetApiKey() interface{}` + +GetApiKey returns the ApiKey field if non-nil, zero value otherwise. + +### GetApiKeyOk + +`func (o *WiseConfig) GetApiKeyOk() (*interface{}, bool)` + +GetApiKeyOk returns a tuple with the ApiKey field if it's non-nil, zero value otherwise +and a boolean to check if the value has been set. + +### SetApiKey + +`func (o *WiseConfig) SetApiKey(v interface{})` + +SetApiKey sets ApiKey field to given value. + + +### SetApiKeyNil + +`func (o *WiseConfig) SetApiKeyNil(b bool)` + + SetApiKeyNil sets the value for ApiKey to be an explicit nil + +### UnsetApiKey +`func (o *WiseConfig) UnsetApiKey()` + +UnsetApiKey ensures that no value is present for ApiKey, not even an explicit nil + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/client/git_push.sh b/client/git_push.sh index ffbbf98d..983458ae 100644 --- a/client/git_push.sh +++ b/client/git_push.sh @@ -14,12 +14,12 @@ if [ "$git_host" = "" ]; then fi if [ "$git_user_id" = "" ]; then - git_user_id="numary" + git_user_id="formancehq" echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" fi if [ "$git_repo_id" = "" ]; then - git_repo_id="payments" + git_repo_id="payments/client" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/client/go.mod b/client/go.mod index 60048988..56733569 100644 --- a/client/go.mod +++ b/client/go.mod @@ -3,5 +3,4 @@ module github.com/formancehq/payments/client go 1.13 require ( - golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 ) diff --git a/client/go.sum b/client/go.sum index 734252e6..c966c8dd 100644 --- a/client/go.sum +++ b/client/go.sum @@ -4,8 +4,6 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/client/model_banking_circle_config.go b/client/model_banking_circle_config.go new file mode 100644 index 00000000..c26605de --- /dev/null +++ b/client/model_banking_circle_config.go @@ -0,0 +1,214 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the BankingCircleConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BankingCircleConfig{} + +// BankingCircleConfig struct for BankingCircleConfig +type BankingCircleConfig struct { + Username interface{} `json:"username"` + Password interface{} `json:"password"` + Endpoint interface{} `json:"endpoint"` + AuthorizationEndpoint interface{} `json:"authorizationEndpoint"` +} + +// NewBankingCircleConfig instantiates a new BankingCircleConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewBankingCircleConfig(username interface{}, password interface{}, endpoint interface{}, authorizationEndpoint interface{}) *BankingCircleConfig { + this := BankingCircleConfig{} + this.Username = username + this.Password = password + this.Endpoint = endpoint + this.AuthorizationEndpoint = authorizationEndpoint + return &this +} + +// NewBankingCircleConfigWithDefaults instantiates a new BankingCircleConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBankingCircleConfigWithDefaults() *BankingCircleConfig { + this := BankingCircleConfig{} + return &this +} + +// GetUsername returns the Username field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *BankingCircleConfig) GetUsername() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.Username +} + +// GetUsernameOk returns a tuple with the Username field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BankingCircleConfig) GetUsernameOk() (*interface{}, bool) { + if o == nil || isNil(o.Username) { + return nil, false + } + return &o.Username, true +} + +// SetUsername sets field value +func (o *BankingCircleConfig) SetUsername(v interface{}) { + o.Username = v +} + +// GetPassword returns the Password field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *BankingCircleConfig) GetPassword() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.Password +} + +// GetPasswordOk returns a tuple with the Password field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BankingCircleConfig) GetPasswordOk() (*interface{}, bool) { + if o == nil || isNil(o.Password) { + return nil, false + } + return &o.Password, true +} + +// SetPassword sets field value +func (o *BankingCircleConfig) SetPassword(v interface{}) { + o.Password = v +} + +// GetEndpoint returns the Endpoint field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *BankingCircleConfig) GetEndpoint() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BankingCircleConfig) GetEndpointOk() (*interface{}, bool) { + if o == nil || isNil(o.Endpoint) { + return nil, false + } + return &o.Endpoint, true +} + +// SetEndpoint sets field value +func (o *BankingCircleConfig) SetEndpoint(v interface{}) { + o.Endpoint = v +} + +// GetAuthorizationEndpoint returns the AuthorizationEndpoint field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *BankingCircleConfig) GetAuthorizationEndpoint() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.AuthorizationEndpoint +} + +// GetAuthorizationEndpointOk returns a tuple with the AuthorizationEndpoint field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *BankingCircleConfig) GetAuthorizationEndpointOk() (*interface{}, bool) { + if o == nil || isNil(o.AuthorizationEndpoint) { + return nil, false + } + return &o.AuthorizationEndpoint, true +} + +// SetAuthorizationEndpoint sets field value +func (o *BankingCircleConfig) SetAuthorizationEndpoint(v interface{}) { + o.AuthorizationEndpoint = v +} + +func (o BankingCircleConfig) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o BankingCircleConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Username != nil { + toSerialize["username"] = o.Username + } + if o.Password != nil { + toSerialize["password"] = o.Password + } + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + if o.AuthorizationEndpoint != nil { + toSerialize["authorizationEndpoint"] = o.AuthorizationEndpoint + } + return toSerialize, nil +} + +type NullableBankingCircleConfig struct { + value *BankingCircleConfig + isSet bool +} + +func (v NullableBankingCircleConfig) Get() *BankingCircleConfig { + return v.value +} + +func (v *NullableBankingCircleConfig) Set(val *BankingCircleConfig) { + v.value = val + v.isSet = true +} + +func (v NullableBankingCircleConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableBankingCircleConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBankingCircleConfig(val *BankingCircleConfig) *NullableBankingCircleConfig { + return &NullableBankingCircleConfig{value: val, isSet: true} +} + +func (v NullableBankingCircleConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBankingCircleConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/client/model_connector_base_info.go b/client/model_connector_base_info.go new file mode 100644 index 00000000..6ba6f604 --- /dev/null +++ b/client/model_connector_base_info.go @@ -0,0 +1,164 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the ConnectorBaseInfo type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConnectorBaseInfo{} + +// ConnectorBaseInfo struct for ConnectorBaseInfo +type ConnectorBaseInfo struct { + Provider interface{} `json:"provider,omitempty"` + Disabled interface{} `json:"disabled,omitempty"` +} + +// NewConnectorBaseInfo instantiates a new ConnectorBaseInfo object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConnectorBaseInfo() *ConnectorBaseInfo { + this := ConnectorBaseInfo{} + return &this +} + +// NewConnectorBaseInfoWithDefaults instantiates a new ConnectorBaseInfo object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConnectorBaseInfoWithDefaults() *ConnectorBaseInfo { + this := ConnectorBaseInfo{} + return &this +} + +// GetProvider returns the Provider field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ConnectorBaseInfo) GetProvider() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.Provider +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConnectorBaseInfo) GetProviderOk() (*interface{}, bool) { + if o == nil || isNil(o.Provider) { + return nil, false + } + return &o.Provider, true +} + +// HasProvider returns a boolean if a field has been set. +func (o *ConnectorBaseInfo) HasProvider() bool { + if o != nil && isNil(o.Provider) { + return true + } + + return false +} + +// SetProvider gets a reference to the given interface{} and assigns it to the Provider field. +func (o *ConnectorBaseInfo) SetProvider(v interface{}) { + o.Provider = v +} + +// GetDisabled returns the Disabled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ConnectorBaseInfo) GetDisabled() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.Disabled +} + +// GetDisabledOk returns a tuple with the Disabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ConnectorBaseInfo) GetDisabledOk() (*interface{}, bool) { + if o == nil || isNil(o.Disabled) { + return nil, false + } + return &o.Disabled, true +} + +// HasDisabled returns a boolean if a field has been set. +func (o *ConnectorBaseInfo) HasDisabled() bool { + if o != nil && isNil(o.Disabled) { + return true + } + + return false +} + +// SetDisabled gets a reference to the given interface{} and assigns it to the Disabled field. +func (o *ConnectorBaseInfo) SetDisabled(v interface{}) { + o.Disabled = v +} + +func (o ConnectorBaseInfo) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ConnectorBaseInfo) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Provider != nil { + toSerialize["provider"] = o.Provider + } + if o.Disabled != nil { + toSerialize["disabled"] = o.Disabled + } + return toSerialize, nil +} + +type NullableConnectorBaseInfo struct { + value *ConnectorBaseInfo + isSet bool +} + +func (v NullableConnectorBaseInfo) Get() *ConnectorBaseInfo { + return v.value +} + +func (v *NullableConnectorBaseInfo) Set(val *ConnectorBaseInfo) { + v.value = val + v.isSet = true +} + +func (v NullableConnectorBaseInfo) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectorBaseInfo) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectorBaseInfo(val *ConnectorBaseInfo) *NullableConnectorBaseInfo { + return &NullableConnectorBaseInfo{value: val, isSet: true} +} + +func (v NullableConnectorBaseInfo) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectorBaseInfo) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/client/model_currency_cloud_config.go b/client/model_currency_cloud_config.go new file mode 100644 index 00000000..ec96b777 --- /dev/null +++ b/client/model_currency_cloud_config.go @@ -0,0 +1,229 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the CurrencyCloudConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CurrencyCloudConfig{} + +// CurrencyCloudConfig struct for CurrencyCloudConfig +type CurrencyCloudConfig struct { + ApiKey interface{} `json:"apiKey"` + // Username of the API Key holder + LoginID interface{} `json:"loginID"` + // The frequency at which the connector will fetch transactions + PollingPeriod interface{} `json:"pollingPeriod,omitempty"` + // The endpoint to use for the API. Defaults to https://devapi.currencycloud.com + Endpoint interface{} `json:"endpoint,omitempty"` +} + +// NewCurrencyCloudConfig instantiates a new CurrencyCloudConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewCurrencyCloudConfig(apiKey interface{}, loginID interface{}) *CurrencyCloudConfig { + this := CurrencyCloudConfig{} + this.ApiKey = apiKey + this.LoginID = loginID + return &this +} + +// NewCurrencyCloudConfigWithDefaults instantiates a new CurrencyCloudConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewCurrencyCloudConfigWithDefaults() *CurrencyCloudConfig { + this := CurrencyCloudConfig{} + return &this +} + +// GetApiKey returns the ApiKey field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *CurrencyCloudConfig) GetApiKey() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.ApiKey +} + +// GetApiKeyOk returns a tuple with the ApiKey field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CurrencyCloudConfig) GetApiKeyOk() (*interface{}, bool) { + if o == nil || isNil(o.ApiKey) { + return nil, false + } + return &o.ApiKey, true +} + +// SetApiKey sets field value +func (o *CurrencyCloudConfig) SetApiKey(v interface{}) { + o.ApiKey = v +} + +// GetLoginID returns the LoginID field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *CurrencyCloudConfig) GetLoginID() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.LoginID +} + +// GetLoginIDOk returns a tuple with the LoginID field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CurrencyCloudConfig) GetLoginIDOk() (*interface{}, bool) { + if o == nil || isNil(o.LoginID) { + return nil, false + } + return &o.LoginID, true +} + +// SetLoginID sets field value +func (o *CurrencyCloudConfig) SetLoginID(v interface{}) { + o.LoginID = v +} + +// GetPollingPeriod returns the PollingPeriod field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CurrencyCloudConfig) GetPollingPeriod() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.PollingPeriod +} + +// GetPollingPeriodOk returns a tuple with the PollingPeriod field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CurrencyCloudConfig) GetPollingPeriodOk() (*interface{}, bool) { + if o == nil || isNil(o.PollingPeriod) { + return nil, false + } + return &o.PollingPeriod, true +} + +// HasPollingPeriod returns a boolean if a field has been set. +func (o *CurrencyCloudConfig) HasPollingPeriod() bool { + if o != nil && isNil(o.PollingPeriod) { + return true + } + + return false +} + +// SetPollingPeriod gets a reference to the given interface{} and assigns it to the PollingPeriod field. +func (o *CurrencyCloudConfig) SetPollingPeriod(v interface{}) { + o.PollingPeriod = v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *CurrencyCloudConfig) GetEndpoint() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *CurrencyCloudConfig) GetEndpointOk() (*interface{}, bool) { + if o == nil || isNil(o.Endpoint) { + return nil, false + } + return &o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *CurrencyCloudConfig) HasEndpoint() bool { + if o != nil && isNil(o.Endpoint) { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given interface{} and assigns it to the Endpoint field. +func (o *CurrencyCloudConfig) SetEndpoint(v interface{}) { + o.Endpoint = v +} + +func (o CurrencyCloudConfig) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CurrencyCloudConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.ApiKey != nil { + toSerialize["apiKey"] = o.ApiKey + } + if o.LoginID != nil { + toSerialize["loginID"] = o.LoginID + } + if o.PollingPeriod != nil { + toSerialize["pollingPeriod"] = o.PollingPeriod + } + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + return toSerialize, nil +} + +type NullableCurrencyCloudConfig struct { + value *CurrencyCloudConfig + isSet bool +} + +func (v NullableCurrencyCloudConfig) Get() *CurrencyCloudConfig { + return v.value +} + +func (v *NullableCurrencyCloudConfig) Set(val *CurrencyCloudConfig) { + v.value = val + v.isSet = true +} + +func (v NullableCurrencyCloudConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableCurrencyCloudConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCurrencyCloudConfig(val *CurrencyCloudConfig) *NullableCurrencyCloudConfig { + return &NullableCurrencyCloudConfig{value: val, isSet: true} +} + +func (v NullableCurrencyCloudConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCurrencyCloudConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/client/model_dummy_pay_config.go b/client/model_dummy_pay_config.go new file mode 100644 index 00000000..dd13bcbc --- /dev/null +++ b/client/model_dummy_pay_config.go @@ -0,0 +1,197 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the DummyPayConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DummyPayConfig{} + +// DummyPayConfig struct for DummyPayConfig +type DummyPayConfig struct { + // The frequency at which the connector will try to fetch new payment objects from the directory + FilePollingPeriod interface{} `json:"filePollingPeriod,omitempty"` + // The frequency at which the connector will create new payment objects in the directory + FileGenerationPeriod interface{} `json:"fileGenerationPeriod,omitempty"` + Directory interface{} `json:"directory"` +} + +// NewDummyPayConfig instantiates a new DummyPayConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewDummyPayConfig(directory interface{}) *DummyPayConfig { + this := DummyPayConfig{} + this.Directory = directory + return &this +} + +// NewDummyPayConfigWithDefaults instantiates a new DummyPayConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewDummyPayConfigWithDefaults() *DummyPayConfig { + this := DummyPayConfig{} + return &this +} + +// GetFilePollingPeriod returns the FilePollingPeriod field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DummyPayConfig) GetFilePollingPeriod() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.FilePollingPeriod +} + +// GetFilePollingPeriodOk returns a tuple with the FilePollingPeriod field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DummyPayConfig) GetFilePollingPeriodOk() (*interface{}, bool) { + if o == nil || isNil(o.FilePollingPeriod) { + return nil, false + } + return &o.FilePollingPeriod, true +} + +// HasFilePollingPeriod returns a boolean if a field has been set. +func (o *DummyPayConfig) HasFilePollingPeriod() bool { + if o != nil && isNil(o.FilePollingPeriod) { + return true + } + + return false +} + +// SetFilePollingPeriod gets a reference to the given interface{} and assigns it to the FilePollingPeriod field. +func (o *DummyPayConfig) SetFilePollingPeriod(v interface{}) { + o.FilePollingPeriod = v +} + +// GetFileGenerationPeriod returns the FileGenerationPeriod field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DummyPayConfig) GetFileGenerationPeriod() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.FileGenerationPeriod +} + +// GetFileGenerationPeriodOk returns a tuple with the FileGenerationPeriod field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DummyPayConfig) GetFileGenerationPeriodOk() (*interface{}, bool) { + if o == nil || isNil(o.FileGenerationPeriod) { + return nil, false + } + return &o.FileGenerationPeriod, true +} + +// HasFileGenerationPeriod returns a boolean if a field has been set. +func (o *DummyPayConfig) HasFileGenerationPeriod() bool { + if o != nil && isNil(o.FileGenerationPeriod) { + return true + } + + return false +} + +// SetFileGenerationPeriod gets a reference to the given interface{} and assigns it to the FileGenerationPeriod field. +func (o *DummyPayConfig) SetFileGenerationPeriod(v interface{}) { + o.FileGenerationPeriod = v +} + +// GetDirectory returns the Directory field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *DummyPayConfig) GetDirectory() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.Directory +} + +// GetDirectoryOk returns a tuple with the Directory field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *DummyPayConfig) GetDirectoryOk() (*interface{}, bool) { + if o == nil || isNil(o.Directory) { + return nil, false + } + return &o.Directory, true +} + +// SetDirectory sets field value +func (o *DummyPayConfig) SetDirectory(v interface{}) { + o.Directory = v +} + +func (o DummyPayConfig) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DummyPayConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.FilePollingPeriod != nil { + toSerialize["filePollingPeriod"] = o.FilePollingPeriod + } + if o.FileGenerationPeriod != nil { + toSerialize["fileGenerationPeriod"] = o.FileGenerationPeriod + } + if o.Directory != nil { + toSerialize["directory"] = o.Directory + } + return toSerialize, nil +} + +type NullableDummyPayConfig struct { + value *DummyPayConfig + isSet bool +} + +func (v NullableDummyPayConfig) Get() *DummyPayConfig { + return v.value +} + +func (v *NullableDummyPayConfig) Set(val *DummyPayConfig) { + v.value = val + v.isSet = true +} + +func (v NullableDummyPayConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableDummyPayConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDummyPayConfig(val *DummyPayConfig) *NullableDummyPayConfig { + return &NullableDummyPayConfig{value: val, isSet: true} +} + +func (v NullableDummyPayConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDummyPayConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/client/model_get_payment_response.go b/client/model_get_payment_response.go index 4f3d71f4..18de8c87 100644 --- a/client/model_get_payment_response.go +++ b/client/model_get_payment_response.go @@ -14,6 +14,9 @@ import ( "encoding/json" ) +// checks if the GetPaymentResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetPaymentResponse{} + // GetPaymentResponse struct for GetPaymentResponse type GetPaymentResponse struct { Data Payment `json:"data"` @@ -62,13 +65,19 @@ func (o *GetPaymentResponse) SetData(v Payment) { } func (o GetPaymentResponse) MarshalJSON() ([]byte, error) { - toSerialize := map[string]interface{}{} - if true { - toSerialize["data"] = o.Data + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err } return json.Marshal(toSerialize) } +func (o GetPaymentResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["data"] = o.Data + return toSerialize, nil +} + type NullableGetPaymentResponse struct { value *GetPaymentResponse isSet bool @@ -104,3 +113,5 @@ func (v *NullableGetPaymentResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/client/model_list_connectors_response.go b/client/model_list_connectors_response.go new file mode 100644 index 00000000..6fdf9961 --- /dev/null +++ b/client/model_list_connectors_response.go @@ -0,0 +1,121 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the ListConnectorsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListConnectorsResponse{} + +// ListConnectorsResponse struct for ListConnectorsResponse +type ListConnectorsResponse struct { + Data interface{} `json:"data"` +} + +// NewListConnectorsResponse instantiates a new ListConnectorsResponse object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewListConnectorsResponse(data interface{}) *ListConnectorsResponse { + this := ListConnectorsResponse{} + this.Data = data + return &this +} + +// NewListConnectorsResponseWithDefaults instantiates a new ListConnectorsResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewListConnectorsResponseWithDefaults() *ListConnectorsResponse { + this := ListConnectorsResponse{} + return &this +} + +// GetData returns the Data field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *ListConnectorsResponse) GetData() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ListConnectorsResponse) GetDataOk() (*interface{}, bool) { + if o == nil || isNil(o.Data) { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value +func (o *ListConnectorsResponse) SetData(v interface{}) { + o.Data = v +} + +func (o ListConnectorsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListConnectorsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Data != nil { + toSerialize["data"] = o.Data + } + return toSerialize, nil +} + +type NullableListConnectorsResponse struct { + value *ListConnectorsResponse + isSet bool +} + +func (v NullableListConnectorsResponse) Get() *ListConnectorsResponse { + return v.value +} + +func (v *NullableListConnectorsResponse) Set(val *ListConnectorsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListConnectorsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListConnectorsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListConnectorsResponse(val *ListConnectorsResponse) *NullableListConnectorsResponse { + return &NullableListConnectorsResponse{value: val, isSet: true} +} + +func (v NullableListConnectorsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListConnectorsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/client/model_list_payments_response.go b/client/model_list_payments_response.go index f32d7f48..bd5e2e43 100644 --- a/client/model_list_payments_response.go +++ b/client/model_list_payments_response.go @@ -14,16 +14,19 @@ import ( "encoding/json" ) +// checks if the ListPaymentsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListPaymentsResponse{} + // ListPaymentsResponse struct for ListPaymentsResponse type ListPaymentsResponse struct { - Data []Payment `json:"data"` + Data interface{} `json:"data"` } // NewListPaymentsResponse instantiates a new ListPaymentsResponse object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewListPaymentsResponse(data []Payment) *ListPaymentsResponse { +func NewListPaymentsResponse(data interface{}) *ListPaymentsResponse { this := ListPaymentsResponse{} this.Data = data return &this @@ -38,9 +41,10 @@ func NewListPaymentsResponseWithDefaults() *ListPaymentsResponse { } // GetData returns the Data field value -func (o *ListPaymentsResponse) GetData() []Payment { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *ListPaymentsResponse) GetData() interface{} { if o == nil { - var ret []Payment + var ret interface{} return ret } @@ -49,24 +53,33 @@ func (o *ListPaymentsResponse) GetData() []Payment { // GetDataOk returns a tuple with the Data field value // and a boolean to check if the value has been set. -func (o *ListPaymentsResponse) GetDataOk() ([]Payment, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ListPaymentsResponse) GetDataOk() (*interface{}, bool) { + if o == nil || isNil(o.Data) { return nil, false } - return o.Data, true + return &o.Data, true } // SetData sets field value -func (o *ListPaymentsResponse) SetData(v []Payment) { +func (o *ListPaymentsResponse) SetData(v interface{}) { o.Data = v } func (o ListPaymentsResponse) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ListPaymentsResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { + if o.Data != nil { toSerialize["data"] = o.Data } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableListPaymentsResponse struct { @@ -104,3 +117,5 @@ func (v *NullableListPaymentsResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/client/model_modulr_config.go b/client/model_modulr_config.go new file mode 100644 index 00000000..4a361dd6 --- /dev/null +++ b/client/model_modulr_config.go @@ -0,0 +1,189 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the ModulrConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ModulrConfig{} + +// ModulrConfig struct for ModulrConfig +type ModulrConfig struct { + ApiKey interface{} `json:"apiKey"` + ApiSecret interface{} `json:"apiSecret"` + Endpoint interface{} `json:"endpoint,omitempty"` +} + +// NewModulrConfig instantiates a new ModulrConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewModulrConfig(apiKey interface{}, apiSecret interface{}) *ModulrConfig { + this := ModulrConfig{} + this.ApiKey = apiKey + this.ApiSecret = apiSecret + return &this +} + +// NewModulrConfigWithDefaults instantiates a new ModulrConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewModulrConfigWithDefaults() *ModulrConfig { + this := ModulrConfig{} + return &this +} + +// GetApiKey returns the ApiKey field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *ModulrConfig) GetApiKey() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.ApiKey +} + +// GetApiKeyOk returns a tuple with the ApiKey field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ModulrConfig) GetApiKeyOk() (*interface{}, bool) { + if o == nil || isNil(o.ApiKey) { + return nil, false + } + return &o.ApiKey, true +} + +// SetApiKey sets field value +func (o *ModulrConfig) SetApiKey(v interface{}) { + o.ApiKey = v +} + +// GetApiSecret returns the ApiSecret field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *ModulrConfig) GetApiSecret() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.ApiSecret +} + +// GetApiSecretOk returns a tuple with the ApiSecret field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ModulrConfig) GetApiSecretOk() (*interface{}, bool) { + if o == nil || isNil(o.ApiSecret) { + return nil, false + } + return &o.ApiSecret, true +} + +// SetApiSecret sets field value +func (o *ModulrConfig) SetApiSecret(v interface{}) { + o.ApiSecret = v +} + +// GetEndpoint returns the Endpoint field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *ModulrConfig) GetEndpoint() interface{} { + if o == nil { + var ret interface{} + return ret + } + return o.Endpoint +} + +// GetEndpointOk returns a tuple with the Endpoint field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *ModulrConfig) GetEndpointOk() (*interface{}, bool) { + if o == nil || isNil(o.Endpoint) { + return nil, false + } + return &o.Endpoint, true +} + +// HasEndpoint returns a boolean if a field has been set. +func (o *ModulrConfig) HasEndpoint() bool { + if o != nil && isNil(o.Endpoint) { + return true + } + + return false +} + +// SetEndpoint gets a reference to the given interface{} and assigns it to the Endpoint field. +func (o *ModulrConfig) SetEndpoint(v interface{}) { + o.Endpoint = v +} + +func (o ModulrConfig) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ModulrConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.ApiKey != nil { + toSerialize["apiKey"] = o.ApiKey + } + if o.ApiSecret != nil { + toSerialize["apiSecret"] = o.ApiSecret + } + if o.Endpoint != nil { + toSerialize["endpoint"] = o.Endpoint + } + return toSerialize, nil +} + +type NullableModulrConfig struct { + value *ModulrConfig + isSet bool +} + +func (v NullableModulrConfig) Get() *ModulrConfig { + return v.value +} + +func (v *NullableModulrConfig) Set(val *ModulrConfig) { + v.value = val + v.isSet = true +} + +func (v NullableModulrConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableModulrConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableModulrConfig(val *ModulrConfig) *NullableModulrConfig { + return &NullableModulrConfig{value: val, isSet: true} +} + +func (v NullableModulrConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableModulrConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/client/model_payment.go b/client/model_payment.go index b419e0d0..a151d5b4 100644 --- a/client/model_payment.go +++ b/client/model_payment.go @@ -12,28 +12,30 @@ package client import ( "encoding/json" - "time" ) +// checks if the Payment type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Payment{} + // Payment struct for Payment type Payment struct { - Provider string `json:"provider"` - Reference *string `json:"reference,omitempty"` - Scheme string `json:"scheme"` - Status string `json:"status"` - Type string `json:"type"` - Id string `json:"id"` - Amount int32 `json:"amount"` - Asset string `json:"asset"` - Date time.Time `json:"date"` - Raw interface{} `json:"raw,omitempty"` + Provider interface{} `json:"provider"` + Reference interface{} `json:"reference,omitempty"` + Scheme interface{} `json:"scheme"` + Status interface{} `json:"status"` + Type interface{} `json:"type"` + Id interface{} `json:"id"` + Amount interface{} `json:"amount"` + Asset interface{} `json:"asset"` + Date interface{} `json:"date"` + Raw interface{} `json:"raw,omitempty"` } // NewPayment instantiates a new Payment object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewPayment(provider string, scheme string, status string, type_ string, id string, amount int32, asset string, date time.Time) *Payment { +func NewPayment(provider interface{}, scheme interface{}, status interface{}, type_ interface{}, id interface{}, amount interface{}, asset interface{}, date interface{}) *Payment { this := Payment{} this.Provider = provider this.Scheme = scheme @@ -55,9 +57,10 @@ func NewPaymentWithDefaults() *Payment { } // GetProvider returns the Provider field value -func (o *Payment) GetProvider() string { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetProvider() interface{} { if o == nil { - var ret string + var ret interface{} return ret } @@ -66,54 +69,57 @@ func (o *Payment) GetProvider() string { // GetProviderOk returns a tuple with the Provider field value // and a boolean to check if the value has been set. -func (o *Payment) GetProviderOk() (*string, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetProviderOk() (*interface{}, bool) { + if o == nil || isNil(o.Provider) { return nil, false } return &o.Provider, true } // SetProvider sets field value -func (o *Payment) SetProvider(v string) { +func (o *Payment) SetProvider(v interface{}) { o.Provider = v } -// GetReference returns the Reference field value if set, zero value otherwise. -func (o *Payment) GetReference() string { - if o == nil || o.Reference == nil { - var ret string +// GetReference returns the Reference field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Payment) GetReference() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.Reference + return o.Reference } // GetReferenceOk returns a tuple with the Reference field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *Payment) GetReferenceOk() (*string, bool) { - if o == nil || o.Reference == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetReferenceOk() (*interface{}, bool) { + if o == nil || isNil(o.Reference) { return nil, false } - return o.Reference, true + return &o.Reference, true } // HasReference returns a boolean if a field has been set. func (o *Payment) HasReference() bool { - if o != nil && o.Reference != nil { + if o != nil && isNil(o.Reference) { return true } return false } -// SetReference gets a reference to the given string and assigns it to the Reference field. -func (o *Payment) SetReference(v string) { - o.Reference = &v +// SetReference gets a reference to the given interface{} and assigns it to the Reference field. +func (o *Payment) SetReference(v interface{}) { + o.Reference = v } // GetScheme returns the Scheme field value -func (o *Payment) GetScheme() string { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetScheme() interface{} { if o == nil { - var ret string + var ret interface{} return ret } @@ -122,22 +128,24 @@ func (o *Payment) GetScheme() string { // GetSchemeOk returns a tuple with the Scheme field value // and a boolean to check if the value has been set. -func (o *Payment) GetSchemeOk() (*string, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetSchemeOk() (*interface{}, bool) { + if o == nil || isNil(o.Scheme) { return nil, false } return &o.Scheme, true } // SetScheme sets field value -func (o *Payment) SetScheme(v string) { +func (o *Payment) SetScheme(v interface{}) { o.Scheme = v } // GetStatus returns the Status field value -func (o *Payment) GetStatus() string { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetStatus() interface{} { if o == nil { - var ret string + var ret interface{} return ret } @@ -146,22 +154,24 @@ func (o *Payment) GetStatus() string { // GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. -func (o *Payment) GetStatusOk() (*string, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetStatusOk() (*interface{}, bool) { + if o == nil || isNil(o.Status) { return nil, false } return &o.Status, true } // SetStatus sets field value -func (o *Payment) SetStatus(v string) { +func (o *Payment) SetStatus(v interface{}) { o.Status = v } // GetType returns the Type field value -func (o *Payment) GetType() string { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetType() interface{} { if o == nil { - var ret string + var ret interface{} return ret } @@ -170,22 +180,24 @@ func (o *Payment) GetType() string { // GetTypeOk returns a tuple with the Type field value // and a boolean to check if the value has been set. -func (o *Payment) GetTypeOk() (*string, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetTypeOk() (*interface{}, bool) { + if o == nil || isNil(o.Type) { return nil, false } return &o.Type, true } // SetType sets field value -func (o *Payment) SetType(v string) { +func (o *Payment) SetType(v interface{}) { o.Type = v } // GetId returns the Id field value -func (o *Payment) GetId() string { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetId() interface{} { if o == nil { - var ret string + var ret interface{} return ret } @@ -194,22 +206,24 @@ func (o *Payment) GetId() string { // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. -func (o *Payment) GetIdOk() (*string, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetIdOk() (*interface{}, bool) { + if o == nil || isNil(o.Id) { return nil, false } return &o.Id, true } // SetId sets field value -func (o *Payment) SetId(v string) { +func (o *Payment) SetId(v interface{}) { o.Id = v } // GetAmount returns the Amount field value -func (o *Payment) GetAmount() int32 { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetAmount() interface{} { if o == nil { - var ret int32 + var ret interface{} return ret } @@ -218,22 +232,24 @@ func (o *Payment) GetAmount() int32 { // GetAmountOk returns a tuple with the Amount field value // and a boolean to check if the value has been set. -func (o *Payment) GetAmountOk() (*int32, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetAmountOk() (*interface{}, bool) { + if o == nil || isNil(o.Amount) { return nil, false } return &o.Amount, true } // SetAmount sets field value -func (o *Payment) SetAmount(v int32) { +func (o *Payment) SetAmount(v interface{}) { o.Amount = v } // GetAsset returns the Asset field value -func (o *Payment) GetAsset() string { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetAsset() interface{} { if o == nil { - var ret string + var ret interface{} return ret } @@ -242,22 +258,24 @@ func (o *Payment) GetAsset() string { // GetAssetOk returns a tuple with the Asset field value // and a boolean to check if the value has been set. -func (o *Payment) GetAssetOk() (*string, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetAssetOk() (*interface{}, bool) { + if o == nil || isNil(o.Asset) { return nil, false } return &o.Asset, true } // SetAsset sets field value -func (o *Payment) SetAsset(v string) { +func (o *Payment) SetAsset(v interface{}) { o.Asset = v } // GetDate returns the Date field value -func (o *Payment) GetDate() time.Time { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *Payment) GetDate() interface{} { if o == nil { - var ret time.Time + var ret interface{} return ret } @@ -266,15 +284,16 @@ func (o *Payment) GetDate() time.Time { // GetDateOk returns a tuple with the Date field value // and a boolean to check if the value has been set. -func (o *Payment) GetDateOk() (*time.Time, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *Payment) GetDateOk() (*interface{}, bool) { + if o == nil || isNil(o.Date) { return nil, false } return &o.Date, true } // SetDate sets field value -func (o *Payment) SetDate(v time.Time) { +func (o *Payment) SetDate(v interface{}) { o.Date = v } @@ -291,7 +310,7 @@ func (o *Payment) GetRaw() interface{} { // and a boolean to check if the value has been set. // NOTE: If the value is an explicit nil, `nil, true` will be returned func (o *Payment) GetRawOk() (*interface{}, bool) { - if o == nil || o.Raw == nil { + if o == nil || isNil(o.Raw) { return nil, false } return &o.Raw, true @@ -299,7 +318,7 @@ func (o *Payment) GetRawOk() (*interface{}, bool) { // HasRaw returns a boolean if a field has been set. func (o *Payment) HasRaw() bool { - if o != nil && o.Raw != nil { + if o != nil && isNil(o.Raw) { return true } @@ -312,38 +331,46 @@ func (o *Payment) SetRaw(v interface{}) { } func (o Payment) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Payment) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if true { + if o.Provider != nil { toSerialize["provider"] = o.Provider } if o.Reference != nil { toSerialize["reference"] = o.Reference } - if true { + if o.Scheme != nil { toSerialize["scheme"] = o.Scheme } - if true { + if o.Status != nil { toSerialize["status"] = o.Status } - if true { + if o.Type != nil { toSerialize["type"] = o.Type } - if true { + if o.Id != nil { toSerialize["id"] = o.Id } - if true { + if o.Amount != nil { toSerialize["amount"] = o.Amount } - if true { + if o.Asset != nil { toSerialize["asset"] = o.Asset } - if true { + if o.Date != nil { toSerialize["date"] = o.Date } if o.Raw != nil { toSerialize["raw"] = o.Raw } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullablePayment struct { @@ -381,3 +408,5 @@ func (v *NullablePayment) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/client/model_stripe_config.go b/client/model_stripe_config.go index cb3452de..6f1d3dff 100644 --- a/client/model_stripe_config.go +++ b/client/model_stripe_config.go @@ -14,26 +14,25 @@ import ( "encoding/json" ) +// checks if the StripeConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StripeConfig{} + // StripeConfig struct for StripeConfig type StripeConfig struct { // The frequency at which the connector will try to fetch new BalanceTransaction objects from Stripe api - PollingPeriod *string `json:"pollingPeriod,omitempty"` - ApiKey string `json:"apiKey"` - // Number of BalanceTransaction to fetch at each polling interval. - PageSize *float32 `json:"pageSize,omitempty"` + PollingPeriod interface{} `json:"pollingPeriod,omitempty"` + ApiKey interface{} `json:"apiKey"` + // Number of BalanceTransaction to fetch at each polling interval. + PageSize interface{} `json:"pageSize,omitempty"` } // NewStripeConfig instantiates a new StripeConfig object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed -func NewStripeConfig(apiKey string) *StripeConfig { +func NewStripeConfig(apiKey interface{}) *StripeConfig { this := StripeConfig{} - var pollingPeriod string = "120s" - this.PollingPeriod = &pollingPeriod this.ApiKey = apiKey - var pageSize float32 = 10 - this.PageSize = &pageSize return &this } @@ -42,49 +41,47 @@ func NewStripeConfig(apiKey string) *StripeConfig { // but it doesn't guarantee that properties required by API are set func NewStripeConfigWithDefaults() *StripeConfig { this := StripeConfig{} - var pollingPeriod string = "120s" - this.PollingPeriod = &pollingPeriod - var pageSize float32 = 10 - this.PageSize = &pageSize return &this } -// GetPollingPeriod returns the PollingPeriod field value if set, zero value otherwise. -func (o *StripeConfig) GetPollingPeriod() string { - if o == nil || o.PollingPeriod == nil { - var ret string +// GetPollingPeriod returns the PollingPeriod field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *StripeConfig) GetPollingPeriod() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.PollingPeriod + return o.PollingPeriod } // GetPollingPeriodOk returns a tuple with the PollingPeriod field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StripeConfig) GetPollingPeriodOk() (*string, bool) { - if o == nil || o.PollingPeriod == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeConfig) GetPollingPeriodOk() (*interface{}, bool) { + if o == nil || isNil(o.PollingPeriod) { return nil, false } - return o.PollingPeriod, true + return &o.PollingPeriod, true } // HasPollingPeriod returns a boolean if a field has been set. func (o *StripeConfig) HasPollingPeriod() bool { - if o != nil && o.PollingPeriod != nil { + if o != nil && isNil(o.PollingPeriod) { return true } return false } -// SetPollingPeriod gets a reference to the given string and assigns it to the PollingPeriod field. -func (o *StripeConfig) SetPollingPeriod(v string) { - o.PollingPeriod = &v +// SetPollingPeriod gets a reference to the given interface{} and assigns it to the PollingPeriod field. +func (o *StripeConfig) SetPollingPeriod(v interface{}) { + o.PollingPeriod = v } // GetApiKey returns the ApiKey field value -func (o *StripeConfig) GetApiKey() string { +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *StripeConfig) GetApiKey() interface{} { if o == nil { - var ret string + var ret interface{} return ret } @@ -93,62 +90,72 @@ func (o *StripeConfig) GetApiKey() string { // GetApiKeyOk returns a tuple with the ApiKey field value // and a boolean to check if the value has been set. -func (o *StripeConfig) GetApiKeyOk() (*string, bool) { - if o == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeConfig) GetApiKeyOk() (*interface{}, bool) { + if o == nil || isNil(o.ApiKey) { return nil, false } return &o.ApiKey, true } // SetApiKey sets field value -func (o *StripeConfig) SetApiKey(v string) { +func (o *StripeConfig) SetApiKey(v interface{}) { o.ApiKey = v } -// GetPageSize returns the PageSize field value if set, zero value otherwise. -func (o *StripeConfig) GetPageSize() float32 { - if o == nil || o.PageSize == nil { - var ret float32 +// GetPageSize returns the PageSize field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *StripeConfig) GetPageSize() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.PageSize + return o.PageSize } // GetPageSizeOk returns a tuple with the PageSize field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StripeConfig) GetPageSizeOk() (*float32, bool) { - if o == nil || o.PageSize == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeConfig) GetPageSizeOk() (*interface{}, bool) { + if o == nil || isNil(o.PageSize) { return nil, false } - return o.PageSize, true + return &o.PageSize, true } // HasPageSize returns a boolean if a field has been set. func (o *StripeConfig) HasPageSize() bool { - if o != nil && o.PageSize != nil { + if o != nil && isNil(o.PageSize) { return true } return false } -// SetPageSize gets a reference to the given float32 and assigns it to the PageSize field. -func (o *StripeConfig) SetPageSize(v float32) { - o.PageSize = &v +// SetPageSize gets a reference to the given interface{} and assigns it to the PageSize field. +func (o *StripeConfig) SetPageSize(v interface{}) { + o.PageSize = v } func (o StripeConfig) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StripeConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.PollingPeriod != nil { toSerialize["pollingPeriod"] = o.PollingPeriod } - if true { + if o.ApiKey != nil { toSerialize["apiKey"] = o.ApiKey } if o.PageSize != nil { toSerialize["pageSize"] = o.PageSize } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableStripeConfig struct { @@ -186,3 +193,5 @@ func (v *NullableStripeConfig) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/client/model_stripe_task.go b/client/model_stripe_task.go index 1f2bf791..d4ca2380 100644 --- a/client/model_stripe_task.go +++ b/client/model_stripe_task.go @@ -12,21 +12,22 @@ package client import ( "encoding/json" - "time" ) +// checks if the StripeTask type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StripeTask{} + // StripeTask struct for StripeTask type StripeTask struct { // The id of the oldest BalanceTransaction fetched from stripe for this account - OldestId *string `json:"oldestId,omitempty"` + OldestId interface{} `json:"oldestId,omitempty"` // The creation date of the oldest BalanceTransaction fetched from stripe for this account - OldestDate *time.Time `json:"oldestDate,omitempty"` + OldestDate interface{} `json:"oldestDate,omitempty"` // The id of the more recent BalanceTransaction fetched from stripe for this account - MoreRecentId *string `json:"moreRecentId,omitempty"` + MoreRecentId interface{} `json:"moreRecentId,omitempty"` // The creation date of the more recent BalanceTransaction fetched from stripe for this account - MoreRecentDate *time.Time `json:"moreRecentDate,omitempty"` - // Indicate that there no more history to fetch on this account - NoMoreHistory *bool `json:"noMoreHistory,omitempty"` + MoreRecentDate interface{} `json:"moreRecentDate,omitempty"` + NoMoreHistory interface{} `json:"noMoreHistory,omitempty"` } // NewStripeTask instantiates a new StripeTask object @@ -46,167 +47,180 @@ func NewStripeTaskWithDefaults() *StripeTask { return &this } -// GetOldestId returns the OldestId field value if set, zero value otherwise. -func (o *StripeTask) GetOldestId() string { - if o == nil || o.OldestId == nil { - var ret string +// GetOldestId returns the OldestId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *StripeTask) GetOldestId() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.OldestId + return o.OldestId } // GetOldestIdOk returns a tuple with the OldestId field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StripeTask) GetOldestIdOk() (*string, bool) { - if o == nil || o.OldestId == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeTask) GetOldestIdOk() (*interface{}, bool) { + if o == nil || isNil(o.OldestId) { return nil, false } - return o.OldestId, true + return &o.OldestId, true } // HasOldestId returns a boolean if a field has been set. func (o *StripeTask) HasOldestId() bool { - if o != nil && o.OldestId != nil { + if o != nil && isNil(o.OldestId) { return true } return false } -// SetOldestId gets a reference to the given string and assigns it to the OldestId field. -func (o *StripeTask) SetOldestId(v string) { - o.OldestId = &v +// SetOldestId gets a reference to the given interface{} and assigns it to the OldestId field. +func (o *StripeTask) SetOldestId(v interface{}) { + o.OldestId = v } -// GetOldestDate returns the OldestDate field value if set, zero value otherwise. -func (o *StripeTask) GetOldestDate() time.Time { - if o == nil || o.OldestDate == nil { - var ret time.Time +// GetOldestDate returns the OldestDate field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *StripeTask) GetOldestDate() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.OldestDate + return o.OldestDate } // GetOldestDateOk returns a tuple with the OldestDate field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StripeTask) GetOldestDateOk() (*time.Time, bool) { - if o == nil || o.OldestDate == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeTask) GetOldestDateOk() (*interface{}, bool) { + if o == nil || isNil(o.OldestDate) { return nil, false } - return o.OldestDate, true + return &o.OldestDate, true } // HasOldestDate returns a boolean if a field has been set. func (o *StripeTask) HasOldestDate() bool { - if o != nil && o.OldestDate != nil { + if o != nil && isNil(o.OldestDate) { return true } return false } -// SetOldestDate gets a reference to the given time.Time and assigns it to the OldestDate field. -func (o *StripeTask) SetOldestDate(v time.Time) { - o.OldestDate = &v +// SetOldestDate gets a reference to the given interface{} and assigns it to the OldestDate field. +func (o *StripeTask) SetOldestDate(v interface{}) { + o.OldestDate = v } -// GetMoreRecentId returns the MoreRecentId field value if set, zero value otherwise. -func (o *StripeTask) GetMoreRecentId() string { - if o == nil || o.MoreRecentId == nil { - var ret string +// GetMoreRecentId returns the MoreRecentId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *StripeTask) GetMoreRecentId() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.MoreRecentId + return o.MoreRecentId } // GetMoreRecentIdOk returns a tuple with the MoreRecentId field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StripeTask) GetMoreRecentIdOk() (*string, bool) { - if o == nil || o.MoreRecentId == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeTask) GetMoreRecentIdOk() (*interface{}, bool) { + if o == nil || isNil(o.MoreRecentId) { return nil, false } - return o.MoreRecentId, true + return &o.MoreRecentId, true } // HasMoreRecentId returns a boolean if a field has been set. func (o *StripeTask) HasMoreRecentId() bool { - if o != nil && o.MoreRecentId != nil { + if o != nil && isNil(o.MoreRecentId) { return true } return false } -// SetMoreRecentId gets a reference to the given string and assigns it to the MoreRecentId field. -func (o *StripeTask) SetMoreRecentId(v string) { - o.MoreRecentId = &v +// SetMoreRecentId gets a reference to the given interface{} and assigns it to the MoreRecentId field. +func (o *StripeTask) SetMoreRecentId(v interface{}) { + o.MoreRecentId = v } -// GetMoreRecentDate returns the MoreRecentDate field value if set, zero value otherwise. -func (o *StripeTask) GetMoreRecentDate() time.Time { - if o == nil || o.MoreRecentDate == nil { - var ret time.Time +// GetMoreRecentDate returns the MoreRecentDate field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *StripeTask) GetMoreRecentDate() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.MoreRecentDate + return o.MoreRecentDate } // GetMoreRecentDateOk returns a tuple with the MoreRecentDate field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StripeTask) GetMoreRecentDateOk() (*time.Time, bool) { - if o == nil || o.MoreRecentDate == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeTask) GetMoreRecentDateOk() (*interface{}, bool) { + if o == nil || isNil(o.MoreRecentDate) { return nil, false } - return o.MoreRecentDate, true + return &o.MoreRecentDate, true } // HasMoreRecentDate returns a boolean if a field has been set. func (o *StripeTask) HasMoreRecentDate() bool { - if o != nil && o.MoreRecentDate != nil { + if o != nil && isNil(o.MoreRecentDate) { return true } return false } -// SetMoreRecentDate gets a reference to the given time.Time and assigns it to the MoreRecentDate field. -func (o *StripeTask) SetMoreRecentDate(v time.Time) { - o.MoreRecentDate = &v +// SetMoreRecentDate gets a reference to the given interface{} and assigns it to the MoreRecentDate field. +func (o *StripeTask) SetMoreRecentDate(v interface{}) { + o.MoreRecentDate = v } -// GetNoMoreHistory returns the NoMoreHistory field value if set, zero value otherwise. -func (o *StripeTask) GetNoMoreHistory() bool { - if o == nil || o.NoMoreHistory == nil { - var ret bool +// GetNoMoreHistory returns the NoMoreHistory field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *StripeTask) GetNoMoreHistory() interface{} { + if o == nil { + var ret interface{} return ret } - return *o.NoMoreHistory + return o.NoMoreHistory } // GetNoMoreHistoryOk returns a tuple with the NoMoreHistory field value if set, nil otherwise // and a boolean to check if the value has been set. -func (o *StripeTask) GetNoMoreHistoryOk() (*bool, bool) { - if o == nil || o.NoMoreHistory == nil { +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *StripeTask) GetNoMoreHistoryOk() (*interface{}, bool) { + if o == nil || isNil(o.NoMoreHistory) { return nil, false } - return o.NoMoreHistory, true + return &o.NoMoreHistory, true } // HasNoMoreHistory returns a boolean if a field has been set. func (o *StripeTask) HasNoMoreHistory() bool { - if o != nil && o.NoMoreHistory != nil { + if o != nil && isNil(o.NoMoreHistory) { return true } return false } -// SetNoMoreHistory gets a reference to the given bool and assigns it to the NoMoreHistory field. -func (o *StripeTask) SetNoMoreHistory(v bool) { - o.NoMoreHistory = &v +// SetNoMoreHistory gets a reference to the given interface{} and assigns it to the NoMoreHistory field. +func (o *StripeTask) SetNoMoreHistory(v interface{}) { + o.NoMoreHistory = v } func (o StripeTask) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o StripeTask) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.OldestId != nil { toSerialize["oldestId"] = o.OldestId @@ -223,7 +237,7 @@ func (o StripeTask) MarshalJSON() ([]byte, error) { if o.NoMoreHistory != nil { toSerialize["noMoreHistory"] = o.NoMoreHistory } - return json.Marshal(toSerialize) + return toSerialize, nil } type NullableStripeTask struct { @@ -261,3 +275,5 @@ func (v *NullableStripeTask) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + + diff --git a/client/model_wise_config.go b/client/model_wise_config.go new file mode 100644 index 00000000..b95b7656 --- /dev/null +++ b/client/model_wise_config.go @@ -0,0 +1,121 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// checks if the WiseConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &WiseConfig{} + +// WiseConfig struct for WiseConfig +type WiseConfig struct { + ApiKey interface{} `json:"apiKey"` +} + +// NewWiseConfig instantiates a new WiseConfig object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewWiseConfig(apiKey interface{}) *WiseConfig { + this := WiseConfig{} + this.ApiKey = apiKey + return &this +} + +// NewWiseConfigWithDefaults instantiates a new WiseConfig object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewWiseConfigWithDefaults() *WiseConfig { + this := WiseConfig{} + return &this +} + +// GetApiKey returns the ApiKey field value +// If the value is explicit nil, the zero value for interface{} will be returned +func (o *WiseConfig) GetApiKey() interface{} { + if o == nil { + var ret interface{} + return ret + } + + return o.ApiKey +} + +// GetApiKeyOk returns a tuple with the ApiKey field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *WiseConfig) GetApiKeyOk() (*interface{}, bool) { + if o == nil || isNil(o.ApiKey) { + return nil, false + } + return &o.ApiKey, true +} + +// SetApiKey sets field value +func (o *WiseConfig) SetApiKey(v interface{}) { + o.ApiKey = v +} + +func (o WiseConfig) MarshalJSON() ([]byte, error) { + toSerialize,err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o WiseConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.ApiKey != nil { + toSerialize["apiKey"] = o.ApiKey + } + return toSerialize, nil +} + +type NullableWiseConfig struct { + value *WiseConfig + isSet bool +} + +func (v NullableWiseConfig) Get() *WiseConfig { + return v.value +} + +func (v *NullableWiseConfig) Set(val *WiseConfig) { + v.value = val + v.isSet = true +} + +func (v NullableWiseConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableWiseConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableWiseConfig(val *WiseConfig) *NullableWiseConfig { + return &NullableWiseConfig{value: val, isSet: true} +} + +func (v NullableWiseConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableWiseConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + + diff --git a/client/utils.go b/client/utils.go index 42345086..7b178ca4 100644 --- a/client/utils.go +++ b/client/utils.go @@ -12,6 +12,7 @@ package client import ( "encoding/json" + "reflect" "time" ) @@ -326,3 +327,21 @@ func (v *NullableTime) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } + +// isNil checks if an input is nil +func isNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} diff --git a/main.go b/main.go index 836f8944..60931fd7 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -//go:generate docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate -i ./swagger.yml -g go -o ./client --git-user-id=numary --git-repo-id=payments -p packageVersion=latest -p isGoSubmodule=true -p packageName=client +//go:generate docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate -i ./swagger.yml -g go -o ./client --git-user-id=formancehq --git-repo-id=payments -p packageVersion=latest -p isGoSubmodule=true -p packageName=client //go:generate docker run --rm -w /local -v ${PWD}:/local cytopia/goimports -w -e ./client package main diff --git a/swagger.yml b/swagger.yml index 5dd01fc4..58f0e76d 100644 --- a/swagger.yml +++ b/swagger.yml @@ -85,7 +85,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ListConnectorsConfigsResponse' + $ref: '#/components/schemas/ConnectorConfig' /connectors/{connector}: post: summary: Install connector From 951690cb2854fde49a22fadc127bd6a72f598b7d Mon Sep 17 00:00:00 2001 From: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com> Date: Fri, 23 Dec 2022 14:46:18 +0200 Subject: [PATCH 2/3] fix: client generation under strict version Signed-off-by: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com> --- client/.openapi-generator-ignore | 1 - client/.openapi-generator/FILES | 2 + client/README.md | 2 +- client/api_payments.go | 155 ++++---- client/client.go | 141 ++++---- client/configuration.go | 17 +- client/docs/ConnectorConfig.md | 103 ------ client/docs/ConnectorTask.md | 160 --------- client/docs/DefaultApi.md | 433 ----------------------- client/git_push.sh | 2 +- client/model_banking_circle_config.go | 10 +- client/model_connector_base_info.go | 4 +- client/model_connector_config.go | 115 ------ client/model_connector_task.go | 115 ------ client/model_currency_cloud_config.go | 4 +- client/model_dummy_pay_config.go | 6 +- client/model_get_payment_response.go | 4 +- client/model_list_connectors_response.go | 4 +- client/model_list_payments_response.go | 4 +- client/model_modulr_config.go | 8 +- client/model_payment.go | 22 +- client/model_stripe_config.go | 8 +- client/model_stripe_task.go | 6 +- client/model_wise_config.go | 4 +- client/test/api_payments_test.go | 158 +++++++++ main.go | 4 +- 26 files changed, 349 insertions(+), 1143 deletions(-) delete mode 100644 client/docs/ConnectorConfig.md delete mode 100644 client/docs/ConnectorTask.md delete mode 100644 client/docs/DefaultApi.md delete mode 100644 client/model_connector_config.go delete mode 100644 client/model_connector_task.go create mode 100644 client/test/api_payments_test.go diff --git a/client/.openapi-generator-ignore b/client/.openapi-generator-ignore index e6441656..7484ee59 100644 --- a/client/.openapi-generator-ignore +++ b/client/.openapi-generator-ignore @@ -21,4 +21,3 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md -test/ diff --git a/client/.openapi-generator/FILES b/client/.openapi-generator/FILES index 0b5c8f31..949fc56b 100644 --- a/client/.openapi-generator/FILES +++ b/client/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -34,4 +35,5 @@ model_stripe_config.go model_stripe_task.go model_wise_config.go response.go +test/api_payments_test.go utils.go diff --git a/client/README.md b/client/README.md index c8f06ed3..7ca0a070 100644 --- a/client/README.md +++ b/client/README.md @@ -6,7 +6,7 @@ No description provided (generated by Openapi Generator https://github.com/opena This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. - API version: 1.0.0 -- Package version: 1.0.0 +- Package version: latest - Build package: org.openapitools.codegen.languages.GoClientCodegen ## Installation diff --git a/client/api_payments.go b/client/api_payments.go index ad8de49a..5b6b418e 100644 --- a/client/api_payments.go +++ b/client/api_payments.go @@ -19,12 +19,11 @@ import ( "strings" ) - // PaymentsApiService PaymentsApi service type PaymentsApiService service type ApiGetAllConnectorsRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService } @@ -43,7 +42,7 @@ Get all installed connectors func (a *PaymentsApiService) GetAllConnectors(ctx context.Context) ApiGetAllConnectorsRequest { return ApiGetAllConnectorsRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } @@ -51,10 +50,10 @@ func (a *PaymentsApiService) GetAllConnectors(ctx context.Context) ApiGetAllConn // @return ListConnectorsResponse func (a *PaymentsApiService) GetAllConnectorsExecute(r ApiGetAllConnectorsRequest) (*ListConnectorsResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListConnectorsResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListConnectorsResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetAllConnectors") @@ -123,7 +122,7 @@ func (a *PaymentsApiService) GetAllConnectorsExecute(r ApiGetAllConnectorsReques } type ApiGetAllConnectorsConfigsRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService } @@ -142,7 +141,7 @@ Get all available connectors configs func (a *PaymentsApiService) GetAllConnectorsConfigs(ctx context.Context) ApiGetAllConnectorsConfigsRequest { return ApiGetAllConnectorsConfigsRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } @@ -150,10 +149,10 @@ func (a *PaymentsApiService) GetAllConnectorsConfigs(ctx context.Context) ApiGet // @return interface{} func (a *PaymentsApiService) GetAllConnectorsConfigsExecute(r ApiGetAllConnectorsConfigsRequest) (interface{}, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue interface{} + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetAllConnectorsConfigs") @@ -222,10 +221,10 @@ func (a *PaymentsApiService) GetAllConnectorsConfigsExecute(r ApiGetAllConnector } type ApiGetConnectorTaskRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - connector interface{} - taskId interface{} + connector interface{} + taskId interface{} } func (r ApiGetConnectorTaskRequest) Execute() (interface{}, *http.Response, error) { @@ -245,9 +244,9 @@ Get a specific task associated to the connector func (a *PaymentsApiService) GetConnectorTask(ctx context.Context, connector interface{}, taskId interface{}) ApiGetConnectorTaskRequest { return ApiGetConnectorTaskRequest{ ApiService: a, - ctx: ctx, - connector: connector, - taskId: taskId, + ctx: ctx, + connector: connector, + taskId: taskId, } } @@ -255,10 +254,10 @@ func (a *PaymentsApiService) GetConnectorTask(ctx context.Context, connector int // @return interface{} func (a *PaymentsApiService) GetConnectorTaskExecute(r ApiGetConnectorTaskRequest) (interface{}, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue interface{} + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetConnectorTask") @@ -329,9 +328,9 @@ func (a *PaymentsApiService) GetConnectorTaskExecute(r ApiGetConnectorTaskReques } type ApiGetPaymentRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - paymentId interface{} + paymentId interface{} } func (r ApiGetPaymentRequest) Execute() (*Payment, *http.Response, error) { @@ -348,8 +347,8 @@ GetPayment Returns a payment. func (a *PaymentsApiService) GetPayment(ctx context.Context, paymentId interface{}) ApiGetPaymentRequest { return ApiGetPaymentRequest{ ApiService: a, - ctx: ctx, - paymentId: paymentId, + ctx: ctx, + paymentId: paymentId, } } @@ -357,10 +356,10 @@ func (a *PaymentsApiService) GetPayment(ctx context.Context, paymentId interface // @return Payment func (a *PaymentsApiService) GetPaymentExecute(r ApiGetPaymentRequest) (*Payment, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *Payment + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Payment ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetPayment") @@ -430,10 +429,10 @@ func (a *PaymentsApiService) GetPaymentExecute(r ApiGetPaymentRequest) (*Payment } type ApiInstallConnectorRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - connector interface{} - body *interface{} + connector interface{} + body *interface{} } func (r ApiInstallConnectorRequest) Body(body interface{}) ApiInstallConnectorRequest { @@ -457,17 +456,17 @@ Install connector func (a *PaymentsApiService) InstallConnector(ctx context.Context, connector interface{}) ApiInstallConnectorRequest { return ApiInstallConnectorRequest{ ApiService: a, - ctx: ctx, - connector: connector, + ctx: ctx, + connector: connector, } } // Execute executes the request func (a *PaymentsApiService) InstallConnectorExecute(r ApiInstallConnectorRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.InstallConnector") @@ -533,9 +532,9 @@ func (a *PaymentsApiService) InstallConnectorExecute(r ApiInstallConnectorReques } type ApiListConnectorTasksRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector interface{} } func (r ApiListConnectorTasksRequest) Execute() (interface{}, *http.Response, error) { @@ -554,8 +553,8 @@ List all tasks associated with this connector. func (a *PaymentsApiService) ListConnectorTasks(ctx context.Context, connector interface{}) ApiListConnectorTasksRequest { return ApiListConnectorTasksRequest{ ApiService: a, - ctx: ctx, - connector: connector, + ctx: ctx, + connector: connector, } } @@ -563,10 +562,10 @@ func (a *PaymentsApiService) ListConnectorTasks(ctx context.Context, connector i // @return interface{} func (a *PaymentsApiService) ListConnectorTasksExecute(r ApiListConnectorTasksRequest) (interface{}, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue interface{} + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ListConnectorTasks") @@ -636,11 +635,11 @@ func (a *PaymentsApiService) ListConnectorTasksExecute(r ApiListConnectorTasksRe } type ApiListPaymentsRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - limit *interface{} - skip *interface{} - sort *interface{} + limit *interface{} + skip *interface{} + sort *interface{} } // Limit the number of payments to return, pagination can be achieved in conjunction with 'skip' parameter. @@ -674,7 +673,7 @@ ListPayments Returns a list of payments. func (a *PaymentsApiService) ListPayments(ctx context.Context) ApiListPaymentsRequest { return ApiListPaymentsRequest{ ApiService: a, - ctx: ctx, + ctx: ctx, } } @@ -682,10 +681,10 @@ func (a *PaymentsApiService) ListPayments(ctx context.Context) ApiListPaymentsRe // @return ListPaymentsResponse func (a *PaymentsApiService) ListPaymentsExecute(r ApiListPaymentsRequest) (*ListPaymentsResponse, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue *ListPaymentsResponse + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListPaymentsResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ListPayments") @@ -763,9 +762,9 @@ func (a *PaymentsApiService) ListPaymentsExecute(r ApiListPaymentsRequest) (*Lis } type ApiReadConnectorConfigRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector interface{} } func (r ApiReadConnectorConfigRequest) Execute() (interface{}, *http.Response, error) { @@ -784,8 +783,8 @@ Read connector config func (a *PaymentsApiService) ReadConnectorConfig(ctx context.Context, connector interface{}) ApiReadConnectorConfigRequest { return ApiReadConnectorConfigRequest{ ApiService: a, - ctx: ctx, - connector: connector, + ctx: ctx, + connector: connector, } } @@ -793,10 +792,10 @@ func (a *PaymentsApiService) ReadConnectorConfig(ctx context.Context, connector // @return interface{} func (a *PaymentsApiService) ReadConnectorConfigExecute(r ApiReadConnectorConfigRequest) (interface{}, *http.Response, error) { var ( - localVarHTTPMethod = http.MethodGet - localVarPostBody interface{} - formFiles []formFile - localVarReturnValue interface{} + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue interface{} ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ReadConnectorConfig") @@ -866,9 +865,9 @@ func (a *PaymentsApiService) ReadConnectorConfigExecute(r ApiReadConnectorConfig } type ApiResetConnectorRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector interface{} } func (r ApiResetConnectorRequest) Execute() (*http.Response, error) { @@ -887,17 +886,17 @@ Reset connector. Will remove the connector and ALL PAYMENTS generated with it. func (a *PaymentsApiService) ResetConnector(ctx context.Context, connector interface{}) ApiResetConnectorRequest { return ApiResetConnectorRequest{ ApiService: a, - ctx: ctx, - connector: connector, + ctx: ctx, + connector: connector, } } // Execute executes the request func (a *PaymentsApiService) ResetConnectorExecute(r ApiResetConnectorRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodPost - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ResetConnector") @@ -958,9 +957,9 @@ func (a *PaymentsApiService) ResetConnectorExecute(r ApiResetConnectorRequest) ( } type ApiUninstallConnectorRequest struct { - ctx context.Context + ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector interface{} } func (r ApiUninstallConnectorRequest) Execute() (*http.Response, error) { @@ -979,17 +978,17 @@ Uninstall connector func (a *PaymentsApiService) UninstallConnector(ctx context.Context, connector interface{}) ApiUninstallConnectorRequest { return ApiUninstallConnectorRequest{ ApiService: a, - ctx: ctx, - connector: connector, + ctx: ctx, + connector: connector, } } // Execute executes the request func (a *PaymentsApiService) UninstallConnectorExecute(r ApiUninstallConnectorRequest) (*http.Response, error) { var ( - localVarHTTPMethod = http.MethodDelete - localVarPostBody interface{} - formFiles []formFile + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.UninstallConnector") diff --git a/client/client.go b/client/client.go index 92ad8f41..4b8537eb 100644 --- a/client/client.go +++ b/client/client.go @@ -32,14 +32,13 @@ import ( "strings" "time" "unicode/utf8" - ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" ) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") ) // APIClient manages communication with the Payments API API v1.0.0 @@ -126,15 +125,15 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { return nil } -func parameterValueToString( obj interface{}, key string ) string { +func parameterValueToString(obj interface{}, key string) string { if reflect.TypeOf(obj).Kind() != reflect.Ptr { return fmt.Sprintf("%v", obj) } - var param,ok = obj.(MappedNullable) + var param, ok = obj.(MappedNullable) if !ok { return "" } - dataMap,err := param.ToMap() + dataMap, err := param.ToMap() if err != nil { return "" } @@ -149,77 +148,77 @@ func parameterAddToQuery(queryParams interface{}, keyPrefix string, obj interfac value = "null" } else { switch v.Kind() { - case reflect.Invalid: - value = "invalid" + case reflect.Invalid: + value = "invalid" - case reflect.Struct: - if t,ok := obj.(MappedNullable); ok { - dataMap,err := t.ToMap() - if err != nil { - return - } - parameterAddToQuery(queryParams, keyPrefix, dataMap, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToQuery(queryParams, keyPrefix, t.Format(time.RFC3339), collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { return } - var lenIndValue = indValue.Len() - for i:=0;i ConnectorTask GetConnectorTask(ctx, connector, taskId).Execute() - -Read a specific task of the connector - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - connector := "connector_example" // string | The connector code - taskId := "task1" // string | The task id - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultApi.GetConnectorTask(context.Background(), connector, taskId).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.GetConnectorTask``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `GetConnectorTask`: ConnectorTask - fmt.Fprintf(os.Stdout, "Response from `DefaultApi.GetConnectorTask`: %v\n", resp) -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | **string** | The connector code | -**taskId** | **string** | The task id | - -### Other Parameters - -Other parameters are passed through a pointer to a apiGetConnectorTaskRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - - -### Return type - -[**ConnectorTask**](ConnectorTask.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## InstallConnector - -> InstallConnector(ctx, connector).ConnectorConfig(connectorConfig).Execute() - -Install connector - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - connector := "connector_example" // string | The connector code - connectorConfig := openapiclient.ConnectorConfig{StripeConfig: openapiclient.NewStripeConfig("XXX")} // ConnectorConfig | - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultApi.InstallConnector(context.Background(), connector).ConnectorConfig(connectorConfig).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.InstallConnector``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | **string** | The connector code | - -### Other Parameters - -Other parameters are passed through a pointer to a apiInstallConnectorRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - **connectorConfig** | [**ConnectorConfig**](ConnectorConfig.md) | | - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: application/json -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## ListConnectorTasks - -> []ConnectorTask ListConnectorTasks(ctx, connector).Execute() - -List connector tasks - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - connector := "connector_example" // string | The connector code - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultApi.ListConnectorTasks(context.Background(), connector).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ListConnectorTasks``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ListConnectorTasks`: []ConnectorTask - fmt.Fprintf(os.Stdout, "Response from `DefaultApi.ListConnectorTasks`: %v\n", resp) -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | **string** | The connector code | - -### Other Parameters - -Other parameters are passed through a pointer to a apiListConnectorTasksRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - -[**[]ConnectorTask**](ConnectorTask.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## ReadConnectorConfig - -> ConnectorConfig ReadConnectorConfig(ctx, connector).Execute() - -Read connector config - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - connector := "connector_example" // string | The connector code - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultApi.ReadConnectorConfig(context.Background(), connector).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ReadConnectorConfig``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } - // response from `ReadConnectorConfig`: ConnectorConfig - fmt.Fprintf(os.Stdout, "Response from `DefaultApi.ReadConnectorConfig`: %v\n", resp) -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | **string** | The connector code | - -### Other Parameters - -Other parameters are passed through a pointer to a apiReadConnectorConfigRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - -[**ConnectorConfig**](ConnectorConfig.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## ResetConnector - -> ResetConnector(ctx, connector).Execute() - -Reset connector - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - connector := "connector_example" // string | The connector code - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultApi.ResetConnector(context.Background(), connector).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.ResetConnector``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | **string** | The connector code | - -### Other Parameters - -Other parameters are passed through a pointer to a apiResetConnectorRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - - -## UninstallConnector - -> UninstallConnector(ctx, connector).Execute() - -Uninstall connector - - - -### Example - -```go -package main - -import ( - "context" - "fmt" - "os" - openapiclient "./openapi" -) - -func main() { - connector := "connector_example" // string | The connector code - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - resp, r, err := apiClient.DefaultApi.UninstallConnector(context.Background(), connector).Execute() - if err != nil { - fmt.Fprintf(os.Stderr, "Error when calling `DefaultApi.UninstallConnector``: %v\n", err) - fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) - } -} -``` - -### Path Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- -**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | **string** | The connector code | - -### Other Parameters - -Other parameters are passed through a pointer to a apiUninstallConnectorRequest struct via the builder pattern - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - - -### Return type - - (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) -[[Back to Model list]](../README.md#documentation-for-models) -[[Back to README]](../README.md) - diff --git a/client/git_push.sh b/client/git_push.sh index 983458ae..aa98ffa9 100644 --- a/client/git_push.sh +++ b/client/git_push.sh @@ -19,7 +19,7 @@ if [ "$git_user_id" = "" ]; then fi if [ "$git_repo_id" = "" ]; then - git_repo_id="payments/client" + git_repo_id="payments" echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" fi diff --git a/client/model_banking_circle_config.go b/client/model_banking_circle_config.go index c26605de..0681f44e 100644 --- a/client/model_banking_circle_config.go +++ b/client/model_banking_circle_config.go @@ -19,9 +19,9 @@ var _ MappedNullable = &BankingCircleConfig{} // BankingCircleConfig struct for BankingCircleConfig type BankingCircleConfig struct { - Username interface{} `json:"username"` - Password interface{} `json:"password"` - Endpoint interface{} `json:"endpoint"` + Username interface{} `json:"username"` + Password interface{} `json:"password"` + Endpoint interface{} `json:"endpoint"` AuthorizationEndpoint interface{} `json:"authorizationEndpoint"` } @@ -151,7 +151,7 @@ func (o *BankingCircleConfig) SetAuthorizationEndpoint(v interface{}) { } func (o BankingCircleConfig) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -210,5 +210,3 @@ func (v *NullableBankingCircleConfig) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_connector_base_info.go b/client/model_connector_base_info.go index 6ba6f604..a8b25302 100644 --- a/client/model_connector_base_info.go +++ b/client/model_connector_base_info.go @@ -107,7 +107,7 @@ func (o *ConnectorBaseInfo) SetDisabled(v interface{}) { } func (o ConnectorBaseInfo) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -160,5 +160,3 @@ func (v *NullableConnectorBaseInfo) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_connector_config.go b/client/model_connector_config.go deleted file mode 100644 index 27107568..00000000 --- a/client/model_connector_config.go +++ /dev/null @@ -1,115 +0,0 @@ -/* -Payments API - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - -API version: 1.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "encoding/json" - "fmt" -) - -// ConnectorConfig - struct for ConnectorConfig -type ConnectorConfig struct { - StripeConfig *StripeConfig -} - -// StripeConfigAsConnectorConfig is a convenience function that returns StripeConfig wrapped in ConnectorConfig -func StripeConfigAsConnectorConfig(v *StripeConfig) ConnectorConfig { - return ConnectorConfig{ - StripeConfig: v, - } -} - -// Unmarshal JSON data into one of the pointers in the struct -func (dst *ConnectorConfig) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into StripeConfig - err = newStrictDecoder(data).Decode(&dst.StripeConfig) - if err == nil { - jsonStripeConfig, _ := json.Marshal(dst.StripeConfig) - if string(jsonStripeConfig) == "{}" { // empty struct - dst.StripeConfig = nil - } else { - match++ - } - } else { - dst.StripeConfig = nil - } - - if match > 1 { // more than 1 match - // reset to nil - dst.StripeConfig = nil - - return fmt.Errorf("Data matches more than one schema in oneOf(ConnectorConfig)") - } else if match == 1 { - return nil // exactly one match - } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(ConnectorConfig)") - } -} - -// Marshal data from the first non-nil pointers in the struct to JSON -func (src ConnectorConfig) MarshalJSON() ([]byte, error) { - if src.StripeConfig != nil { - return json.Marshal(&src.StripeConfig) - } - - return nil, nil // no data in oneOf schemas -} - -// Get the actual instance -func (obj *ConnectorConfig) GetActualInstance() interface{} { - if obj == nil { - return nil - } - if obj.StripeConfig != nil { - return obj.StripeConfig - } - - // all schemas are nil - return nil -} - -type NullableConnectorConfig struct { - value *ConnectorConfig - isSet bool -} - -func (v NullableConnectorConfig) Get() *ConnectorConfig { - return v.value -} - -func (v *NullableConnectorConfig) Set(val *ConnectorConfig) { - v.value = val - v.isSet = true -} - -func (v NullableConnectorConfig) IsSet() bool { - return v.isSet -} - -func (v *NullableConnectorConfig) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableConnectorConfig(val *ConnectorConfig) *NullableConnectorConfig { - return &NullableConnectorConfig{value: val, isSet: true} -} - -func (v NullableConnectorConfig) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableConnectorConfig) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/client/model_connector_task.go b/client/model_connector_task.go deleted file mode 100644 index 981c0d53..00000000 --- a/client/model_connector_task.go +++ /dev/null @@ -1,115 +0,0 @@ -/* -Payments API - -No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - -API version: 1.0.0 -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. - -package client - -import ( - "encoding/json" - "fmt" -) - -// ConnectorTask - struct for ConnectorTask -type ConnectorTask struct { - StripeTask *StripeTask -} - -// StripeTaskAsConnectorTask is a convenience function that returns StripeTask wrapped in ConnectorTask -func StripeTaskAsConnectorTask(v *StripeTask) ConnectorTask { - return ConnectorTask{ - StripeTask: v, - } -} - -// Unmarshal JSON data into one of the pointers in the struct -func (dst *ConnectorTask) UnmarshalJSON(data []byte) error { - var err error - match := 0 - // try to unmarshal data into StripeTask - err = newStrictDecoder(data).Decode(&dst.StripeTask) - if err == nil { - jsonStripeTask, _ := json.Marshal(dst.StripeTask) - if string(jsonStripeTask) == "{}" { // empty struct - dst.StripeTask = nil - } else { - match++ - } - } else { - dst.StripeTask = nil - } - - if match > 1 { // more than 1 match - // reset to nil - dst.StripeTask = nil - - return fmt.Errorf("Data matches more than one schema in oneOf(ConnectorTask)") - } else if match == 1 { - return nil // exactly one match - } else { // no match - return fmt.Errorf("Data failed to match schemas in oneOf(ConnectorTask)") - } -} - -// Marshal data from the first non-nil pointers in the struct to JSON -func (src ConnectorTask) MarshalJSON() ([]byte, error) { - if src.StripeTask != nil { - return json.Marshal(&src.StripeTask) - } - - return nil, nil // no data in oneOf schemas -} - -// Get the actual instance -func (obj *ConnectorTask) GetActualInstance() interface{} { - if obj == nil { - return nil - } - if obj.StripeTask != nil { - return obj.StripeTask - } - - // all schemas are nil - return nil -} - -type NullableConnectorTask struct { - value *ConnectorTask - isSet bool -} - -func (v NullableConnectorTask) Get() *ConnectorTask { - return v.value -} - -func (v *NullableConnectorTask) Set(val *ConnectorTask) { - v.value = val - v.isSet = true -} - -func (v NullableConnectorTask) IsSet() bool { - return v.isSet -} - -func (v *NullableConnectorTask) Unset() { - v.value = nil - v.isSet = false -} - -func NewNullableConnectorTask(val *ConnectorTask) *NullableConnectorTask { - return &NullableConnectorTask{value: val, isSet: true} -} - -func (v NullableConnectorTask) MarshalJSON() ([]byte, error) { - return json.Marshal(v.value) -} - -func (v *NullableConnectorTask) UnmarshalJSON(src []byte) error { - v.isSet = true - return json.Unmarshal(src, &v.value) -} diff --git a/client/model_currency_cloud_config.go b/client/model_currency_cloud_config.go index ec96b777..428ef15d 100644 --- a/client/model_currency_cloud_config.go +++ b/client/model_currency_cloud_config.go @@ -166,7 +166,7 @@ func (o *CurrencyCloudConfig) SetEndpoint(v interface{}) { } func (o CurrencyCloudConfig) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -225,5 +225,3 @@ func (v *NullableCurrencyCloudConfig) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_dummy_pay_config.go b/client/model_dummy_pay_config.go index dd13bcbc..5c35970f 100644 --- a/client/model_dummy_pay_config.go +++ b/client/model_dummy_pay_config.go @@ -23,7 +23,7 @@ type DummyPayConfig struct { FilePollingPeriod interface{} `json:"filePollingPeriod,omitempty"` // The frequency at which the connector will create new payment objects in the directory FileGenerationPeriod interface{} `json:"fileGenerationPeriod,omitempty"` - Directory interface{} `json:"directory"` + Directory interface{} `json:"directory"` } // NewDummyPayConfig instantiates a new DummyPayConfig object @@ -137,7 +137,7 @@ func (o *DummyPayConfig) SetDirectory(v interface{}) { } func (o DummyPayConfig) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -193,5 +193,3 @@ func (v *NullableDummyPayConfig) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_get_payment_response.go b/client/model_get_payment_response.go index 18de8c87..419f015e 100644 --- a/client/model_get_payment_response.go +++ b/client/model_get_payment_response.go @@ -65,7 +65,7 @@ func (o *GetPaymentResponse) SetData(v Payment) { } func (o GetPaymentResponse) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -113,5 +113,3 @@ func (v *NullableGetPaymentResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_list_connectors_response.go b/client/model_list_connectors_response.go index 6fdf9961..5a49bb64 100644 --- a/client/model_list_connectors_response.go +++ b/client/model_list_connectors_response.go @@ -67,7 +67,7 @@ func (o *ListConnectorsResponse) SetData(v interface{}) { } func (o ListConnectorsResponse) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -117,5 +117,3 @@ func (v *NullableListConnectorsResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_list_payments_response.go b/client/model_list_payments_response.go index bd5e2e43..3ae3f49f 100644 --- a/client/model_list_payments_response.go +++ b/client/model_list_payments_response.go @@ -67,7 +67,7 @@ func (o *ListPaymentsResponse) SetData(v interface{}) { } func (o ListPaymentsResponse) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -117,5 +117,3 @@ func (v *NullableListPaymentsResponse) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_modulr_config.go b/client/model_modulr_config.go index 4a361dd6..a70bc046 100644 --- a/client/model_modulr_config.go +++ b/client/model_modulr_config.go @@ -19,9 +19,9 @@ var _ MappedNullable = &ModulrConfig{} // ModulrConfig struct for ModulrConfig type ModulrConfig struct { - ApiKey interface{} `json:"apiKey"` + ApiKey interface{} `json:"apiKey"` ApiSecret interface{} `json:"apiSecret"` - Endpoint interface{} `json:"endpoint,omitempty"` + Endpoint interface{} `json:"endpoint,omitempty"` } // NewModulrConfig instantiates a new ModulrConfig object @@ -129,7 +129,7 @@ func (o *ModulrConfig) SetEndpoint(v interface{}) { } func (o ModulrConfig) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -185,5 +185,3 @@ func (v *NullableModulrConfig) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_payment.go b/client/model_payment.go index a151d5b4..2013d2f4 100644 --- a/client/model_payment.go +++ b/client/model_payment.go @@ -19,16 +19,16 @@ var _ MappedNullable = &Payment{} // Payment struct for Payment type Payment struct { - Provider interface{} `json:"provider"` + Provider interface{} `json:"provider"` Reference interface{} `json:"reference,omitempty"` - Scheme interface{} `json:"scheme"` - Status interface{} `json:"status"` - Type interface{} `json:"type"` - Id interface{} `json:"id"` - Amount interface{} `json:"amount"` - Asset interface{} `json:"asset"` - Date interface{} `json:"date"` - Raw interface{} `json:"raw,omitempty"` + Scheme interface{} `json:"scheme"` + Status interface{} `json:"status"` + Type interface{} `json:"type"` + Id interface{} `json:"id"` + Amount interface{} `json:"amount"` + Asset interface{} `json:"asset"` + Date interface{} `json:"date"` + Raw interface{} `json:"raw,omitempty"` } // NewPayment instantiates a new Payment object @@ -331,7 +331,7 @@ func (o *Payment) SetRaw(v interface{}) { } func (o Payment) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -408,5 +408,3 @@ func (v *NullablePayment) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_stripe_config.go b/client/model_stripe_config.go index 6f1d3dff..24a3dfa6 100644 --- a/client/model_stripe_config.go +++ b/client/model_stripe_config.go @@ -21,8 +21,8 @@ var _ MappedNullable = &StripeConfig{} type StripeConfig struct { // The frequency at which the connector will try to fetch new BalanceTransaction objects from Stripe api PollingPeriod interface{} `json:"pollingPeriod,omitempty"` - ApiKey interface{} `json:"apiKey"` - // Number of BalanceTransaction to fetch at each polling interval. + ApiKey interface{} `json:"apiKey"` + // Number of BalanceTransaction to fetch at each polling interval. PageSize interface{} `json:"pageSize,omitempty"` } @@ -137,7 +137,7 @@ func (o *StripeConfig) SetPageSize(v interface{}) { } func (o StripeConfig) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -193,5 +193,3 @@ func (v *NullableStripeConfig) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_stripe_task.go b/client/model_stripe_task.go index d4ca2380..e415aea5 100644 --- a/client/model_stripe_task.go +++ b/client/model_stripe_task.go @@ -27,7 +27,7 @@ type StripeTask struct { MoreRecentId interface{} `json:"moreRecentId,omitempty"` // The creation date of the more recent BalanceTransaction fetched from stripe for this account MoreRecentDate interface{} `json:"moreRecentDate,omitempty"` - NoMoreHistory interface{} `json:"noMoreHistory,omitempty"` + NoMoreHistory interface{} `json:"noMoreHistory,omitempty"` } // NewStripeTask instantiates a new StripeTask object @@ -213,7 +213,7 @@ func (o *StripeTask) SetNoMoreHistory(v interface{}) { } func (o StripeTask) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -275,5 +275,3 @@ func (v *NullableStripeTask) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/model_wise_config.go b/client/model_wise_config.go index b95b7656..2cf3aa87 100644 --- a/client/model_wise_config.go +++ b/client/model_wise_config.go @@ -67,7 +67,7 @@ func (o *WiseConfig) SetApiKey(v interface{}) { } func (o WiseConfig) MarshalJSON() ([]byte, error) { - toSerialize,err := o.ToMap() + toSerialize, err := o.ToMap() if err != nil { return []byte{}, err } @@ -117,5 +117,3 @@ func (v *NullableWiseConfig) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } - - diff --git a/client/test/api_payments_test.go b/client/test/api_payments_test.go new file mode 100644 index 00000000..3d87012d --- /dev/null +++ b/client/test/api_payments_test.go @@ -0,0 +1,158 @@ +/* +Payments API + +Testing PaymentsApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package client + +import ( + "context" + "testing" + + openapiclient "github.com/formancehq/payments/client" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func Test_client_PaymentsApiService(t *testing.T) { + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + + t.Run("Test PaymentsApiService GetAllConnectors", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.PaymentsApi.GetAllConnectors(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService GetAllConnectorsConfigs", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.PaymentsApi.GetAllConnectorsConfigs(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService GetConnectorTask", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var connector interface{} + var taskId interface{} + + resp, httpRes, err := apiClient.PaymentsApi.GetConnectorTask(context.Background(), connector, taskId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService GetPayment", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var paymentId interface{} + + resp, httpRes, err := apiClient.PaymentsApi.GetPayment(context.Background(), paymentId).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService InstallConnector", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var connector interface{} + + httpRes, err := apiClient.PaymentsApi.InstallConnector(context.Background(), connector).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService ListConnectorTasks", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var connector interface{} + + resp, httpRes, err := apiClient.PaymentsApi.ListConnectorTasks(context.Background(), connector).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService ListPayments", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + resp, httpRes, err := apiClient.PaymentsApi.ListPayments(context.Background()).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService ReadConnectorConfig", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var connector interface{} + + resp, httpRes, err := apiClient.PaymentsApi.ReadConnectorConfig(context.Background(), connector).Execute() + + require.Nil(t, err) + require.NotNil(t, resp) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService ResetConnector", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var connector interface{} + + httpRes, err := apiClient.PaymentsApi.ResetConnector(context.Background(), connector).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + + t.Run("Test PaymentsApiService UninstallConnector", func(t *testing.T) { + + t.Skip("skip test") // remove to run test + + var connector interface{} + + httpRes, err := apiClient.PaymentsApi.UninstallConnector(context.Background(), connector).Execute() + + require.Nil(t, err) + assert.Equal(t, 200, httpRes.StatusCode) + + }) + +} diff --git a/main.go b/main.go index 60931fd7..c52a3c1f 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,5 @@ -//go:generate docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:latest generate -i ./swagger.yml -g go -o ./client --git-user-id=formancehq --git-repo-id=payments -p packageVersion=latest -p isGoSubmodule=true -p packageName=client -//go:generate docker run --rm -w /local -v ${PWD}:/local cytopia/goimports -w -e ./client +//go:generate docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:v6.2.1 generate -i ./swagger.yml -g go -o ./client --git-user-id=formancehq --git-repo-id=payments/client -p packageVersion=latest -p isGoSubmodule=true -p packageName=client +//go:generate docker run --rm -w /local -v ${PWD}:/local cytopia/goimports: -w -e ./client package main import "github.com/formancehq/payments/cmd" From f265c84f83cec921de3bf0ab76c674228e891001 Mon Sep 17 00:00:00 2001 From: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com> Date: Fri, 23 Dec 2022 15:26:56 +0200 Subject: [PATCH 3/3] fix: merge conflicts Signed-off-by: Lawrence Zawila <113581282+darkmatterpool@users.noreply.github.com> --- client/.openapi-generator-ignore | 1 + client/.openapi-generator/FILES | 14 +- client/.openapi-generator/VERSION | 2 +- client/README.md | 8 + client/api/openapi.yaml | 186 ++++++++++++++++++++--- client/api_payments.go | 153 +++++++++++++++---- client/client.go | 163 ++++++-------------- client/configuration.go | 15 ++ client/docs/Connectors.md | 30 ++++ client/docs/PaymentsApi.md | 95 ++++++++++-- client/go.mod | 3 +- client/go.sum | 2 + client/model_banking_circle_config.go | 13 +- client/model_connector_base_info.go | 13 +- client/model_connectors.go | 77 ++++++++++ client/model_currency_cloud_config.go | 13 +- client/model_dummy_pay_config.go | 13 +- client/model_get_payment_response.go | 15 +- client/model_list_connectors_response.go | 13 +- client/model_list_payments_response.go | 13 +- client/model_modulr_config.go | 13 +- client/model_payment.go | 13 +- client/model_stripe_config.go | 13 +- client/model_stripe_task.go | 13 +- client/model_wise_config.go | 13 +- client/test/api_payments_test.go | 158 ------------------- client/utils.go | 4 - main.go | 4 +- 28 files changed, 582 insertions(+), 491 deletions(-) create mode 100644 client/docs/Connectors.md create mode 100644 client/model_connectors.go delete mode 100644 client/test/api_payments_test.go diff --git a/client/.openapi-generator-ignore b/client/.openapi-generator-ignore index 7484ee59..c09dc47b 100644 --- a/client/.openapi-generator-ignore +++ b/client/.openapi-generator-ignore @@ -21,3 +21,4 @@ #docs/*.md # Then explicitly reverse the ignore rule for a single file: #!docs/README.md +test/ \ No newline at end of file diff --git a/client/.openapi-generator/FILES b/client/.openapi-generator/FILES index 949fc56b..54d42d42 100644 --- a/client/.openapi-generator/FILES +++ b/client/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore .travis.yml README.md api/openapi.yaml @@ -8,9 +7,14 @@ client.go configuration.go docs/BankingCircleConfig.md docs/ConnectorBaseInfo.md +docs/ConnectorTaskBase.md +docs/Connectors.md docs/CurrencyCloudConfig.md docs/DummyPayConfig.md docs/GetPaymentResponse.md +docs/ListConnectorsConfigsResponse.md +docs/ListConnectorsConfigsResponseConnector.md +docs/ListConnectorsConfigsResponseConnectorKey.md docs/ListConnectorsResponse.md docs/ListPaymentsResponse.md docs/ModulrConfig.md @@ -18,22 +22,28 @@ docs/Payment.md docs/PaymentsApi.md docs/StripeConfig.md docs/StripeTask.md +docs/StripeTransferRequest.md docs/WiseConfig.md git_push.sh go.mod go.sum model_banking_circle_config.go model_connector_base_info.go +model_connector_task_base.go +model_connectors.go model_currency_cloud_config.go model_dummy_pay_config.go model_get_payment_response.go +model_list_connectors_configs_response.go +model_list_connectors_configs_response_connector.go +model_list_connectors_configs_response_connector_key.go model_list_connectors_response.go model_list_payments_response.go model_modulr_config.go model_payment.go model_stripe_config.go model_stripe_task.go +model_stripe_transfer_request.go model_wise_config.go response.go -test/api_payments_test.go utils.go diff --git a/client/.openapi-generator/VERSION b/client/.openapi-generator/VERSION index d6b4ec4a..0df17dd0 100644 --- a/client/.openapi-generator/VERSION +++ b/client/.openapi-generator/VERSION @@ -1 +1 @@ -6.3.0-SNAPSHOT \ No newline at end of file +6.2.1 \ No newline at end of file diff --git a/client/README.md b/client/README.md index 7ca0a070..5d05b226 100644 --- a/client/README.md +++ b/client/README.md @@ -15,6 +15,7 @@ Install the following dependencies: ```shell go get github.com/stretchr/testify/assert +go get golang.org/x/oauth2 go get golang.org/x/net/context ``` @@ -77,6 +78,7 @@ All URIs are relative to *http://localhost* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*PaymentsApi* | [**ConnectorsStripeTransfer**](docs/PaymentsApi.md#connectorsstripetransfer) | **Post** /connectors/stripe/transfer | Transfer funds between Stripe accounts *PaymentsApi* | [**GetAllConnectors**](docs/PaymentsApi.md#getallconnectors) | **Get** /connectors | Get all installed connectors *PaymentsApi* | [**GetAllConnectorsConfigs**](docs/PaymentsApi.md#getallconnectorsconfigs) | **Get** /connectors/configs | Get all available connectors configs *PaymentsApi* | [**GetConnectorTask**](docs/PaymentsApi.md#getconnectortask) | **Get** /connectors/{connector}/tasks/{taskId} | Read a specific task of the connector @@ -93,15 +95,21 @@ Class | Method | HTTP request | Description - [BankingCircleConfig](docs/BankingCircleConfig.md) - [ConnectorBaseInfo](docs/ConnectorBaseInfo.md) + - [ConnectorTaskBase](docs/ConnectorTaskBase.md) + - [Connectors](docs/Connectors.md) - [CurrencyCloudConfig](docs/CurrencyCloudConfig.md) - [DummyPayConfig](docs/DummyPayConfig.md) - [GetPaymentResponse](docs/GetPaymentResponse.md) + - [ListConnectorsConfigsResponse](docs/ListConnectorsConfigsResponse.md) + - [ListConnectorsConfigsResponseConnector](docs/ListConnectorsConfigsResponseConnector.md) + - [ListConnectorsConfigsResponseConnectorKey](docs/ListConnectorsConfigsResponseConnectorKey.md) - [ListConnectorsResponse](docs/ListConnectorsResponse.md) - [ListPaymentsResponse](docs/ListPaymentsResponse.md) - [ModulrConfig](docs/ModulrConfig.md) - [Payment](docs/Payment.md) - [StripeConfig](docs/StripeConfig.md) - [StripeTask](docs/StripeTask.md) + - [StripeTransferRequest](docs/StripeTransferRequest.md) - [WiseConfig](docs/WiseConfig.md) diff --git a/client/api/openapi.yaml b/client/api/openapi.yaml index 1d19ec2e..f8f9f45a 100644 --- a/client/api/openapi.yaml +++ b/client/api/openapi.yaml @@ -91,7 +91,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ConnectorConfig' + $ref: '#/components/schemas/ListConnectorsConfigsResponse' description: List of available connectors configs summary: Get all available connectors configs tags: @@ -107,8 +107,7 @@ paths: name: connector required: true schema: - enum: - - stripe + $ref: '#/components/schemas/Connectors' style: simple responses: "204": @@ -126,12 +125,7 @@ paths: name: connector required: true schema: - enum: - - stripe - - dummypay - - wise - - modulr - - currencycloud + $ref: '#/components/schemas/Connectors' style: simple requestBody: content: @@ -156,8 +150,7 @@ paths: name: connector required: true schema: - enum: - - stripe + $ref: '#/components/schemas/Connectors' style: simple responses: "200": @@ -181,8 +174,7 @@ paths: name: connector required: true schema: - enum: - - stripe + $ref: '#/components/schemas/Connectors' style: simple responses: "204": @@ -201,8 +193,7 @@ paths: name: connector required: true schema: - enum: - - stripe + $ref: '#/components/schemas/Connectors' style: simple responses: "200": @@ -210,7 +201,13 @@ paths: application/json: schema: items: - $ref: '#/components/schemas/ConnectorTask' + oneOf: + - $ref: '#/components/schemas/TaskDescriptorStripe' + - $ref: '#/components/schemas/TaskDescriptorWise' + - $ref: '#/components/schemas/TaskDescriptorCurrencyCloud' + - $ref: '#/components/schemas/TaskDescriptorDummyPay' + - $ref: '#/components/schemas/TaskDescriptorModulr' + - $ref: '#/components/schemas/TaskDescriptorBankingCircle' description: Task list summary: List connector tasks tags: @@ -226,8 +223,7 @@ paths: name: connector required: true schema: - enum: - - stripe + $ref: '#/components/schemas/Connectors' style: simple - description: The task id example: task1 @@ -242,13 +238,43 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/ConnectorTask' + oneOf: + - $ref: '#/components/schemas/TaskDescriptorStripe' + - $ref: '#/components/schemas/TaskDescriptorWise' + - $ref: '#/components/schemas/TaskDescriptorCurrencyCloud' + - $ref: '#/components/schemas/TaskDescriptorDummyPay' + - $ref: '#/components/schemas/TaskDescriptorModulr' + - $ref: '#/components/schemas/TaskDescriptorBankingCircle' description: The specified task summary: Read a specific task of the connector tags: - Payments + /connectors/stripe/transfer: + post: + description: Execute a transfer between two Stripe accounts + operationId: connectorsStripeTransfer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/StripeTransferRequest' + required: true + responses: + "200": + description: Transfer has been executed + summary: Transfer funds between Stripe accounts + tags: + - Payments components: schemas: + Connectors: + enum: + - STRIPE + - DUMMY-PAY + - SIE + - MODULR + - CURRENCY-CLOUD + - BANKING-CIRCLE ConnectorConfig: oneOf: - $ref: '#/components/schemas/StripeConfig' @@ -257,9 +283,6 @@ components: - $ref: '#/components/schemas/ModulrConfig' - $ref: '#/components/schemas/CurrencyCloudConfig' - $ref: '#/components/schemas/BankingCircleConfig' - ConnectorTask: - oneOf: - - $ref: '#/components/schemas/StripeTask' StripeConfig: properties: pollingPeriod: @@ -435,9 +458,128 @@ components: $ref: '#/components/schemas/ConnectorBaseInfo' required: - data + ListConnectorsConfigsResponse: + example: + connector: + key: + datatype: "" + required: "" + properties: + connector: + $ref: '#/components/schemas/ListConnectorsConfigsResponse_connector' ConnectorBaseInfo: properties: provider: example: stripe disabled: example: false + StripeTransferRequest: + example: + amount: 100 + metadata: + order_id: "6735" + destination: acct_1Gqj58KZcSIg2N2q + asset: USD + properties: + amount: + example: 100 + asset: + example: USD + destination: + example: acct_1Gqj58KZcSIg2N2q + metadata: + description: | + A set of key/value pairs that you can attach to a transfer object. + It can be useful for storing additional information about the transfer in a structured format. + example: + order_id: "6735" + ConnectorTaskBase: + properties: + provider: + description: The connector code + example: stripe + createdAt: + description: The date when the task was created + example: 2020-01-01T00:00:00.000Z + format: date-time + status: + description: The task status + enum: + - stopped + - pending + - terminated + - active + - failed + example: stopped + error: + description: The error message if the task failed + example: "Error: Something went wrong" + state: + description: The task state + example: {} + TaskDescriptorStripe: + allOf: + - $ref: '#/components/schemas/ConnectorTaskBase' + - properties: + descriptor: + properties: + name: {} + main: {} + account: {} + TaskDescriptorWise: + allOf: + - $ref: '#/components/schemas/ConnectorTaskBase' + - properties: + descriptor: + properties: + name: {} + key: {} + profileID: {} + TaskDescriptorModulr: + allOf: + - $ref: '#/components/schemas/ConnectorTaskBase' + - properties: + descriptor: + properties: + name: {} + key: {} + accountID: {} + TaskDescriptorDummyPay: + allOf: + - $ref: '#/components/schemas/ConnectorTaskBase' + - properties: + descriptor: + properties: + name: {} + key: {} + fileName: {} + TaskDescriptorCurrencyCloud: + allOf: + - $ref: '#/components/schemas/ConnectorTaskBase' + - properties: + descriptor: + properties: + name: {} + TaskDescriptorBankingCircle: + allOf: + - $ref: '#/components/schemas/ConnectorTaskBase' + - properties: + descriptor: + properties: + name: {} + key: {} + ListConnectorsConfigsResponse_connector_key: + example: + datatype: "" + required: "" + properties: + datatype: {} + required: {} + ListConnectorsConfigsResponse_connector: + example: + key: + datatype: "" + required: "" + properties: + key: + $ref: '#/components/schemas/ListConnectorsConfigsResponse_connector_key' diff --git a/client/api_payments.go b/client/api_payments.go index 5b6b418e..4cabc8a2 100644 --- a/client/api_payments.go +++ b/client/api_payments.go @@ -22,6 +22,105 @@ import ( // PaymentsApiService PaymentsApi service type PaymentsApiService service +type ApiConnectorsStripeTransferRequest struct { + ctx context.Context + ApiService *PaymentsApiService + stripeTransferRequest *StripeTransferRequest +} + +func (r ApiConnectorsStripeTransferRequest) StripeTransferRequest(stripeTransferRequest StripeTransferRequest) ApiConnectorsStripeTransferRequest { + r.stripeTransferRequest = &stripeTransferRequest + return r +} + +func (r ApiConnectorsStripeTransferRequest) Execute() (*http.Response, error) { + return r.ApiService.ConnectorsStripeTransferExecute(r) +} + +/* +ConnectorsStripeTransfer Transfer funds between Stripe accounts + +Execute a transfer between two Stripe accounts + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiConnectorsStripeTransferRequest +*/ +func (a *PaymentsApiService) ConnectorsStripeTransfer(ctx context.Context) ApiConnectorsStripeTransferRequest { + return ApiConnectorsStripeTransferRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +func (a *PaymentsApiService) ConnectorsStripeTransferExecute(r ApiConnectorsStripeTransferRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.ConnectorsStripeTransfer") + if err != nil { + return nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/connectors/stripe/transfer" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.stripeTransferRequest == nil { + return nil, reportError("stripeTransferRequest is required and must be specified") + } + + // 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{} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.stripeTransferRequest + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.client.callAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := ioutil.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = ioutil.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &GenericOpenAPIError{ + body: localVarBody, + error: localVarHTTPResponse.Status, + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + type ApiGetAllConnectorsRequest struct { ctx context.Context ApiService *PaymentsApiService @@ -126,7 +225,7 @@ type ApiGetAllConnectorsConfigsRequest struct { ApiService *PaymentsApiService } -func (r ApiGetAllConnectorsConfigsRequest) Execute() (interface{}, *http.Response, error) { +func (r ApiGetAllConnectorsConfigsRequest) Execute() (*ListConnectorsConfigsResponse, *http.Response, error) { return r.ApiService.GetAllConnectorsConfigsExecute(r) } @@ -146,13 +245,13 @@ func (a *PaymentsApiService) GetAllConnectorsConfigs(ctx context.Context) ApiGet } // Execute executes the request -// @return interface{} -func (a *PaymentsApiService) GetAllConnectorsConfigsExecute(r ApiGetAllConnectorsConfigsRequest) (interface{}, *http.Response, error) { +// @return ListConnectorsConfigsResponse +func (a *PaymentsApiService) GetAllConnectorsConfigsExecute(r ApiGetAllConnectorsConfigsRequest) (*ListConnectorsConfigsResponse, *http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue interface{} + localVarReturnValue *ListConnectorsConfigsResponse ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PaymentsApiService.GetAllConnectorsConfigs") @@ -223,7 +322,7 @@ func (a *PaymentsApiService) GetAllConnectorsConfigsExecute(r ApiGetAllConnector type ApiGetConnectorTaskRequest struct { ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector Connectors taskId interface{} } @@ -241,7 +340,7 @@ Get a specific task associated to the connector @param taskId The task id @return ApiGetConnectorTaskRequest */ -func (a *PaymentsApiService) GetConnectorTask(ctx context.Context, connector interface{}, taskId interface{}) ApiGetConnectorTaskRequest { +func (a *PaymentsApiService) GetConnectorTask(ctx context.Context, connector Connectors, taskId interface{}) ApiGetConnectorTaskRequest { return ApiGetConnectorTaskRequest{ ApiService: a, ctx: ctx, @@ -266,8 +365,8 @@ func (a *PaymentsApiService) GetConnectorTaskExecute(r ApiGetConnectorTaskReques } localVarPath := localBasePath + "/connectors/{connector}/tasks/{taskId}" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", url.PathEscape(parameterValueToString(r.taskId, "taskId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"taskId"+"}", url.PathEscape(parameterToString(r.taskId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -368,7 +467,7 @@ func (a *PaymentsApiService) GetPaymentExecute(r ApiGetPaymentRequest) (*Payment } localVarPath := localBasePath + "/payments/{paymentId}" - localVarPath = strings.Replace(localVarPath, "{"+"paymentId"+"}", url.PathEscape(parameterValueToString(r.paymentId, "paymentId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"paymentId"+"}", url.PathEscape(parameterToString(r.paymentId, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -431,7 +530,7 @@ func (a *PaymentsApiService) GetPaymentExecute(r ApiGetPaymentRequest) (*Payment type ApiInstallConnectorRequest struct { ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector Connectors body *interface{} } @@ -453,7 +552,7 @@ Install connector @param connector The connector code @return ApiInstallConnectorRequest */ -func (a *PaymentsApiService) InstallConnector(ctx context.Context, connector interface{}) ApiInstallConnectorRequest { +func (a *PaymentsApiService) InstallConnector(ctx context.Context, connector Connectors) ApiInstallConnectorRequest { return ApiInstallConnectorRequest{ ApiService: a, ctx: ctx, @@ -475,7 +574,7 @@ func (a *PaymentsApiService) InstallConnectorExecute(r ApiInstallConnectorReques } localVarPath := localBasePath + "/connectors/{connector}" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -534,7 +633,7 @@ func (a *PaymentsApiService) InstallConnectorExecute(r ApiInstallConnectorReques type ApiListConnectorTasksRequest struct { ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector Connectors } func (r ApiListConnectorTasksRequest) Execute() (interface{}, *http.Response, error) { @@ -550,7 +649,7 @@ List all tasks associated with this connector. @param connector The connector code @return ApiListConnectorTasksRequest */ -func (a *PaymentsApiService) ListConnectorTasks(ctx context.Context, connector interface{}) ApiListConnectorTasksRequest { +func (a *PaymentsApiService) ListConnectorTasks(ctx context.Context, connector Connectors) ApiListConnectorTasksRequest { return ApiListConnectorTasksRequest{ ApiService: a, ctx: ctx, @@ -574,7 +673,7 @@ func (a *PaymentsApiService) ListConnectorTasksExecute(r ApiListConnectorTasksRe } localVarPath := localBasePath + "/connectors/{connector}/tasks" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -699,13 +798,13 @@ func (a *PaymentsApiService) ListPaymentsExecute(r ApiListPaymentsRequest) (*Lis localVarFormParams := url.Values{} if r.limit != nil { - parameterAddToQuery(localVarQueryParams, "limit", r.limit, "") + localVarQueryParams.Add("limit", parameterToString(*r.limit, "")) } if r.skip != nil { - parameterAddToQuery(localVarQueryParams, "skip", r.skip, "") + localVarQueryParams.Add("skip", parameterToString(*r.skip, "")) } if r.sort != nil { - parameterAddToQuery(localVarQueryParams, "sort", r.sort, "") + localVarQueryParams.Add("sort", parameterToString(*r.sort, "")) } // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -764,7 +863,7 @@ func (a *PaymentsApiService) ListPaymentsExecute(r ApiListPaymentsRequest) (*Lis type ApiReadConnectorConfigRequest struct { ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector Connectors } func (r ApiReadConnectorConfigRequest) Execute() (interface{}, *http.Response, error) { @@ -780,7 +879,7 @@ Read connector config @param connector The connector code @return ApiReadConnectorConfigRequest */ -func (a *PaymentsApiService) ReadConnectorConfig(ctx context.Context, connector interface{}) ApiReadConnectorConfigRequest { +func (a *PaymentsApiService) ReadConnectorConfig(ctx context.Context, connector Connectors) ApiReadConnectorConfigRequest { return ApiReadConnectorConfigRequest{ ApiService: a, ctx: ctx, @@ -804,7 +903,7 @@ func (a *PaymentsApiService) ReadConnectorConfigExecute(r ApiReadConnectorConfig } localVarPath := localBasePath + "/connectors/{connector}/config" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -867,7 +966,7 @@ func (a *PaymentsApiService) ReadConnectorConfigExecute(r ApiReadConnectorConfig type ApiResetConnectorRequest struct { ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector Connectors } func (r ApiResetConnectorRequest) Execute() (*http.Response, error) { @@ -883,7 +982,7 @@ Reset connector. Will remove the connector and ALL PAYMENTS generated with it. @param connector The connector code @return ApiResetConnectorRequest */ -func (a *PaymentsApiService) ResetConnector(ctx context.Context, connector interface{}) ApiResetConnectorRequest { +func (a *PaymentsApiService) ResetConnector(ctx context.Context, connector Connectors) ApiResetConnectorRequest { return ApiResetConnectorRequest{ ApiService: a, ctx: ctx, @@ -905,7 +1004,7 @@ func (a *PaymentsApiService) ResetConnectorExecute(r ApiResetConnectorRequest) ( } localVarPath := localBasePath + "/connectors/{connector}/reset" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -959,7 +1058,7 @@ func (a *PaymentsApiService) ResetConnectorExecute(r ApiResetConnectorRequest) ( type ApiUninstallConnectorRequest struct { ctx context.Context ApiService *PaymentsApiService - connector interface{} + connector Connectors } func (r ApiUninstallConnectorRequest) Execute() (*http.Response, error) { @@ -975,7 +1074,7 @@ Uninstall connector @param connector The connector code @return ApiUninstallConnectorRequest */ -func (a *PaymentsApiService) UninstallConnector(ctx context.Context, connector interface{}) ApiUninstallConnectorRequest { +func (a *PaymentsApiService) UninstallConnector(ctx context.Context, connector Connectors) ApiUninstallConnectorRequest { return ApiUninstallConnectorRequest{ ApiService: a, ctx: ctx, @@ -997,7 +1096,7 @@ func (a *PaymentsApiService) UninstallConnectorExecute(r ApiUninstallConnectorRe } localVarPath := localBasePath + "/connectors/{connector}" - localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterValueToString(r.connector, "connector")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"connector"+"}", url.PathEscape(parameterToString(r.connector, "")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} diff --git a/client/client.go b/client/client.go index 4b8537eb..86a30b52 100644 --- a/client/client.go +++ b/client/client.go @@ -32,13 +32,13 @@ import ( "strings" "time" "unicode/utf8" + + "golang.org/x/oauth2" ) var ( - jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) - xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) - queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) - queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") + jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) ) // APIClient manages communication with the Payments API API v1.0.0 @@ -125,101 +125,28 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { return nil } -func parameterValueToString(obj interface{}, key string) string { - if reflect.TypeOf(obj).Kind() != reflect.Ptr { - return fmt.Sprintf("%v", obj) - } - var param, ok = obj.(MappedNullable) - if !ok { - return "" - } - dataMap, err := param.ToMap() - if err != nil { - return "" - } - return fmt.Sprintf("%v", dataMap[key]) -} - -// parameterAddToQuery adds the provided object to the url query supporting deep object syntax -func parameterAddToQuery(queryParams interface{}, keyPrefix string, obj interface{}, collectionType string) { - var v = reflect.ValueOf(obj) - var value = "" - if v == reflect.ValueOf(nil) { - value = "null" - } else { - switch v.Kind() { - case reflect.Invalid: - value = "invalid" - - case reflect.Struct: - if t, ok := obj.(MappedNullable); ok { - dataMap, err := t.ToMap() - if err != nil { - return - } - parameterAddToQuery(queryParams, keyPrefix, dataMap, collectionType) - return - } - if t, ok := obj.(time.Time); ok { - parameterAddToQuery(queryParams, keyPrefix, t.Format(time.RFC3339), collectionType) - return - } - value = v.Type().String() + " value" - case reflect.Slice: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - var lenIndValue = indValue.Len() - for i := 0; i < lenIndValue; i++ { - var arrayValue = indValue.Index(i) - parameterAddToQuery(queryParams, keyPrefix, arrayValue.Interface(), collectionType) - } - return - - case reflect.Map: - var indValue = reflect.ValueOf(obj) - if indValue == reflect.ValueOf(nil) { - return - } - iter := indValue.MapRange() - for iter.Next() { - k, v := iter.Key(), iter.Value() - parameterAddToQuery(queryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType) - } - return +// parameterToString convert interface{} parameters to string, using a delimiter if format is provided. +func parameterToString(obj interface{}, collectionFormat string) string { + var delimiter string - case reflect.Interface: - fallthrough - case reflect.Ptr: - parameterAddToQuery(queryParams, keyPrefix, v.Elem().Interface(), collectionType) - return - - case reflect.Int, reflect.Int8, reflect.Int16, - reflect.Int32, reflect.Int64: - value = strconv.FormatInt(v.Int(), 10) - case reflect.Uint, reflect.Uint8, reflect.Uint16, - reflect.Uint32, reflect.Uint64, reflect.Uintptr: - value = strconv.FormatUint(v.Uint(), 10) - case reflect.Float32, reflect.Float64: - value = strconv.FormatFloat(v.Float(), 'g', -1, 32) - case reflect.Bool: - value = strconv.FormatBool(v.Bool()) - case reflect.String: - value = v.String() - default: - value = v.Type().String() + " value" - } + switch collectionFormat { + case "pipes": + delimiter = "|" + case "ssv": + delimiter = " " + case "tsv": + delimiter = "\t" + case "csv": + delimiter = "," } - switch valuesMap := queryParams.(type) { - case url.Values: - valuesMap.Add(keyPrefix, value) - break - case map[string]string: - valuesMap[keyPrefix] = value - break + if reflect.TypeOf(obj).Kind() == reflect.Slice { + return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) } + + return fmt.Sprintf("%v", obj) } // helper for converting interface{} parameters to json strings @@ -371,11 +298,7 @@ func (c *APIClient) prepareRequest( } // Encode the parameters. - url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { - pieces := strings.Split(s, "=") - pieces[0] = queryDescape.Replace(pieces[0]) - return strings.Join(pieces, "=") - }) + url.RawQuery = query.Encode() // Generate a new request if body != nil { @@ -405,6 +328,27 @@ func (c *APIClient) prepareRequest( // Walk through any authentication. + // OAuth2 authentication + if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok { + // We were able to grab an oauth2 token from the context + var latestToken *oauth2.Token + if latestToken, err = tok.Token(); err != nil { + return nil, err + } + + latestToken.SetAuthHeader(localVarRequest) + } + + // Basic HTTP Authentication + if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok { + localVarRequest.SetBasicAuth(auth.UserName, auth.Password) + } + + // AccessToken Authentication + if auth, ok := ctx.Value(ContextAccessToken).(string); ok { + localVarRequest.Header.Add("Authorization", "Bearer "+auth) + } + } for header, value := range c.cfg.DefaultHeader { @@ -421,18 +365,6 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err *s = string(b) return nil } - if f, ok := v.(*os.File); ok { - f, err = ioutil.TempFile("", "HttpClientFile") - if err != nil { - return - } - _, err = f.Write(b) - if err != nil { - return - } - _, err = f.Seek(0, io.SeekStart) - return - } if f, ok := v.(**os.File); ok { *f, err = ioutil.TempFile("", "HttpClientFile") if err != nil { @@ -508,8 +440,8 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e if reader, ok := body.(io.Reader); ok { _, err = bodyBuf.ReadFrom(reader) - } else if fp, ok := body.(*os.File); ok { - _, err = bodyBuf.ReadFrom(fp) + } else if fp, ok := body.(**os.File); ok { + _, err = bodyBuf.ReadFrom(*fp) } else if b, ok := body.([]byte); ok { _, err = bodyBuf.Write(b) } else if s, ok := body.(string); ok { @@ -632,6 +564,7 @@ func (e GenericOpenAPIError) Model() interface{} { // format error message using title and detail when model implements rfc7807 func formatErrorMessage(status string, v interface{}) string { + str := "" metaValue := reflect.ValueOf(v).Elem() @@ -646,5 +579,5 @@ func formatErrorMessage(status string, v interface{}) string { } // status title (detail) - return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) + return fmt.Sprintf("%s %s", status, str) } diff --git a/client/configuration.go b/client/configuration.go index a7715b78..ba2061bb 100644 --- a/client/configuration.go +++ b/client/configuration.go @@ -28,6 +28,21 @@ func (c contextKey) String() string { } var ( + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. + ContextOAuth2 = contextKey("token") + + // ContextBasicAuth takes BasicAuth as authentication for the request. + ContextBasicAuth = contextKey("basic") + + // ContextAccessToken takes a string oauth2 access token as authentication for the request. + ContextAccessToken = contextKey("accesstoken") + + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request. + ContextHttpSignatureAuth = contextKey("httpsignature") + // ContextServerIndex uses a server configuration from the index. ContextServerIndex = contextKey("serverIndex") diff --git a/client/docs/Connectors.md b/client/docs/Connectors.md new file mode 100644 index 00000000..24123a55 --- /dev/null +++ b/client/docs/Connectors.md @@ -0,0 +1,30 @@ +# Connectors + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +## Methods + +### NewConnectors + +`func NewConnectors() *Connectors` + +NewConnectors instantiates a new Connectors object +This constructor will assign default values to properties that have it defined, +and makes sure properties required by API are set, but the set of arguments +will change when the set of required properties is changed + +### NewConnectorsWithDefaults + +`func NewConnectorsWithDefaults() *Connectors` + +NewConnectorsWithDefaults instantiates a new Connectors object +This constructor will only assign default values to properties that have it defined, +but it doesn't guarantee that properties required by API are set + + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/client/docs/PaymentsApi.md b/client/docs/PaymentsApi.md index 02b4ed0d..6c42f9f8 100644 --- a/client/docs/PaymentsApi.md +++ b/client/docs/PaymentsApi.md @@ -4,6 +4,7 @@ All URIs are relative to *http://localhost* Method | HTTP request | Description ------------- | ------------- | ------------- +[**ConnectorsStripeTransfer**](PaymentsApi.md#ConnectorsStripeTransfer) | **Post** /connectors/stripe/transfer | Transfer funds between Stripe accounts [**GetAllConnectors**](PaymentsApi.md#GetAllConnectors) | **Get** /connectors | Get all installed connectors [**GetAllConnectorsConfigs**](PaymentsApi.md#GetAllConnectorsConfigs) | **Get** /connectors/configs | Get all available connectors configs [**GetConnectorTask**](PaymentsApi.md#GetConnectorTask) | **Get** /connectors/{connector}/tasks/{taskId} | Read a specific task of the connector @@ -17,6 +18,70 @@ Method | HTTP request | Description +## ConnectorsStripeTransfer + +> ConnectorsStripeTransfer(ctx).StripeTransferRequest(stripeTransferRequest).Execute() + +Transfer funds between Stripe accounts + + + +### Example + +```go +package main + +import ( + "context" + "fmt" + "os" + openapiclient "./openapi" +) + +func main() { + stripeTransferRequest := *openapiclient.NewStripeTransferRequest() // StripeTransferRequest | + + configuration := openapiclient.NewConfiguration() + apiClient := openapiclient.NewAPIClient(configuration) + resp, r, err := apiClient.PaymentsApi.ConnectorsStripeTransfer(context.Background()).StripeTransferRequest(stripeTransferRequest).Execute() + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.ConnectorsStripeTransfer``: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} +``` + +### Path Parameters + + + +### Other Parameters + +Other parameters are passed through a pointer to a apiConnectorsStripeTransferRequest struct via the builder pattern + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **stripeTransferRequest** | [**StripeTransferRequest**](StripeTransferRequest.md) | | + +### Return type + + (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + ## GetAllConnectors > ListConnectorsResponse GetAllConnectors(ctx).Execute() @@ -80,7 +145,7 @@ No authorization required ## GetAllConnectorsConfigs -> interface{} GetAllConnectorsConfigs(ctx).Execute() +> ListConnectorsConfigsResponse GetAllConnectorsConfigs(ctx).Execute() Get all available connectors configs @@ -107,7 +172,7 @@ func main() { fmt.Fprintf(os.Stderr, "Error when calling `PaymentsApi.GetAllConnectorsConfigs``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) } - // response from `GetAllConnectorsConfigs`: interface{} + // response from `GetAllConnectorsConfigs`: ListConnectorsConfigsResponse fmt.Fprintf(os.Stdout, "Response from `PaymentsApi.GetAllConnectorsConfigs`: %v\n", resp) } ``` @@ -123,7 +188,7 @@ Other parameters are passed through a pointer to a apiGetAllConnectorsConfigsReq ### Return type -**interface{}** +[**ListConnectorsConfigsResponse**](ListConnectorsConfigsResponse.md) ### Authorization @@ -160,7 +225,7 @@ import ( ) func main() { - connector := TODO // interface{} | The connector code + connector := *openapiclient.NewConnectors() // Connectors | The connector code taskId := TODO // interface{} | The task id configuration := openapiclient.NewConfiguration() @@ -181,7 +246,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | [**interface{}**](.md) | The connector code | +**connector** | [**Connectors**](.md) | The connector code | **taskId** | [**interface{}**](.md) | The task id | ### Other Parameters @@ -301,7 +366,7 @@ import ( ) func main() { - connector := TODO // interface{} | The connector code + connector := *openapiclient.NewConnectors() // Connectors | The connector code body := interface{}(987) // interface{} | configuration := openapiclient.NewConfiguration() @@ -320,7 +385,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | [**interface{}**](.md) | The connector code | +**connector** | [**Connectors**](.md) | The connector code | ### Other Parameters @@ -371,7 +436,7 @@ import ( ) func main() { - connector := TODO // interface{} | The connector code + connector := *openapiclient.NewConnectors() // Connectors | The connector code configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -391,7 +456,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | [**interface{}**](.md) | The connector code | +**connector** | [**Connectors**](.md) | The connector code | ### Other Parameters @@ -509,7 +574,7 @@ import ( ) func main() { - connector := TODO // interface{} | The connector code + connector := *openapiclient.NewConnectors() // Connectors | The connector code configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -529,7 +594,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | [**interface{}**](.md) | The connector code | +**connector** | [**Connectors**](.md) | The connector code | ### Other Parameters @@ -579,7 +644,7 @@ import ( ) func main() { - connector := TODO // interface{} | The connector code + connector := *openapiclient.NewConnectors() // Connectors | The connector code configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -597,7 +662,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | [**interface{}**](.md) | The connector code | +**connector** | [**Connectors**](.md) | The connector code | ### Other Parameters @@ -647,7 +712,7 @@ import ( ) func main() { - connector := TODO // interface{} | The connector code + connector := *openapiclient.NewConnectors() // Connectors | The connector code configuration := openapiclient.NewConfiguration() apiClient := openapiclient.NewAPIClient(configuration) @@ -665,7 +730,7 @@ func main() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**connector** | [**interface{}**](.md) | The connector code | +**connector** | [**Connectors**](.md) | The connector code | ### Other Parameters diff --git a/client/go.mod b/client/go.mod index 1cda6c9b..60048988 100644 --- a/client/go.mod +++ b/client/go.mod @@ -1,6 +1,7 @@ -module github.com/numary/payments/client +module github.com/formancehq/payments/client go 1.13 require ( + golang.org/x/oauth2 v0.0.0-20210323180902-22b0adad7558 ) diff --git a/client/go.sum b/client/go.sum index c966c8dd..734252e6 100644 --- a/client/go.sum +++ b/client/go.sum @@ -4,6 +4,8 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/client/model_banking_circle_config.go b/client/model_banking_circle_config.go index 0681f44e..3374bd28 100644 --- a/client/model_banking_circle_config.go +++ b/client/model_banking_circle_config.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the BankingCircleConfig type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &BankingCircleConfig{} - // BankingCircleConfig struct for BankingCircleConfig type BankingCircleConfig struct { Username interface{} `json:"username"` @@ -151,14 +148,6 @@ func (o *BankingCircleConfig) SetAuthorizationEndpoint(v interface{}) { } func (o BankingCircleConfig) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o BankingCircleConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.Username != nil { toSerialize["username"] = o.Username @@ -172,7 +161,7 @@ func (o BankingCircleConfig) ToMap() (map[string]interface{}, error) { if o.AuthorizationEndpoint != nil { toSerialize["authorizationEndpoint"] = o.AuthorizationEndpoint } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableBankingCircleConfig struct { diff --git a/client/model_connector_base_info.go b/client/model_connector_base_info.go index a8b25302..8ab27f25 100644 --- a/client/model_connector_base_info.go +++ b/client/model_connector_base_info.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the ConnectorBaseInfo type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ConnectorBaseInfo{} - // ConnectorBaseInfo struct for ConnectorBaseInfo type ConnectorBaseInfo struct { Provider interface{} `json:"provider,omitempty"` @@ -107,14 +104,6 @@ func (o *ConnectorBaseInfo) SetDisabled(v interface{}) { } func (o ConnectorBaseInfo) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ConnectorBaseInfo) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.Provider != nil { toSerialize["provider"] = o.Provider @@ -122,7 +111,7 @@ func (o ConnectorBaseInfo) ToMap() (map[string]interface{}, error) { if o.Disabled != nil { toSerialize["disabled"] = o.Disabled } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableConnectorBaseInfo struct { diff --git a/client/model_connectors.go b/client/model_connectors.go new file mode 100644 index 00000000..6d076674 --- /dev/null +++ b/client/model_connectors.go @@ -0,0 +1,77 @@ +/* +Payments API + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package client + +import ( + "encoding/json" +) + +// Connectors struct for Connectors +type Connectors struct { +} + +// NewConnectors instantiates a new Connectors object +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed +func NewConnectors() *Connectors { + this := Connectors{} + return &this +} + +// NewConnectorsWithDefaults instantiates a new Connectors object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewConnectorsWithDefaults() *Connectors { + this := Connectors{} + return &this +} + +func (o Connectors) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + return json.Marshal(toSerialize) +} + +type NullableConnectors struct { + value *Connectors + isSet bool +} + +func (v NullableConnectors) Get() *Connectors { + return v.value +} + +func (v *NullableConnectors) Set(val *Connectors) { + v.value = val + v.isSet = true +} + +func (v NullableConnectors) IsSet() bool { + return v.isSet +} + +func (v *NullableConnectors) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConnectors(val *Connectors) *NullableConnectors { + return &NullableConnectors{value: val, isSet: true} +} + +func (v NullableConnectors) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConnectors) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/client/model_currency_cloud_config.go b/client/model_currency_cloud_config.go index 428ef15d..9b38db17 100644 --- a/client/model_currency_cloud_config.go +++ b/client/model_currency_cloud_config.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the CurrencyCloudConfig type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &CurrencyCloudConfig{} - // CurrencyCloudConfig struct for CurrencyCloudConfig type CurrencyCloudConfig struct { ApiKey interface{} `json:"apiKey"` @@ -166,14 +163,6 @@ func (o *CurrencyCloudConfig) SetEndpoint(v interface{}) { } func (o CurrencyCloudConfig) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o CurrencyCloudConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.ApiKey != nil { toSerialize["apiKey"] = o.ApiKey @@ -187,7 +176,7 @@ func (o CurrencyCloudConfig) ToMap() (map[string]interface{}, error) { if o.Endpoint != nil { toSerialize["endpoint"] = o.Endpoint } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableCurrencyCloudConfig struct { diff --git a/client/model_dummy_pay_config.go b/client/model_dummy_pay_config.go index 5c35970f..83e4302a 100644 --- a/client/model_dummy_pay_config.go +++ b/client/model_dummy_pay_config.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the DummyPayConfig type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &DummyPayConfig{} - // DummyPayConfig struct for DummyPayConfig type DummyPayConfig struct { // The frequency at which the connector will try to fetch new payment objects from the directory @@ -137,14 +134,6 @@ func (o *DummyPayConfig) SetDirectory(v interface{}) { } func (o DummyPayConfig) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o DummyPayConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.FilePollingPeriod != nil { toSerialize["filePollingPeriod"] = o.FilePollingPeriod @@ -155,7 +144,7 @@ func (o DummyPayConfig) ToMap() (map[string]interface{}, error) { if o.Directory != nil { toSerialize["directory"] = o.Directory } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableDummyPayConfig struct { diff --git a/client/model_get_payment_response.go b/client/model_get_payment_response.go index 419f015e..4f3d71f4 100644 --- a/client/model_get_payment_response.go +++ b/client/model_get_payment_response.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the GetPaymentResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &GetPaymentResponse{} - // GetPaymentResponse struct for GetPaymentResponse type GetPaymentResponse struct { Data Payment `json:"data"` @@ -65,19 +62,13 @@ func (o *GetPaymentResponse) SetData(v Payment) { } func (o GetPaymentResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err + toSerialize := map[string]interface{}{} + if true { + toSerialize["data"] = o.Data } return json.Marshal(toSerialize) } -func (o GetPaymentResponse) ToMap() (map[string]interface{}, error) { - toSerialize := map[string]interface{}{} - toSerialize["data"] = o.Data - return toSerialize, nil -} - type NullableGetPaymentResponse struct { value *GetPaymentResponse isSet bool diff --git a/client/model_list_connectors_response.go b/client/model_list_connectors_response.go index 5a49bb64..e4ddde63 100644 --- a/client/model_list_connectors_response.go +++ b/client/model_list_connectors_response.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the ListConnectorsResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListConnectorsResponse{} - // ListConnectorsResponse struct for ListConnectorsResponse type ListConnectorsResponse struct { Data interface{} `json:"data"` @@ -67,19 +64,11 @@ func (o *ListConnectorsResponse) SetData(v interface{}) { } func (o ListConnectorsResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ListConnectorsResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.Data != nil { toSerialize["data"] = o.Data } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableListConnectorsResponse struct { diff --git a/client/model_list_payments_response.go b/client/model_list_payments_response.go index 3ae3f49f..805d2368 100644 --- a/client/model_list_payments_response.go +++ b/client/model_list_payments_response.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the ListPaymentsResponse type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ListPaymentsResponse{} - // ListPaymentsResponse struct for ListPaymentsResponse type ListPaymentsResponse struct { Data interface{} `json:"data"` @@ -67,19 +64,11 @@ func (o *ListPaymentsResponse) SetData(v interface{}) { } func (o ListPaymentsResponse) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ListPaymentsResponse) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.Data != nil { toSerialize["data"] = o.Data } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableListPaymentsResponse struct { diff --git a/client/model_modulr_config.go b/client/model_modulr_config.go index a70bc046..de3ceabf 100644 --- a/client/model_modulr_config.go +++ b/client/model_modulr_config.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the ModulrConfig type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &ModulrConfig{} - // ModulrConfig struct for ModulrConfig type ModulrConfig struct { ApiKey interface{} `json:"apiKey"` @@ -129,14 +126,6 @@ func (o *ModulrConfig) SetEndpoint(v interface{}) { } func (o ModulrConfig) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o ModulrConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.ApiKey != nil { toSerialize["apiKey"] = o.ApiKey @@ -147,7 +136,7 @@ func (o ModulrConfig) ToMap() (map[string]interface{}, error) { if o.Endpoint != nil { toSerialize["endpoint"] = o.Endpoint } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableModulrConfig struct { diff --git a/client/model_payment.go b/client/model_payment.go index 2013d2f4..6112000e 100644 --- a/client/model_payment.go +++ b/client/model_payment.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the Payment type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &Payment{} - // Payment struct for Payment type Payment struct { Provider interface{} `json:"provider"` @@ -331,14 +328,6 @@ func (o *Payment) SetRaw(v interface{}) { } func (o Payment) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o Payment) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.Provider != nil { toSerialize["provider"] = o.Provider @@ -370,7 +359,7 @@ func (o Payment) ToMap() (map[string]interface{}, error) { if o.Raw != nil { toSerialize["raw"] = o.Raw } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullablePayment struct { diff --git a/client/model_stripe_config.go b/client/model_stripe_config.go index 24a3dfa6..c0c1c851 100644 --- a/client/model_stripe_config.go +++ b/client/model_stripe_config.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the StripeConfig type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &StripeConfig{} - // StripeConfig struct for StripeConfig type StripeConfig struct { // The frequency at which the connector will try to fetch new BalanceTransaction objects from Stripe api @@ -137,14 +134,6 @@ func (o *StripeConfig) SetPageSize(v interface{}) { } func (o StripeConfig) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o StripeConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.PollingPeriod != nil { toSerialize["pollingPeriod"] = o.PollingPeriod @@ -155,7 +144,7 @@ func (o StripeConfig) ToMap() (map[string]interface{}, error) { if o.PageSize != nil { toSerialize["pageSize"] = o.PageSize } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableStripeConfig struct { diff --git a/client/model_stripe_task.go b/client/model_stripe_task.go index e415aea5..8bc3d4bd 100644 --- a/client/model_stripe_task.go +++ b/client/model_stripe_task.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the StripeTask type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &StripeTask{} - // StripeTask struct for StripeTask type StripeTask struct { // The id of the oldest BalanceTransaction fetched from stripe for this account @@ -213,14 +210,6 @@ func (o *StripeTask) SetNoMoreHistory(v interface{}) { } func (o StripeTask) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o StripeTask) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.OldestId != nil { toSerialize["oldestId"] = o.OldestId @@ -237,7 +226,7 @@ func (o StripeTask) ToMap() (map[string]interface{}, error) { if o.NoMoreHistory != nil { toSerialize["noMoreHistory"] = o.NoMoreHistory } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableStripeTask struct { diff --git a/client/model_wise_config.go b/client/model_wise_config.go index 2cf3aa87..d529e57e 100644 --- a/client/model_wise_config.go +++ b/client/model_wise_config.go @@ -14,9 +14,6 @@ import ( "encoding/json" ) -// checks if the WiseConfig type satisfies the MappedNullable interface at compile time -var _ MappedNullable = &WiseConfig{} - // WiseConfig struct for WiseConfig type WiseConfig struct { ApiKey interface{} `json:"apiKey"` @@ -67,19 +64,11 @@ func (o *WiseConfig) SetApiKey(v interface{}) { } func (o WiseConfig) MarshalJSON() ([]byte, error) { - toSerialize, err := o.ToMap() - if err != nil { - return []byte{}, err - } - return json.Marshal(toSerialize) -} - -func (o WiseConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if o.ApiKey != nil { toSerialize["apiKey"] = o.ApiKey } - return toSerialize, nil + return json.Marshal(toSerialize) } type NullableWiseConfig struct { diff --git a/client/test/api_payments_test.go b/client/test/api_payments_test.go deleted file mode 100644 index 3d87012d..00000000 --- a/client/test/api_payments_test.go +++ /dev/null @@ -1,158 +0,0 @@ -/* -Payments API - -Testing PaymentsApiService - -*/ - -// Code generated by OpenAPI Generator (https://openapi-generator.tech); - -package client - -import ( - "context" - "testing" - - openapiclient "github.com/formancehq/payments/client" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func Test_client_PaymentsApiService(t *testing.T) { - - configuration := openapiclient.NewConfiguration() - apiClient := openapiclient.NewAPIClient(configuration) - - t.Run("Test PaymentsApiService GetAllConnectors", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.PaymentsApi.GetAllConnectors(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService GetAllConnectorsConfigs", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.PaymentsApi.GetAllConnectorsConfigs(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService GetConnectorTask", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var connector interface{} - var taskId interface{} - - resp, httpRes, err := apiClient.PaymentsApi.GetConnectorTask(context.Background(), connector, taskId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService GetPayment", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var paymentId interface{} - - resp, httpRes, err := apiClient.PaymentsApi.GetPayment(context.Background(), paymentId).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService InstallConnector", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var connector interface{} - - httpRes, err := apiClient.PaymentsApi.InstallConnector(context.Background(), connector).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService ListConnectorTasks", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var connector interface{} - - resp, httpRes, err := apiClient.PaymentsApi.ListConnectorTasks(context.Background(), connector).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService ListPayments", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - resp, httpRes, err := apiClient.PaymentsApi.ListPayments(context.Background()).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService ReadConnectorConfig", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var connector interface{} - - resp, httpRes, err := apiClient.PaymentsApi.ReadConnectorConfig(context.Background(), connector).Execute() - - require.Nil(t, err) - require.NotNil(t, resp) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService ResetConnector", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var connector interface{} - - httpRes, err := apiClient.PaymentsApi.ResetConnector(context.Background(), connector).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - - t.Run("Test PaymentsApiService UninstallConnector", func(t *testing.T) { - - t.Skip("skip test") // remove to run test - - var connector interface{} - - httpRes, err := apiClient.PaymentsApi.UninstallConnector(context.Background(), connector).Execute() - - require.Nil(t, err) - assert.Equal(t, 200, httpRes.StatusCode) - - }) - -} diff --git a/client/utils.go b/client/utils.go index 7b178ca4..d83916f7 100644 --- a/client/utils.go +++ b/client/utils.go @@ -341,7 +341,3 @@ func isNil(i interface{}) bool { } return false } - -type MappedNullable interface { - ToMap() (map[string]interface{}, error) -} diff --git a/main.go b/main.go index c52a3c1f..9e9fdf11 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,5 @@ -//go:generate docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:v6.2.1 generate -i ./swagger.yml -g go -o ./client --git-user-id=formancehq --git-repo-id=payments/client -p packageVersion=latest -p isGoSubmodule=true -p packageName=client -//go:generate docker run --rm -w /local -v ${PWD}:/local cytopia/goimports: -w -e ./client +//go:generate docker run --rm -w /local -v ${PWD}:/local openapitools/openapi-generator-cli:v6.2.1 generate -i ./swagger.yml -g go -o ./client --git-user-id=formancehq --git-repo-id=payments -p packageVersion=latest -p isGoSubmodule=true -p packageName=client +//go:generate docker run --rm -w /local -v ${PWD}:/local cytopia/goimports -w -e ./client package main import "github.com/formancehq/payments/cmd"