import { ConversationType, XboxMessage } from '.'; import { GatewayChannelGroupMessage, GatewayContentParts } from './ws'; type RequestUrl = string | URL; type MethodRequestConfig = { relyingParty?: string; contractVersion?: string; data?: unknown; headers?: HeadersInit; }; export interface APIGroup { timestamp: string; groupId: string; groupName: string; groupType: string; groupTypeMetadata: null; displayImageUrl: string; canInvite: boolean; owner: string; participants: string[]; channels: APIChannelElement[]; } export interface APIChannelElement { timestamp: string; id: string; voiceId: string; channelId: string; channelName: string; consumptionHorizon: string; directMentionHorizon: string; clearHorizon: string; ticketValid: boolean; lastMessage: APIGroupLastMessage; notificationOptions: string; isRead: boolean; voiceRoster: string[]; } export interface APIGroupLastMessage { channel: GatewayChannelGroupMessage; payload: APIMessage; messageId: string; messageTime: string; flagIsDeleted: boolean; } export interface APIOneToOneConversation { timestamp: string; networkId: string; type: ConversationType.OneToOne; conversationId: string; participants: string[]; readHorizon: string; deleteHorizon: string; isRead: boolean; folder: string; notificationOptions: string; messages: APIMessage[]; continuationToken: null; directMentionHorizon: string; muted: boolean; voiceId: string; voiceRoster: string[]; } export interface APIGroupConversation { timestamp: string; networkId: string; type: ConversationType.Group; conversationId: string; participants: string[]; readHorizon: string; deleteHorizon: string; isRead: boolean; folder: string; notificationOptions: string; messages: APIMessage[]; continuationToken: null; owner: string; name: string; displayImageUrl: string; directMentionHorizon: string; groupType: string; muted: boolean; voiceId: string; voiceRoster: string[]; } export interface APIMessage { contentPayload: APIContentPayload; timestamp: string; lastUpdateTimestamp: string; type: string; networkId: string; conversationType: string; conversationId: string; sender: string; owner: number; messageId: string; clock: string; isDeleted: boolean; isServerUpdated: boolean; } export interface APIContentPayload { content: APIContent; } export interface APIContent { parts: GatewayContentParts[]; } export type APIInboxConversation = APIInboxConversationOneToOne | APIInboxConversationGroup; export interface APIInboxConversationBase { timestamp: string; networkId: string; type: ConversationType; conversationId: string; participants: string[]; folder: string; readHorizon: string; deleteHorizon: string; lastMessage: APIMessage; notificationOptions: string; isRead: boolean; directMentionHorizon: string; } export interface APIInboxConversationOneToOne extends APIInboxConversationBase { type: ConversationType.OneToOne; } export interface APIInboxConversationGroup extends APIInboxConversationBase { type: ConversationType.Group; groupType: string; owner: string; name: string; displayImageUrl: string; } export type RestGetAttachmentsTranscribeResponse = { transcription: string; confidence: string; }; export type RestGetUploadAttachmentResponse = { uploadUri: string; attachmentId: string; }; export type RestPostSendMessageResponse = { messageId: string; conversationId: string; nudgeUser: boolean; }; export interface RestGetInboxResponse { folder: string; totalCount: number; unreadCount: number; conversations: APIInboxConversation[]; } export type RestGetConversationResponse = APIOneToOneConversation | APIGroupConversation; export interface RestGetProfileResponse { people: RestGetProfilePersonResponse[]; recommendationSummary: null; friendFinderState: null; accountLinkDetails: null; } export interface RestGetProfilePersonResponse { xuid: string; isFavorite: boolean; isFollowingCaller: boolean; isFollowedByCaller: boolean; isIdentityShared: boolean; addedDateTimeUtc: null; displayName: string; realName: string; displayPicRaw: string; showUserAsAvatar: string; gamertag: string; gamerScore: string; modernGamertag: string; modernGamertagSuffix: string; uniqueModernGamertag: string; xboxOneRep: string; presenceState: string; presenceText: string; presenceDevices: null; isBroadcasting: boolean; isCloaked: boolean; isQuarantined: boolean; isXbox360Gamerpic: boolean; lastSeenDateTimeUtc: null; suggestion: null; recommendation: null; search: null; titleHistory: null; multiplayerSummary: null; recentPlayer: null; follower: null; preferredColor: { primaryColor: string; secondaryColor: string; tertiaryColor: string; }; presenceDetails: unknown[]; titlePresence: null; titleSummaries: null; presenceTitleIds: null; detail: { accountTier: string; bio: string; isVerified: boolean; location: string; tenure: string; watermarks: string[]; blocked: boolean; mute: boolean; followerCount: number; followingCount: number; hasGamePass: boolean; }; communityManagerTitles: null; socialManager: null; broadcast: null; avatar: { updateTimeOffset: string; spritesheetMetadata: string; }; linkedAccounts: { networkName: string; displayName: string; showOnProfile: boolean; isFamilyFriendly: boolean; deeplink: string; }[]; colorTheme: string; preferredFlag: string; preferredPlatforms: unknown[]; } export type RestGetChatAuthResponse = { AuthKey: string; }; export interface RestGetGroupsResponse { groups: APIGroup[]; } export interface RestGetGroupResponse { group: APIGroup; } export interface RestGetProfileSettingsResponse { profileUsers: { id: string; hostId: string; settings: unknown[]; isSponsoredUser: boolean; }[]; } export declare class Rest { client: XboxMessage; constructor(client: XboxMessage); post(url: RequestUrl, config?: MethodRequestConfig): Promise; put(url: RequestUrl, config?: MethodRequestConfig): Promise; get(url: RequestUrl, config?: MethodRequestConfig): Promise; delete(url: RequestUrl, config?: MethodRequestConfig): Promise; getAuthKey(xuid: string): Promise; getXuid(gamertag: string): Promise; /** * Get a user's profile * @param identifier The XUID or Gamertag of the user * @returns The user's profile */ getProfile(xuid: string): Promise; getProfiles(xuids: string[]): Promise; getConversations(inbox?: string): Promise; getConversation(conversationType: 'OneToOne' | 'Group', conversationId: string): Promise; getGroups(): Promise; getGroup(id: string): Promise; getUploadUrl(fileType: 'png' | 'jpg' | 'wav' | 'silk' | 'gif' | 'aac'): Promise; transcribeVoiceMessage(attachmentId: string): Promise; sendMessageToPlayer(xuid: string, body: object): Promise; sendMessageToGroup(groupId: string, channelId: string, body: object): Promise; markMessageAsRead(messageId: string, conversationId: string, conversationType: 'OneToOne' | 'Group'): Promise; private request; } export {};