Skip to content

Commit

Permalink
Release 0.1.4
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 7, 2024
1 parent a7ed5d6 commit 2ff819c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 45 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Instantiate and use the client with the following:
```typescript
import { ScrapybaraClient } from "scrapybara";

const client = new ScrapybaraClient({ authorization: "YOUR_AUTHORIZATION" });
const client = new ScrapybaraClient({ apiKey: "YOUR_API_KEY" });
await client.start();
```

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": "scrapybara",
"version": "0.1.3",
"version": "0.1.4",
"private": false,
"repository": "https://github.com/scrapybara/scrapybara-ts",
"main": "./index.js",
Expand Down
17 changes: 7 additions & 10 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import { Browser } from "./api/resources/browser/client/Client";
export declare namespace ScrapybaraClient {
interface Options {
environment?: core.Supplier<environments.ScrapybaraEnvironment | string>;
/** Override the authorization header */
authorization: core.Supplier<string>;
apiKey: core.Supplier<string>;
}

interface RequestOptions {
Expand All @@ -25,8 +24,6 @@ export declare namespace ScrapybaraClient {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the authorization header */
authorization?: string;
/** Additional headers to include in the request. */
headers?: Record<string, string>;
}
Expand Down Expand Up @@ -57,8 +54,8 @@ export class ScrapybaraClient {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -136,8 +133,8 @@ export class ScrapybaraClient {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -207,7 +204,7 @@ export class ScrapybaraClient {
}

protected async _getCustomAuthorizationHeaders() {
const authorizationValue = await core.Supplier.get(this._options.authorization);
return { authorization: authorizationValue };
const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["SCRAPYBARA_API_KEY"];
return { "X-API-Key": apiKeyValue };
}
}
25 changes: 11 additions & 14 deletions src/api/resources/browser/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import * as errors from "../../../../errors/index";
export declare namespace Browser {
interface Options {
environment?: core.Supplier<environments.ScrapybaraEnvironment | string>;
/** Override the authorization header */
authorization: core.Supplier<string>;
apiKey: core.Supplier<string>;
}

interface RequestOptions {
Expand All @@ -23,8 +22,6 @@ export declare namespace Browser {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the authorization header */
authorization?: string;
/** Additional headers to include in the request. */
headers?: Record<string, string>;
}
Expand Down Expand Up @@ -55,8 +52,8 @@ export class Browser {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -135,8 +132,8 @@ export class Browser {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -224,8 +221,8 @@ export class Browser {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -305,8 +302,8 @@ export class Browser {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -364,7 +361,7 @@ export class Browser {
}

protected async _getCustomAuthorizationHeaders() {
const authorizationValue = await core.Supplier.get(this._options.authorization);
return { authorization: authorizationValue };
const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["SCRAPYBARA_API_KEY"];
return { "X-API-Key": apiKeyValue };
}
}
33 changes: 15 additions & 18 deletions src/api/resources/instance/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ import * as errors from "../../../../errors/index";
export declare namespace Instance {
interface Options {
environment?: core.Supplier<environments.ScrapybaraEnvironment | string>;
/** Override the authorization header */
authorization: core.Supplier<string>;
apiKey: core.Supplier<string>;
}

interface RequestOptions {
Expand All @@ -23,8 +22,6 @@ export declare namespace Instance {
maxRetries?: number;
/** A hook to abort the request. */
abortSignal?: AbortSignal;
/** Override the authorization header */
authorization?: string;
/** Additional headers to include in the request. */
headers?: Record<string, string>;
}
Expand Down Expand Up @@ -55,8 +52,8 @@ export class Instance {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -135,8 +132,8 @@ export class Instance {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -219,8 +216,8 @@ export class Instance {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -297,8 +294,8 @@ export class Instance {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -378,8 +375,8 @@ export class Instance {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -454,8 +451,8 @@ export class Instance {
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.3",
"User-Agent": "scrapybara/0.1.3",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -513,7 +510,7 @@ export class Instance {
}

protected async _getCustomAuthorizationHeaders() {
const authorizationValue = await core.Supplier.get(this._options.authorization);
return { authorization: authorizationValue };
const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["SCRAPYBARA_API_KEY"];
return { "X-API-Key": apiKeyValue };
}
}
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const SDK_VERSION = "0.1.3";
export const SDK_VERSION = "0.1.4";

0 comments on commit 2ff819c

Please sign in to comment.