@crosspost/sdk 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NearAuthData } from 'near-sign-verify';
2
- import { ActivityLeaderboardQuery, ActivityLeaderboardResponse, AccountActivityQuery, AccountActivityResponse, AccountPostsQuery, AccountPostsResponse, NearAuthorizationResponse, Platform, ApiResponse, AuthStatusResponse, AuthRevokeResponse, ConnectedAccountsResponse, CreatePostRequest, CreatePostResponse, RepostRequest, RepostResponse, QuotePostRequest, QuotePostResponse, ReplyToPostRequest, ReplyToPostResponse, LikePostRequest, LikePostResponse, UnlikePostRequest, UnlikePostResponse, DeletePostRequest, DeletePostResponse, RateLimitResponse, EndpointRateLimitResponse, ApiErrorCode, StatusCode, ErrorDetails } from '@crosspost/types';
2
+ import { ActivityLeaderboardQuery, ActivityLeaderboardResponse, AccountActivityQuery, AccountActivityResponse, AccountPostsQuery, AccountPostsResponse, NearAuthorizationResponse, Platform, AuthInitRequest, AuthUrlResponse, AuthCallbackResponse, ConnectedAccount, AuthStatusResponse, NearUnauthorizationResponse, AuthRevokeResponse, ConnectedAccountsResponse, CreatePostRequest, CreatePostResponse, RepostRequest, RepostResponse, QuotePostRequest, QuotePostResponse, ReplyToPostRequest, ReplyToPostResponse, LikePostRequest, LikePostResponse, UnlikePostRequest, UnlikePostResponse, DeletePostRequest, DeletePostResponse, RateLimitResponse, EndpointRateLimitResponse, HealthStatus, ApiErrorCode, StatusCode, ErrorDetails } from '@crosspost/types';
3
3
  export * from '@crosspost/types';
4
4
 
5
5
  /**
@@ -12,17 +12,18 @@ interface RequestOptions {
12
12
  baseUrl: string;
13
13
  /**
14
14
  * NEAR authentication data for generating auth tokens
15
- * Can be undefined if not authorize yet
15
+ * Required for non-GET requests, optional for GET requests
16
16
  */
17
17
  nearAuthData?: NearAuthData;
18
18
  /**
19
- * Request timeout in milliseconds
19
+ * NEAR account ID for simplified GET request authentication
20
+ * If not provided, will use account_id from nearAuthData
20
21
  */
21
- timeout: number;
22
+ nearAccount?: string;
22
23
  /**
23
- * Number of retries for failed requests
24
+ * Request timeout in milliseconds
24
25
  */
25
- retries: number;
26
+ timeout: number;
26
27
  }
27
28
 
28
29
  /**
@@ -84,34 +85,37 @@ declare class AuthApi {
84
85
  * @param options Optional success and error redirect URLs.
85
86
  * @returns A promise resolving with the response from the service (might indicate success/failure or redirect info).
86
87
  */
87
- loginToPlatform(platform: Platform, options?: {
88
- successUrl?: string;
89
- errorUrl?: string;
90
- }): Promise<ApiResponse<any>>;
88
+ loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<AuthUrlResponse>;
91
89
  /**
92
90
  * Refreshes the authentication token for the specified platform.
93
91
  * @param platform The target platform.
94
- * @returns A promise resolving with the refresh response.
92
+ * @returns A promise resolving with the refresh response containing updated auth details.
95
93
  */
96
- refreshToken(platform: Platform): Promise<ApiResponse<any>>;
94
+ refreshToken(platform: Platform, userId: string): Promise<AuthCallbackResponse>;
97
95
  /**
98
96
  * Refreshes the user's profile information from the specified platform.
99
97
  * @param platform The target platform.
100
- * @returns A promise resolving with the profile refresh response.
98
+ * @param userId The user ID on the platform
99
+ * @returns A promise resolving with the updated account profile information.
101
100
  */
102
- refreshProfile(platform: Platform): Promise<ApiResponse<any>>;
101
+ refreshProfile(platform: Platform, userId: string): Promise<ConnectedAccount>;
103
102
  /**
104
103
  * Gets the authentication status for the specified platform.
105
104
  * @param platform The target platform.
106
105
  * @returns A promise resolving with the authentication status response.
107
106
  */
108
- getAuthStatus(platform: Platform): Promise<AuthStatusResponse>;
107
+ getAuthStatus(platform: Platform, userId: string): Promise<AuthStatusResponse>;
108
+ /**
109
+ * Unauthorizes a NEAR account from using the service
110
+ * @returns A promise resolving with the unauthorized response
111
+ */
112
+ unauthorizeNear(): Promise<NearUnauthorizationResponse>;
109
113
  /**
110
114
  * Revokes the authentication token for the specified platform.
111
115
  * @param platform The target platform.
112
116
  * @returns A promise resolving with the revocation response.
113
117
  */
114
- revokeAuth(platform: Platform): Promise<AuthRevokeResponse>;
118
+ revokeAuth(platform: Platform, userId: string): Promise<AuthRevokeResponse>;
115
119
  /**
116
120
  * Lists all accounts connected to the NEAR account.
117
121
  * @returns A promise resolving with the list of connected accounts.
@@ -199,9 +203,7 @@ declare class SystemApi {
199
203
  * Gets the health status of the API
200
204
  * @returns A promise resolving with the health status
201
205
  */
202
- getHealthStatus(): Promise<ApiResponse<{
203
- status: string;
204
- }>>;
206
+ getHealthStatus(): Promise<HealthStatus>;
205
207
  }
206
208
 
207
209
  /**
@@ -222,11 +224,6 @@ interface CrosspostClientConfig {
222
224
  * @default 30000
223
225
  */
224
226
  timeout?: number;
225
- /**
226
- * Number of retries for failed requests (specifically for network errors or 5xx status codes)
227
- * @default 2
228
- */
229
- retries?: number;
230
227
  }
231
228
 
232
229
  /**
@@ -245,14 +242,36 @@ declare class CrosspostClient {
245
242
  constructor(config?: CrosspostClientConfig);
246
243
  /**
247
244
  * Sets the authentication data (signature) for the client
245
+ * Required for non-GET requests
248
246
  * @param nearAuthData The NEAR authentication data
249
247
  */
250
248
  setAuthentication(nearAuthData: NearAuthData): void;
249
+ /**
250
+ * Sets the NEAR account ID for simplified GET request authentication
251
+ * If not set, will use account_id from nearAuthData
252
+ * @param nearAccount The NEAR account ID
253
+ */
254
+ setNearAccount(nearAccount: string): void;
255
+ /**
256
+ * Gets the current NEAR account ID being used for authentication
257
+ * @returns The NEAR account ID from nearAccount or nearAuthData
258
+ */
259
+ getNearAccount(): string | undefined;
251
260
  /**
252
261
  * Checks if authentication data (signature) exists on client
253
- * @param signature The NEAR authentication data
262
+ * @returns true if nearAuthData is set (required for non-GET requests)
254
263
  */
255
264
  isAuthenticated(): boolean;
265
+ /**
266
+ * Checks if a NEAR account is set for GET request authentication
267
+ * @returns true if either nearAccount or nearAuthData.account_id is set
268
+ */
269
+ hasNearAccount(): boolean;
270
+ /**
271
+ * Clears all authentication data from the client
272
+ * This will prevent all requests from working until new authentication is set
273
+ */
274
+ clear(): void;
256
275
  }
257
276
 
258
277
  /**
package/dist/index.js CHANGED
@@ -4095,6 +4095,7 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
4095
4095
  ApiErrorCode2["POST_DELETION_FAILED"] = "POST_DELETION_FAILED";
4096
4096
  ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
4097
4097
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
4098
+ ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
4098
4099
  return ApiErrorCode2;
4099
4100
  })(ApiErrorCode || {});
4100
4101
  var ApiErrorCodeSchema = z.enum(Object.values(ApiErrorCode));
@@ -4174,7 +4175,11 @@ var errorCodeToStatusCode = {
4174
4175
  [
4175
4176
  "NETWORK_ERROR"
4176
4177
  /* NETWORK_ERROR */
4177
- ]: 503
4178
+ ]: 503,
4179
+ [
4180
+ "INVALID_RESPONSE"
4181
+ /* INVALID_RESPONSE */
4182
+ ]: 500
4178
4183
  };
4179
4184
  var ErrorDetailSchema = z.object({
4180
4185
  message: z.string().describe("Human-readable error message"),
@@ -4207,6 +4212,11 @@ var SuccessDetailSchema = z.object({
4207
4212
  additionalData: z.any().optional(),
4208
4213
  status: z.literal("success")
4209
4214
  }).catchall(z.any());
4215
+ var HealthStatusSchema = z.object({
4216
+ status: z.string().describe("Health status of the API"),
4217
+ version: z.string().optional().describe("API version"),
4218
+ timestamp: z.string().datetime().describe("Current server time")
4219
+ }).describe("Health status response");
4210
4220
  var MultiStatusDataSchema = z.object({
4211
4221
  summary: z.object({
4212
4222
  total: z.number().int().nonnegative(),
@@ -4239,6 +4249,14 @@ var AuthCallbackResponseSchema = z.object({
4239
4249
  userId: z.string().describe("User ID"),
4240
4250
  redirectUrl: z.string().optional().describe("URL to redirect the user to after authentication")
4241
4251
  }).describe("Auth callback response");
4252
+ var AuthStatusParamsSchema = z.object({
4253
+ platform: z.string().describe("Social media platform"),
4254
+ userId: z.string().describe("User ID on the platform")
4255
+ }).describe("Token status parameters");
4256
+ var NearUnauthorizationResponseSchema = z.object({
4257
+ success: z.boolean().describe("Whether the unauthorized operation was successful"),
4258
+ nearAccount: z.string().describe("NEAR account ID that was unauthorized")
4259
+ }).describe("NEAR unauthorized response");
4242
4260
  var AuthStatusResponseSchema = z.object({
4243
4261
  platform: PlatformSchema,
4244
4262
  userId: z.string().describe("User ID"),
@@ -4835,7 +4853,7 @@ function createNetworkError(error, url, timeout) {
4835
4853
  // src/core/request.ts
4836
4854
  async function makeRequest(method, path, options, data, query) {
4837
4855
  let url = `${options.baseUrl}${path.startsWith("/") ? path : `/${path}`}`;
4838
- if (query && Object.keys(query).length > 0) {
4856
+ if (query && typeof query === "object" && Object.keys(query).length > 0) {
4839
4857
  const queryParams = new URLSearchParams();
4840
4858
  for (const [key, value] of Object.entries(query)) {
4841
4859
  if (value !== void 0 && value !== null) {
@@ -4850,84 +4868,96 @@ async function makeRequest(method, path, options, data, query) {
4850
4868
  const context = {
4851
4869
  method,
4852
4870
  path,
4853
- url,
4854
- retries: options.retries
4871
+ url
4855
4872
  };
4856
- return apiWrapper(async () => {
4857
- let lastError = null;
4858
- for (let attempt = 0; attempt <= options.retries; attempt++) {
4859
- const controller = new AbortController();
4860
- const timeoutId = setTimeout(() => controller.abort(), options.timeout);
4873
+ const controller = new AbortController();
4874
+ const timeoutId = setTimeout(() => controller.abort(), options.timeout);
4875
+ try {
4876
+ const headers = {
4877
+ "Content-Type": "application/json",
4878
+ "Accept": "application/json"
4879
+ };
4880
+ if (method === "GET") {
4881
+ const nearAccount = options.nearAccount || options.nearAuthData?.account_id;
4882
+ if (!nearAccount) {
4883
+ throw new CrosspostError(
4884
+ "No NEAR account provided for GET request",
4885
+ ApiErrorCode.UNAUTHORIZED,
4886
+ 401
4887
+ );
4888
+ }
4889
+ headers["X-Near-Account"] = nearAccount;
4890
+ } else {
4891
+ if (!options.nearAuthData) {
4892
+ throw new CrosspostError(
4893
+ "NEAR authentication data required for non-GET request",
4894
+ ApiErrorCode.UNAUTHORIZED,
4895
+ 401
4896
+ );
4897
+ }
4898
+ headers["Authorization"] = `Bearer ${createAuthToken(options.nearAuthData)}`;
4899
+ }
4900
+ const requestOptions = {
4901
+ method,
4902
+ headers,
4903
+ body: method !== "GET" && data ? JSON.stringify(data) : void 0,
4904
+ signal: controller.signal
4905
+ };
4906
+ const response = await fetch(url, requestOptions);
4907
+ clearTimeout(timeoutId);
4908
+ let responseData;
4909
+ try {
4910
+ responseData = await response.json();
4911
+ } catch (jsonError) {
4912
+ let responseText;
4861
4913
  try {
4862
- const headers = {
4863
- "Content-Type": "application/json",
4864
- "Accept": "application/json",
4865
- "Authorization": `Bearer ${createAuthToken(options.nearAuthData)}`
4866
- };
4867
- const requestOptions = {
4868
- method,
4869
- headers,
4870
- body: method !== "GET" && data ? JSON.stringify(data) : void 0,
4871
- signal: controller.signal
4872
- };
4873
- const response = await fetch(url, requestOptions);
4874
- clearTimeout(timeoutId);
4875
- let responseData;
4876
- try {
4877
- responseData = await response.json();
4878
- } catch (jsonError) {
4879
- if (!response.ok) {
4880
- throw new CrosspostError(
4881
- `API request failed with status ${response.status} and non-JSON response`,
4882
- ApiErrorCode.NETWORK_ERROR,
4883
- response.status,
4884
- { originalStatusText: response.statusText }
4885
- );
4886
- }
4887
- throw new CrosspostError(
4888
- `Failed to parse JSON response: ${jsonError instanceof Error ? jsonError.message : String(jsonError)}`,
4889
- ApiErrorCode.INTERNAL_ERROR,
4890
- response.status
4891
- );
4892
- }
4893
- if (!response.ok) {
4894
- lastError = handleErrorResponse(responseData, response.status);
4895
- const shouldRetry = lastError instanceof CrosspostError && lastError.code === ApiErrorCode.RATE_LIMITED;
4896
- if (shouldRetry && attempt < options.retries) {
4897
- await new Promise((resolve) => setTimeout(resolve, 1e3 * Math.pow(2, attempt)));
4898
- continue;
4899
- }
4900
- throw lastError;
4901
- }
4902
- if (responseData && typeof responseData === "object" && "success" in responseData) {
4903
- if (responseData.success) {
4904
- return responseData.data;
4905
- } else {
4906
- lastError = handleErrorResponse(responseData, response.status);
4907
- const shouldRetry = lastError instanceof CrosspostError && lastError.code === ApiErrorCode.RATE_LIMITED;
4908
- if (shouldRetry && attempt < options.retries) {
4909
- await new Promise((resolve) => setTimeout(resolve, 1e3 * Math.pow(2, attempt)));
4910
- continue;
4911
- }
4912
- throw lastError;
4913
- }
4914
- }
4915
- } catch (error) {
4916
- clearTimeout(timeoutId);
4917
- lastError = error instanceof Error ? error : new Error(String(error));
4918
- const isNetworkError2 = error instanceof TypeError || error instanceof DOMException && error.name === "AbortError";
4919
- if (isNetworkError2 && attempt < options.retries) {
4920
- await new Promise((resolve) => setTimeout(resolve, 1e3 * Math.pow(2, attempt)));
4921
- continue;
4922
- }
4923
- if (!(error instanceof CrosspostError)) {
4924
- throw createNetworkError(error, url, options.timeout);
4925
- }
4926
- throw error;
4914
+ responseText = await response.text();
4915
+ } catch (_) {
4927
4916
  }
4917
+ throw new CrosspostError(
4918
+ `API request failed with status ${response.status} and non-JSON response`,
4919
+ ApiErrorCode.INVALID_RESPONSE,
4920
+ response.status,
4921
+ {
4922
+ originalStatusText: response.statusText,
4923
+ originalError: jsonError instanceof Error ? jsonError.message : String(jsonError),
4924
+ responseText
4925
+ }
4926
+ );
4927
+ }
4928
+ if (!response.ok) {
4929
+ throw handleErrorResponse(responseData, response.status);
4930
+ }
4931
+ if (!responseData || typeof responseData !== "object" || !("success" in responseData)) {
4932
+ throw new CrosspostError(
4933
+ "Invalid success response format from API",
4934
+ ApiErrorCode.INVALID_RESPONSE,
4935
+ response.status,
4936
+ { responseData }
4937
+ );
4938
+ }
4939
+ if (responseData.success) {
4940
+ return responseData.data;
4941
+ }
4942
+ throw handleErrorResponse(responseData, response.status);
4943
+ } catch (error) {
4944
+ clearTimeout(timeoutId);
4945
+ if (error instanceof CrosspostError) {
4946
+ throw enrichErrorWithContext(error, context);
4947
+ }
4948
+ if (error instanceof TypeError || error instanceof DOMException && error.name === "AbortError") {
4949
+ throw enrichErrorWithContext(createNetworkError(error, url, options.timeout), context);
4928
4950
  }
4929
- throw lastError || new CrosspostError("Request failed after multiple retries", ApiErrorCode.INTERNAL_ERROR, 500);
4930
- }, context);
4951
+ throw enrichErrorWithContext(
4952
+ new CrosspostError(
4953
+ error instanceof Error ? error.message : String(error),
4954
+ ApiErrorCode.INTERNAL_ERROR,
4955
+ 500,
4956
+ { originalError: String(error) }
4957
+ ),
4958
+ context
4959
+ );
4960
+ }
4931
4961
  }
4932
4962
 
4933
4963
  // src/api/activity.ts
@@ -5035,25 +5065,28 @@ var AuthApi = class {
5035
5065
  /**
5036
5066
  * Refreshes the authentication token for the specified platform.
5037
5067
  * @param platform The target platform.
5038
- * @returns A promise resolving with the refresh response.
5068
+ * @returns A promise resolving with the refresh response containing updated auth details.
5039
5069
  */
5040
- async refreshToken(platform) {
5070
+ async refreshToken(platform, userId) {
5041
5071
  return makeRequest(
5042
5072
  "POST",
5043
5073
  `/auth/${platform}/refresh`,
5044
- this.options
5074
+ this.options,
5075
+ { userId }
5045
5076
  );
5046
5077
  }
5047
5078
  /**
5048
5079
  * Refreshes the user's profile information from the specified platform.
5049
5080
  * @param platform The target platform.
5050
- * @returns A promise resolving with the profile refresh response.
5081
+ * @param userId The user ID on the platform
5082
+ * @returns A promise resolving with the updated account profile information.
5051
5083
  */
5052
- async refreshProfile(platform) {
5084
+ async refreshProfile(platform, userId) {
5053
5085
  return makeRequest(
5054
5086
  "POST",
5055
5087
  `/auth/${platform}/refresh-profile`,
5056
- this.options
5088
+ this.options,
5089
+ { userId }
5057
5090
  );
5058
5091
  }
5059
5092
  /**
@@ -5061,11 +5094,25 @@ var AuthApi = class {
5061
5094
  * @param platform The target platform.
5062
5095
  * @returns A promise resolving with the authentication status response.
5063
5096
  */
5064
- async getAuthStatus(platform) {
5097
+ async getAuthStatus(platform, userId) {
5065
5098
  return makeRequest(
5066
5099
  "GET",
5067
- `/auth/${platform}/status`,
5068
- this.options
5100
+ `/auth/${platform}/status/${userId}`,
5101
+ this.options,
5102
+ void 0,
5103
+ { platform, userId }
5104
+ );
5105
+ }
5106
+ /**
5107
+ * Unauthorizes a NEAR account from using the service
5108
+ * @returns A promise resolving with the unauthorized response
5109
+ */
5110
+ async unauthorizeNear() {
5111
+ return makeRequest(
5112
+ "DELETE",
5113
+ "/auth/unauthorize/near",
5114
+ this.options,
5115
+ {}
5069
5116
  );
5070
5117
  }
5071
5118
  /**
@@ -5073,11 +5120,12 @@ var AuthApi = class {
5073
5120
  * @param platform The target platform.
5074
5121
  * @returns A promise resolving with the revocation response.
5075
5122
  */
5076
- async revokeAuth(platform) {
5123
+ async revokeAuth(platform, userId) {
5077
5124
  return makeRequest(
5078
5125
  "DELETE",
5079
5126
  `/auth/${platform}/revoke`,
5080
- this.options
5127
+ this.options,
5128
+ { userId }
5081
5129
  );
5082
5130
  }
5083
5131
  /**
@@ -5224,7 +5272,9 @@ var SystemApi = class {
5224
5272
  return makeRequest(
5225
5273
  "GET",
5226
5274
  `/api/rate-limit/${endpoint}`,
5227
- this.options
5275
+ this.options,
5276
+ void 0,
5277
+ { endpoint }
5228
5278
  );
5229
5279
  }
5230
5280
  /**
@@ -5243,8 +5293,7 @@ var SystemApi = class {
5243
5293
  // src/core/config.ts
5244
5294
  var DEFAULT_CONFIG = {
5245
5295
  baseUrl: "https://open-crosspost-proxy.deno.dev/",
5246
- timeout: 3e4,
5247
- retries: 2
5296
+ timeout: 3e4
5248
5297
  };
5249
5298
 
5250
5299
  // src/core/client.ts
@@ -5256,12 +5305,10 @@ var CrosspostClient = class {
5256
5305
  constructor(config = {}) {
5257
5306
  const baseUrl = config.baseUrl || DEFAULT_CONFIG.baseUrl;
5258
5307
  const timeout = config.timeout || DEFAULT_CONFIG.timeout;
5259
- const retries = config.retries ?? DEFAULT_CONFIG.retries;
5260
5308
  const nearAuthData = config.nearAuthData;
5261
5309
  this.options = {
5262
5310
  baseUrl,
5263
5311
  timeout,
5264
- retries,
5265
5312
  nearAuthData
5266
5313
  };
5267
5314
  this.auth = new AuthApi(this.options);
@@ -5271,18 +5318,52 @@ var CrosspostClient = class {
5271
5318
  }
5272
5319
  /**
5273
5320
  * Sets the authentication data (signature) for the client
5321
+ * Required for non-GET requests
5274
5322
  * @param nearAuthData The NEAR authentication data
5275
5323
  */
5276
5324
  setAuthentication(nearAuthData) {
5277
5325
  this.options.nearAuthData = nearAuthData;
5326
+ if (!this.options.nearAccount) {
5327
+ this.options.nearAccount = nearAuthData.account_id;
5328
+ }
5329
+ }
5330
+ /**
5331
+ * Sets the NEAR account ID for simplified GET request authentication
5332
+ * If not set, will use account_id from nearAuthData
5333
+ * @param nearAccount The NEAR account ID
5334
+ */
5335
+ setNearAccount(nearAccount) {
5336
+ this.options.nearAccount = nearAccount;
5337
+ }
5338
+ /**
5339
+ * Gets the current NEAR account ID being used for authentication
5340
+ * @returns The NEAR account ID from nearAccount or nearAuthData
5341
+ */
5342
+ getNearAccount() {
5343
+ return this.options.nearAccount || this.options.nearAuthData?.account_id;
5278
5344
  }
5279
5345
  /**
5280
5346
  * Checks if authentication data (signature) exists on client
5281
- * @param signature The NEAR authentication data
5347
+ * @returns true if nearAuthData is set (required for non-GET requests)
5282
5348
  */
5283
5349
  isAuthenticated() {
5284
5350
  return !!this.options.nearAuthData;
5285
5351
  }
5352
+ /**
5353
+ * Checks if a NEAR account is set for GET request authentication
5354
+ * @returns true if either nearAccount or nearAuthData.account_id is set
5355
+ */
5356
+ hasNearAccount() {
5357
+ return !!(this.options.nearAccount || this.options.nearAuthData?.account_id);
5358
+ }
5359
+ /**
5360
+ * Clears all authentication data from the client
5361
+ * This will prevent all requests from working until new authentication is set
5362
+ */
5363
+ clear() {
5364
+ this.options.nearAuthData = void 0;
5365
+ this.options.nearAccount = void 0;
5366
+ }
5286
5367
  };
5287
5368
  export {
5288
5369
  AccountActivityEntrySchema,
@@ -5301,6 +5382,7 @@ export {
5301
5382
  AuthCallbackResponseSchema,
5302
5383
  AuthInitRequestSchema,
5303
5384
  AuthRevokeResponseSchema,
5385
+ AuthStatusParamsSchema,
5304
5386
  AuthStatusResponseSchema,
5305
5387
  AuthTokenRequestSchema,
5306
5388
  AuthUrlResponseSchema,
@@ -5314,6 +5396,7 @@ export {
5314
5396
  DeleteResultSchema,
5315
5397
  EndpointRateLimitResponseSchema,
5316
5398
  ErrorDetailSchema,
5399
+ HealthStatusSchema,
5317
5400
  LikePostRequestSchema,
5318
5401
  LikePostResponseSchema,
5319
5402
  LikeResultSchema,
@@ -5323,6 +5406,7 @@ export {
5323
5406
  NearAuthorizationRequestSchema,
5324
5407
  NearAuthorizationResponseSchema,
5325
5408
  NearAuthorizationStatusResponseSchema,
5409
+ NearUnauthorizationResponseSchema,
5326
5410
  Platform,
5327
5411
  PlatformActivitySchema,
5328
5412
  PlatformParamSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/sdk",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "SDK for interacting with the Crosspost API",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -28,7 +28,7 @@ export class ActivityApi {
28
28
  * @returns A promise resolving with the leaderboard response
29
29
  */
30
30
  async getLeaderboard(query?: ActivityLeaderboardQuery): Promise<ActivityLeaderboardResponse> {
31
- return makeRequest<ActivityLeaderboardResponse>(
31
+ return makeRequest<ActivityLeaderboardResponse, never, ActivityLeaderboardQuery>(
32
32
  'GET',
33
33
  '/api/activity',
34
34
  this.options,
@@ -47,7 +47,7 @@ export class ActivityApi {
47
47
  signerId: string,
48
48
  query?: AccountActivityQuery,
49
49
  ): Promise<AccountActivityResponse> {
50
- return makeRequest<AccountActivityResponse>(
50
+ return makeRequest<AccountActivityResponse, never, AccountActivityQuery>(
51
51
  'GET',
52
52
  `/api/activity/${signerId}`,
53
53
  this.options,
@@ -66,7 +66,7 @@ export class ActivityApi {
66
66
  signerId: string,
67
67
  query?: AccountPostsQuery,
68
68
  ): Promise<AccountPostsResponse> {
69
- return makeRequest<AccountPostsResponse>(
69
+ return makeRequest<AccountPostsResponse, never, AccountPostsQuery>(
70
70
  'GET',
71
71
  `/api/activity/${signerId}/posts`,
72
72
  this.options,