@crosspost/sdk 0.1.8 → 0.1.10
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/README.md +23 -13
- package/dist/index.cjs +212 -4908
- package/dist/index.d.cts +7 -15
- package/dist/index.d.ts +7 -15
- package/dist/index.js +188 -4811
- package/package.json +2 -1
- package/src/api/auth.ts +31 -12
- package/src/core/client.ts +0 -2
- package/src/core/config.ts +0 -6
- package/src/core/request.ts +125 -127
- package/src/utils/popup.ts +129 -0
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, AuthInitRequest,
|
2
|
+
import { ActivityLeaderboardQuery, ActivityLeaderboardResponse, AccountActivityQuery, AccountActivityResponse, AccountPostsQuery, AccountPostsResponse, NearAuthorizationResponse, Platform, AuthInitRequest, 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
|
/**
|
@@ -24,10 +24,6 @@ interface RequestOptions {
|
|
24
24
|
* Request timeout in milliseconds
|
25
25
|
*/
|
26
26
|
timeout: number;
|
27
|
-
/**
|
28
|
-
* Number of retries for failed requests
|
29
|
-
*/
|
30
|
-
retries: number;
|
31
27
|
}
|
32
28
|
|
33
29
|
/**
|
@@ -83,13 +79,13 @@ declare class AuthApi {
|
|
83
79
|
*/
|
84
80
|
getNearAuthorizationStatus(): Promise<NearAuthorizationResponse>;
|
85
81
|
/**
|
86
|
-
* Initiates the login process for a specific platform.
|
87
|
-
* The service handles the OAuth flow; this method triggers it.
|
82
|
+
* Initiates the login process for a specific platform using a popup window.
|
88
83
|
* @param platform The target platform.
|
89
84
|
* @param options Optional success and error redirect URLs.
|
90
|
-
* @returns
|
85
|
+
* @returns Promise that resolves with the authentication result when the popup completes.
|
86
|
+
* @throws Error if popups are blocked or if running in a non-browser environment.
|
91
87
|
*/
|
92
|
-
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<
|
88
|
+
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<AuthCallbackResponse>;
|
93
89
|
/**
|
94
90
|
* Refreshes the authentication token for the specified platform.
|
95
91
|
* @param platform The target platform.
|
@@ -122,7 +118,8 @@ declare class AuthApi {
|
|
122
118
|
revokeAuth(platform: Platform, userId: string): Promise<AuthRevokeResponse>;
|
123
119
|
/**
|
124
120
|
* Lists all accounts connected to the NEAR account.
|
125
|
-
* @returns A promise resolving with the
|
121
|
+
* @returns A promise resolving with the connected accounts response containing an array of accounts.
|
122
|
+
* @throws {CrosspostError} If the request fails or returns invalid data.
|
126
123
|
*/
|
127
124
|
getConnectedAccounts(): Promise<ConnectedAccountsResponse>;
|
128
125
|
}
|
@@ -228,11 +225,6 @@ interface CrosspostClientConfig {
|
|
228
225
|
* @default 30000
|
229
226
|
*/
|
230
227
|
timeout?: number;
|
231
|
-
/**
|
232
|
-
* Number of retries for failed requests (specifically for network errors or 5xx status codes)
|
233
|
-
* @default 2
|
234
|
-
*/
|
235
|
-
retries?: number;
|
236
228
|
}
|
237
229
|
|
238
230
|
/**
|
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, AuthInitRequest,
|
2
|
+
import { ActivityLeaderboardQuery, ActivityLeaderboardResponse, AccountActivityQuery, AccountActivityResponse, AccountPostsQuery, AccountPostsResponse, NearAuthorizationResponse, Platform, AuthInitRequest, 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
|
/**
|
@@ -24,10 +24,6 @@ interface RequestOptions {
|
|
24
24
|
* Request timeout in milliseconds
|
25
25
|
*/
|
26
26
|
timeout: number;
|
27
|
-
/**
|
28
|
-
* Number of retries for failed requests
|
29
|
-
*/
|
30
|
-
retries: number;
|
31
27
|
}
|
32
28
|
|
33
29
|
/**
|
@@ -83,13 +79,13 @@ declare class AuthApi {
|
|
83
79
|
*/
|
84
80
|
getNearAuthorizationStatus(): Promise<NearAuthorizationResponse>;
|
85
81
|
/**
|
86
|
-
* Initiates the login process for a specific platform.
|
87
|
-
* The service handles the OAuth flow; this method triggers it.
|
82
|
+
* Initiates the login process for a specific platform using a popup window.
|
88
83
|
* @param platform The target platform.
|
89
84
|
* @param options Optional success and error redirect URLs.
|
90
|
-
* @returns
|
85
|
+
* @returns Promise that resolves with the authentication result when the popup completes.
|
86
|
+
* @throws Error if popups are blocked or if running in a non-browser environment.
|
91
87
|
*/
|
92
|
-
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<
|
88
|
+
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<AuthCallbackResponse>;
|
93
89
|
/**
|
94
90
|
* Refreshes the authentication token for the specified platform.
|
95
91
|
* @param platform The target platform.
|
@@ -122,7 +118,8 @@ declare class AuthApi {
|
|
122
118
|
revokeAuth(platform: Platform, userId: string): Promise<AuthRevokeResponse>;
|
123
119
|
/**
|
124
120
|
* Lists all accounts connected to the NEAR account.
|
125
|
-
* @returns A promise resolving with the
|
121
|
+
* @returns A promise resolving with the connected accounts response containing an array of accounts.
|
122
|
+
* @throws {CrosspostError} If the request fails or returns invalid data.
|
126
123
|
*/
|
127
124
|
getConnectedAccounts(): Promise<ConnectedAccountsResponse>;
|
128
125
|
}
|
@@ -228,11 +225,6 @@ interface CrosspostClientConfig {
|
|
228
225
|
* @default 30000
|
229
226
|
*/
|
230
227
|
timeout?: number;
|
231
|
-
/**
|
232
|
-
* Number of retries for failed requests (specifically for network errors or 5xx status codes)
|
233
|
-
* @default 2
|
234
|
-
*/
|
235
|
-
retries?: number;
|
236
228
|
}
|
237
229
|
|
238
230
|
/**
|