Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jul 23, 2024
1 parent 4a0ff06 commit 7af099e
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 130 deletions.
2 changes: 1 addition & 1 deletion .mock/fern.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"organization" : "crossmint",
"version" : "0.31.24"
"version" : "0.33.5"
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crossmint",
"version": "0.1.7",
"version": "0.0.3",
"private": false,
"repository": "https://github.com/fern-demo/crossmint-typescript-sdk",
"main": "./index.js",
Expand All @@ -13,7 +13,7 @@
},
"dependencies": {
"url-join": "4.0.1",
"form-data": "4.0.0",
"form-data": "^4.0.0",
"formdata-node": "^6.0.3",
"node-fetch": "2.7.0",
"qs": "6.11.2"
Expand Down
90 changes: 15 additions & 75 deletions reference.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
## Checkout
# Reference

<details><summary> <code>client.checkout.<a href="./src/api/resources/checkout/client/Client.ts">createOrder</a>({ ...params }) -> Crossmint.CreateOrderResponse</code> </summary>
## Checkout

<details><summary><code>client.checkout.<a href="/src/api/resources/checkout/client/Client.ts">createOrder</a>({ ...params }) -> Crossmint.CreateOrderResponse</code></summary>
<dl>

<dd>

#### 📝 Description

<dl>

<dd>

<dl>

<dd>

Creates a new order that can be used to complete a headless checkout.

</dd>

</dl>

</dd>

</dl>

#### 🔌 Usage

<dl>

<dd>

<dl>

<dd>

```ts
```typescript
await client.checkout.createOrder({
payment: {
method: Crossmint.EvmPaymentMethods.ArbitrumSepolia,
Expand All @@ -49,228 +42,175 @@ await client.checkout.createOrder({
```

</dd>

</dl>

</dd>

</dl>

#### ⚙️ Parameters

<dl>

<dd>

<dl>

<dd>

**request: `Crossmint.CheckoutCreateOrderRequest`**
**request:** `Crossmint.CheckoutCreateOrderRequest`

</dd>

</dl>

<dl>

<dd>

**requestOptions: `Checkout.RequestOptions`**
**requestOptions:** `Checkout.RequestOptions`

</dd>

</dl>

</dd>

</dl>

</dd>

</dl>
</details>

<details><summary> <code>client.checkout.<a href="./src/api/resources/checkout/client/Client.ts">getOrder</a>(orderId) -> Crossmint.OrderObject</code> </summary>

<details><summary><code>client.checkout.<a href="/src/api/resources/checkout/client/Client.ts">getOrder</a>(orderId) -> Crossmint.OrderObject</code></summary>
<dl>

<dd>

#### 📝 Description

<dl>

<dd>

<dl>

<dd>

Get specific order by ID

</dd>

</dl>

</dd>

</dl>

#### 🔌 Usage

<dl>

<dd>

<dl>

<dd>

```ts
```typescript
await client.checkout.getOrder("orderId");
```

</dd>

</dl>

</dd>

</dl>

#### ⚙️ Parameters

<dl>

<dd>

<dl>

<dd>

**orderId: `string`**
**orderId:** `string`

This is the identifier for the order with UUID format.

**Example:** `9c82ef99-617f-497d-9abb-fd355291681b`

</dd>

</dl>

<dl>

<dd>

**requestOptions: `Checkout.RequestOptions`**
**requestOptions:** `Checkout.RequestOptions`

</dd>

</dl>

</dd>

</dl>

</dd>

</dl>
</details>

<details><summary> <code>client.checkout.<a href="./src/api/resources/checkout/client/Client.ts">editOrder</a>(orderId, { ...params }) -> Crossmint.OrderObject</code> </summary>

<details><summary><code>client.checkout.<a href="/src/api/resources/checkout/client/Client.ts">editOrder</a>(orderId, { ...params }) -> Crossmint.OrderObject</code></summary>
<dl>

<dd>

#### 📝 Description

<dl>

<dd>

<dl>

<dd>

Edit an existing order. You can update the recipient, the payment method, and/or the locale.

</dd>

</dl>

</dd>

</dl>

#### 🔌 Usage

<dl>

<dd>

<dl>

<dd>

```ts
```typescript
await client.checkout.editOrder("orderId");
```

</dd>

</dl>

</dd>

</dl>

#### ⚙️ Parameters

<dl>

<dd>

<dl>

<dd>

**orderId: `string`**
**orderId:** `string`

This is the identifier for the order with UUID format.

**Example:** `9c82ef99-617f-497d-9abb-fd355291681b`

</dd>

</dl>

<dl>

<dd>

**request: `Crossmint.OrderDto`**
**request:** `Crossmint.OrderDto`

</dd>

</dl>

<dl>

<dd>

**requestOptions: `Checkout.RequestOptions`**
**requestOptions:** `Checkout.RequestOptions`

</dd>

</dl>

</dd>

</dl>

</dd>

</dl>
</details>
9 changes: 6 additions & 3 deletions src/api/resources/checkout/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ export class Checkout {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.1.7",
"X-Fern-SDK-Version": "0.0.3",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
},
contentType: "application/json",
requestType: "json",
body: serializers.CheckoutCreateOrderRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
Expand Down Expand Up @@ -176,12 +177,13 @@ export class Checkout {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.1.7",
"X-Fern-SDK-Version": "0.0.3",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
},
contentType: "application/json",
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
Expand Down Expand Up @@ -292,12 +294,13 @@ export class Checkout {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.1.7",
"X-Fern-SDK-Version": "0.0.3",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
},
contentType: "application/json",
requestType: "json",
body: serializers.OrderDto.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
Expand Down
14 changes: 12 additions & 2 deletions src/core/fetcher/Fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export declare namespace Fetcher {
maxRetries?: number;
withCredentials?: boolean;
abortSignal?: AbortSignal;
requestType?: "json" | "file" | "bytes";
responseType?: "json" | "blob" | "streaming" | "text";
duplex?: "half";
}

export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError;
Expand Down Expand Up @@ -62,7 +64,10 @@ export async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIR
}

const url = createRequestUrl(args.url, args.queryParameters);
let requestBody: BodyInit | undefined = await getRequestBody(args.body, args.contentType ?? "");
let requestBody: BodyInit | undefined = await getRequestBody({
body: args.body,
type: args.requestType === "json" ? "json" : "other",
});
const fetchFn = await getFetchFn();

try {
Expand All @@ -76,13 +81,18 @@ export async function fetcherImpl<R = unknown>(args: Fetcher.Args): Promise<APIR
requestBody,
args.timeoutMs,
args.abortSignal,
args.withCredentials
args.withCredentials,
args.duplex
),
args.maxRetries
);
let responseBody = await getResponseBody(response, args.responseType);

if (response.status >= 200 && response.status < 400) {
if (args.duplex && args.responseType === "streaming") {
responseBody = (await import("stream")).Readable.from(responseBody as any);
}

return {
ok: true,
body: responseBody as R,
Expand Down
Loading

0 comments on commit 7af099e

Please sign in to comment.