Skip to content

Commit

Permalink
Release v0.0.33
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jul 12, 2023
1 parent c4d464a commit b29da77
Show file tree
Hide file tree
Showing 17 changed files with 230 additions and 85 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "superagentai-js",
"version": "v0.0.32",
"version": "v0.0.33",
"private": false,
"repository": "https://github.com/homanp/superagent-js",
"main": "./index.js",
Expand All @@ -14,7 +14,8 @@
"url-join": "4.0.1",
"@types/url-join": "4.0.1",
"@ungap/url-search-params": "0.2.2",
"axios": "1.4.0"
"axios": "1.4.0",
"js-base64": "3.7.2"
},
"devDependencies": {
"@types/node": "17.0.33",
Expand Down
2 changes: 1 addition & 1 deletion src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Traces } from "./api/resources/traces/client/Client";
export declare namespace SuperAgentClient {
interface Options {
environment: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
token?: core.Supplier<core.BearerToken | undefined>;
}
}

Expand Down
35 changes: 22 additions & 13 deletions src/api/resources/agent/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as serializers from "../../../../serialization";
export declare namespace Agent {
interface Options {
environment: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
token?: core.Supplier<core.BearerToken | undefined>;
}
}

Expand All @@ -26,10 +26,10 @@ export class Agent {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/agents"),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -69,10 +69,10 @@ export class Agent {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/agents"),
method: "POST",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
body: await serializers.Agent.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -125,10 +125,10 @@ export class Agent {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/agents/${agentId}`),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -180,10 +180,10 @@ export class Agent {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/agents/${agentId}`),
method: "PATCH",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
body: await serializers.agent.patchAgent.Request.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -236,10 +236,10 @@ export class Agent {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/agents/${agentId}`),
method: "DELETE",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -291,10 +291,10 @@ export class Agent {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/agents/${agentId}/predict`),
method: "POST",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
body: await serializers.PredictAgent.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -337,4 +337,13 @@ export class Agent {
});
}
}

protected async _getAuthorizationHeader() {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
}
}
27 changes: 18 additions & 9 deletions src/api/resources/agentDocuments/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as serializers from "../../../../serialization";
export declare namespace AgentDocuments {
interface Options {
environment: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
token?: core.Supplier<core.BearerToken | undefined>;
}
}

Expand All @@ -36,10 +36,10 @@ export class AgentDocuments {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/agent-documents"),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -92,10 +92,10 @@ export class AgentDocuments {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/agent-documents"),
method: "POST",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
body: await serializers.AgentDocument.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -151,10 +151,10 @@ export class AgentDocuments {
),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -209,10 +209,10 @@ export class AgentDocuments {
),
method: "DELETE",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -254,4 +254,13 @@ export class AgentDocuments {
});
}
}

protected async _getAuthorizationHeader() {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
}
}
27 changes: 18 additions & 9 deletions src/api/resources/agentTools/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as serializers from "../../../../serialization";
export declare namespace AgentTools {
interface Options {
environment: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
token?: core.Supplier<core.BearerToken | undefined>;
}
}

Expand All @@ -34,10 +34,10 @@ export class AgentTools {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/agent-tools"),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
queryParameters: _queryParams,
Expand Down Expand Up @@ -90,10 +90,10 @@ export class AgentTools {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/agent-tools"),
method: "POST",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
body: await serializers.AgentTool.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -146,10 +146,10 @@ export class AgentTools {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/agent-tools/${agentToolId}`),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -201,10 +201,10 @@ export class AgentTools {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/agent-tools/${agentToolId}`),
method: "DELETE",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -246,4 +246,13 @@ export class AgentTools {
});
}
}

protected async _getAuthorizationHeader() {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
}
}
27 changes: 18 additions & 9 deletions src/api/resources/apiToken/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as serializers from "../../../../serialization";
export declare namespace ApiToken {
interface Options {
environment: core.Supplier<string>;
apiKey?: core.Supplier<string | undefined>;
token?: core.Supplier<core.BearerToken | undefined>;
}
}

Expand All @@ -26,10 +26,10 @@ export class ApiToken {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/api-tokens"),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -69,10 +69,10 @@ export class ApiToken {
url: urlJoin(await core.Supplier.get(this._options.environment), "api/v1/api-tokens"),
method: "POST",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
body: await serializers.ApiToken.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
Expand Down Expand Up @@ -125,10 +125,10 @@ export class ApiToken {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/api-tokens/${tokenId}`),
method: "GET",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -180,10 +180,10 @@ export class ApiToken {
url: urlJoin(await core.Supplier.get(this._options.environment), `api/v1/api-tokens/${tokenId}`),
method: "DELETE",
headers: {
X_SUPERAGENT_API_KEY: await core.Supplier.get(this._options.apiKey),
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "superagentai-js",
"X-Fern-SDK-Version": "v0.0.32",
"X-Fern-SDK-Version": "v0.0.33",
},
contentType: "application/json",
timeoutMs: 60000,
Expand Down Expand Up @@ -225,4 +225,13 @@ export class ApiToken {
});
}
}

protected async _getAuthorizationHeader() {
const bearer = await core.Supplier.get(this._options.token);
if (bearer != null) {
return `Bearer ${bearer}`;
}

return undefined;
}
}
Loading

0 comments on commit b29da77

Please sign in to comment.