Skip to content

Commit aad13a7

Browse files
committed
Release 0.0.1
1 parent d5e0ef0 commit aad13a7

File tree

37 files changed

+353
-108
lines changed

37 files changed

+353
-108
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Instantiate and use the client with the following:
1818
```typescript
1919
import { GooeyClient } from "gooey";
2020

21-
const client = new GooeyClient({ token: "YOUR_TOKEN" });
21+
const client = new GooeyClient({ apiKey: "YOUR_API_KEY" });
2222
await client.copilotIntegrations.videoBotsStreamCreate({
2323
integrationId: "integration_id",
2424
});

src/Client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import { Misc } from "./api/resources/misc/client/Client";
4343
export declare namespace GooeyClient {
4444
interface Options {
4545
environment?: core.Supplier<environments.GooeyEnvironment | string>;
46-
token: core.Supplier<core.BearerToken>;
46+
apiKey?: core.Supplier<core.BearerToken | undefined>;
4747
fetcher?: core.FetchFunction;
4848
}
4949

@@ -58,7 +58,7 @@ export declare namespace GooeyClient {
5858
}
5959

6060
export class GooeyClient {
61-
constructor(protected readonly _options: GooeyClient.Options) {}
61+
constructor(protected readonly _options: GooeyClient.Options = {}) {}
6262

6363
protected _copilotIntegrations: CopilotIntegrations | undefined;
6464

src/api/resources/aiAnimationGenerator/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace AiAnimationGenerator {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace AiAnimationGenerator {
2727
}
2828

2929
export class AiAnimationGenerator {
30-
constructor(protected readonly _options: AiAnimationGenerator.Options) {}
30+
constructor(protected readonly _options: AiAnimationGenerator.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.DeforumSdPageRequest} request
@@ -335,6 +335,13 @@ export class AiAnimationGenerator {
335335
}
336336

337337
protected async _getAuthorizationHeader(): Promise<string> {
338-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
338+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
339+
if (bearer == null) {
340+
throw new errors.GooeyError({
341+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
342+
});
343+
}
344+
345+
return `Bearer ${bearer}`;
339346
}
340347
}

src/api/resources/aiArtQrCode/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace AiArtQrCode {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace AiArtQrCode {
2727
}
2828

2929
export class AiArtQrCode {
30-
constructor(protected readonly _options: AiArtQrCode.Options) {}
30+
constructor(protected readonly _options: AiArtQrCode.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.QrCodeGeneratorPageRequest} request
@@ -329,6 +329,13 @@ export class AiArtQrCode {
329329
}
330330

331331
protected async _getAuthorizationHeader(): Promise<string> {
332-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
332+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
333+
if (bearer == null) {
334+
throw new errors.GooeyError({
335+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
336+
});
337+
}
338+
339+
return `Bearer ${bearer}`;
333340
}
334341
}

src/api/resources/aiBackgroundChanger/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace AiBackgroundChanger {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace AiBackgroundChanger {
2727
}
2828

2929
export class AiBackgroundChanger {
30-
constructor(protected readonly _options: AiBackgroundChanger.Options) {}
30+
constructor(protected readonly _options: AiBackgroundChanger.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.ImageSegmentationPageRequest} request
@@ -329,6 +329,13 @@ export class AiBackgroundChanger {
329329
}
330330

331331
protected async _getAuthorizationHeader(): Promise<string> {
332-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
332+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
333+
if (bearer == null) {
334+
throw new errors.GooeyError({
335+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
336+
});
337+
}
338+
339+
return `Bearer ${bearer}`;
333340
}
334341
}

src/api/resources/aiGeneratedPhotoFromEmailProfileLookup/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace AiGeneratedPhotoFromEmailProfileLookup {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace AiGeneratedPhotoFromEmailProfileLookup {
2727
}
2828

2929
export class AiGeneratedPhotoFromEmailProfileLookup {
30-
constructor(protected readonly _options: AiGeneratedPhotoFromEmailProfileLookup.Options) {}
30+
constructor(protected readonly _options: AiGeneratedPhotoFromEmailProfileLookup.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.EmailFaceInpaintingPageRequest} request
@@ -331,6 +331,13 @@ export class AiGeneratedPhotoFromEmailProfileLookup {
331331
}
332332

333333
protected async _getAuthorizationHeader(): Promise<string> {
334-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
334+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
335+
if (bearer == null) {
336+
throw new errors.GooeyError({
337+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
338+
});
339+
}
340+
341+
return `Bearer ${bearer}`;
335342
}
336343
}

src/api/resources/aiImageWithAFace/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace AiImageWithAFace {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace AiImageWithAFace {
2727
}
2828

2929
export class AiImageWithAFace {
30-
constructor(protected readonly _options: AiImageWithAFace.Options) {}
30+
constructor(protected readonly _options: AiImageWithAFace.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.FaceInpaintingPageRequest} request
@@ -331,6 +331,13 @@ export class AiImageWithAFace {
331331
}
332332

333333
protected async _getAuthorizationHeader(): Promise<string> {
334-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
334+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
335+
if (bearer == null) {
336+
throw new errors.GooeyError({
337+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
338+
});
339+
}
340+
341+
return `Bearer ${bearer}`;
335342
}
336343
}

src/api/resources/bulkRunner/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace BulkRunner {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace BulkRunner {
2727
}
2828

2929
export class BulkRunner {
30-
constructor(protected readonly _options: BulkRunner.Options) {}
30+
constructor(protected readonly _options: BulkRunner.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.BulkRunnerPageRequest} request
@@ -343,6 +343,13 @@ export class BulkRunner {
343343
}
344344

345345
protected async _getAuthorizationHeader(): Promise<string> {
346-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
346+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
347+
if (bearer == null) {
348+
throw new errors.GooeyError({
349+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
350+
});
351+
}
352+
353+
return `Bearer ${bearer}`;
347354
}
348355
}

src/api/resources/chyronPlantBot/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace ChyronPlantBot {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace ChyronPlantBot {
2727
}
2828

2929
export class ChyronPlantBot {
30-
constructor(protected readonly _options: ChyronPlantBot.Options) {}
30+
constructor(protected readonly _options: ChyronPlantBot.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.ChyronPlantPageRequest} request
@@ -329,6 +329,13 @@ export class ChyronPlantBot {
329329
}
330330

331331
protected async _getAuthorizationHeader(): Promise<string> {
332-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
332+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
333+
if (bearer == null) {
334+
throw new errors.GooeyError({
335+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
336+
});
337+
}
338+
339+
return `Bearer ${bearer}`;
333340
}
334341
}

src/api/resources/compareAiImageGenerators/client/Client.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as errors from "../../../../errors/index";
1212
export declare namespace CompareAiImageGenerators {
1313
interface Options {
1414
environment?: core.Supplier<environments.GooeyEnvironment | string>;
15-
token: core.Supplier<core.BearerToken>;
15+
apiKey?: core.Supplier<core.BearerToken | undefined>;
1616
fetcher?: core.FetchFunction;
1717
}
1818

@@ -27,7 +27,7 @@ export declare namespace CompareAiImageGenerators {
2727
}
2828

2929
export class CompareAiImageGenerators {
30-
constructor(protected readonly _options: CompareAiImageGenerators.Options) {}
30+
constructor(protected readonly _options: CompareAiImageGenerators.Options = {}) {}
3131

3232
/**
3333
* @param {Gooey.CompareText2ImgPageRequest} request
@@ -329,6 +329,13 @@ export class CompareAiImageGenerators {
329329
}
330330

331331
protected async _getAuthorizationHeader(): Promise<string> {
332-
return `Bearer ${await core.Supplier.get(this._options.token)}`;
332+
const bearer = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["GOOEY_API_KEY"];
333+
if (bearer == null) {
334+
throw new errors.GooeyError({
335+
message: "Please specify GOOEY_API_KEY when instantiating the client.",
336+
});
337+
}
338+
339+
return `Bearer ${bearer}`;
333340
}
334341
}

0 commit comments

Comments
 (0)