openblox
Version:
Roblox API Wrapper For Both Classic And OpenCloud APIs.
531 lines (530 loc) • 24.9 kB
TypeScript
import type { Identifier } from "typeforge";
import type { SubsriptionPrice } from "./subscriptions.types";
/**
* Creates a subscription for a specified universe.
* @endpoint POST /v1/experiences/{universeId}/experience-subscriptions
*
* @param universeId The id of the universe to create a subscription for.
* @param name The subscription name.
* @param description The subscription description.
* @param type The subscription type.
* @param price The subscription price.
*
* @example
* const { data } = await ClassicSubscriptionsApi.createSubscription({
universeId: 5795192361, name: "Cool Subscription", description: "Lorem ipsum dolor sit amet.", type: "Durable", price: "$7.99"
})
* @exampleData {"id":"8517167288618319987","universeId":5795192361,"shopId":5795481121,"name":"Cool Subscription","description":"Lorem ipsum dolor sit amet.","imageAssetId":0,"periodType":"Monthly","developerSubscriptionProductType":"Durable","productStatusType":1,"initialActivationTimestampMs":null,"createdTimestampMs":1713322834753,"updatedTimestampMs":1713322834753}
* @exampleRawBody {"developerSubscription":{"id":"8517167288618319987","universeId":5795192361,"shopId":5795481121,"name":"Cool Subscription","description":"Lorem ipsum dolor sit amet.","imageAssetId":0,"periodType":1,"developerSubscriptionProductType":3,"productStatusType":1,"initialActivationTimestampMs":null,"createdTimestampMs":1713322834753,"updatedTimestampMs":1713322834753}}
*/
export declare const createSubscription: <UniverseId extends Identifier, Name extends string, Description extends string, Type extends "Durable" | "Consumable" | "Currency">(this: any, args: {
universeId: UniverseId;
name: Name;
description: Description;
type: Type;
price: SubsriptionPrice;
}) => Promise<{
data: {
id: Identifier;
universeId: UniverseId;
shopId: number;
name: Name;
description: Description;
imageAssetId: number;
periodType: "Monthly";
developerSubscriptionProductType: Type;
productStatusType: number;
initialActivationTimestampMs: number | null;
createdTimestampMs: number;
updatedTimestampMs: number;
};
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
developerSubscription: {
id: Identifier;
universeId: UniverseId;
shopId: number;
name: Name;
description: Description;
imageAssetId: number;
periodType: number;
developerSubscriptionProductType: Type extends "Durable" ? 3 : Type extends "Currency" ? 2 : Type extends "Consumable" ? 1 : never;
productStatusType: number;
initialActivationTimestampMs: number | null;
createdTimestampMs: number;
updatedTimestampMs: number;
};
};
};
} & {
again: () => Promise<{
data: {
id: Identifier;
universeId: UniverseId;
shopId: number;
name: Name;
description: Description;
imageAssetId: number;
periodType: "Monthly";
developerSubscriptionProductType: Type;
productStatusType: number;
initialActivationTimestampMs: number | null;
createdTimestampMs: number;
updatedTimestampMs: number;
};
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
developerSubscription: {
id: Identifier;
universeId: UniverseId;
shopId: number;
name: Name;
description: Description;
imageAssetId: number;
periodType: number;
developerSubscriptionProductType: Type extends "Durable" ? 3 : Type extends "Currency" ? 2 : Type extends "Consumable" ? 1 : never;
productStatusType: number;
initialActivationTimestampMs: number | null;
createdTimestampMs: number;
updatedTimestampMs: number;
};
};
};
}>;
}>;
/**
* Sets the icon of a subscription.
* @endpoint POST /v1/experiences/{universeId}/experience-subscriptions/{subscriptionId}/upload-image
*
* @param universeId The id of the universe to create a subscription for.
*
* @example
* const { data:success } = await ClassicSubscriptionsApi.setSubscriptionIcon({
universeId: 5795192361, subscriptionId: "3656348821302804581", actingUserId: 45348281, icon: "./src/image.png"
})
* @exampleData true
* @exampleRawBody { status: true }
*/
export declare const setSubscriptionIcon: import("../../apiGroup/apiGroup.types").CallApiMethod<{
universeId: Identifier;
subscriptionId: Identifier;
actingUserId: Identifier;
icon: string | File;
}, {
method: import("../../../utils/utils.types").RestMethod;
path: `/${string}`;
name: string;
searchParams?: string | Record<string, any> | undefined;
headers?: Record<string, any> | undefined;
body?: string | number | Record<string, any> | undefined;
formData?: FormData | undefined;
applyFieldMask?: boolean | undefined;
pathToPoll?: ((rawData: {
status: boolean;
}) => string) | undefined;
getCursorsFn?: ((rawData: {
status: boolean;
}) => [previous: import("../../apiGroup/apiGroup.types").Cursor, next: import("../../apiGroup/apiGroup.types").Cursor]) | undefined;
"\uD83D\uDD12__PRIVATE_RAW_DATA"?: {
status: boolean;
} | undefined;
"\uD83D\uDD12__PRIVATE_FORMATTED_DATA"?: boolean | undefined;
} & import("../../apiGroup/apiGroup.types").ApiMethodDataFormatRawData<{
status: boolean;
}, boolean>, false>;
/**
* Lists subscriptions for a specified universe.
* @endpoint GET /v1/experiences/{universeId}/experience-subscriptions
*
* @param universeId The id of the universe to create a subscription for.
* @param resultsPerPage The number of results to show per page.
* @param cursor A pagination cursor for the next or previous page.
*
* @exampleconst { data:subscriptions } = await ClassicSubscriptionsApi.subscriptionsForUniverse({ universeId: 5795192361 })
* @exampleData [{"id":"3656348821302804581","universeId":5795192361,"name":"Testing","description":"Lorem ipsum dolor sit amet.","imageAssetId":17095512680,"periodType":"Monthly","productType":"Consumable","productStatusType":1,"basePriceId":"919c5912-7de8-413c-9756-d4265b3cbd3a","initialActivationTimestampMs":0,"createdTimestampMs":1712783803427,"updatedTimestampMs":1712783804047,"basePrice":"$2.99"}]
* @exampleRawBody {"developerSubscriptions":[{"id":"3656348821302804581","universeId":5795192361,"name":"Testing","description":"Lorem ipsum dolor sit amet.","imageAssetId":17095512680,"periodType":1,"productType":1,"productStatusType":1,"basePriceId":"919c5912-7de8-413c-9756-d4265b3cbd3a","initialActivationTimestampMs":0,"createdTimestampMs":1712783803427,"updatedTimestampMs":1712783804047}],"previousCursor":"id_2Ac8yvfXhfKwAZQ","nextCursor":"id_2Ac8yvfXhfKwAZQ","hasMoreResults":false}
*/
export declare const subscriptionsForUniverse: <UniverseId extends Identifier>(this: any, args: {
universeId: UniverseId;
resultsPerPage?: number | undefined;
cursor?: string | undefined;
}) => Promise<{
data: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: "Durable" | "Consumable" | "Currency";
productStatusType: number;
basePrice: "$2.99" | "$4.99" | "$7.99" | "$9.99" | "$14.99";
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
}[];
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
developerSubscriptions: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: number;
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
};
previousCursor: string;
nextCursor: string;
hasMoreResults: false;
};
};
cursors: {
previous: import("../../apiGroup/apiGroup.types").Cursor;
next: import("../../apiGroup/apiGroup.types").Cursor;
};
[Symbol.asyncIterator]: () => AsyncGenerator<{
data: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: "Durable" | "Consumable" | "Currency";
productStatusType: number;
basePrice: "$2.99" | "$4.99" | "$7.99" | "$9.99" | "$14.99";
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
}[];
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
developerSubscriptions: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: number;
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
};
previousCursor: string;
nextCursor: string;
hasMoreResults: false;
};
};
cursors: {
previous: import("../../apiGroup/apiGroup.types").Cursor;
next: import("../../apiGroup/apiGroup.types").Cursor;
};
[Symbol.asyncIterator]: null;
} & {
again: () => Promise<{
data: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: "Durable" | "Consumable" | "Currency";
productStatusType: number;
basePrice: "$2.99" | "$4.99" | "$7.99" | "$9.99" | "$14.99";
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
}[];
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
developerSubscriptions: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: number;
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
};
previousCursor: string;
nextCursor: string;
hasMoreResults: false;
};
};
}>;
}, any, unknown>;
} & {
again: () => Promise<{
data: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: "Durable" | "Consumable" | "Currency";
productStatusType: number;
basePrice: "$2.99" | "$4.99" | "$7.99" | "$9.99" | "$14.99";
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
}[];
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
developerSubscriptions: {
id: Identifier;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: Identifier;
periodType: "Monthly";
productType: number;
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
initialActivationTimestampMs: number;
createdTimestampMs: number;
updatedTimestampMs: number;
};
previousCursor: string;
nextCursor: string;
hasMoreResults: false;
};
};
}>;
}>;
/**
* Gets information about a subscription for a specified universe.
* @endpoint GET /v1/experiences/{universeId}/experience-subscriptions/{subscriptionId}
*
* @param universeId The id of the universe.
* @param subscriptionId The id of the subscription to get.
*
* @example const { data:subscription } = await ClassicSubscriptionsApi.subscriptionInfo({ universeId: 5795192361, subscriptionId: "3656348821302804581" });
* @exampleData {"id":"3656348821302804581","universeId":5795192361,"name":"Testing","description":"Lorem ipsum dolor sit amet.","imageAssetId":17175811135,"periodType":"Monthly","productType":"Consumable","productStatusType":1,"basePriceId":"919c5912-7de8-413c-9756-d4265b3cbd3a","initialActivationTimestampMs":0,"createdTimestampMs":1712783803427,"updatedTimestampMs":1713318949692,"basePrice":"$2.99"}
* @exampleRawBody {"id":"3656348821302804581","universeId":5795192361,"name":"Testing","description":"Lorem ipsum dolor sit amet.","imageAssetId":17175811135,"periodType":1,"productType":1,"productStatusType":1,"basePriceId":"919c5912-7de8-413c-9756-d4265b3cbd3a","initialActivationTimestampMs":0,"createdTimestampMs":1712783803427,"updatedTimestampMs":1713318949692}
*/
export declare const subscriptionInfo: <UniverseId extends Identifier, SubscriptionId extends Identifier>(this: any, args: {
universeId: UniverseId;
subscriptionId: SubscriptionId;
}) => Promise<{
data: {
id: SubscriptionId;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: number;
periodType: "Monthly";
productType: "Durable" | "Consumable" | "Currency";
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
basePrice: "$2.99" | "$4.99" | "$7.99" | "$9.99" | "$14.99";
createdTimestampMs: number;
updatedTimestampMs: number;
};
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
id: SubscriptionId;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: number;
periodType: number;
productType: number;
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
createdTimestampMs: number;
updatedTimestampMs: number;
};
};
} & {
again: () => Promise<{
data: {
id: SubscriptionId;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: number;
periodType: "Monthly";
productType: "Durable" | "Consumable" | "Currency";
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
basePrice: "$2.99" | "$4.99" | "$7.99" | "$9.99" | "$14.99";
createdTimestampMs: number;
updatedTimestampMs: number;
};
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../../../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: {
id: SubscriptionId;
universeId: UniverseId;
name: string;
description: string;
imageAssetId: number;
periodType: number;
productType: number;
productStatusType: number;
basePriceId: "919c5912-7de8-413c-9756-d4265b3cbd3a" | "c0516080-fc44-42a2-bc23-3c6dbfd0772d" | "75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a" | "1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7" | "790ff0ac-ef4b-490e-9b95-89f9249b8f51";
createdTimestampMs: number;
updatedTimestampMs: number;
};
};
}>;
}>;
/**
* Gets all of the availible price tiers that a universe's subscriptions can have.
* @endpoint GET /v1/experiences/{universeId}/experience-subscriptions/prices
*
* @param universeId The id of the universe.
*
* @example const { data:tiers } = await ClassicSubscriptionsApi.subscriptionsPriceTiersForUniverse({ universeId: 5795192361 })
* @exampleData {"919c5912-7de8-413c-9756-d4265b3cbd3a":"$2.99","c0516080-fc44-42a2-bc23-3c6dbfd0772d":"$4.99","75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a":"$7.99","1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7":"$9.99","790ff0ac-ef4b-490e-9b95-89f9249b8f51":"$14.99"}
* @exampleRawBody {"priceTierPrices":{"919c5912-7de8-413c-9756-d4265b3cbd3a":{"units":2,"cents":99},"c0516080-fc44-42a2-bc23-3c6dbfd0772d":{"units":4,"cents":99},"75c782ff-9d8b-4cf0-b3d8-64dd0ec4676a":{"units":7,"cents":99},"1adf5d0a-eabb-4d5d-a9e7-d9ab28dcb7c7":{"units":9,"cents":99},"790ff0ac-ef4b-490e-9b95-89f9249b8f51":{"units":14,"cents":99}}}
*/
export declare const subscriptionsPriceTiersForUniverse: import("../../apiGroup/apiGroup.types").CallApiMethod<{
universeId: Identifier;
}, {
method: import("../../../utils/utils.types").RestMethod;
path: `/${string}`;
name: string;
searchParams?: string | Record<string, any> | undefined;
headers?: Record<string, any> | undefined;
body?: string | number | Record<string, any> | undefined;
formData?: FormData | undefined;
applyFieldMask?: boolean | undefined;
pathToPoll?: ((rawData: {
priceTierPrices: {
[Key: string]: {
units: number;
cents: number;
};
};
}) => string) | undefined;
getCursorsFn?: ((rawData: {
priceTierPrices: {
[Key: string]: {
units: number;
cents: number;
};
};
}) => [previous: import("../../apiGroup/apiGroup.types").Cursor, next: import("../../apiGroup/apiGroup.types").Cursor]) | undefined;
"\uD83D\uDD12__PRIVATE_RAW_DATA"?: {
priceTierPrices: {
[Key: string]: {
units: number;
cents: number;
};
};
} | undefined;
"\uD83D\uDD12__PRIVATE_FORMATTED_DATA"?: {
[x: string]: `$${number}.${number}`;
} | undefined;
} & import("../../apiGroup/apiGroup.types").ApiMethodDataFormatRawData<{
priceTierPrices: {
[Key: string]: {
units: number;
cents: number;
};
};
}, {
[x: string]: `$${number}.${number}`;
}>, false>;
/**
* Gets permissions the authenticated user can perform of a specified universes subscriptions.
* @endpoint GET /v1/experiences/{universeId}/experience-subscriptions/permission
*
* @param universeId The id of the universe to get subscription permissions for.
*
* @example const { data:perms } = await ClassicSubscriptionsApi.authenticatedUserSubscriptionsPermissionsForUniverse({ universeId: 5795192361 })
* @exampleData { canUserEditExperienceSubscription: true }
* @exampleRawBody { canUserEditExperienceSubscription: true }
*/
export declare const authenticatedUserSubscriptionsPermissionsForUniverse: import("../../apiGroup/apiGroup.types").CallApiMethod<{
universeId: Identifier;
}, {
method: import("../../../utils/utils.types").RestMethod;
path: `/${string}`;
name: string;
searchParams?: string | Record<string, any> | undefined;
headers?: Record<string, any> | undefined;
body?: string | number | Record<string, any> | undefined;
formData?: FormData | undefined;
applyFieldMask?: boolean | undefined;
pathToPoll?: ((rawData: {
canUserEditExperienceSubscription: boolean;
}) => string) | undefined;
getCursorsFn?: ((rawData: {
canUserEditExperienceSubscription: boolean;
}) => [previous: import("../../apiGroup/apiGroup.types").Cursor, next: import("../../apiGroup/apiGroup.types").Cursor]) | undefined;
"\uD83D\uDD12__PRIVATE_RAW_DATA"?: {
canUserEditExperienceSubscription: boolean;
} | undefined;
"\uD83D\uDD12__PRIVATE_FORMATTED_DATA"?: {
canUserEditExperienceSubscription: boolean;
} | undefined;
}, false>;