Skip to content

Commit

Permalink
🌿 Rename namespace to FernInternal
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo authored Apr 28, 2024
2 parents 42a1d0b + 35e01ff commit 57872f1
Show file tree
Hide file tree
Showing 52 changed files with 244 additions and 239 deletions.
2 changes: 1 addition & 1 deletion .mock/fern.config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"organization" : "fern",
"version" : "0.0.5351"
"version" : "0.0.5354"
}
2 changes: 1 addition & 1 deletion .mock/generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ groups:
license: MIT
config:
noSerdeLayer: true
namespaceExport: Fern
namespaceExport: FernInternal
includeApiReference: true

fiddle:
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": "@fern/typescript-sdk",
"version": "0.0.5351",
"version": "0.0.5354",
"private": false,
"repository": "https://github.com/fern-api/fern-typescript",
"license": "MIT",
Expand Down
14 changes: 7 additions & 7 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Snippets


<details><summary> <code>fern.snippets.<a href="./src/api/resources/snippets/client/Client.ts">get</a>({ ...params }) -> Fern.Snippet[]</code> </summary>
<details><summary> <code>fernInternal.snippets.<a href="./src/api/resources/snippets/client/Client.ts">get</a>({ ...params }) -> FernInternal.Snippet[]</code> </summary>

<dl>

Expand Down Expand Up @@ -39,9 +39,9 @@ Get snippet by endpoint method and path
<dd>

```ts
await fern.snippets.get({
await fernInternal.snippets.get({
endpoint: {
method: Fern.EndpointMethod.Get,
method: FernInternal.EndpointMethod.Get,
path: "/v1/search"
}
});
Expand All @@ -66,7 +66,7 @@ await fern.snippets.get({
<dd>


**request: `Fern.GetSnippetRequest`**
**request: `FernInternal.GetSnippetRequest`**


</dd>
Expand Down Expand Up @@ -97,7 +97,7 @@ await fern.snippets.get({
</details>


<details><summary> <code>fern.snippets.<a href="./src/api/resources/snippets/client/Client.ts">load</a>({ ...params }) -> Fern.SnippetsPage</code> </summary>
<details><summary> <code>fernInternal.snippets.<a href="./src/api/resources/snippets/client/Client.ts">load</a>({ ...params }) -> FernInternal.SnippetsPage</code> </summary>

<dl>

Expand All @@ -114,7 +114,7 @@ await fern.snippets.get({
<dd>

```ts
await fern.snippets.load({
await fernInternal.snippets.load({
page: 1,
orgId: "vellum",
apiId: "vellum-ai",
Expand Down Expand Up @@ -145,7 +145,7 @@ await fern.snippets.load({
<dd>


**request: `Fern.ListSnippetsRequest`**
**request: `FernInternal.ListSnippetsRequest`**


</dd>
Expand Down
8 changes: 4 additions & 4 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import * as core from "./core";
import { Snippets } from "./api/resources/snippets/client/Client";
import { Templates } from "./api/resources/templates/client/Client";

export declare namespace FernClient {
export declare namespace FernInternalClient {
interface Options {
environment?: core.Supplier<environments.FernEnvironment | string>;
environment?: core.Supplier<environments.FernInternalEnvironment | string>;
token?: core.Supplier<core.BearerToken | undefined>;
}

Expand All @@ -19,8 +19,8 @@ export declare namespace FernClient {
}
}

export class FernClient {
constructor(protected readonly _options: FernClient.Options = {}) {}
export class FernInternalClient {
constructor(protected readonly _options: FernInternalClient.Options = {}) {}

protected _snippets: Snippets | undefined;

Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/commons/errors/UnauthorizedError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as errors from "../../../../errors";

export class UnauthorizedError extends errors.FernError {
export class UnauthorizedError extends errors.FernInternalError {
constructor(body: string) {
super({
message: "UnauthorizedError",
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/commons/errors/UnavailableError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as errors from "../../../../errors";

export class UnavailableError extends errors.FernError {
export class UnavailableError extends errors.FernInternalError {
constructor(body: string) {
super({
message: "UnavailableError",
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/commons/errors/UserNotInOrgError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as errors from "../../../../errors";

export class UserNotInOrgError extends errors.FernError {
export class UserNotInOrgError extends errors.FernInternalError {
constructor() {
super({
message: "UserNotInOrgError",
Expand Down
118 changes: 59 additions & 59 deletions src/api/resources/snippets/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

import * as environments from "../../../../environments";
import * as core from "../../../../core";
import * as Fern from "../../..";
import * as FernInternal from "../../..";
import urlJoin from "url-join";
import * as errors from "../../../../errors";

export declare namespace Snippets {
interface Options {
environment?: core.Supplier<environments.FernEnvironment | string>;
environment?: core.Supplier<environments.FernInternalEnvironment | string>;
token?: core.Supplier<core.BearerToken | undefined>;
}

Expand All @@ -25,39 +25,39 @@ export class Snippets {

/**
* Get snippet by endpoint method and path
* @throws {@link Fern.UnauthorizedError}
* @throws {@link Fern.UserNotInOrgError}
* @throws {@link Fern.UnavailableError}
* @throws {@link Fern.ApiIdRequiredError}
* @throws {@link Fern.OrgIdRequiredError}
* @throws {@link Fern.OrgIdAndApiIdNotFound}
* @throws {@link Fern.OrgIdNotFound}
* @throws {@link Fern.EndpointNotFound}
* @throws {@link Fern.SdkNotFound}
* @throws {@link FernInternal.UnauthorizedError}
* @throws {@link FernInternal.UserNotInOrgError}
* @throws {@link FernInternal.UnavailableError}
* @throws {@link FernInternal.ApiIdRequiredError}
* @throws {@link FernInternal.OrgIdRequiredError}
* @throws {@link FernInternal.OrgIdAndApiIdNotFound}
* @throws {@link FernInternal.OrgIdNotFound}
* @throws {@link FernInternal.EndpointNotFound}
* @throws {@link FernInternal.SdkNotFound}
*
* @example
* await fern.snippets.get({
* await fernInternal.snippets.get({
* endpoint: {
* method: Fern.EndpointMethod.Get,
* method: FernInternal.EndpointMethod.Get,
* path: "/v1/search"
* }
* })
*/
public async get(
request: Fern.GetSnippetRequest,
request: FernInternal.GetSnippetRequest,
requestOptions?: Snippets.RequestOptions
): Promise<Fern.Snippet[]> {
): Promise<FernInternal.Snippet[]> {
const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.FernEnvironment.Dev,
(await core.Supplier.get(this._options.environment)) ?? environments.FernInternalEnvironment.Dev,
"/snippets"
),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern/typescript-sdk",
"X-Fern-SDK-Version": "0.0.5351",
"X-Fern-SDK-Version": "0.0.5354",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand All @@ -67,31 +67,31 @@ export class Snippets {
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return _response.body as Fern.Snippet[];
return _response.body as FernInternal.Snippet[];
}

if (_response.error.reason === "status-code") {
switch ((_response.error.body as any)?.["error"]) {
case "UnauthorizedError":
throw new Fern.UnauthorizedError(_response.error.body as string);
throw new FernInternal.UnauthorizedError(_response.error.body as string);
case "UserNotInOrgError":
throw new Fern.UserNotInOrgError();
throw new FernInternal.UserNotInOrgError();
case "UnavailableError":
throw new Fern.UnavailableError(_response.error.body as string);
throw new FernInternal.UnavailableError(_response.error.body as string);
case "ApiIdRequiredError":
throw new Fern.ApiIdRequiredError(_response.error.body as string);
throw new FernInternal.ApiIdRequiredError(_response.error.body as string);
case "OrgIdRequiredError":
throw new Fern.OrgIdRequiredError(_response.error.body as string);
throw new FernInternal.OrgIdRequiredError(_response.error.body as string);
case "OrgIdAndApiIdNotFound":
throw new Fern.OrgIdAndApiIdNotFound(_response.error.body as string);
throw new FernInternal.OrgIdAndApiIdNotFound(_response.error.body as string);
case "OrgIdNotFound":
throw new Fern.OrgIdNotFound(_response.error.body as string);
throw new FernInternal.OrgIdNotFound(_response.error.body as string);
case "EndpointNotFound":
throw new Fern.EndpointNotFound(_response.error.body as string);
throw new FernInternal.EndpointNotFound(_response.error.body as string);
case "SDKNotFound":
throw new Fern.SdkNotFound(_response.error.body as string);
throw new FernInternal.SdkNotFound(_response.error.body as string);
default:
throw new errors.FernError({
throw new errors.FernInternalError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
Expand All @@ -100,32 +100,32 @@ export class Snippets {

switch (_response.error.reason) {
case "non-json":
throw new errors.FernError({
throw new errors.FernInternalError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.FernTimeoutError();
throw new errors.FernInternalTimeoutError();
case "unknown":
throw new errors.FernError({
throw new errors.FernInternalError({
message: _response.error.errorMessage,
});
}
}

/**
* @throws {@link Fern.UnauthorizedError}
* @throws {@link Fern.UserNotInOrgError}
* @throws {@link Fern.UnavailableError}
* @throws {@link Fern.InvalidPageError}
* @throws {@link Fern.ApiIdRequiredError}
* @throws {@link Fern.OrgIdRequiredError}
* @throws {@link Fern.OrgIdAndApiIdNotFound}
* @throws {@link Fern.OrgIdNotFound}
* @throws {@link Fern.SdkNotFound}
* @throws {@link FernInternal.UnauthorizedError}
* @throws {@link FernInternal.UserNotInOrgError}
* @throws {@link FernInternal.UnavailableError}
* @throws {@link FernInternal.InvalidPageError}
* @throws {@link FernInternal.ApiIdRequiredError}
* @throws {@link FernInternal.OrgIdRequiredError}
* @throws {@link FernInternal.OrgIdAndApiIdNotFound}
* @throws {@link FernInternal.OrgIdNotFound}
* @throws {@link FernInternal.SdkNotFound}
*
* @example
* await fern.snippets.load({
* await fernInternal.snippets.load({
* page: 1,
* orgId: "vellum",
* apiId: "vellum-ai",
Expand All @@ -137,9 +137,9 @@ export class Snippets {
* })
*/
public async load(
request: Fern.ListSnippetsRequest = {},
request: FernInternal.ListSnippetsRequest = {},
requestOptions?: Snippets.RequestOptions
): Promise<Fern.SnippetsPage> {
): Promise<FernInternal.SnippetsPage> {
const { page, ..._body } = request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (page != null) {
Expand All @@ -148,15 +148,15 @@ export class Snippets {

const _response = await core.fetcher({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.FernEnvironment.Dev,
(await core.Supplier.get(this._options.environment)) ?? environments.FernInternalEnvironment.Dev,
"/snippets/load"
),
method: "POST",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@fern/typescript-sdk",
"X-Fern-SDK-Version": "0.0.5351",
"X-Fern-SDK-Version": "0.0.5354",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand All @@ -167,31 +167,31 @@ export class Snippets {
maxRetries: requestOptions?.maxRetries,
});
if (_response.ok) {
return _response.body as Fern.SnippetsPage;
return _response.body as FernInternal.SnippetsPage;
}

if (_response.error.reason === "status-code") {
switch ((_response.error.body as any)?.["error"]) {
case "UnauthorizedError":
throw new Fern.UnauthorizedError(_response.error.body as string);
throw new FernInternal.UnauthorizedError(_response.error.body as string);
case "UserNotInOrgError":
throw new Fern.UserNotInOrgError();
throw new FernInternal.UserNotInOrgError();
case "UnavailableError":
throw new Fern.UnavailableError(_response.error.body as string);
throw new FernInternal.UnavailableError(_response.error.body as string);
case "InvalidPageError":
throw new Fern.InvalidPageError(_response.error.body as string);
throw new FernInternal.InvalidPageError(_response.error.body as string);
case "ApiIdRequiredError":
throw new Fern.ApiIdRequiredError(_response.error.body as string);
throw new FernInternal.ApiIdRequiredError(_response.error.body as string);
case "OrgIdRequiredError":
throw new Fern.OrgIdRequiredError(_response.error.body as string);
throw new FernInternal.OrgIdRequiredError(_response.error.body as string);
case "OrgIdAndApiIdNotFound":
throw new Fern.OrgIdAndApiIdNotFound(_response.error.body as string);
throw new FernInternal.OrgIdAndApiIdNotFound(_response.error.body as string);
case "OrgIdNotFound":
throw new Fern.OrgIdNotFound(_response.error.body as string);
throw new FernInternal.OrgIdNotFound(_response.error.body as string);
case "SDKNotFound":
throw new Fern.SdkNotFound(_response.error.body as string);
throw new FernInternal.SdkNotFound(_response.error.body as string);
default:
throw new errors.FernError({
throw new errors.FernInternalError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
Expand All @@ -200,14 +200,14 @@ export class Snippets {

switch (_response.error.reason) {
case "non-json":
throw new errors.FernError({
throw new errors.FernInternalError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.FernTimeoutError();
throw new errors.FernInternalTimeoutError();
case "unknown":
throw new errors.FernError({
throw new errors.FernInternalError({
message: _response.error.errorMessage,
});
}
Expand Down
Loading

0 comments on commit 57872f1

Please sign in to comment.