UNPKG

fnbr

Version:

A library to interact with Epic Games' Fortnite HTTP and XMPP services

42 lines 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const Endpoints_1 = tslib_1.__importDefault(require("../../../resources/Endpoints")); const PartyInvitationExpiredError_1 = tslib_1.__importDefault(require("../../exceptions/PartyInvitationExpiredError")); const BasePartyInvitation_1 = tslib_1.__importDefault(require("./BasePartyInvitation")); const enums_1 = require("../../../resources/enums"); /** * Represents a recieved party invitation */ class ReceivedPartyInvitation extends BasePartyInvitation_1.default { /** * Accepts this invitation * @throws {PartyInvitationExpiredError} The invitation already got accepted or declined * @throws {EpicgamesAPIError} */ async accept() { if (this.isExpired || this.isHandled) throw new PartyInvitationExpiredError_1.default(); await this.party.join(); this.isHandled = true; await this.client.http.epicgamesRequest({ method: 'DELETE', url: `${Endpoints_1.default.BR_PARTY}/user/${this.client.user.self.id}/pings/${this.sender.id}`, }, enums_1.AuthSessionStoreKey.Fortnite); } /** * Declines this invitation * @throws {PartyInvitationExpiredError} The invitation already got accepted or declined */ async decline() { if (this.isExpired || this.isHandled) throw new PartyInvitationExpiredError_1.default(); await this.client.http.epicgamesRequest({ method: 'DELETE', url: `${Endpoints_1.default.BR_PARTY}/user/${this.client.user.self.id}/pings/${this.sender.id}`, }, enums_1.AuthSessionStoreKey.Fortnite); this.isHandled = true; } } exports.default = ReceivedPartyInvitation; //# sourceMappingURL=ReceivedPartyInvitation.js.map