Skip to content

Commit

Permalink
Merge pull request #4 from Scrapybara/master
Browse files Browse the repository at this point in the history
Merge SDK 0.1.5
  • Loading branch information
justinsunyt authored Dec 7, 2024
2 parents c95942d + 48068b6 commit 65395a6
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
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.4",
"version": "0.1.5",
"private": false,
"repository": "https://github.com/scrapybara/scrapybara-ts",
"main": "./index.js",
Expand Down
14 changes: 7 additions & 7 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ export class ScrapybaraClient {
): Promise<Scrapybara.GetInstanceResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
"v1/start"
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -126,15 +126,15 @@ export class ScrapybaraClient {
): Promise<Scrapybara.GetInstanceResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}`
),
method: "GET",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -205,6 +205,6 @@ export class ScrapybaraClient {

protected async _getCustomAuthorizationHeaders() {
const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["SCRAPYBARA_API_KEY"];
return { "X-API-Key": apiKeyValue };
return { "x-api-key": apiKeyValue };
}
}
26 changes: 13 additions & 13 deletions src/api/resources/browser/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export class Browser {
): Promise<Scrapybara.StartBrowserResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/browser/start`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -125,15 +125,15 @@ export class Browser {
): Promise<Scrapybara.BrowserGetCdpUrlResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/browser/cdp_url`
),
method: "GET",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -214,15 +214,15 @@ export class Browser {
_queryParams["context_id"] = contextId;
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/browser/authenticate`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -295,15 +295,15 @@ export class Browser {
): Promise<Scrapybara.StopBrowserResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/browser/stop`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -362,6 +362,6 @@ export class Browser {

protected async _getCustomAuthorizationHeaders() {
const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["SCRAPYBARA_API_KEY"];
return { "X-API-Key": apiKeyValue };
return { "x-api-key": apiKeyValue };
}
}
38 changes: 19 additions & 19 deletions src/api/resources/instance/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export class Instance {
): Promise<Scrapybara.InstanceScreenshotResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/screenshot`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -125,15 +125,15 @@ export class Instance {
): Promise<Scrapybara.InstanceGetStreamUrlResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/stream_url`
),
method: "GET",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -209,15 +209,15 @@ export class Instance {
): Promise<unknown> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/computer`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -287,15 +287,15 @@ export class Instance {
): Promise<unknown> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/bash`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -368,15 +368,15 @@ export class Instance {
): Promise<unknown> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/edit`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -444,15 +444,15 @@ export class Instance {
): Promise<Scrapybara.StopInstanceResponse> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Default,
(await core.Supplier.get(this._options.environment)) ?? environments.ScrapybaraEnvironment.Production,
`v1/instance/${encodeURIComponent(instanceId)}/stop`
),
method: "POST",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "scrapybara",
"X-Fern-SDK-Version": "0.1.4",
"User-Agent": "scrapybara/0.1.4",
"X-Fern-SDK-Version": "0.1.5",
"User-Agent": "scrapybara/0.1.5",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
Expand Down Expand Up @@ -511,6 +511,6 @@ export class Instance {

protected async _getCustomAuthorizationHeaders() {
const apiKeyValue = (await core.Supplier.get(this._options.apiKey)) ?? process?.env["SCRAPYBARA_API_KEY"];
return { "X-API-Key": apiKeyValue };
return { "x-api-key": apiKeyValue };
}
}
4 changes: 2 additions & 2 deletions src/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

export const ScrapybaraEnvironment = {
Default: "https://api.scrapybara.com",
Production: "https://api.scrapybara.com",
} as const;

export type ScrapybaraEnvironment = typeof ScrapybaraEnvironment.Default;
export type ScrapybaraEnvironment = typeof ScrapybaraEnvironment.Production;
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.4";
export const SDK_VERSION = "0.1.5";

0 comments on commit 65395a6

Please sign in to comment.