Skip to content

Commit

Permalink
SDK regeneration
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jul 26, 2024
1 parent 04338fa commit 98fd099
Show file tree
Hide file tree
Showing 11 changed files with 545 additions and 389 deletions.
8 changes: 4 additions & 4 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ await client.connects.get("live_xJd0lUrvpDkzeGBWZbuI2wbvEdM");

## Grants

<details><summary><code>client.grants.<a href="/src/api/resources/grants/client/Client.ts">list</a>({ ...params }) -> Chariot.GrantsListResponse</code></summary>
<details><summary><code>client.grants.<a href="/src/api/resources/grants/client/Client.ts">list</a>({ ...params }) -> core.Page<Chariot.UnintegratedGrant></code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -819,7 +819,7 @@ await client.grants.getRecurringGrant("10229488-08d2-4629-b70c-a2f4f4d25344");

## DaFs

<details><summary><code>client.daFs.<a href="/src/api/resources/daFs/client/Client.ts">list</a>({ ...params }) -> Chariot.DaFsListResponse</code></summary>
<details><summary><code>client.daFs.<a href="/src/api/resources/daFs/client/Client.ts">list</a>({ ...params }) -> core.Page<Chariot.Daf></code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -949,7 +949,7 @@ await client.daFs.get("f9e28217-e0f7-4a54-9764-d664ffb10722");

## Events

<details><summary><code>client.events.<a href="/src/api/resources/events/client/Client.ts">list</a>({ ...params }) -> Chariot.EventsListResponse</code></summary>
<details><summary><code>client.events.<a href="/src/api/resources/events/client/Client.ts">list</a>({ ...params }) -> core.Page<Chariot.Event></code></summary>
<dl>
<dd>

Expand Down Expand Up @@ -1077,7 +1077,7 @@ await client.events.get("id");

## EventSubscriptions

<details><summary><code>client.eventSubscriptions.<a href="/src/api/resources/eventSubscriptions/client/Client.ts">list</a>({ ...params }) -> Chariot.EventSubscriptionsListResponse</code></summary>
<details><summary><code>client.eventSubscriptions.<a href="/src/api/resources/eventSubscriptions/client/Client.ts">list</a>({ ...params }) -> core.Page<Chariot.EventSubscription></code></summary>
<dl>
<dd>

Expand Down
166 changes: 86 additions & 80 deletions src/api/resources/daFs/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,91 +44,97 @@ export class DaFs {
public async list(
request: Chariot.DaFsListRequest = {},
requestOptions?: DaFs.RequestOptions
): Promise<Chariot.DaFsListResponse> {
const { pageLimit, pageToken } = request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (pageLimit != null) {
_queryParams["pageLimit"] = pageLimit.toString();
}

if (pageToken != null) {
_queryParams["pageToken"] = pageToken;
}

const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ChariotEnvironment.Sandbox,
"v1/dafs"
),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "chariot",
"X-Fern-SDK-Version": "0.0.1-alpha0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
contentType: "application/json",
queryParameters: _queryParams,
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return serializers.DaFsListResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
): Promise<core.Page<Chariot.Daf>> {
const list = async (request: Chariot.DaFsListRequest): Promise<Chariot.DaFsListResponse> => {
const { pageLimit, pageToken } = request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (pageLimit != null) {
_queryParams["pageLimit"] = pageLimit.toString();
}
if (pageToken != null) {
_queryParams["pageToken"] = pageToken;
}
const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.ChariotEnvironment.Sandbox,
"v1/dafs"
),
method: "GET",
headers: {
Authorization: await this._getAuthorizationHeader(),
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "chariot",
"X-Fern-SDK-Version": "0.0.1-alpha0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
contentType: "application/json",
queryParameters: _queryParams,
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
}

if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 400:
throw new Chariot.BadRequestError(
serializers.Error_.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
})
);
case 500:
throw new Chariot.InternalServerError(
serializers.Error_.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
})
);
default:
if (_response.ok) {
return serializers.DaFsListResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
});
}
if (_response.error.reason === "status-code") {
switch (_response.error.statusCode) {
case 400:
throw new Chariot.BadRequestError(
serializers.Error_.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
})
);
case 500:
throw new Chariot.InternalServerError(
serializers.Error_.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
})
);
default:
throw new errors.ChariotError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
}
}
switch (_response.error.reason) {
case "non-json":
throw new errors.ChariotError({
statusCode: _response.error.statusCode,
body: _response.error.body,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.ChariotTimeoutError();
case "unknown":
throw new errors.ChariotError({
message: _response.error.errorMessage,
});
}
}

switch (_response.error.reason) {
case "non-json":
throw new errors.ChariotError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.ChariotTimeoutError();
case "unknown":
throw new errors.ChariotError({
message: _response.error.errorMessage,
});
}
};
return new core.Pageable<Chariot.DaFsListResponse, Chariot.Daf>({
response: await list(request),
hasNextPage: (response) => response?.nextPageToken != null,
getItems: (response) => response?.results ?? [],
loadPage: (response) => {
return list(core.setObjectProperty(request, "pageToken", response?.nextPageToken));
},
});
}

/**
Expand Down
Loading

0 comments on commit 98fd099

Please sign in to comment.