Skip to content

Commit

Permalink
Merge pull request #26 from pagarme/CodeGen-NodeJS
Browse files Browse the repository at this point in the history
Code gen node js
  • Loading branch information
andreals authored Feb 19, 2024
2 parents a8526a5 + 7d6d36a commit c8a6caa
Show file tree
Hide file tree
Showing 48 changed files with 1,139 additions and 100 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ License:
The MIT License (MIT)
http://opensource.org/licenses/MIT

Copyright (c) 2014 - 2023 APIMATIC Limited
Copyright (c) 2014 - 2024 APIMATIC Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
50 changes: 21 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ npm install

## Initialize the API Client

**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/client.md)
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/client.md)

The following parameters are configurable for the API Client:

Expand All @@ -81,8 +81,6 @@ The following parameters are configurable for the API Client:
| `timeout` | `number` | Timeout for API calls.<br>*Default*: `0` |
| `httpClientOptions` | `Partial<HttpClientOptions>` | Stable configurable http client options. |
| `unstableHttpClientOptions` | `any` | Unstable configurable http client options. |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |

### HttpClientOptions

Expand Down Expand Up @@ -111,45 +109,39 @@ The API client can be initialized as follows:
const client = new Client({
serviceRefererName: 'ServiceRefererName',
timeout: 0,
basicAuthUserName: 'BasicAuthUserName',
basicAuthPassword: 'BasicAuthPassword',
});
```

## Authorization

This API uses `Basic Authentication`.

## API Errors

Here is the list of errors that the API might throw.

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 400 | Invalid request | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/models/custom-error.md) |
| 401 | Invalid API key | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/models/custom-error.md) |
| 404 | An informed resource was not found | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/models/custom-error.md) |
| 412 | Business validation error | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/models/custom-error.md) |
| 422 | Contract validation error | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/models/custom-error.md) |
| 500 | Internal server error | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/models/custom-error.md) |
| 400 | Invalid request | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/models/custom-error.md) |
| 401 | Invalid API key | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/models/custom-error.md) |
| 404 | An informed resource was not found | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/models/custom-error.md) |
| 412 | Business validation error | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/models/custom-error.md) |
| 422 | Contract validation error | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/models/custom-error.md) |
| 500 | Internal server error | [`CustomError`](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/models/custom-error.md) |

## List of APIs

* [Subscriptions](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/subscriptions.md)
* [Orders](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/orders.md)
* [Plans](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/plans.md)
* [Invoices](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/invoices.md)
* [Customers](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/customers.md)
* [Charges](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/charges.md)
* [Recipients](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/recipients.md)
* [Tokens](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/tokens.md)
* [Transactions](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/transactions.md)
* [Transfers](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/transfers.md)
* [Payables](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/payables.md)
* [Balance Operations](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/controllers/balance-operations.md)
* [Subscriptions](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/subscriptions.md)
* [Orders](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/orders.md)
* [Plans](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/plans.md)
* [Invoices](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/invoices.md)
* [Customers](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/customers.md)
* [Charges](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/charges.md)
* [Recipients](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/recipients.md)
* [Tokens](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/tokens.md)
* [Transactions](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/transactions.md)
* [Transfers](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/transfers.md)
* [Payables](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/payables.md)
* [Balance Operations](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/controllers/balance-operations.md)

## Classes Documentation

* [ApiResponse](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/api-response.md)
* [ApiError](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.1/doc/api-error.md)
* [ApiResponse](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/api-response.md)
* [ApiError](https://www.github.com/pagarme/pagarme-nodejs-sdk/tree/6.8.5/doc/api-error.md)

4 changes: 0 additions & 4 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ The following parameters are configurable for the API Client:
| `timeout` | `number` | Timeout for API calls.<br>*Default*: `0` |
| `httpClientOptions` | `Partial<HttpClientOptions>` | Stable configurable http client options. |
| `unstableHttpClientOptions` | `any` | Unstable configurable http client options. |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |

## HttpClientOptions

Expand Down Expand Up @@ -39,8 +37,6 @@ The API client can be initialized as follows:
const client = new Client({
serviceRefererName: 'ServiceRefererName',
timeout: 0,
basicAuthUserName: 'BasicAuthUserName',
basicAuthPassword: 'BasicAuthPassword',
});
```

Expand Down
4 changes: 2 additions & 2 deletions doc/controllers/customers.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@ async getCustomers(
| --- | --- | --- | --- |
| `name` | `string \| undefined` | Query, Optional | Name of the Customer |
| `document` | `string \| undefined` | Query, Optional | Document of the Customer |
| `page` | `number \| undefined` | Query, Optional | Current page the the search<br>**Default**: `1` |
| `size` | `number \| undefined` | Query, Optional | Quantity pages of the search<br>**Default**: `10` |
| `page` | `number \| undefined` | Query, Optional | Current page the the search |
| `size` | `number \| undefined` | Query, Optional | Quantity pages of the search |
| `email` | `string \| undefined` | Query, Optional | Customer's email |
| `code` | `string \| undefined` | Query, Optional | Customer's code |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |
Expand Down
5 changes: 0 additions & 5 deletions doc/controllers/recipients.md
Original file line number Diff line number Diff line change
Expand Up @@ -1030,11 +1030,6 @@ async createRecipient(

```ts
const request: CreateRecipientRequest = {
name: 'name6',
email: 'email0',
description: 'description6',
document: 'document0',
type: 'type4',
defaultBankAccount: {
holderName: 'holder_name4',
holderType: 'holder_type0',
Expand Down
4 changes: 0 additions & 4 deletions doc/controllers/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ const tokensController = new TokensController(client);

# Create Token

:information_source: **Note** This endpoint does not require authentication.

```ts
async createToken(
publicKey: string,
Expand Down Expand Up @@ -82,8 +80,6 @@ try {

Gets a token from its id

:information_source: **Note** This endpoint does not require authentication.

```ts
async getToken(
id: string,
Expand Down
56 changes: 56 additions & 0 deletions doc/models/create-managing-partner-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

# Create Managing Partner Request

Managing Partner Request

## Structure

`CreateManagingPartnerRequest`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `name` | `string` | Required | - |
| `email` | `string` | Required | - |
| `document` | `string` | Required | - |
| `motherName` | `string` | Required | - |
| `birthdate` | `string` | Required | - |
| `monthlyIncome` | `number` | Required | - |
| `professionalOccupation` | `string` | Required | - |
| `selfDeclaredLegalRepresentative` | `boolean` | Required | - |
| `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - |
| `phoneNumbers` | [`CreateRegisterInformationPhoneRequest[]`](../../doc/models/create-register-information-phone-request.md) | Required | - |

## Example (as JSON)

```json
{
"name": "name4",
"email": "email2",
"document": "document2",
"mother_name": "mother_name0",
"birthdate": "birthdate8",
"monthly_income": 70,
"professional_occupation": "professional_occupation8",
"self_declared_legal_representative": false,
"address": {
"street": "street6",
"complementary": "complementary8",
"street_number": "street_number6",
"neighborhood": "neighborhood2",
"city": "city6",
"state": "state2",
"zip_code": "zip_code0",
"reference_point": "reference_point0"
},
"phone_numbers": [
{
"ddd": "ddd4",
"number": "number2",
"type": "type0"
}
]
}
```

26 changes: 11 additions & 15 deletions doc/models/create-recipient-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,22 @@ Request for creating a recipient

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `name` | `string` | Required | Recipient name |
| `email` | `string` | Required | Recipient email |
| `description` | `string` | Required | Recipient description |
| `document` | `string` | Required | Recipient document number |
| `type` | `string` | Required | Recipient type |
| `name` | `string \| null \| undefined` | Optional | Recipient name. Required if the register_information field isn't populated. |
| `email` | `string \| null \| undefined` | Optional | Recipient email. Required if the register_information field isn't populated. |
| `description` | `string \| null \| undefined` | Optional | Recipient description |
| `document` | `string \| null \| undefined` | Optional | Recipient document number. Required if the register_information field isn't populated. |
| `type` | `string \| null \| undefined` | Optional | Recipient type. Required if the register_information field isn't populated. |
| `defaultBankAccount` | [`CreateBankAccountRequest`](../../doc/models/create-bank-account-request.md) | Required | Bank account |
| `metadata` | `Record<string, string>` | Required | Metadata |
| `transferSettings` | [`CreateTransferSettingsRequest \| undefined`](../../doc/models/create-transfer-settings-request.md) | Optional | Receiver Transfer Information |
| `code` | `string` | Required | Recipient code |
| `paymentMode` | `string` | Required | Payment mode<br>**Default**: `'bank_transfer'` |
| `registerInformation` | [`CreateRegisterInformationBaseRequest \| null \| undefined`](../../doc/models/create-register-information-base-request.md) | Optional | Register Information |

## Example (as JSON)

```json
{
"name": "name6",
"email": "email0",
"description": "description6",
"document": "document0",
"type": "type4",
"default_bank_account": {
"holder_name": "holder_name4",
"holder_type": "holder_type0",
Expand All @@ -53,11 +49,11 @@ Request for creating a recipient
},
"code": "code4",
"payment_mode": "bank_transfer",
"transfer_settings": {
"transfer_enabled": false,
"transfer_interval": "transfer_interval4",
"transfer_day": 10
}
"name": "name6",
"email": "email0",
"description": "description6",
"document": "document0",
"type": "type4"
}
```

37 changes: 37 additions & 0 deletions doc/models/create-register-information-address-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Create Register Information Address Request

Register Information Address

## Structure

`CreateRegisterInformationAddressRequest`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `street` | `string` | Required | - |
| `complementary` | `string` | Required | - |
| `streetNumber` | `string` | Required | - |
| `neighborhood` | `string` | Required | - |
| `city` | `string` | Required | - |
| `state` | `string` | Required | - |
| `zipCode` | `string` | Required | - |
| `referencePoint` | `string` | Required | - |

## Example (as JSON)

```json
{
"street": "street8",
"complementary": "complementary0",
"street_number": "street_number8",
"neighborhood": "neighborhood4",
"city": "city8",
"state": "state4",
"zip_code": "zip_code2",
"reference_point": "reference_point2"
}
```

37 changes: 37 additions & 0 deletions doc/models/create-register-information-base-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Create Register Information Base Request

Request object for RegisterInformation.

## Structure

`CreateRegisterInformationBaseRequest`

## Fields

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `email` | `string` | Required | - |
| `document` | `string` | Required | - |
| `type` | `string` | Required | "individual" ou "corporation" |
| `siteUrl` | `string \| null \| undefined` | Optional | - |
| `phoneNumbers` | [`CreateRegisterInformationPhoneRequest[]`](../../doc/models/create-register-information-phone-request.md) | Required | - |

## Example (as JSON)

```json
{
"email": "email4",
"document": "document6",
"type": "type8",
"phone_numbers": [
{
"ddd": "ddd4",
"number": "number2",
"type": "type0"
}
],
"site_url": "site_url4"
}
```

Loading

0 comments on commit c8a6caa

Please sign in to comment.