UNPKG

quria

Version:

A user-friendly Destiny 2 API Wrapper written with TypeScript and approved by -Axis Minds- Oryx.

95 lines (92 loc) 5.48 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Social = void 0; const adapters_1 = require("../../adapters"); class Social { url; headers; constructor(url, headers) { this.url = url; this.headers = headers; } /** * Returns your Bungie Friend list * @returns Returns your Bungie Friend list */ GetFriendList(tokens) { const requestURL = `${this.url}/Social/Friends/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } /** * Returns your friend request queue. * @returns Returns your friend request queue. */ GetFriendRequestList(tokens) { const requestURL = `${this.url}/Social/Friends/Requests/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } /** * Requests a friend relationship with the target user. Any of the target user's linked membership ids are valid inputs. * @param membershipId The membership id of the user you wish to add. * @returns Requests a friend relationship with the target user. Any of the target user's linked membership ids are valid inputs. */ IssueFriendRequest(membershipId, tokens) { const requestURL = `${this.url}/Social/Friends/Add/${membershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "POST", authHeaders); } /** * Accepts a friend relationship with the target user. The user must be on your incoming friend request list, though no error will occur if they are not. * @param membershipId The membership id of the user you wish to accept. * @returns Accepts a friend relationship with the target user. The user must be on your incoming friend request list, though no error will occur if they are not. */ AcceptFriendRequest(membershipId, tokens) { const requestURL = `${this.url}/Social/Friends/Requests/Accept/${membershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "POST", authHeaders); } /** * Declines a friend relationship with the target user. The user must be on your incoming friend request list, though no error will occur if they are not. * @param membershipId The membership id of the user you wish to decline. * @returns Declines a friend relationship with the target user. The user must be on your incoming friend request list, though no error will occur if they are not. */ DeclineFriendRequest(membershipId, tokens) { const requestURL = `${this.url}/Social/Friends/Requests/Decline/${membershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "POST", authHeaders); } /** * Remove a friend relationship with the target user. The user must be on your friend list, though no error will occur if they are not. * @param membershipId The membership id of the user you wish to remove. * @returns Remove a friend relationship with the target user. The user must be on your friend list, though no error will occur if they are not. */ RemoveFriend(membershipId, tokens) { const requestURL = `${this.url}/Social/Friends/Remove/${membershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "POST", authHeaders); } /** * Remove a friend relationship with the target user. The user must be on your outgoing request friend list, though no error will occur if they are not. * @param membershipId The membership id of the user you wish to remove. * @returns Remove a friend relationship with the target user. The user must be on your outgoing request friend list, though no error will occur if they are not. */ RemoveFriendRequest(membershipId, tokens) { const requestURL = `${this.url}/Social/Friends/Requests/Remove/${membershipId}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "POST", authHeaders); } /** * Gets the platform friend of the requested type, with additional information if they have Bungie accounts. Must have a recent login session with said platform. * @param friendPlatform The platform friend type. * @param page The zero based page to return. Page size is 100. * @returns Gets the platform friend of the requested type, with additional information if they have Bungie accounts. Must have a recent login session with said platform. */ GetPlatformFriendList(friendPlatform, page, tokens) { const requestURL = `${this.url}/Social/PlatformFriends/${friendPlatform}/${page}/`; const authHeaders = (0, adapters_1.parseAuthenticationHeaders)(this.headers, tokens); return adapters_1.Controller.request(requestURL, true, "GET", authHeaders); } } exports.Social = Social;