redai-automation-web-sdk
Version:
TypeScript SDK for RedAI Automation Web API - Zalo Personal automation, messaging, advanced sticker search, and bulk operations. 100% compatible with automation-web backend. v1.8.1: Updated GroupInfo interface to match backend controller with complete gro
566 lines • 10.1 kB
TypeScript
/**
* Friend management related types and interfaces
*/
import { PaginatedResponse } from './common.types';
/**
* Friend status enum
*/
export declare enum FriendStatus {
ONLINE = "online",
OFFLINE = "offline",
AWAY = "away",
BUSY = "busy",
INVISIBLE = "invisible"
}
/**
* Friend request status enum
*/
export declare enum FriendRequestStatus {
PENDING = "pending",
ACCEPTED = "accepted",
REJECTED = "rejected",
CANCELLED = "cancelled"
}
/**
* Friend relationship type
*/
export declare enum FriendRelationship {
FRIEND = "friend",
BLOCKED = "blocked",
STRANGER = "stranger",
PENDING_INCOMING = "pending_incoming",
PENDING_OUTGOING = "pending_outgoing"
}
/**
* Friend information
*/
export interface FriendInfo {
/**
* User ID
*/
userId: string;
/**
* Display name
*/
displayName: string;
/**
* Avatar URL
*/
avatar?: string;
/**
* Current status
*/
status: FriendStatus;
/**
* Last seen timestamp
*/
lastSeen?: string;
/**
* Phone number (if available)
*/
phoneNumber?: string;
/**
* Email (if available)
*/
email?: string;
/**
* Friend since timestamp
*/
friendSince: string;
/**
* Whether friend is favorite
*/
isFavorite: boolean;
/**
* Whether friend is blocked
*/
isBlocked: boolean;
/**
* Relationship type
*/
relationship: FriendRelationship;
/**
* Mutual friends count
*/
mutualFriendsCount?: number;
/**
* Last interaction timestamp
*/
lastInteraction?: string;
/**
* Friend's bio/status message
*/
bio?: string;
/**
* Additional metadata
*/
metadata?: Record<string, any>;
}
/**
* Friend request information
*/
export interface FriendRequest {
/**
* Request ID
*/
requestId: string;
/**
* Requester user ID
*/
fromUserId: string;
/**
* Target user ID
*/
toUserId: string;
/**
* Requester display name
*/
fromDisplayName: string;
/**
* Requester avatar
*/
fromAvatar?: string;
/**
* Request message
*/
message?: string;
/**
* Request status
*/
status: FriendRequestStatus;
/**
* Request timestamp
*/
createdAt: string;
/**
* Response timestamp (if responded)
*/
respondedAt?: string;
/**
* Mutual friends count
*/
mutualFriendsCount?: number;
/**
* Additional metadata
*/
metadata?: Record<string, any>;
}
/**
* Send friend request
*/
export interface SendFriendRequestRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Target user ID or phone number
*/
userId: string;
/**
* Optional message
*/
message?: string;
/**
* Source of the friend request
*/
source?: 'search' | 'contacts' | 'suggestion' | 'qr_code';
}
/**
* Accept friend request
*/
export interface AcceptFriendRequestRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Request ID or user ID
*/
requestId: string;
/**
* Optional response message
*/
message?: string;
}
/**
* Reject friend request
*/
export interface RejectFriendRequestRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Request ID or user ID
*/
requestId: string;
/**
* Optional reason
*/
reason?: string;
}
/**
* Block user request
*/
export interface BlockUserRequest {
/**
* Session ID
*/
sessionId: string;
/**
* User ID to block
*/
userId: string;
/**
* Reason for blocking
*/
reason?: string;
/**
* Whether to also report the user
*/
report?: boolean;
}
/**
* Unblock user request
*/
export interface UnblockUserRequest {
/**
* Session ID
*/
sessionId: string;
/**
* User ID to unblock
*/
userId: string;
}
/**
* Remove friend request
*/
export interface RemoveFriendRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Friend user ID
*/
userId: string;
/**
* Reason for removal
*/
reason?: string;
}
/**
* Search friends request
*/
export interface SearchFriendsRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Search query (name, phone, email)
*/
query: string;
/**
* Status filter
*/
status?: FriendStatus;
/**
* Relationship filter
*/
relationship?: FriendRelationship;
/**
* Whether to include favorites only
*/
favoritesOnly?: boolean;
/**
* Page number
*/
page?: number;
/**
* Items per page
*/
limit?: number;
}
/**
* Update friend request
*/
export interface UpdateFriendRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Friend user ID
*/
userId: string;
/**
* Whether to mark as favorite
*/
isFavorite?: boolean;
/**
* Custom nickname for the friend
*/
nickname?: string;
/**
* Custom notes about the friend
*/
notes?: string;
}
/**
* Friend list response
*/
export interface FriendListResponse extends PaginatedResponse<FriendInfo> {
/**
* Online friends count
*/
onlineCount: number;
/**
* Offline friends count
*/
offlineCount: number;
/**
* Favorite friends count
*/
favoriteCount: number;
/**
* Blocked users count
*/
blockedCount: number;
}
/**
* Friend requests response
*/
export interface FriendRequestsResponse extends PaginatedResponse<FriendRequest> {
/**
* Pending incoming requests count
*/
incomingCount: number;
/**
* Pending outgoing requests count
*/
outgoingCount: number;
/**
* Accepted requests count
*/
acceptedCount: number;
/**
* Rejected requests count
*/
rejectedCount: number;
}
/**
* Friend operation result
*/
export interface FriendOperationResult {
/**
* Whether operation was successful
*/
success: boolean;
/**
* User ID
*/
userId: string;
/**
* Operation message
*/
message?: string;
/**
* Error message (if failed)
*/
error?: string;
/**
* Additional result data
*/
data?: any;
}
/**
* Bulk friend operation result
*/
export interface BulkFriendOperationResult {
/**
* Total operations attempted
*/
total: number;
/**
* Number of successful operations
*/
successful: number;
/**
* Number of failed operations
*/
failed: number;
/**
* Individual operation results
*/
results: Array<{
userId: string;
success: boolean;
error?: string;
}>;
}
/**
* Friend suggestions
*/
export interface FriendSuggestion {
/**
* Suggested user ID
*/
userId: string;
/**
* Display name
*/
displayName: string;
/**
* Avatar URL
*/
avatar?: string;
/**
* Mutual friends count
*/
mutualFriendsCount: number;
/**
* Mutual friends (sample)
*/
mutualFriends: Array<{
userId: string;
displayName: string;
}>;
/**
* Suggestion reason
*/
reason: 'mutual_friends' | 'contacts' | 'location' | 'activity';
/**
* Suggestion score (0-1)
*/
score: number;
/**
* Additional metadata
*/
metadata?: Record<string, any>;
}
/**
* Get friend suggestions request
*/
export interface GetFriendSuggestionsRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Number of suggestions to return
*/
limit?: number;
/**
* Minimum mutual friends count
*/
minMutualFriends?: number;
/**
* Suggestion sources to include
*/
sources?: Array<'mutual_friends' | 'contacts' | 'location' | 'activity'>;
}
/**
* Friend activity
*/
export interface FriendActivity {
/**
* Friend user ID
*/
userId: string;
/**
* Display name
*/
displayName: string;
/**
* Activity type
*/
activityType: 'message' | 'call' | 'status_update' | 'profile_update';
/**
* Activity description
*/
description: string;
/**
* Activity timestamp
*/
timestamp: string;
/**
* Additional activity data
*/
data?: any;
}
/**
* Get friend activities request
*/
export interface GetFriendActivitiesRequest {
/**
* Session ID
*/
sessionId: string;
/**
* Friend user ID (optional, if not provided returns all friends' activities)
*/
userId?: string;
/**
* Activity types to include
*/
activityTypes?: Array<'message' | 'call' | 'status_update' | 'profile_update'>;
/**
* Start date for activities
*/
startDate?: string;
/**
* End date for activities
*/
endDate?: string;
/**
* Page number
*/
page?: number;
/**
* Items per page
*/
limit?: number;
}
/**
* Friend statistics
*/
export interface FriendStatistics {
/**
* Total friends count
*/
totalFriends: number;
/**
* Online friends count
*/
onlineFriends: number;
/**
* New friends this month
*/
newFriendsThisMonth: number;
/**
* Most active friends
*/
mostActiveFriends: Array<{
userId: string;
displayName: string;
messageCount: number;
lastInteraction: string;
}>;
/**
* Friend requests statistics
*/
requestStats: {
sent: number;
received: number;
accepted: number;
rejected: number;
};
/**
* Blocked users count
*/
blockedUsers: number;
}
//# sourceMappingURL=friends.types.d.ts.map