@crosspost/sdk 0.1.6 → 0.1.8

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.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { NearAuthData } from 'near-sign-verify';
2
- import { ActivityLeaderboardQuery, ActivityLeaderboardResponse, AccountActivityQuery, AccountActivityResponse, AccountPostsQuery, AccountPostsResponse, NearAuthorizationResponse, Platform, EnhancedApiResponse, AuthStatusResponse, AuthRevokeResponse, ConnectedAccountsResponse, CreatePostRequest, CreatePostResponse, RepostRequest, RepostResponse, QuotePostRequest, QuotePostResponse, ReplyToPostRequest, ReplyToPostResponse, LikePostRequest, LikePostResponse, UnlikePostRequest, UnlikePostResponse, DeletePostRequest, DeletePostResponse, RateLimitResponse, EndpointRateLimitResponse, ApiError, ApiErrorCode, PlatformError, CompositeApiError } 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,9 +12,14 @@ 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
+ /**
19
+ * NEAR account ID for simplified GET request authentication
20
+ * If not provided, will use account_id from nearAuthData
21
+ */
22
+ nearAccount?: string;
18
23
  /**
19
24
  * Request timeout in milliseconds
20
25
  */
@@ -84,34 +89,37 @@ declare class AuthApi {
84
89
  * @param options Optional success and error redirect URLs.
85
90
  * @returns A promise resolving with the response from the service (might indicate success/failure or redirect info).
86
91
  */
87
- loginToPlatform(platform: Platform, options?: {
88
- successUrl?: string;
89
- errorUrl?: string;
90
- }): Promise<EnhancedApiResponse<any>>;
92
+ loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<AuthUrlResponse>;
91
93
  /**
92
94
  * Refreshes the authentication token for the specified platform.
93
95
  * @param platform The target platform.
94
- * @returns A promise resolving with the refresh response.
96
+ * @returns A promise resolving with the refresh response containing updated auth details.
95
97
  */
96
- refreshToken(platform: Platform): Promise<EnhancedApiResponse<any>>;
98
+ refreshToken(platform: Platform, userId: string): Promise<AuthCallbackResponse>;
97
99
  /**
98
100
  * Refreshes the user's profile information from the specified platform.
99
101
  * @param platform The target platform.
100
- * @returns A promise resolving with the profile refresh response.
102
+ * @param userId The user ID on the platform
103
+ * @returns A promise resolving with the updated account profile information.
101
104
  */
102
- refreshProfile(platform: Platform): Promise<EnhancedApiResponse<any>>;
105
+ refreshProfile(platform: Platform, userId: string): Promise<ConnectedAccount>;
103
106
  /**
104
107
  * Gets the authentication status for the specified platform.
105
108
  * @param platform The target platform.
106
109
  * @returns A promise resolving with the authentication status response.
107
110
  */
108
- getAuthStatus(platform: Platform): Promise<AuthStatusResponse>;
111
+ getAuthStatus(platform: Platform, userId: string): Promise<AuthStatusResponse>;
112
+ /**
113
+ * Unauthorizes a NEAR account from using the service
114
+ * @returns A promise resolving with the unauthorized response
115
+ */
116
+ unauthorizeNear(): Promise<NearUnauthorizationResponse>;
109
117
  /**
110
118
  * Revokes the authentication token for the specified platform.
111
119
  * @param platform The target platform.
112
120
  * @returns A promise resolving with the revocation response.
113
121
  */
114
- revokeAuth(platform: Platform): Promise<AuthRevokeResponse>;
122
+ revokeAuth(platform: Platform, userId: string): Promise<AuthRevokeResponse>;
115
123
  /**
116
124
  * Lists all accounts connected to the NEAR account.
117
125
  * @returns A promise resolving with the list of connected accounts.
@@ -199,9 +207,7 @@ declare class SystemApi {
199
207
  * Gets the health status of the API
200
208
  * @returns A promise resolving with the health status
201
209
  */
202
- getHealthStatus(): Promise<{
203
- status: string;
204
- }>;
210
+ getHealthStatus(): Promise<HealthStatus>;
205
211
  }
206
212
 
207
213
  /**
@@ -245,140 +251,115 @@ declare class CrosspostClient {
245
251
  constructor(config?: CrosspostClientConfig);
246
252
  /**
247
253
  * Sets the authentication data (signature) for the client
254
+ * Required for non-GET requests
248
255
  * @param nearAuthData The NEAR authentication data
249
256
  */
250
257
  setAuthentication(nearAuthData: NearAuthData): void;
258
+ /**
259
+ * Sets the NEAR account ID for simplified GET request authentication
260
+ * If not set, will use account_id from nearAuthData
261
+ * @param nearAccount The NEAR account ID
262
+ */
263
+ setNearAccount(nearAccount: string): void;
264
+ /**
265
+ * Gets the current NEAR account ID being used for authentication
266
+ * @returns The NEAR account ID from nearAccount or nearAuthData
267
+ */
268
+ getNearAccount(): string | undefined;
251
269
  /**
252
270
  * Checks if authentication data (signature) exists on client
253
- * @param signature The NEAR authentication data
271
+ * @returns true if nearAuthData is set (required for non-GET requests)
254
272
  */
255
273
  isAuthenticated(): boolean;
274
+ /**
275
+ * Checks if a NEAR account is set for GET request authentication
276
+ * @returns true if either nearAccount or nearAuthData.account_id is set
277
+ */
278
+ hasNearAccount(): boolean;
279
+ /**
280
+ * Clears all authentication data from the client
281
+ * This will prevent all requests from working until new authentication is set
282
+ */
283
+ clear(): void;
256
284
  }
257
285
 
258
286
  /**
259
- * Error categories grouped by type
260
- */
261
- declare const ERROR_CATEGORIES: {
262
- AUTH: ApiErrorCode[];
263
- VALIDATION: ApiErrorCode[];
264
- NETWORK: ApiErrorCode[];
265
- PLATFORM: ApiErrorCode[];
266
- CONTENT: ApiErrorCode[];
267
- RATE_LIMIT: ApiErrorCode[];
268
- POST: ApiErrorCode[];
269
- MEDIA: ApiErrorCode[];
270
- };
271
- /**
272
- * Check if an error belongs to a specific category
273
- *
274
- * @param error The error to check
275
- * @param category The category to check against
276
- * @returns True if the error belongs to the category, false otherwise
287
+ * CrosspostError class for SDK error handling
277
288
  */
278
- declare function isErrorOfCategory(error: unknown, category: ApiErrorCode[]): boolean;
289
+ declare class CrosspostError extends Error {
290
+ readonly code: ApiErrorCode;
291
+ readonly status: StatusCode;
292
+ readonly details?: ErrorDetails;
293
+ readonly recoverable: boolean;
294
+ constructor(message: string, code: ApiErrorCode, status: StatusCode, details?: ErrorDetails, recoverable?: boolean);
295
+ /**
296
+ * Get platform from details if available
297
+ */
298
+ get platform(): string | undefined;
299
+ /**
300
+ * Get userId from details if available
301
+ */
302
+ get userId(): string | undefined;
303
+ }
279
304
  /**
280
305
  * Check if an error is an authentication error
281
- *
282
- * @param error The error to check
283
- * @returns True if the error is an authentication error, false otherwise
284
306
  */
285
307
  declare function isAuthError(error: unknown): boolean;
286
308
  /**
287
309
  * Check if an error is a validation error
288
- *
289
- * @param error The error to check
290
- * @returns True if the error is a validation error, false otherwise
291
310
  */
292
311
  declare function isValidationError(error: unknown): boolean;
293
312
  /**
294
313
  * Check if an error is a network error
295
- *
296
- * @param error The error to check
297
- * @returns True if the error is a network error, false otherwise
298
314
  */
299
315
  declare function isNetworkError(error: unknown): boolean;
300
316
  /**
301
317
  * Check if an error is a platform error
302
- *
303
- * @param error The error to check
304
- * @returns True if the error is a platform error, false otherwise
305
318
  */
306
319
  declare function isPlatformError(error: unknown): boolean;
307
320
  /**
308
321
  * Check if an error is a content policy error
309
- *
310
- * @param error The error to check
311
- * @returns True if the error is a content policy error, false otherwise
312
322
  */
313
323
  declare function isContentError(error: unknown): boolean;
314
324
  /**
315
325
  * Check if an error is a rate limit error
316
- *
317
- * @param error The error to check
318
- * @returns True if the error is a rate limit error, false otherwise
319
326
  */
320
327
  declare function isRateLimitError(error: unknown): boolean;
321
328
  /**
322
329
  * Check if an error is a post-related error
323
- *
324
- * @param error The error to check
325
- * @returns True if the error is a post-related error, false otherwise
326
330
  */
327
331
  declare function isPostError(error: unknown): boolean;
328
332
  /**
329
333
  * Check if an error is a media-related error
330
- *
331
- * @param error The error to check
332
- * @returns True if the error is a media-related error, false otherwise
333
334
  */
334
335
  declare function isMediaError(error: unknown): boolean;
335
336
  /**
336
337
  * Check if an error is recoverable
337
- *
338
- * @param error The error to check
339
- * @returns True if the error is recoverable, false otherwise
340
338
  */
341
339
  declare function isRecoverableError(error: unknown): boolean;
342
340
  /**
343
341
  * Get a user-friendly error message
344
- *
345
- * @param error The error to get the message from
346
- * @param defaultMessage The default message to return if no message is found
347
- * @returns The error message
348
342
  */
349
343
  declare function getErrorMessage(error: unknown, defaultMessage?: string): string;
350
344
  /**
351
- * Extract error details if available
352
- *
353
- * @param error The error to extract details from
354
- * @returns The error details or undefined if none are found
345
+ * Get error details if available
355
346
  */
356
- declare function getErrorDetails(error: unknown): Record<string, any> | undefined;
347
+ declare function getErrorDetails(error: unknown): ErrorDetails | undefined;
357
348
  /**
358
349
  * Enrich an error with additional context
359
- *
360
- * @param error The error to enrich
361
- * @param context The context to add to the error
362
- * @returns The enriched error
363
350
  */
364
- declare function enrichErrorWithContext(error: unknown, context: Record<string, any>): Error;
351
+ declare function enrichErrorWithContext(error: unknown, context: Record<string, unknown>): Error;
365
352
  /**
366
353
  * Wrapper for API calls with consistent error handling
367
- *
368
- * @param apiCall The API call to wrap
369
- * @param context Optional context to add to any errors
370
- * @returns The result of the API call
371
- * @throws An enriched error if the API call fails
372
354
  */
373
- declare function apiWrapper<T>(apiCall: () => Promise<T>, context?: Record<string, any>): Promise<T>;
355
+ declare function apiWrapper<T>(apiCall: () => Promise<T>, context?: Record<string, unknown>): Promise<T>;
374
356
  /**
375
357
  * Handles error responses from the API and converts them to appropriate error objects.
376
- *
377
- * @param data The error response data
378
- * @param status The HTTP status code
379
- * @returns An ApiError or PlatformError instance
380
358
  */
381
- declare function handleErrorResponse(data: any, status: number): ApiError | PlatformError | CompositeApiError;
382
- declare function createNetworkError(error: unknown, url: string, timeout: number): ApiError;
359
+ declare function handleErrorResponse(data: any, status: number): CrosspostError;
360
+ /**
361
+ * Creates a network error with appropriate details
362
+ */
363
+ declare function createNetworkError(error: unknown, url: string, timeout: number): CrosspostError;
383
364
 
384
- export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, ERROR_CATEGORIES, PostApi, SystemApi, apiWrapper, createNetworkError, enrichErrorWithContext, getErrorDetails, getErrorMessage, handleErrorResponse, isAuthError, isContentError, isErrorOfCategory, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };
365
+ export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, PostApi, SystemApi, apiWrapper, createNetworkError, enrichErrorWithContext, getErrorDetails, getErrorMessage, handleErrorResponse, isAuthError, isContentError, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };
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, EnhancedApiResponse, AuthStatusResponse, AuthRevokeResponse, ConnectedAccountsResponse, CreatePostRequest, CreatePostResponse, RepostRequest, RepostResponse, QuotePostRequest, QuotePostResponse, ReplyToPostRequest, ReplyToPostResponse, LikePostRequest, LikePostResponse, UnlikePostRequest, UnlikePostResponse, DeletePostRequest, DeletePostResponse, RateLimitResponse, EndpointRateLimitResponse, ApiError, ApiErrorCode, PlatformError, CompositeApiError } 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,9 +12,14 @@ 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
+ /**
19
+ * NEAR account ID for simplified GET request authentication
20
+ * If not provided, will use account_id from nearAuthData
21
+ */
22
+ nearAccount?: string;
18
23
  /**
19
24
  * Request timeout in milliseconds
20
25
  */
@@ -84,34 +89,37 @@ declare class AuthApi {
84
89
  * @param options Optional success and error redirect URLs.
85
90
  * @returns A promise resolving with the response from the service (might indicate success/failure or redirect info).
86
91
  */
87
- loginToPlatform(platform: Platform, options?: {
88
- successUrl?: string;
89
- errorUrl?: string;
90
- }): Promise<EnhancedApiResponse<any>>;
92
+ loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<AuthUrlResponse>;
91
93
  /**
92
94
  * Refreshes the authentication token for the specified platform.
93
95
  * @param platform The target platform.
94
- * @returns A promise resolving with the refresh response.
96
+ * @returns A promise resolving with the refresh response containing updated auth details.
95
97
  */
96
- refreshToken(platform: Platform): Promise<EnhancedApiResponse<any>>;
98
+ refreshToken(platform: Platform, userId: string): Promise<AuthCallbackResponse>;
97
99
  /**
98
100
  * Refreshes the user's profile information from the specified platform.
99
101
  * @param platform The target platform.
100
- * @returns A promise resolving with the profile refresh response.
102
+ * @param userId The user ID on the platform
103
+ * @returns A promise resolving with the updated account profile information.
101
104
  */
102
- refreshProfile(platform: Platform): Promise<EnhancedApiResponse<any>>;
105
+ refreshProfile(platform: Platform, userId: string): Promise<ConnectedAccount>;
103
106
  /**
104
107
  * Gets the authentication status for the specified platform.
105
108
  * @param platform The target platform.
106
109
  * @returns A promise resolving with the authentication status response.
107
110
  */
108
- getAuthStatus(platform: Platform): Promise<AuthStatusResponse>;
111
+ getAuthStatus(platform: Platform, userId: string): Promise<AuthStatusResponse>;
112
+ /**
113
+ * Unauthorizes a NEAR account from using the service
114
+ * @returns A promise resolving with the unauthorized response
115
+ */
116
+ unauthorizeNear(): Promise<NearUnauthorizationResponse>;
109
117
  /**
110
118
  * Revokes the authentication token for the specified platform.
111
119
  * @param platform The target platform.
112
120
  * @returns A promise resolving with the revocation response.
113
121
  */
114
- revokeAuth(platform: Platform): Promise<AuthRevokeResponse>;
122
+ revokeAuth(platform: Platform, userId: string): Promise<AuthRevokeResponse>;
115
123
  /**
116
124
  * Lists all accounts connected to the NEAR account.
117
125
  * @returns A promise resolving with the list of connected accounts.
@@ -199,9 +207,7 @@ declare class SystemApi {
199
207
  * Gets the health status of the API
200
208
  * @returns A promise resolving with the health status
201
209
  */
202
- getHealthStatus(): Promise<{
203
- status: string;
204
- }>;
210
+ getHealthStatus(): Promise<HealthStatus>;
205
211
  }
206
212
 
207
213
  /**
@@ -245,140 +251,115 @@ declare class CrosspostClient {
245
251
  constructor(config?: CrosspostClientConfig);
246
252
  /**
247
253
  * Sets the authentication data (signature) for the client
254
+ * Required for non-GET requests
248
255
  * @param nearAuthData The NEAR authentication data
249
256
  */
250
257
  setAuthentication(nearAuthData: NearAuthData): void;
258
+ /**
259
+ * Sets the NEAR account ID for simplified GET request authentication
260
+ * If not set, will use account_id from nearAuthData
261
+ * @param nearAccount The NEAR account ID
262
+ */
263
+ setNearAccount(nearAccount: string): void;
264
+ /**
265
+ * Gets the current NEAR account ID being used for authentication
266
+ * @returns The NEAR account ID from nearAccount or nearAuthData
267
+ */
268
+ getNearAccount(): string | undefined;
251
269
  /**
252
270
  * Checks if authentication data (signature) exists on client
253
- * @param signature The NEAR authentication data
271
+ * @returns true if nearAuthData is set (required for non-GET requests)
254
272
  */
255
273
  isAuthenticated(): boolean;
274
+ /**
275
+ * Checks if a NEAR account is set for GET request authentication
276
+ * @returns true if either nearAccount or nearAuthData.account_id is set
277
+ */
278
+ hasNearAccount(): boolean;
279
+ /**
280
+ * Clears all authentication data from the client
281
+ * This will prevent all requests from working until new authentication is set
282
+ */
283
+ clear(): void;
256
284
  }
257
285
 
258
286
  /**
259
- * Error categories grouped by type
260
- */
261
- declare const ERROR_CATEGORIES: {
262
- AUTH: ApiErrorCode[];
263
- VALIDATION: ApiErrorCode[];
264
- NETWORK: ApiErrorCode[];
265
- PLATFORM: ApiErrorCode[];
266
- CONTENT: ApiErrorCode[];
267
- RATE_LIMIT: ApiErrorCode[];
268
- POST: ApiErrorCode[];
269
- MEDIA: ApiErrorCode[];
270
- };
271
- /**
272
- * Check if an error belongs to a specific category
273
- *
274
- * @param error The error to check
275
- * @param category The category to check against
276
- * @returns True if the error belongs to the category, false otherwise
287
+ * CrosspostError class for SDK error handling
277
288
  */
278
- declare function isErrorOfCategory(error: unknown, category: ApiErrorCode[]): boolean;
289
+ declare class CrosspostError extends Error {
290
+ readonly code: ApiErrorCode;
291
+ readonly status: StatusCode;
292
+ readonly details?: ErrorDetails;
293
+ readonly recoverable: boolean;
294
+ constructor(message: string, code: ApiErrorCode, status: StatusCode, details?: ErrorDetails, recoverable?: boolean);
295
+ /**
296
+ * Get platform from details if available
297
+ */
298
+ get platform(): string | undefined;
299
+ /**
300
+ * Get userId from details if available
301
+ */
302
+ get userId(): string | undefined;
303
+ }
279
304
  /**
280
305
  * Check if an error is an authentication error
281
- *
282
- * @param error The error to check
283
- * @returns True if the error is an authentication error, false otherwise
284
306
  */
285
307
  declare function isAuthError(error: unknown): boolean;
286
308
  /**
287
309
  * Check if an error is a validation error
288
- *
289
- * @param error The error to check
290
- * @returns True if the error is a validation error, false otherwise
291
310
  */
292
311
  declare function isValidationError(error: unknown): boolean;
293
312
  /**
294
313
  * Check if an error is a network error
295
- *
296
- * @param error The error to check
297
- * @returns True if the error is a network error, false otherwise
298
314
  */
299
315
  declare function isNetworkError(error: unknown): boolean;
300
316
  /**
301
317
  * Check if an error is a platform error
302
- *
303
- * @param error The error to check
304
- * @returns True if the error is a platform error, false otherwise
305
318
  */
306
319
  declare function isPlatformError(error: unknown): boolean;
307
320
  /**
308
321
  * Check if an error is a content policy error
309
- *
310
- * @param error The error to check
311
- * @returns True if the error is a content policy error, false otherwise
312
322
  */
313
323
  declare function isContentError(error: unknown): boolean;
314
324
  /**
315
325
  * Check if an error is a rate limit error
316
- *
317
- * @param error The error to check
318
- * @returns True if the error is a rate limit error, false otherwise
319
326
  */
320
327
  declare function isRateLimitError(error: unknown): boolean;
321
328
  /**
322
329
  * Check if an error is a post-related error
323
- *
324
- * @param error The error to check
325
- * @returns True if the error is a post-related error, false otherwise
326
330
  */
327
331
  declare function isPostError(error: unknown): boolean;
328
332
  /**
329
333
  * Check if an error is a media-related error
330
- *
331
- * @param error The error to check
332
- * @returns True if the error is a media-related error, false otherwise
333
334
  */
334
335
  declare function isMediaError(error: unknown): boolean;
335
336
  /**
336
337
  * Check if an error is recoverable
337
- *
338
- * @param error The error to check
339
- * @returns True if the error is recoverable, false otherwise
340
338
  */
341
339
  declare function isRecoverableError(error: unknown): boolean;
342
340
  /**
343
341
  * Get a user-friendly error message
344
- *
345
- * @param error The error to get the message from
346
- * @param defaultMessage The default message to return if no message is found
347
- * @returns The error message
348
342
  */
349
343
  declare function getErrorMessage(error: unknown, defaultMessage?: string): string;
350
344
  /**
351
- * Extract error details if available
352
- *
353
- * @param error The error to extract details from
354
- * @returns The error details or undefined if none are found
345
+ * Get error details if available
355
346
  */
356
- declare function getErrorDetails(error: unknown): Record<string, any> | undefined;
347
+ declare function getErrorDetails(error: unknown): ErrorDetails | undefined;
357
348
  /**
358
349
  * Enrich an error with additional context
359
- *
360
- * @param error The error to enrich
361
- * @param context The context to add to the error
362
- * @returns The enriched error
363
350
  */
364
- declare function enrichErrorWithContext(error: unknown, context: Record<string, any>): Error;
351
+ declare function enrichErrorWithContext(error: unknown, context: Record<string, unknown>): Error;
365
352
  /**
366
353
  * Wrapper for API calls with consistent error handling
367
- *
368
- * @param apiCall The API call to wrap
369
- * @param context Optional context to add to any errors
370
- * @returns The result of the API call
371
- * @throws An enriched error if the API call fails
372
354
  */
373
- declare function apiWrapper<T>(apiCall: () => Promise<T>, context?: Record<string, any>): Promise<T>;
355
+ declare function apiWrapper<T>(apiCall: () => Promise<T>, context?: Record<string, unknown>): Promise<T>;
374
356
  /**
375
357
  * Handles error responses from the API and converts them to appropriate error objects.
376
- *
377
- * @param data The error response data
378
- * @param status The HTTP status code
379
- * @returns An ApiError or PlatformError instance
380
358
  */
381
- declare function handleErrorResponse(data: any, status: number): ApiError | PlatformError | CompositeApiError;
382
- declare function createNetworkError(error: unknown, url: string, timeout: number): ApiError;
359
+ declare function handleErrorResponse(data: any, status: number): CrosspostError;
360
+ /**
361
+ * Creates a network error with appropriate details
362
+ */
363
+ declare function createNetworkError(error: unknown, url: string, timeout: number): CrosspostError;
383
364
 
384
- export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, ERROR_CATEGORIES, PostApi, SystemApi, apiWrapper, createNetworkError, enrichErrorWithContext, getErrorDetails, getErrorMessage, handleErrorResponse, isAuthError, isContentError, isErrorOfCategory, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };
365
+ export { ActivityApi, AuthApi, CrosspostClient, type CrosspostClientConfig, PostApi, SystemApi, apiWrapper, createNetworkError, enrichErrorWithContext, getErrorDetails, getErrorMessage, handleErrorResponse, isAuthError, isContentError, isMediaError, isNetworkError, isPlatformError, isPostError, isRateLimitError, isRecoverableError, isValidationError };