Skip to content

Commit

Permalink
Release 0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Aug 1, 2024
1 parent 3c28a67 commit 6dbe575
Show file tree
Hide file tree
Showing 25 changed files with 257 additions and 166 deletions.
5 changes: 5 additions & 0 deletions .mock/definition/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ default-environment: Staging
environments:
Staging: https://staging.crossmint.com/api
Production: https://www.crossmint.com/api
headers:
Authorization:
name: clientSecret
env: CROSSMINT_CLIENT_SECRET
type: optional<string>
auth-schemes:
apiKey:
header: X-API-KEY
Expand Down
2 changes: 1 addition & 1 deletion .mock/definition/headless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ service:
edit-order:
path: /2022-06-09/orders/{orderId}
method: PATCH
auth: true
auth: false
docs: >-
Edit an existing order. You can update the recipient, the payment
method, and/or the locale.
Expand Down
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.36.0"
"version" : "0.37.0"
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Instantiate and use the client with the following:
```typescript
import { CrossmintClient, Crossmint } from "crossmint";

const client = new CrossmintClient({ apiKey: "YOUR_API_KEY" });
const client = new CrossmintClient({ apiKey: "YOUR_API_KEY", clientSecret: "YOUR_CLIENT_SECRET" });
await client.wallets({});
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crossmint",
"version": "0.2.1",
"version": "0.2.2",
"private": false,
"repository": "https://github.com/Paella-Labs/typescript-sdk",
"main": "./index.js",
Expand Down
17 changes: 11 additions & 6 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import { Sign } from "./api/resources/sign/client/Client";
export declare namespace CrossmintClient {
interface Options {
environment?: core.Supplier<environments.CrossmintEnvironment | string>;
apiKey: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
/** Override the Authorization header */
clientSecret?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

Expand All @@ -34,11 +36,13 @@ export declare namespace CrossmintClient {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the Authorization header */
clientSecret?: string | undefined;
}
}

export class CrossmintClient {
constructor(protected readonly _options: CrossmintClient.Options) {}
constructor(protected readonly _options: CrossmintClient.Options = {}) {}

/**
* Get usage data for a project.
Expand Down Expand Up @@ -80,7 +84,7 @@ export class CrossmintClient {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -161,7 +165,7 @@ export class CrossmintClient {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -241,7 +245,7 @@ export class CrossmintClient {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -353,7 +357,8 @@ export class CrossmintClient {
}

protected async _getCustomAuthorizationHeaders() {
const clientSecretValue = await core.Supplier.get(this._options.clientSecret);
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
return { "X-API-KEY": apiKeyValue };
return { Authorization: clientSecretValue, "X-API-KEY": apiKeyValue };
}
}
13 changes: 9 additions & 4 deletions src/api/resources/actions/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import * as errors from "../../../../errors/index";
export declare namespace Actions {
interface Options {
environment?: core.Supplier<environments.CrossmintEnvironment | string>;
apiKey: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
/** Override the Authorization header */
clientSecret?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

Expand All @@ -23,11 +25,13 @@ export declare namespace Actions {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the Authorization header */
clientSecret?: string | undefined;
}
}

export class Actions {
constructor(protected readonly _options: Actions.Options) {}
constructor(protected readonly _options: Actions.Options = {}) {}

/**
* Use this API to poll for the status of asynchonous actions such as NFT mints, transfers, etc.
Expand Down Expand Up @@ -56,7 +60,7 @@ export class Actions {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -107,7 +111,8 @@ export class Actions {
}

protected async _getCustomAuthorizationHeaders() {
const clientSecretValue = await core.Supplier.get(this._options.clientSecret);
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
return { "X-API-KEY": apiKeyValue };
return { Authorization: clientSecretValue, "X-API-KEY": apiKeyValue };
}
}
13 changes: 9 additions & 4 deletions src/api/resources/checkout/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import * as errors from "../../../../errors/index";
export declare namespace Checkout {
interface Options {
environment?: core.Supplier<environments.CrossmintEnvironment | string>;
apiKey: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
/** Override the Authorization header */
clientSecret?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

Expand All @@ -23,11 +25,13 @@ export declare namespace Checkout {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the Authorization header */
clientSecret?: string | undefined;
}
}

export class Checkout {
constructor(protected readonly _options: Checkout.Options) {}
constructor(protected readonly _options: Checkout.Options = {}) {}

/**
* **API scope required**: `nfts.checkout` Begin the checkout process for a mint
Expand Down Expand Up @@ -58,7 +62,7 @@ export class Checkout {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -110,7 +114,8 @@ export class Checkout {
}

protected async _getCustomAuthorizationHeaders() {
const clientSecretValue = await core.Supplier.get(this._options.clientSecret);
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
return { "X-API-KEY": apiKeyValue };
return { Authorization: clientSecretValue, "X-API-KEY": apiKeyValue };
}
}
17 changes: 11 additions & 6 deletions src/api/resources/headless/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import * as errors from "../../../../errors/index";
export declare namespace Headless {
interface Options {
environment?: core.Supplier<environments.CrossmintEnvironment | string>;
apiKey: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
/** Override the Authorization header */
clientSecret?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

Expand All @@ -23,11 +25,13 @@ export declare namespace Headless {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the Authorization header */
clientSecret?: string | undefined;
}
}

export class Headless {
constructor(protected readonly _options: Headless.Options) {}
constructor(protected readonly _options: Headless.Options = {}) {}

/**
* Creates a new order that can be used to complete a headless checkout.
Expand Down Expand Up @@ -64,7 +68,7 @@ export class Headless {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -145,7 +149,7 @@ export class Headless {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -230,7 +234,7 @@ export class Headless {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -286,7 +290,8 @@ export class Headless {
}

protected async _getCustomAuthorizationHeaders() {
const clientSecretValue = await core.Supplier.get(this._options.clientSecret);
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
return { "X-API-KEY": apiKeyValue };
return { Authorization: clientSecretValue, "X-API-KEY": apiKeyValue };
}
}
31 changes: 18 additions & 13 deletions src/api/resources/nfTs/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import * as errors from "../../../../errors/index";
export declare namespace NfTs {
interface Options {
environment?: core.Supplier<environments.CrossmintEnvironment | string>;
apiKey: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
/** Override the Authorization header */
clientSecret?: core.Supplier<string | undefined>;
fetcher?: core.FetchFunction;
}

Expand All @@ -23,11 +25,13 @@ export declare namespace NfTs {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the Authorization header */
clientSecret?: string | undefined;
}
}

export class NfTs {
constructor(protected readonly _options: NfTs.Options) {}
constructor(protected readonly _options: NfTs.Options = {}) {}

/**
* Mint multiple NFTs with a single call and deliver them to a web3 wallet or an email address
Expand Down Expand Up @@ -67,7 +71,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -167,7 +171,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -265,7 +269,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -361,7 +365,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
"x-idempotency-key": idempotencyKey != null ? idempotencyKey : undefined,
Expand Down Expand Up @@ -454,7 +458,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -555,7 +559,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -647,7 +651,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -748,7 +752,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -833,7 +837,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -936,7 +940,7 @@ export class NfTs {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "crossmint",
"X-Fern-SDK-Version": "0.2.1",
"X-Fern-SDK-Version": "0.2.2",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -1002,7 +1006,8 @@ export class NfTs {
}

protected async _getCustomAuthorizationHeaders() {
const clientSecretValue = await core.Supplier.get(this._options.clientSecret);
const apiKeyValue = await core.Supplier.get(this._options.apiKey);
return { "X-API-KEY": apiKeyValue };
return { Authorization: clientSecretValue, "X-API-KEY": apiKeyValue };
}
}
Loading

0 comments on commit 6dbe575

Please sign in to comment.