Skip to content

Commit

Permalink
SDK Updates (#44)
Browse files Browse the repository at this point in the history
* Automated commit message

* Automated commit message

* DE-564: fixed broken tests from latest changes from SDK

---------

Co-authored-by: maxio-sdk <[email protected]>
Co-authored-by: alberto-blacutt-maxio <[email protected]>
Co-authored-by: Alberto Blacutt <[email protected]>
  • Loading branch information
4 people authored Jan 18, 2024
1 parent 108cc10 commit d3cd684
Show file tree
Hide file tree
Showing 92 changed files with 471 additions and 4,241 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
run: pnpm install --no-frozen-lockfile
- name: Build process verification
run: pnpm run build
- name: e2e tests verification
Expand Down
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ The following parameters are configurable for the API Client:
| `timeout` | `number` | Timeout for API calls.<br>*Default*: `30000` |
| `httpClientOptions` | `Partial<HttpClientOptions>` | Stable configurable http client options. |
| `unstableHttpClientOptions` | `any` | Unstable configurable http client options. |
| `basicAuthCredentials` | [`BasicAuthCredentials`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/0.0.4/doc/$a/https://www.github.com/maxio-com/ab-typescript-sdk/tree/0.0.4/basic-authentication.md) | The credential object for basicAuth |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |

### HttpClientOptions

Expand All @@ -317,12 +318,10 @@ The API client can be initialized as follows:

```ts
const client = new Client({
basicAuthCredentials: {
username: 'BasicAuthUserName',
password: 'BasicAuthPassword'
},
timeout: 30000,
environment: Environment.Production,
basicAuthUserName: 'BasicAuthUserName',
basicAuthPassword: 'BasicAuthPassword',
});
```

Expand All @@ -339,9 +338,7 @@ The SDK can be configured to use a different environment for making API calls. A

## Authorization

This API uses the following authentication schemes.

* [`BasicAuth (Basic Authentication)`](https://www.github.com/maxio-com/ab-typescript-sdk/tree/0.0.4/doc/$a/https://www.github.com/maxio-com/ab-typescript-sdk/tree/0.0.4/basic-authentication.md)
This API uses `Basic Authentication`.

## List of APIs

Expand Down
34 changes: 0 additions & 34 deletions doc/auth/basic-authentication.md

This file was deleted.

9 changes: 4 additions & 5 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ The following parameters are configurable for the API Client:
| `timeout` | `number` | Timeout for API calls.<br>*Default*: `30000` |
| `httpClientOptions` | `Partial<HttpClientOptions>` | Stable configurable http client options. |
| `unstableHttpClientOptions` | `any` | Unstable configurable http client options. |
| `basicAuthCredentials` | [`BasicAuthCredentials`]($a/basic-authentication.md) | The credential object for basicAuth |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |

## HttpClientOptions

Expand All @@ -38,12 +39,10 @@ The API client can be initialized as follows:

```ts
const client = new Client({
basicAuthCredentials: {
username: 'BasicAuthUserName',
password: 'BasicAuthPassword'
},
timeout: 30000,
environment: Environment.Production,
basicAuthUserName: 'BasicAuthUserName',
basicAuthPassword: 'BasicAuthPassword',
});
```

Expand Down
3 changes: 0 additions & 3 deletions doc/controllers/advance-invoice.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) |

Expand Down Expand Up @@ -126,7 +125,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |


Expand Down Expand Up @@ -180,6 +178,5 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |

6 changes: 0 additions & 6 deletions doc/controllers/billing-portal.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,3 @@ try {
}
```

## Errors

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 422 | Unprocessable Entity (WebDAV) | `ApiError` |

1 change: 1 addition & 0 deletions doc/controllers/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ const body: CreateComponentPricePointRequest = {
}
],
handle: 'wholesale-handle',
useSiteExchangeRate: false,
},
};

Expand Down
32 changes: 9 additions & 23 deletions doc/controllers/custom-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const customFieldsController = new CustomFieldsController(client);
* [Update Metafield](../../doc/controllers/custom-fields.md#update-metafield)
* [Delete Metafield](../../doc/controllers/custom-fields.md#delete-metafield)
* [Create Metadata](../../doc/controllers/custom-fields.md#create-metadata)
* [Read Metadata](../../doc/controllers/custom-fields.md#read-metadata)
* [List Metadata](../../doc/controllers/custom-fields.md#list-metadata)
* [Update Metadata](../../doc/controllers/custom-fields.md#update-metadata)
* [Delete Metadata](../../doc/controllers/custom-fields.md#delete-metadata)
* [List Metadata](../../doc/controllers/custom-fields.md#list-metadata)
* [List Metadata for Resource Type](../../doc/controllers/custom-fields.md#list-metadata-for-resource-type)


# Create Metafields
Expand Down Expand Up @@ -237,8 +237,6 @@ Use the following method to update metafields for your Site. Metafields can be p
```ts
async updateMetafield(
resourceType: ResourceType,
name: string,
currentName?: string,
body?: UpdateMetafieldsRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<Metafield[]>>
Expand All @@ -249,8 +247,6 @@ async updateMetafield(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong |
| `name` | `string` | Query, Required | Name of the custom field. |
| `currentName` | `string \| undefined` | Query, Optional | This only applies when you are updating an existing record and you wish to rename the field. Note you must supply name and current_name to rename the field |
| `body` | [`UpdateMetafieldsRequest \| undefined`](../../doc/models/update-metafields-request.md) | Body, Optional | - |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

Expand All @@ -263,15 +259,10 @@ async updateMetafield(
```ts
const resourceType = ResourceType.Subscriptions;

const name = 'name0';

try {
// @ts-expect-error: unused variables
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { result, ...httpResponse } = await customFieldsController.updateMetafield(
resourceType,
name
);
const { result, ...httpResponse } = await customFieldsController.updateMetafield(resourceType);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
Expand Down Expand Up @@ -368,7 +359,6 @@ Please pay special attention to the resource you use when creating metadata.
async createMetadata(
resourceType: ResourceType,
resourceId: string,
value?: string,
body?: CreateMetadataRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<Metadata[]>>
Expand All @@ -380,7 +370,6 @@ async createMetadata(
| --- | --- | --- | --- |
| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong |
| `resourceId` | `string` | Template, Required | The Chargify id of the customer or the subscription for which the metadata applies |
| `value` | `string \| undefined` | Query, Optional | Can be a single item or a list of metadata |
| `body` | [`CreateMetadataRequest \| undefined`](../../doc/models/create-metadata-request.md) | Body, Optional | - |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

Expand Down Expand Up @@ -414,7 +403,6 @@ try {
const { result, ...httpResponse } = await customFieldsController.createMetadata(
resourceType,
resourceId,
undefined,
body
);
// Get more response info...
Expand All @@ -436,7 +424,7 @@ try {
| 422 | Unprocessable Entity (WebDAV) | [`SingleErrorResponseError`](../../doc/models/single-error-response-error.md) |


# Read Metadata
# List Metadata

This request will list all of the metadata belonging to a particular resource (ie. subscription, customer) that is specified.

Expand All @@ -445,7 +433,7 @@ This request will list all of the metadata belonging to a particular resource (i
This endpoint will also display the current stats of your metadata to use as a tool for pagination.

```ts
async readMetadata(
async listMetadata(
resourceType: ResourceType,
resourceId: string,
page?: number,
Expand Down Expand Up @@ -480,7 +468,7 @@ const collect = {
try {
// @ts-expect-error: unused variables
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { result, ...httpResponse } = await customFieldsController.readMetadata(collect);
const { result, ...httpResponse } = await customFieldsController.listMetadata(collect);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
Expand All @@ -502,7 +490,6 @@ This method allows you to update the existing metadata associated with a subscri
async updateMetadata(
resourceType: ResourceType,
resourceId: string,
value?: string,
body?: UpdateMetadataRequest,
requestOptions?: RequestOptions
): Promise<ApiResponse<Metadata[]>>
Expand All @@ -514,7 +501,6 @@ async updateMetadata(
| --- | --- | --- | --- |
| `resourceType` | [`ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong |
| `resourceId` | `string` | Template, Required | The Chargify id of the customer or the subscription for which the metadata applies |
| `value` | `string \| undefined` | Query, Optional | Can be a single item or a list of metadata |
| `body` | [`UpdateMetadataRequest \| undefined`](../../doc/models/update-metadata-request.md) | Body, Optional | - |
| `requestOptions` | `RequestOptions \| undefined` | Optional | Pass additional request options. |

Expand Down Expand Up @@ -632,7 +618,7 @@ Liquid error: Value cannot be null. (Parameter 'key')try {
| 404 | Not Found | `ApiError` |


# List Metadata
# List Metadata for Resource Type

This method will provide you information on usage of metadata across your selected resource (ie. subscriptions, customers)

Expand All @@ -649,7 +635,7 @@ This endpoint will also display the current stats of your metadata to use as a t
This endpoint will list the number of pages of metadata information that are contained within a site.

```ts
async listMetadata(
async listMetadataForResourceType(
resourceType: ResourceType,
page?: number,
perPage?: number,
Expand Down Expand Up @@ -698,7 +684,7 @@ const collect = {Liquid error: Value cannot be null. (Parameter 'key')
try {
// @ts-expect-error: unused variables
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { result, ...httpResponse } = await customFieldsController.listMetadata(collect);
const { result, ...httpResponse } = await customFieldsController.listMetadataForResourceType(collect);
// Get more response info...
// const { statusCode, headers } = httpResponse;
} catch (error) {
Expand Down
12 changes: 0 additions & 12 deletions doc/controllers/events-based-billing-segments.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`EventBasedBillingSegmentErrorsError`](../../doc/models/event-based-billing-segment-errors-error.md) |

Expand Down Expand Up @@ -171,8 +169,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`EventBasedBillingListSegmentsErrorsError`](../../doc/models/event-based-billing-list-segments-errors-error.md) |

Expand Down Expand Up @@ -240,8 +236,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`EventBasedBillingSegmentErrorsError`](../../doc/models/event-based-billing-segment-errors-error.md) |

Expand Down Expand Up @@ -307,8 +301,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | `ApiError` |

Expand Down Expand Up @@ -373,8 +365,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`EventBasedBillingSegmentError`](../../doc/models/event-based-billing-segment-error-1.md) |

Expand Down Expand Up @@ -439,8 +429,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 403 | Forbidden | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`EventBasedBillingSegmentError`](../../doc/models/event-based-billing-segment-error-1.md) |

4 changes: 1 addition & 3 deletions doc/controllers/invoices.md
Original file line number Diff line number Diff line change
Expand Up @@ -2856,7 +2856,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`NestedErrorResponseError`](../../doc/models/nested-error-response-error.md) |


Expand Down Expand Up @@ -3256,7 +3255,7 @@ try {
],
"public_url": "dolo",
"previous_balance_data": {
"capture_date": "aliqua velit quis voluptate",
"captured_at": "2024-01-09T11:22:23-05:00",
"invoices": [
{
"number": "veniam dolore labore ipsum cupidatat",
Expand Down Expand Up @@ -3345,7 +3344,6 @@ try {

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 401 | Unauthorized | `ApiError` |
| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseError`](../../doc/models/error-list-response-error.md) |

Loading

0 comments on commit d3cd684

Please sign in to comment.