Skip to content

Commit

Permalink
Release 0.0.39
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Aug 13, 2024
1 parent f356589 commit eddd285
Show file tree
Hide file tree
Showing 51 changed files with 2,039 additions and 213 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gooeyai",
"version": "0.0.1-beta7",
"version": "0.0.39",
"private": false,
"repository": "https://github.com/GooeyAI/typescript-sdk",
"main": "./index.js",
Expand Down
286 changes: 145 additions & 141 deletions src/Client.ts

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions src/api/client/requests/AiPhotoEditorAsyncRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as Gooey from "../../index";

/**
* @example
* {
* body: {
* inputImage: "input_image"
* }
* }
*/
export interface AiPhotoEditorAsyncRequest {
exampleId?: string;
body: Gooey.Img2ImgPageRequest;
}
18 changes: 18 additions & 0 deletions src/api/client/requests/CompareAiImageGeneratorsAsyncRequest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

import * as Gooey from "../../index";

/**
* @example
* {
* body: {
* inputImage: "input_image"
* }
* }
*/
export interface CompareAiImageGeneratorsAsyncRequest {
exampleId?: string;
body: Gooey.Img2ImgPageRequest;
}
4 changes: 2 additions & 2 deletions src/api/client/requests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ export { type Text2AudioPageRequest } from "./Text2AudioPageRequest";
export { type Text2AudioStatusRequest } from "./Text2AudioStatusRequest";
export { type TranslationPageRequest } from "./TranslationPageRequest";
export { type CompareAiTranslationStatusRequest } from "./CompareAiTranslationStatusRequest";
export { type Img2ImgPageRequest } from "./Img2ImgPageRequest";
export { type AiPhotoEditorAsyncRequest } from "./AiPhotoEditorAsyncRequest";
export { type AiPhotoEditorStatusRequest } from "./AiPhotoEditorStatusRequest";
export { type CompareText2ImgPageRequest } from "./CompareText2ImgPageRequest";
export { type CompareAiImageGeneratorsAsyncRequest } from "./CompareAiImageGeneratorsAsyncRequest";
export { type CompareAiImageGeneratorsStatusRequest } from "./CompareAiImageGeneratorsStatusRequest";
export { type ObjectInpaintingPageRequest } from "./ObjectInpaintingPageRequest";
export { type ProductPhotoBackgroundGeneratorStatusRequest } from "./ProductPhotoBackgroundGeneratorStatusRequest";
Expand Down
4 changes: 2 additions & 2 deletions src/api/resources/copilotIntegrations/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class CopilotIntegrations {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "gooeyai",
"X-Fern-SDK-Version": "0.0.1-beta7",
"X-Fern-SDK-Version": "0.0.39",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -137,7 +137,7 @@ export class CopilotIntegrations {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "gooeyai",
"X-Fern-SDK-Version": "0.0.1-beta7",
"X-Fern-SDK-Version": "0.0.39",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
4 changes: 2 additions & 2 deletions src/api/resources/misc/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class Misc {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "gooeyai",
"X-Fern-SDK-Version": "0.0.1-beta7",
"X-Fern-SDK-Version": "0.0.39",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -123,7 +123,7 @@ export class Misc {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "gooeyai",
"X-Fern-SDK-Version": "0.0.1-beta7",
"X-Fern-SDK-Version": "0.0.39",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as Gooey from "../../index";
import * as Gooey from "../index";

/**
* @example
* {
* textPrompt: "text_prompt"
* }
*/
export interface CompareText2ImgPageRequest {
exampleId?: string;
functions?: Gooey.RecipeFunction[];
/** Variables to be used as Jinja prompt templates and in functions as arguments */
variables?: Record<string, unknown>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,9 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as Gooey from "../../index";
import * as Gooey from "../index";

/**
* @example
* {
* inputImage: "input_image"
* }
*/
export interface Img2ImgPageRequest {
exampleId?: string;
functions?: Gooey.RecipeFunction[];
/** Variables to be used as Jinja prompt templates and in functions as arguments */
variables?: Record<string, unknown>;
Expand Down
12 changes: 7 additions & 5 deletions src/api/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export * from "./AsrPageRequestSelectedModel";
export * from "./AsrPageRequestTranslationModel";
export * from "./AsrPageRequestOutputFormat";
export * from "./TranslationPageRequestSelectedModel";
export * from "./Img2ImgPageRequestSelectedModel";
export * from "./Img2ImgPageRequestSelectedControlnetModelItem";
export * from "./Img2ImgPageRequestSelectedControlnetModel";
export * from "./CompareText2ImgPageRequestSelectedModelsItem";
export * from "./CompareText2ImgPageRequestScheduler";
export * from "./ObjectInpaintingPageRequestSelectedModel";
export * from "./FaceInpaintingPageRequestSelectedModel";
export * from "./EmailFaceInpaintingPageRequestSelectedModel";
Expand Down Expand Up @@ -100,6 +95,9 @@ export * from "./CompareLlmPageOutput";
export * from "./CompareLlmPageResponse";
export * from "./CompareLlmPageStatusResponse";
export * from "./CompareText2ImgPageOutput";
export * from "./CompareText2ImgPageRequestSelectedModelsItem";
export * from "./CompareText2ImgPageRequestScheduler";
export * from "./CompareText2ImgPageRequest";
export * from "./CompareText2ImgPageResponse";
export * from "./CompareText2ImgPageStatusResponse";
export * from "./CompareUpscalerPageOutput";
Expand Down Expand Up @@ -156,6 +154,10 @@ export * from "./ImageSegmentationPageStatusResponse";
export * from "./ImageUrlDetail";
export * from "./ImageUrl";
export * from "./Img2ImgPageOutput";
export * from "./Img2ImgPageRequestSelectedModel";
export * from "./Img2ImgPageRequestSelectedControlnetModelItem";
export * from "./Img2ImgPageRequestSelectedControlnetModel";
export * from "./Img2ImgPageRequest";
export * from "./Img2ImgPageResponse";
export * from "./Img2ImgPageStatusResponse";
export * from "./LlmTools";
Expand Down
2 changes: 0 additions & 2 deletions src/serialization/client/requests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ export { TextToSpeechPageRequest } from "./TextToSpeechPageRequest";
export { AsrPageRequest } from "./AsrPageRequest";
export { Text2AudioPageRequest } from "./Text2AudioPageRequest";
export { TranslationPageRequest } from "./TranslationPageRequest";
export { Img2ImgPageRequest } from "./Img2ImgPageRequest";
export { CompareText2ImgPageRequest } from "./CompareText2ImgPageRequest";
export { ObjectInpaintingPageRequest } from "./ObjectInpaintingPageRequest";
export { FaceInpaintingPageRequest } from "./FaceInpaintingPageRequest";
export { EmailFaceInpaintingPageRequest } from "./EmailFaceInpaintingPageRequest";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "../../index";
import * as Gooey from "../../../api/index";
import * as core from "../../../core";
import { RecipeFunction } from "../../types/RecipeFunction";
import { CompareText2ImgPageRequestSelectedModelsItem } from "../../types/CompareText2ImgPageRequestSelectedModelsItem";
import { CompareText2ImgPageRequestScheduler } from "../../types/CompareText2ImgPageRequestScheduler";
import { RunSettings } from "../../types/RunSettings";
import * as serializers from "../index";
import * as Gooey from "../../api/index";
import * as core from "../../core";
import { RecipeFunction } from "./RecipeFunction";
import { CompareText2ImgPageRequestSelectedModelsItem } from "./CompareText2ImgPageRequestSelectedModelsItem";
import { CompareText2ImgPageRequestScheduler } from "./CompareText2ImgPageRequestScheduler";
import { RunSettings } from "./RunSettings";

export const CompareText2ImgPageRequest: core.serialization.Schema<
export const CompareText2ImgPageRequest: core.serialization.ObjectSchema<
serializers.CompareText2ImgPageRequest.Raw,
Omit<Gooey.CompareText2ImgPageRequest, "exampleId">
Gooey.CompareText2ImgPageRequest
> = core.serialization.object({
functions: core.serialization.list(RecipeFunction).optional(),
variables: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
* This file was auto-generated by Fern from our API Definition.
*/

import * as serializers from "../../index";
import * as Gooey from "../../../api/index";
import * as core from "../../../core";
import { RecipeFunction } from "../../types/RecipeFunction";
import { Img2ImgPageRequestSelectedModel } from "../../types/Img2ImgPageRequestSelectedModel";
import { Img2ImgPageRequestSelectedControlnetModel } from "../../types/Img2ImgPageRequestSelectedControlnetModel";
import { RunSettings } from "../../types/RunSettings";
import * as serializers from "../index";
import * as Gooey from "../../api/index";
import * as core from "../../core";
import { RecipeFunction } from "./RecipeFunction";
import { Img2ImgPageRequestSelectedModel } from "./Img2ImgPageRequestSelectedModel";
import { Img2ImgPageRequestSelectedControlnetModel } from "./Img2ImgPageRequestSelectedControlnetModel";
import { RunSettings } from "./RunSettings";

export const Img2ImgPageRequest: core.serialization.Schema<
export const Img2ImgPageRequest: core.serialization.ObjectSchema<
serializers.Img2ImgPageRequest.Raw,
Omit<Gooey.Img2ImgPageRequest, "exampleId">
Gooey.Img2ImgPageRequest
> = core.serialization.object({
functions: core.serialization.list(RecipeFunction).optional(),
variables: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
Expand Down
12 changes: 7 additions & 5 deletions src/serialization/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ export * from "./AsrPageRequestSelectedModel";
export * from "./AsrPageRequestTranslationModel";
export * from "./AsrPageRequestOutputFormat";
export * from "./TranslationPageRequestSelectedModel";
export * from "./Img2ImgPageRequestSelectedModel";
export * from "./Img2ImgPageRequestSelectedControlnetModelItem";
export * from "./Img2ImgPageRequestSelectedControlnetModel";
export * from "./CompareText2ImgPageRequestSelectedModelsItem";
export * from "./CompareText2ImgPageRequestScheduler";
export * from "./ObjectInpaintingPageRequestSelectedModel";
export * from "./FaceInpaintingPageRequestSelectedModel";
export * from "./EmailFaceInpaintingPageRequestSelectedModel";
Expand Down Expand Up @@ -100,6 +95,9 @@ export * from "./CompareLlmPageOutput";
export * from "./CompareLlmPageResponse";
export * from "./CompareLlmPageStatusResponse";
export * from "./CompareText2ImgPageOutput";
export * from "./CompareText2ImgPageRequestSelectedModelsItem";
export * from "./CompareText2ImgPageRequestScheduler";
export * from "./CompareText2ImgPageRequest";
export * from "./CompareText2ImgPageResponse";
export * from "./CompareText2ImgPageStatusResponse";
export * from "./CompareUpscalerPageOutput";
Expand Down Expand Up @@ -156,6 +154,10 @@ export * from "./ImageSegmentationPageStatusResponse";
export * from "./ImageUrlDetail";
export * from "./ImageUrl";
export * from "./Img2ImgPageOutput";
export * from "./Img2ImgPageRequestSelectedModel";
export * from "./Img2ImgPageRequestSelectedControlnetModelItem";
export * from "./Img2ImgPageRequestSelectedControlnetModel";
export * from "./Img2ImgPageRequest";
export * from "./Img2ImgPageResponse";
export * from "./Img2ImgPageStatusResponse";
export * from "./LlmTools";
Expand Down
22 changes: 22 additions & 0 deletions tests/unit/auth/BasicAuth.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { BasicAuth } from "../../../src/core/auth/BasicAuth";

describe("BasicAuth", () => {
describe("toAuthorizationHeader", () => {
it("correctly converts to header", () => {
expect(
BasicAuth.toAuthorizationHeader({
username: "username",
password: "password",
})
).toBe("Basic dXNlcm5hbWU6cGFzc3dvcmQ=");
});
});
describe("fromAuthorizationHeader", () => {
it("correctly parses header", () => {
expect(BasicAuth.fromAuthorizationHeader("Basic dXNlcm5hbWU6cGFzc3dvcmQ=")).toEqual({
username: "username",
password: "password",
});
});
});
});
14 changes: 14 additions & 0 deletions tests/unit/auth/BearerToken.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { BearerToken } from "../../../src/core/auth/BearerToken";

describe("BearerToken", () => {
describe("toAuthorizationHeader", () => {
it("correctly converts to header", () => {
expect(BearerToken.toAuthorizationHeader("my-token")).toBe("Bearer my-token");
});
});
describe("fromAuthorizationHeader", () => {
it("correctly parses header", () => {
expect(BearerToken.fromAuthorizationHeader("Bearer my-token")).toBe("my-token");
});
});
});
47 changes: 47 additions & 0 deletions tests/unit/fetcher/Fetcher.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher";

describe("Test fetcherImpl", () => {
let mockCreateUrl: jest.Mock;
let mockGetBody: jest.Mock;
let mockGetFetchFn: jest.Mock;
let mockRequestWithRetries: jest.Mock;
let mockGetResponseBody: jest.Mock;

beforeEach(() => {
mockCreateUrl = jest.fn();
mockGetBody = jest.fn();
mockGetFetchFn = jest.fn();
mockRequestWithRetries = jest.fn();
mockGetResponseBody = jest.fn();

jest.mock("../../../src/core/fetcher/Fetcher", () => ({
createUrl: mockCreateUrl,
getBody: mockGetBody,
getFetchFn: mockGetFetchFn,
requestWithRetries: mockRequestWithRetries,
getResponseBody: mockGetResponseBody,
}));
});

it("should handle successful request", async () => {
const mockArgs: Fetcher.Args = {
url: "https://httpbin.org/post",
method: "POST",
headers: { "X-Test": "x-test-header" },
body: { data: "test" },
contentType: "application/json",
requestType: "json",
};

mockCreateUrl.mockReturnValue("https://test.com");
mockGetBody.mockResolvedValue(JSON.stringify({ data: "test" }));
mockGetFetchFn.mockResolvedValue(() => Promise.resolve());
mockRequestWithRetries.mockResolvedValue({ status: 200 });
mockGetResponseBody.mockResolvedValue({ result: "success" });

const result = await fetcherImpl(mockArgs);
expect(result.ok).toBe(true);
// @ts-expect-error
expect(result.body.json).toEqual({ data: "test" });
});
});
51 changes: 51 additions & 0 deletions tests/unit/fetcher/createRequestUrl.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { createRequestUrl } from "../../../src/core/fetcher/createRequestUrl";

describe("Test createRequestUrl", () => {
it("should return the base URL when no query parameters are provided", () => {
const baseUrl = "https://api.example.com";
expect(createRequestUrl(baseUrl)).toBe(baseUrl);
});

it("should append simple query parameters", () => {
const baseUrl = "https://api.example.com";
const queryParams = { key: "value", another: "param" };
expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?key=value&another=param");
});

it("should handle array query parameters", () => {
const baseUrl = "https://api.example.com";
const queryParams = { items: ["a", "b", "c"] };
expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?items=a&items=b&items=c");
});

it("should handle object query parameters", () => {
const baseUrl = "https://api.example.com";
const queryParams = { filter: { name: "John", age: 30 } };
expect(createRequestUrl(baseUrl, queryParams)).toBe(
"https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30"
);
});

it("should handle mixed types of query parameters", () => {
const baseUrl = "https://api.example.com";
const queryParams = {
simple: "value",
array: ["x", "y"],
object: { key: "value" },
};
expect(createRequestUrl(baseUrl, queryParams)).toBe(
"https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value"
);
});

it("should handle empty query parameters object", () => {
const baseUrl = "https://api.example.com";
expect(createRequestUrl(baseUrl, {})).toBe(baseUrl);
});

it("should encode special characters in query parameters", () => {
const baseUrl = "https://api.example.com";
const queryParams = { special: "a&b=c d" };
expect(createRequestUrl(baseUrl, queryParams)).toBe("https://api.example.com?special=a%26b%3Dc%20d");
});
});
Loading

0 comments on commit eddd285

Please sign in to comment.