@crosspost/sdk 0.1.9 → 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 +131 -4822
- package/dist/index.d.cts +7 -6
- package/dist/index.d.ts +7 -6
- package/dist/index.js +107 -4725
- package/package.json +2 -1
- package/src/api/auth.ts +31 -12
- package/src/core/request.ts +17 -2
- 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
|
/**
|
@@ -79,13 +79,13 @@ declare class AuthApi {
|
|
79
79
|
*/
|
80
80
|
getNearAuthorizationStatus(): Promise<NearAuthorizationResponse>;
|
81
81
|
/**
|
82
|
-
* Initiates the login process for a specific platform.
|
83
|
-
* The service handles the OAuth flow; this method triggers it.
|
82
|
+
* Initiates the login process for a specific platform using a popup window.
|
84
83
|
* @param platform The target platform.
|
85
84
|
* @param options Optional success and error redirect URLs.
|
86
|
-
* @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.
|
87
87
|
*/
|
88
|
-
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<
|
88
|
+
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<AuthCallbackResponse>;
|
89
89
|
/**
|
90
90
|
* Refreshes the authentication token for the specified platform.
|
91
91
|
* @param platform The target platform.
|
@@ -118,7 +118,8 @@ declare class AuthApi {
|
|
118
118
|
revokeAuth(platform: Platform, userId: string): Promise<AuthRevokeResponse>;
|
119
119
|
/**
|
120
120
|
* Lists all accounts connected to the NEAR account.
|
121
|
-
* @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.
|
122
123
|
*/
|
123
124
|
getConnectedAccounts(): Promise<ConnectedAccountsResponse>;
|
124
125
|
}
|
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
|
/**
|
@@ -79,13 +79,13 @@ declare class AuthApi {
|
|
79
79
|
*/
|
80
80
|
getNearAuthorizationStatus(): Promise<NearAuthorizationResponse>;
|
81
81
|
/**
|
82
|
-
* Initiates the login process for a specific platform.
|
83
|
-
* The service handles the OAuth flow; this method triggers it.
|
82
|
+
* Initiates the login process for a specific platform using a popup window.
|
84
83
|
* @param platform The target platform.
|
85
84
|
* @param options Optional success and error redirect URLs.
|
86
|
-
* @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.
|
87
87
|
*/
|
88
|
-
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<
|
88
|
+
loginToPlatform(platform: Platform, options?: AuthInitRequest): Promise<AuthCallbackResponse>;
|
89
89
|
/**
|
90
90
|
* Refreshes the authentication token for the specified platform.
|
91
91
|
* @param platform The target platform.
|
@@ -118,7 +118,8 @@ declare class AuthApi {
|
|
118
118
|
revokeAuth(platform: Platform, userId: string): Promise<AuthRevokeResponse>;
|
119
119
|
/**
|
120
120
|
* Lists all accounts connected to the NEAR account.
|
121
|
-
* @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.
|
122
123
|
*/
|
123
124
|
getConnectedAccounts(): Promise<ConnectedAccountsResponse>;
|
124
125
|
}
|