Skip to content

(feat): resolve authentication for sdk code snippets #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fern-api/sdk",
"version": "0.11.2",
"version": "0.12.0",
"private": false,
"repository": "https://github.com/fern-api/fern-typescript",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions src/api/resources/snippets/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class Snippets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/sdk",
"X-Fern-SDK-Version": "0.8.0",
"X-Fern-SDK-Version": "0.12.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -164,7 +164,7 @@ export class Snippets {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/sdk",
"X-Fern-SDK-Version": "0.8.0",
"X-Fern-SDK-Version": "0.12.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
17 changes: 17 additions & 0 deletions src/api/resources/snippets/types/AuthPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

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

export type AuthPayload = Fern.AuthPayload.Bearer | Fern.AuthPayload.Basic;

export declare namespace AuthPayload {
interface Bearer extends Fern.BearerTokenAuthPayload {
type: "bearer";
}

interface Basic extends Fern.BasicAuthPayload {
type: "basic";
}
}
8 changes: 8 additions & 0 deletions src/api/resources/snippets/types/BasicAuthPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

export interface BasicAuthPayload {
username: string;
password: string;
}
7 changes: 7 additions & 0 deletions src/api/resources/snippets/types/BearerTokenAuthPayload.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

export interface BearerTokenAuthPayload {
token: string;
}
1 change: 1 addition & 0 deletions src/api/resources/snippets/types/CustomSnippetPayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export interface CustomSnippetPayload {
pathParameters?: Fern.ParameterPayload[];
queryParameters?: Fern.ParameterPayload[];
requestBody?: unknown;
auth?: Fern.AuthPayload;
}
3 changes: 3 additions & 0 deletions src/api/resources/snippets/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export * from "./RubySdk";
export * from "./JavaSdk";
export * from "./ParameterPayload";
export * from "./CustomSnippetPayload";
export * from "./AuthPayload";
export * from "./BearerTokenAuthPayload";
export * from "./BasicAuthPayload";
export * from "./SnippetsPage";
export * from "./SnippetsByEndpointMethod";
export * from "./Snippet";
Expand Down
6 changes: 3 additions & 3 deletions src/api/resources/templates/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class Templates {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/sdk",
"X-Fern-SDK-Version": "0.8.0",
"X-Fern-SDK-Version": "0.12.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -210,7 +210,7 @@ export class Templates {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/sdk",
"X-Fern-SDK-Version": "0.8.0",
"X-Fern-SDK-Version": "0.12.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down Expand Up @@ -285,7 +285,7 @@ export class Templates {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern-api/sdk",
"X-Fern-SDK-Version": "0.8.0",
"X-Fern-SDK-Version": "0.12.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
7 changes: 7 additions & 0 deletions src/api/resources/templates/types/ClientInstantiation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

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

export type ClientInstantiation = string | Fern.Template;
3 changes: 2 additions & 1 deletion src/api/resources/templates/types/PayloadLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
* Note that RELATIVE should be used for iterables primarily, so be
* able to specify the path to the field relative to the iterated on object
*/
export type PayloadLocation = "BODY" | "QUERY" | "PATH" | "HEADERS" | "RELATIVE";
export type PayloadLocation = "BODY" | "QUERY" | "PATH" | "HEADERS" | "RELATIVE" | "AUTH";

export const PayloadLocation = {
Body: "BODY",
Query: "QUERY",
Path: "PATH",
Headers: "HEADERS",
Relative: "RELATIVE",
Auth: "AUTH",
} as const;
2 changes: 1 addition & 1 deletion src/api/resources/templates/types/SnippetTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
import * as Fern from "../../../index";

export interface SnippetTemplate {
clientInstantiation: string;
clientInstantiation: Fern.ClientInstantiation;
functionInvocation: Fern.Template;
}
1 change: 1 addition & 0 deletions src/api/resources/templates/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export * from "./TemplateInput";
export * from "./PayloadLocation";
export * from "./PayloadInput";
export * from "./SnippetTemplate";
export * from "./ClientInstantiation";
export * from "./VersionedSnippetTemplate";
export * from "./SnippetRegistryEntry";
export * from "./EndpointSnippetTemplate";
58 changes: 30 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -657,9 +657,9 @@
form-data "^4.0.0"

"@types/node@*":
version "20.14.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.2.tgz#a5f4d2bcb4b6a87bffcaa717718c5a0f208f4a18"
integrity sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==
version "20.14.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.5.tgz#fe35e3022ebe58b8f201580eb24e1fcfc0f2487d"
integrity sha512-aoRR+fJkZT2l0aGOJhuA8frnCSoNX6W7U2mpNq63+BxBIj5BQFt8rHy627kijCmm63ijdSdwvGgpUsU6MBsZZA==
dependencies:
undici-types "~5.26.4"

Expand Down Expand Up @@ -714,14 +714,16 @@ acorn-globals@^7.0.0:
acorn-walk "^8.0.2"

acorn-walk@^8.0.2:
version "8.3.2"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.2.tgz#7703af9415f1b6db9315d6895503862e231d34aa"
integrity sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==
version "8.3.3"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e"
integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==
dependencies:
acorn "^8.11.0"

acorn@^8.1.0, acorn@^8.8.1:
version "8.11.3"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a"
integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==
acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1:
version "8.12.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.0.tgz#1627bfa2e058148036133b8d9b51a700663c294c"
integrity sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==

agent-base@6:
version "6.0.2"
Expand Down Expand Up @@ -862,14 +864,14 @@ braces@^3.0.3:
fill-range "^7.1.1"

browserslist@^4.22.2:
version "4.23.0"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.0.tgz#8f3acc2bbe73af7213399430890f86c63a5674ab"
integrity sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==
version "4.23.1"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.1.tgz#ce4af0534b3d37db5c1a4ca98b9080f985041e96"
integrity sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==
dependencies:
caniuse-lite "^1.0.30001587"
electron-to-chromium "^1.4.668"
caniuse-lite "^1.0.30001629"
electron-to-chromium "^1.4.796"
node-releases "^2.0.14"
update-browserslist-db "^1.0.13"
update-browserslist-db "^1.0.16"

[email protected]:
version "0.2.6"
Expand Down Expand Up @@ -916,10 +918,10 @@ camelcase@^6.2.0:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a"
integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==

caniuse-lite@^1.0.30001587:
version "1.0.30001628"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001628.tgz#90b6cd85ddc2e9f831de0225f4ca5a130c8d8222"
integrity sha512-S3BnR4Kh26TBxbi5t5kpbcUlLJb9lhtDXISDPwOfI+JoC+ik0QksvkZtUVyikw3hjnkgkMPSJ8oIM9yMm9vflA==
caniuse-lite@^1.0.30001629:
version "1.0.30001636"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz#b15f52d2bdb95fad32c2f53c0b68032b85188a78"
integrity sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==

chalk@^2.4.2:
version "2.4.2"
Expand Down Expand Up @@ -1114,10 +1116,10 @@ domexception@^4.0.0:
dependencies:
webidl-conversions "^7.0.0"

electron-to-chromium@^1.4.668:
version "1.4.790"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.790.tgz#2a3a5509593745c5d65d8acd66b308f2a25da041"
integrity sha512-eVGeQxpaBYbomDBa/Mehrs28MdvCXfJmEFzaMFsv8jH/MJDLIylJN81eTJ5kvx7B7p18OiPK0BkC06lydEy63A==
electron-to-chromium@^1.4.796:
version "1.4.806"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.806.tgz#2cb046631cbabceb26fc72be68d273fa183e36bc"
integrity sha512-nkoEX2QIB8kwCOtvtgwhXWy2IHVcOLQZu9Qo36uaGB835mdX/h8uLRlosL6QIhLVUnAiicXRW00PwaPZC74Nrg==

emittery@^0.13.1:
version "0.13.1"
Expand Down Expand Up @@ -2560,7 +2562,7 @@ universalify@^0.2.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0"
integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==

update-browserslist-db@^1.0.13:
update-browserslist-db@^1.0.16:
version "1.0.16"
resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz#f6d489ed90fb2f07d67784eb3f53d7891f736356"
integrity sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ==
Expand Down Expand Up @@ -2672,9 +2674,9 @@ write-file-atomic@^4.0.2:
signal-exit "^3.0.7"

ws@^8.11.0:
version "8.17.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.0.tgz#d145d18eca2ed25aaf791a183903f7be5e295fea"
integrity sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==
version "8.17.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b"
integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==

xml-name-validator@^4.0.0:
version "4.0.0"
Expand Down
Loading