UNPKG

@warriorteam/redai-zalo-sdk

Version:

Comprehensive TypeScript/JavaScript SDK for Zalo APIs - Official Account v3.0, ZNS with Full Type Safety, Consultation Service, Broadcast Service, Group Messaging with List APIs, Social APIs, Enhanced Article Management, Promotion Service v3.0 with Multip

148 lines 5.67 kB
/** * Main Zalo SDK class */ import { AuthService } from "./services/auth.service"; import { OAService } from "./services/oa.service"; import { UserService } from "./services/user.service"; import { ZNSService } from "./services/zns.service"; import { GroupMessageService } from "./services/group-message.service"; import { GroupManagementService } from "./services/group-management.service"; import { ArticleService } from "./services/article.service"; import { VideoUploadService } from "./services/video-upload.service"; import { ConsultationService } from "./services/consultation.service"; import { TransactionService } from "./services/transaction.service"; import { PromotionService } from "./services/promotion.service"; import { GeneralMessageService } from "./services/general-message.service"; import { MessageManagementService } from "./services/message-management.service"; import { BroadcastService } from "./services/broadcast.service"; import { PurchaseService } from "./services/purchase.service"; import { ZaloSDKConfig } from "./types/common"; import { AccessToken, SocialUserInfo } from "./types/auth"; import { OAInfo, MessageQuota } from "./types/oa"; import { SendMessageResponse } from "./types/message"; import { UserInfo, UserListRequest, UserListResponse } from "./types/user"; /** * Main Zalo SDK class providing access to all Zalo APIs */ export declare class ZaloSDK { private readonly client; private readonly logger; readonly auth: AuthService; readonly oa: OAService; readonly user: UserService; readonly zns: ZNSService; readonly groupMessage: GroupMessageService; readonly groupManagement: GroupManagementService; readonly article: ArticleService; readonly videoUpload: VideoUploadService; readonly consultation: ConsultationService; readonly transaction: TransactionService; readonly promotion: PromotionService; readonly generalMessage: GeneralMessageService; readonly messageManagement: MessageManagementService; readonly broadcast: BroadcastService; readonly purchase: PurchaseService; readonly config: Required<ZaloSDKConfig>; constructor(config: ZaloSDKConfig); /** * Quick method to get OA access token from authorization code */ getOAAccessToken(code: string, redirectUri: string): Promise<AccessToken>; /** * Quick method to get Social access token from authorization code */ getSocialAccessToken(code: string, redirectUri: string, codeVerifier?: string): Promise<AccessToken>; /** * Quick method to refresh OA access token */ refreshOAAccessToken(refreshToken: string): Promise<AccessToken>; /** * Quick method to refresh Social access token */ refreshSocialAccessToken(refreshToken: string): Promise<AccessToken>; /** * Quick method to get OA information */ getOAInfo(accessToken: string): Promise<OAInfo>; /** * Quick method to get message quota */ getMessageQuota(accessToken: string): Promise<MessageQuota>; /** * Quick method to get Social user information */ getSocialUserInfo(accessToken: string, fields?: string): Promise<SocialUserInfo>; /** * Quick method to send consultation text message */ sendConsultationText(accessToken: string, userId: string, text: string): Promise<SendMessageResponse>; /** * Quick method to get user information */ getUserInfo(accessToken: string, userId: string): Promise<UserInfo>; /** * Quick method to get user list */ getUserList(accessToken: string, request: UserListRequest): Promise<UserListResponse>; /** * Quick method to get all followers */ getFollowers(accessToken: string): Promise<UserListResponse>; /** * Quick method to register webhook handlers */ /** * Quick method to process webhook */ /** * Create OA authorization URL with PKCE support * @deprecated Use auth.createOAAuthUrl() directly for full control over PKCE and state */ createOAAuthUrl(redirectUri: string, state?: string): string; /** * Create OA authorization URL with full PKCE support * Returns both URL and state for enhanced security */ createSecureOAAuthUrl(redirectUri: string, state?: string, enablePKCE?: boolean): import("./types/auth").OAAuthResult; /** * Create Social authorization URL */ createSocialAuthUrl(redirectUri: string, state?: string): string; /** * Generate PKCE for Social API */ generatePKCE(): import("./types/auth").PKCEConfig; /** * Validate access token */ validateAccessToken(accessToken: string, scope?: "oa" | "social"): Promise<boolean>; /** * Get SDK version */ getVersion(): string; /** * Get SDK configuration (without sensitive data) */ getConfig(): Omit<Required<ZaloSDKConfig>, "appSecret">; /** * Enable or disable debug logging */ setDebug(enabled: boolean): void; /** * Test SDK connectivity */ testConnection(): Promise<boolean>; /** * Make a custom API request (advanced usage) */ customRequest<T = any>(method: "GET" | "POST" | "PUT" | "DELETE", endpoint: string, accessToken: string, data?: any, params?: Record<string, any>): Promise<T>; /** * Upload file to Zalo API */ uploadFile<T = any>(endpoint: string, accessToken: string, file: Buffer | NodeJS.ReadableStream, filename: string, additionalFields?: Record<string, any>): Promise<T>; /** * Dispose SDK resources */ dispose(): void; } //# sourceMappingURL=zalo-sdk.d.ts.map