Skip to content

Commit

Permalink
ci: regenerated with OpenAPI Doc 1.0.0, Speakeasy CLI 1.116.0
Browse files Browse the repository at this point in the history
  • Loading branch information
speakeasybot committed Nov 8, 2023
1 parent 0556e58 commit 16ee11e
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 99 deletions.
261 changes: 177 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,137 +3,165 @@
The Ding Typescript library provides convenient access to the Ding API from applications written in JS or TS.

<!-- Start SDK Installation -->
## SDK Installation

# SDK Installation

## NPM
### NPM

```bash
npm add https://github.com/ding-live/ding-typescript
npm add @ding-live/ding
```

## Yarn
### Yarn

```bash
yarn add https://github.com/ding-live/ding-typescript
yarn add @ding-live/ding
```

<!-- End SDK Installation -->

## SDK Example Usage

<!-- Start SDK Example Usage -->

# Send a code

## Send a code
Send an OTP code to a user's phone number.

```typescript
import { Ding } from "@ding-live/ding";
import { DeviceType } from "@ding-live/ding/dist/models/components";

(async () => {
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});

const res = await sdk.otp.createAutentication({
customerUuid: "eae192ab-9e1e-4b21-b5b1-bfcb79a32fcc",
phoneNumber: "+1234567890",
});

if (res.statusCode == 200) {
// handle response
}
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});

const res = await sdk.otp.createAutentication({
customerUuid: "eae192ab-9e1e-4b21-b5b1-bfcb79a32fcc",
phoneNumber: "+1234567890",
});

if (res.statusCode == 200) {
// handle response
}
})();

```

# Check a code

## Check a code
Check that a code entered by a user is valid.

```typescript
import { Ding } from "@ding-live/ding";

(async () => {
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});

const res = await sdk.otp.check({
authenticationUuid: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
checkCode: "123456",
customerUuid: "8f1196d5-806e-4b71-9b24-5f96ec052808",
});

if (res.statusCode == 200) {
// handle response
}
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});

const res = await sdk.otp.check({
authenticationUuid: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
checkCode: "123456",
customerUuid: "8f1196d5-806e-4b71-9b24-5f96ec052808",
});

if (res.statusCode == 200) {
// handle response
}
})();

```

# Retry an authentication

## Retry an authentication
Retry an authentication if a user has not received the code.

```typescript
import { Ding } from "@ding-live/ding";

(async () => {
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});

const res = await sdk.otp.retry({
authenticationUuid: "a74ee547-564d-487a-91df-37fb25413a91",
customerUuid: "3c8b3a46-881e-4cdd-93a6-f7f238bf020a",
});

if (res.statusCode == 200) {
// handle response
}
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});

const res = await sdk.otp.retry({
authenticationUuid: "a74ee547-564d-487a-91df-37fb25413a91",
customerUuid: "3c8b3a46-881e-4cdd-93a6-f7f238bf020a",
});

if (res.statusCode == 200) {
// handle response
}
})();
```

```
<!-- End SDK Example Usage -->

<!-- Start SDK Available Operations -->
## Available Resources and Operations

# Available Resources and Operations

## [otp](docs/sdks/otp/README.md)
### [otp](docs/sdks/otp/README.md)

- [check](docs/sdks/otp/README.md#check) - Check an authentication code
- [createAutentication](docs/sdks/otp/README.md#createautentication) - Create an authentication
- [retry](docs/sdks/otp/README.md#retry) - Retry an authentication
* [check](docs/sdks/otp/README.md#check) - Check an authentication code
* [createAutentication](docs/sdks/otp/README.md#createautentication) - Create an authentication
* [retry](docs/sdks/otp/README.md#retry) - Retry an authentication

## [lookup](docs/sdks/lookup/README.md)
### [lookup](docs/sdks/lookup/README.md)

- [lookup](docs/sdks/lookup/README.md#lookup) - Lookup a phone number
* [lookup](docs/sdks/lookup/README.md#lookup) - Lookup a phone number
<!-- End SDK Available Operations -->

<!-- Start Dev Containers -->

<!-- End Dev Containers -->

<!-- Start Error Handling -->

# Error Handling

Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.
Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Error type.

| Error Object | Status Code | Content Type |
| -------------------- | -------------------- | -------------------- |
| errors.ErrorResponse | 400 | application/json |
| errors.SDKError | 400-600 | */* |

| Error Object | Status Code | Content Type |
| -------------------- | ----------- | ---------------- |
| errors.ErrorResponse | 400 | application/json |
| errors.SDKError | 400-600 | _/_ |

## Check a code
Check that a code entered by a user is valid.

```typescript
import { Ding } from "@ding-live/ding";

(async() => {
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});


let res;
try {
res = await sdk.otp.check({
authenticationUuid: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
checkCode: "123456",
customerUuid: "8f1196d5-806e-4b71-9b24-5f96ec052808",
});
} catch (e) {
if (e instanceof errors.ErrorResponse) {
console.error(e) // handle exception

}

if (res.statusCode == 200) {
// handle response
}
})();
```
<!-- End Error Handling -->
<!-- Start Custom HTTP Client -->

# Custom HTTP Client
The Typescript SDK makes API calls using the (axios)[https://axios-http.com/docs/intro] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `AxiosInstance` object.
The Typescript SDK makes API calls using the (axios)[https://axios-http.com/docs/intro] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom `AxiosInstance` object.
For example, you could specify a header for every request that your sdk makes as follows:
Expand All @@ -148,48 +176,113 @@ const httpClient = axios.create({

const sdk = new Ding({defaultClient: httpClient});
```
<!-- End Custom HTTP Client -->
<!-- Start Authentication -->
# Authentication
## Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
| -------- | ------ | ------- |
| `apiKey` | apiKey | API key |
| Name | Type | Scheme |
| -------- | -------- | -------- |
| `apiKey` | apiKey | API key |
To authenticate with the API the `apiKey` parameter must be set when initializing the SDK client instance. For example:
## Check a code
Check that a code entered by a user is valid.
```typescript
import { Ding } from "@ding-live/ding";

(async () => {
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});
const sdk = new Ding({
apiKey: "YOUR_API_KEY",
});

const res = await sdk.otp.check({
authenticationUuid: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
checkCode: "123456",
customerUuid: "8f1196d5-806e-4b71-9b24-5f96ec052808",
});

if (res.statusCode == 200) {
// handle response
}
})();

const res = await sdk.otp.check({
authenticationUuid: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
checkCode: "123456",
customerUuid: "8f1196d5-806e-4b71-9b24-5f96ec052808",
});
```
<!-- End Authentication -->
if (res.statusCode == 200) {
// handle response
}
<!-- Start Server Selection -->
# Server Selection
## Select Server by Name
You can override the default server globally by passing a server name to the `server: string` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:
| Name | Server | Variables |
| ----- | ------ | --------- |
| `production` | `https://api.ding.live/v1` | None |

For example:
## Check a code
Check that a code entered by a user is valid.

```typescript
import { Ding } from "@ding-live/ding";
(async () => {
const sdk = new Ding({
server: "production",
apiKey: "YOUR_API_KEY",
});
const res = await sdk.otp.check({
authenticationUuid: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
checkCode: "123456",
customerUuid: "8f1196d5-806e-4b71-9b24-5f96ec052808",
});
if (res.statusCode == 200) {
// handle response
}
})();
```

<!-- End Authentication -->

## Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the `serverURL: str` optional parameter when initializing the SDK client instance. For example:
## Check a code
Check that a code entered by a user is valid.

```typescript
import { Ding } from "@ding-live/ding";
(async () => {
const sdk = new Ding({
serverURL: "https://api.ding.live/v1",
apiKey: "YOUR_API_KEY",
});
const res = await sdk.otp.check({
authenticationUuid: "e0e7b0e9-739d-424b-922f-1c2cb48ab077",
checkCode: "123456",
customerUuid: "8f1196d5-806e-4b71-9b24-5f96ec052808",
});
if (res.statusCode == 200) {
// handle response
}
})();
```
<!-- End Server Selection -->

<!-- Placeholder for Future Speakeasy SDK Sections -->

Expand Down
12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,14 @@ Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.116.0 (2.185.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.1.0] .
- [typescript v0.1.0] .

## 2023-11-08 18:34:20
### Changes
Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.116.0 (2.185.0) https://github.com/speakeasy-api/speakeasy
### Generated
- [typescript v0.2.0] .
### Releases
- [NPM v0.2.0] https://www.npmjs.com/package/@ding-live/ding/v/0.2.0 - .
Loading

0 comments on commit 16ee11e

Please sign in to comment.