Skip to content

Commit

Permalink
gen api 0.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
rotorsoft committed Oct 11, 2024
1 parent 5654c3a commit 66bfcc4
Show file tree
Hide file tree
Showing 77 changed files with 345 additions and 1,154 deletions.
407 changes: 108 additions & 299 deletions libs/api-client/fern/openapi/openapi.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion libs/api-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@commonxyz/api-client",
"version": "0.0.4",
"version": "0.0.5",
"type": "module",
"description": "Common Client Proxy",
"repository": {
Expand Down
1 change: 1 addition & 0 deletions libs/api-client/src/api/resources/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export * as thread from './thread';
export * from './thread/client/requests';
export * from './thread/types';
export * as user from './user';
export * from './user/client/requests';
export * from './user/types';
1 change: 1 addition & 0 deletions libs/api-client/src/api/resources/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export * as thread from './thread';
export * from './thread/client/requests';
export * from './thread/types';
export * as user from './user';
export * from './user/client/requests';
export * from './user/types';
11 changes: 2 additions & 9 deletions libs/api-client/src/api/resources/user/client/Client.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,14 @@ export declare class User {
protected readonly _options: User.Options;
constructor(_options: User.Options);
/**
* @param {User.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.user.getGlobalActivity()
*/
getGlobalActivity(
requestOptions?: User.RequestOptions,
): Promise<CommonApi.GetGlobalActivityResponseItem[]>;
/**
* @param {CommonApi.GetUserActivityRequest} request
* @param {User.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.user.getUserActivity()
*/
getUserActivity(
request?: CommonApi.GetUserActivityRequest,
requestOptions?: User.RequestOptions,
): Promise<CommonApi.GetUserActivityResponseItem[]>;
/**
Expand Down
90 changes: 12 additions & 78 deletions libs/api-client/src/api/resources/user/client/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,93 +44,26 @@ export class User {
this._options = _options;
}
/**
* @param {CommonApi.GetUserActivityRequest} request
* @param {User.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.user.getGlobalActivity()
* await client.user.getUserActivity()
*/
getGlobalActivity(requestOptions) {
getUserActivity(request = {}, requestOptions) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const _response = yield core.fetcher({
url: urlJoin(
(_a = yield core.Supplier.get(this._options.environment)) !== null &&
_a !== void 0
? _a
: environments.CommonApiEnvironment.Default,
'GetGlobalActivity',
),
method: 'GET',
headers: Object.assign(
{
address:
(yield core.Supplier.get(this._options.address)) != null
? yield core.Supplier.get(this._options.address)
: undefined,
'X-Fern-Language': 'JavaScript',
'X-Fern-Runtime': core.RUNTIME.type,
'X-Fern-Runtime-Version': core.RUNTIME.version,
},
yield this._getCustomAuthorizationHeaders(),
),
contentType: 'application/json',
requestType: 'json',
timeoutMs:
(requestOptions === null || requestOptions === void 0
? void 0
: requestOptions.timeoutInSeconds) != null
? requestOptions.timeoutInSeconds * 1000
: 60000,
maxRetries:
requestOptions === null || requestOptions === void 0
? void 0
: requestOptions.maxRetries,
abortSignal:
requestOptions === null || requestOptions === void 0
? void 0
: requestOptions.abortSignal,
});
if (_response.ok) {
return serializers.user.getGlobalActivity.Response.parseOrThrow(
_response.body,
{
unrecognizedObjectKeys: 'passthrough',
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
breadcrumbsPrefix: ['response'],
},
);
const { isGlobal, threadLimit, commentLimit } = request;
const _queryParams = {};
if (isGlobal != null) {
_queryParams['is_global'] = isGlobal.toString();
}
if (_response.error.reason === 'status-code') {
throw new errors.CommonApiError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
if (threadLimit != null) {
_queryParams['thread_limit'] = threadLimit.toString();
}
switch (_response.error.reason) {
case 'non-json':
throw new errors.CommonApiError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case 'timeout':
throw new errors.CommonApiTimeoutError();
case 'unknown':
throw new errors.CommonApiError({
message: _response.error.errorMessage,
});
if (commentLimit != null) {
_queryParams['comment_limit'] = commentLimit.toString();
}
});
}
/**
* @param {User.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.user.getUserActivity()
*/
getUserActivity(requestOptions) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
const _response = yield core.fetcher({
url: urlJoin(
(_a = yield core.Supplier.get(this._options.environment)) !== null &&
Expand All @@ -153,6 +86,7 @@ export class User {
yield this._getCustomAuthorizationHeaders(),
),
contentType: 'application/json',
queryParameters: _queryParams,
requestType: 'json',
timeoutMs:
(requestOptions === null || requestOptions === void 0
Expand Down
2 changes: 1 addition & 1 deletion libs/api-client/src/api/resources/user/client/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {};
export * from './requests';
2 changes: 1 addition & 1 deletion libs/api-client/src/api/resources/user/client/index.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export {};
export * from './requests';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
/**
* @example
* {}
*/
export interface GetUserActivityRequest {
isGlobal?: boolean;
threadLimit?: number;
commentLimit?: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { type GetUserActivityRequest } from './GetUserActivityRequest';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
*/
import * as CommonApi from '../../../index';
export interface GetUserActivityResponseItem {
thread: CommonApi.GetUserActivityResponseItemThread;
communityId: string;
communityIcon?: string;
id: number;
userId: number;
userAddress: string;
profileName?: string;
profileAvatar?: string;
body: string;
title: string;
kind: string;
stage: string;
numberOfComments: number;
createdAt?: string;
updatedAt?: string;
deletedAt?: string;
lockedAt?: string;
archivedAt?: string;
markedAsSpamAt?: string;
readOnly: boolean;
hasPoll?: boolean;
discordMeta?: CommonApi.GetUserActivityResponseItemDiscordMeta;
topic: CommonApi.GetUserActivityResponseItemTopic;
recentComments?: CommonApi.GetUserActivityResponseItemRecentCommentsItem[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* This file was auto-generated by Fern from our API Definition.
*/
import * as CommonApi from '../../../index';
export interface GetUserActivityResponseItemThreadDiscordMeta {
user: CommonApi.GetUserActivityResponseItemThreadDiscordMetaUser;
export interface GetUserActivityResponseItemDiscordMeta {
user: CommonApi.GetUserActivityResponseItemDiscordMetaUser;
channelId: string;
messageId: string;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/
export interface GetUserActivityResponseItemThreadDiscordMetaUser {
export interface GetUserActivityResponseItemDiscordMetaUser {
id: string;
username: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import * as CommonApi from '../../../index';
export interface GetUserActivityResponseItemRecentCommentsItem {
id: number;
address: string;
userId?: number;
profileName?: string;
profileAvatar?: string;
text: string;
createdAt: string;
updatedAt?: string;
deletedAt?: string;
markedAsSpamAt?: string;
discordMeta?: CommonApi.GetUserActivityResponseItemRecentCommentsItemDiscordMeta;
profileName?: string;
profileAvatarUrl?: string;
userId?: number;
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 66bfcc4

Please sign in to comment.