Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DE-565: Fixed nullable schemas #42

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,7 @@ 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. |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |
| `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 |

### HttpClientOptions

Expand All @@ -318,10 +317,12 @@ 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 @@ -338,7 +339,9 @@ The SDK can be configured to use a different environment for making API calls. A

## Authorization

This API uses `Basic Authentication`.
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)

## List of APIs

Expand Down
34 changes: 34 additions & 0 deletions doc/auth/basic-authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

alberto-blacutt-maxio marked this conversation as resolved.
Show resolved Hide resolved
# Basic Authentication



Documentation for accessing and setting credentials for BasicAuth.

## Auth Credentials

| Name | Type | Description | Setter |
| --- | --- | --- | --- |
| BasicAuthUserName | `string` | The username to use with basic authentication | `username` |
| BasicAuthPassword | `string` | The password to use with basic authentication | `password` |



**Note:** Auth credentials can be set using `basicAuthCredentials` object in the client.

## Usage Example

### Client Initialization

You must provide credentials in the client as shown in the following code snippet.

```ts
const client = new Client({
basicAuthCredentials: {
username: 'BasicAuthUserName',
password: 'BasicAuthPassword'
},
});
```


9 changes: 5 additions & 4 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ 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. |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |
| `basicAuthCredentials` | [`BasicAuthCredentials`]($a/basic-authentication.md) | The credential object for basicAuth |

## HttpClientOptions

Expand All @@ -39,10 +38,12 @@ 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
12 changes: 6 additions & 6 deletions doc/controllers/coupons.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ const body: CreateOrUpdateCoupon = {
code: '15OFF',
percentage: '15',
description: '15% off for life',
allowNegativeBalance: 'false',
recurring: 'false',
allowNegativeBalance: false,
recurring: false,
endDate: '2012-08-29T12:00:00-04:00',
productFamilyId: '2',
stackable: 'true',
stackable: true,
compoundingStrategy: CompoundingStrategy.Compound,
excludeMidPeriodAllocations: true,
applyOnCancelAtEndOfPeriod: true,
Expand Down Expand Up @@ -459,11 +459,11 @@ const body: CreateOrUpdateCoupon = {
code: '15OFF',
percentage: '15',
description: '15% off for life',
allowNegativeBalance: 'false',
recurring: 'false',
allowNegativeBalance: false,
recurring: false,
endDate: '2012-08-29T12:00:00-04:00',
productFamilyId: '2',
stackable: 'true',
stackable: true,
compoundingStrategy: CompoundingStrategy.Compound,
},
restrictedProducts: {
Expand Down
12 changes: 12 additions & 0 deletions doc/controllers/custom-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ try {
]
```

## Errors

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 422 | Unprocessable Entity (WebDAV) | [`SingleErrorResponseError`](../../doc/models/single-error-response-error.md) |


# List Metafields

Expand Down Expand Up @@ -423,6 +429,12 @@ try {
}
```

## Errors

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 422 | Unprocessable Entity (WebDAV) | [`SingleErrorResponseError`](../../doc/models/single-error-response-error.md) |


# Read Metadata

Expand Down
6 changes: 6 additions & 0 deletions doc/controllers/product-families.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ try {
}
```

## Errors

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


# List Product Families

Expand Down
2 changes: 0 additions & 2 deletions doc/models/create-metafield.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `id` | `number \| undefined` | Optional | - |
| `name` | `string \| undefined` | Optional | - |
| `scope` | [`MetafieldScope \| undefined`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. |
| `inputType` | [`MetafieldInput \| undefined`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page.<br>**Default**: `MetafieldInput.Text` |
Expand All @@ -19,7 +18,6 @@

```json
{
"id": 0,
"name": "my_field",
"scope": {
"csv": "0",
Expand Down
1 change: 0 additions & 1 deletion doc/models/create-metafields-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
```json
{
"metafields": {
"id": 0,
"name": "my_field",
"scope": {
"csv": "0",
Expand Down
6 changes: 3 additions & 3 deletions doc/models/create-or-update-coupon.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"code": "code8",
"description": "description0",
"percentage": 11.02,
"allow_negative_balance": "allow_negative_balance8",
"recurring": "recurring4",
"end_date": "end_date0",
"allow_negative_balance": false,
"recurring": false,
"end_date": "2016-03-13T12:52:32.123Z",
"product_family_id": "product_family_id6"
},
"restricted_products": {
Expand Down
12 changes: 6 additions & 6 deletions doc/models/create-or-update-flat-amount-coupon.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
| `code` | `string` | Required | may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.” |
| `description` | `string \| undefined` | Optional | - |
| `amountInCents` | `bigint` | Required | - |
| `allowNegativeBalance` | `string \| undefined` | Optional | - |
| `recurring` | `string \| undefined` | Optional | - |
| `allowNegativeBalance` | `boolean \| undefined` | Optional | - |
| `recurring` | `boolean \| undefined` | Optional | - |
| `endDate` | `string \| undefined` | Optional | - |
| `productFamilyId` | `string \| undefined` | Optional | - |
| `stackable` | `string \| undefined` | Optional | - |
| `stackable` | `boolean \| undefined` | Optional | - |
| `compoundingStrategy` | [`CompoundingStrategy \| undefined`](../../doc/models/compounding-strategy.md) | Optional | - |
| `excludeMidPeriodAllocations` | `boolean \| undefined` | Optional | - |
| `applyOnCancelAtEndOfPeriod` | `boolean \| undefined` | Optional | - |
Expand All @@ -30,9 +30,9 @@
"code": "code8",
"description": "description0",
"amount_in_cents": 120,
"allow_negative_balance": "allow_negative_balance2",
"recurring": "recurring6",
"end_date": "end_date0",
"allow_negative_balance": false,
"recurring": false,
"end_date": "2016-03-13T12:52:32.123Z",
"product_family_id": "product_family_id4"
}
```
Expand Down
12 changes: 6 additions & 6 deletions doc/models/create-or-update-percentage-coupon.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
| `code` | `string` | Required | may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.” |
| `description` | `string \| undefined` | Optional | - |
| `percentage` | [`CreateOrUpdatePercentageCouponPercentage`](../../doc/models/containers/create-or-update-percentage-coupon-percentage.md) | Required | This is a container for one-of cases. |
| `allowNegativeBalance` | `string \| undefined` | Optional | - |
| `recurring` | `string \| undefined` | Optional | - |
| `allowNegativeBalance` | `boolean \| undefined` | Optional | - |
| `recurring` | `boolean \| undefined` | Optional | - |
| `endDate` | `string \| undefined` | Optional | - |
| `productFamilyId` | `string \| undefined` | Optional | - |
| `stackable` | `string \| undefined` | Optional | - |
| `stackable` | `boolean \| undefined` | Optional | - |
| `compoundingStrategy` | [`CompoundingStrategy \| undefined`](../../doc/models/compounding-strategy.md) | Optional | - |
| `excludeMidPeriodAllocations` | `boolean \| undefined` | Optional | - |
| `applyOnCancelAtEndOfPeriod` | `boolean \| undefined` | Optional | - |
Expand All @@ -30,9 +30,9 @@
"code": "code8",
"description": "description0",
"percentage": 11.02,
"allow_negative_balance": "allow_negative_balance8",
"recurring": "recurring4",
"end_date": "end_date0",
"allow_negative_balance": false,
"recurring": false,
"end_date": "2016-03-13T12:52:32.123Z",
"product_family_id": "product_family_id6"
}
```
Expand Down
2 changes: 1 addition & 1 deletion doc/models/invoice-line-item-event-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
| `taxCode` | `string \| null \| undefined` | Optional | - |
| `taxAmount` | `string \| undefined` | Optional | - |
| `productId` | `number \| undefined` | Optional | - |
| `productPricePointId` | `number \| undefined` | Optional | - |
| `productPricePointId` | `number \| null \| undefined` | Optional | - |
| `pricePointId` | `number \| null \| undefined` | Optional | - |
| `componentId` | `number \| null \| undefined` | Optional | - |
| `billingScheduleItemId` | `number \| null \| undefined` | Optional | - |
Expand Down
2 changes: 0 additions & 2 deletions doc/models/metafields.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `id` | `number \| undefined` | Optional | - |
| `name` | `string \| undefined` | Optional | - |
| `scope` | [`MetafieldScope \| undefined`](../../doc/models/metafield-scope.md) | Optional | Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings. |
| `inputType` | [`MetafieldInput \| undefined`](../../doc/models/metafield-input.md) | Optional | Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page.<br>**Default**: `MetafieldInput.Text` |
Expand All @@ -20,7 +19,6 @@
```json
{
"input_type": "text",
"id": 188,
"name": "name0",
"scope": {
"csv": "0",
Expand Down
2 changes: 2 additions & 0 deletions doc/models/offer-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
| `componentName` | `string \| undefined` | Optional | - |
| `pricePointName` | `string \| undefined` | Optional | - |
| `currencyPrices` | [`CurrencyPrice[] \| undefined`](../../doc/models/currency-price.md) | Optional | - |
| `interval` | `number \| undefined` | Optional | The numerical interval. i.e. an interval of '30' coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. |
| `intervalUnit` | [`IntervalUnit \| undefined`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. |

## Example (as JSON)

Expand Down
2 changes: 1 addition & 1 deletion doc/models/single-error-response-error.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

```json
{
"error": "error8"
"error": "error2"
}
```

2 changes: 2 additions & 0 deletions doc/models/subscription-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
| `allowFractionalQuantities` | `boolean \| undefined` | Optional | - |
| `subscription` | [`SubscriptionComponentSubscription \| undefined`](../../doc/models/subscription-component-subscription.md) | Optional | An optional object, will be returned if provided `include=subscription` query param. |
| `displayOnHostedPage` | `boolean \| undefined` | Optional | - |
| `interval` | `number \| undefined` | Optional | The numerical interval. i.e. an interval of '30' coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. |
| `intervalUnit` | [`IntervalUnit \| undefined`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. |

## Example (as JSON)

Expand Down
18 changes: 9 additions & 9 deletions e2e/src/couponsController.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const couponBody = {
code: '15OFF',
description: '15% off for life',
percentage: 15,
allowNegativeBalance: 'false',
recurring: 'false',
allowNegativeBalance: false,
recurring: false,
endDate: '2024-08-29T12:00:00-04:00',
productFamilyId: '0',
stackable: 'true',
stackable: true,
compoundingStrategy: CompoundingStrategy.Compound,
excludeMidPeriodAllocations: true,
applyOnCancelAtEndOfPeriod: true,
Expand Down Expand Up @@ -284,11 +284,11 @@ describe('Coupons Controller', () => {
name: '15% off',
description: '15% off for life',
percentage: 15,
allowNegativeBalance: 'false',
recurring: 'false',
allowNegativeBalance: false,
recurring: false,
endDate: '2024-08-29T12:00:00-04:00',
productFamilyId: '0',
stackable: 'true',
stackable: true,
compoundingStrategy: CompoundingStrategy.Compound,
excludeMidPeriodAllocations: true,
applyOnCancelAtEndOfPeriod: true,
Expand Down Expand Up @@ -558,11 +558,11 @@ describe('Coupons Controller', () => {
name: 'CREATE-UPDATE',
code: 'CREATEUPDATE01',
description: '15% off for life',
allowNegativeBalance: 'false',
recurring: 'false',
allowNegativeBalance: false,
recurring: false,
endDate: '2024-08-29T12:00:00-04:00',
productFamilyId: '0',
stackable: 'true',
stackable: true,
compoundingStrategy: CompoundingStrategy.Compound,
excludeMidPeriodAllocations: true,
applyOnCancelAtEndOfPeriod: true,
Expand Down
28 changes: 28 additions & 0 deletions src/authProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Maxio Advanced BillingLib
*
* This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
*/

import {
basicAuthenticationProvider,
compositeAuthenticationProvider,
} from './authentication';
import { Configuration } from './configuration';

export function createAuthProviderFromConfig(config: Partial<Configuration>) {
const authConfig = {
basicAuth:
config.basicAuthCredentials &&
basicAuthenticationProvider (
config.basicAuthCredentials.username,
config.basicAuthCredentials.password
),
};

return compositeAuthenticationProvider <
keyof typeof authConfig,
typeof authConfig
> (authConfig);
}

Loading