63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
// Metro module 10644 (f10645).
|
|
import { Endpoints } from "../../Constants";
|
|
import { HTTP, rejectWithMigratedError } from "../../_bundle/sendRequest";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import APIError from "../../errors/APIError";
|
|
export async function getApplicationSubscriptionGroupListingsForApplication(c26773_0, c26773_1) {
|
|
return (await HTTP.get({
|
|
url: Endpoints.APPLICATION_SUBSCRIPTION_GROUP_LISTING(c26773_0, c26773_1),
|
|
rejectWithError: rejectWithMigratedError()
|
|
})).body;
|
|
}
|
|
export async function getEntitlementsForGuild(c26774_0) {
|
|
return (await HTTP.get({
|
|
url: Endpoints.GUILD_ENTITLEMENTS(c26774_0),
|
|
query: {
|
|
with_sku: true,
|
|
with_application: true
|
|
},
|
|
rejectWithError: rejectWithMigratedError()
|
|
})).body;
|
|
}
|
|
export async function getSubscriptionGroupForSubscriptionPlan(c26775_0) {
|
|
return (await HTTP.get({
|
|
url: Endpoints.SUBSCRIPTION_PLAN_GROUP_LISTING(c26775_0),
|
|
rejectWithError: rejectWithMigratedError()
|
|
})).body;
|
|
}
|
|
export function fetchApplication(a0, a1) {
|
|
const applicationId = a0;
|
|
Dispatcher.dispatch({
|
|
type: "APPLICATION_FETCH",
|
|
applicationId: a0
|
|
});
|
|
return HTTP.get({
|
|
url: Endpoints.APPLICATION_PUBLIC(a0),
|
|
signal: a1,
|
|
rejectWithError: rejectWithMigratedError()
|
|
}).then((result) => {
|
|
Dispatcher.dispatch({
|
|
type: "APPLICATION_FETCH_SUCCESS",
|
|
application: result.body,
|
|
isHydrated: true
|
|
});
|
|
return result.body;
|
|
}).catch((error) => {
|
|
Dispatcher.dispatch({
|
|
type: "APPLICATION_FETCH_FAIL",
|
|
applicationId
|
|
});
|
|
return Promise.reject(new APIError(error));
|
|
});
|
|
}
|
|
export async function fetchEligibleApplicationSubscriptionGuilds(application_id, sku_id) {
|
|
return (await HTTP.get({
|
|
url: Endpoints.ELIGIBLE_APPLICATION_SUBSCRIPTION_GUILDS,
|
|
query: {
|
|
application_id,
|
|
sku_id
|
|
},
|
|
rejectWithError: rejectWithMigratedError()
|
|
})).body;
|
|
}
|