import BaseAPI from "./BaseAPI" ; import Client from "../Client" ; export type ProductDetails = { id : number ; type : string ; isPublicDomain : boolean ; isForSale : boolean ; priceInRobux : number ; premiumPricing : { premiumDiscountPercentage : number ; premiumPriceInRobux : number ; } ; } ; export type GetAssetBundlesOptions = { assetId : number ; sortOrder ? : "Asc" | "Desc" ; limit ? : 10 | 25 | 50 | 100 ; cursor ? : string ; } ; export type GetAssetBundles = { previousPageCursor : string ; nextPageCursor : string ; data : { id : number ; name : string ; description : string ; bundleType : string ; items : { owned : boolean ; id : number ; name : string ; type : string ; } [ ] ; creator : { id : number ; name : string ; type : string ; } ; creatorType : number ; product : ProductDetails ; } [ ] ; } ; export type GetBundleDetailsOptions = { bundleId : number ; } ; export type GetBundleDetails = GetAssetBundles [ "data" ] [ 0 ] ; export type GetBundleRecommendationsByBundleIdOptions = { bundleId : number ; numItems ? : number ; } ; export type GetBundleRecommendationsByBundleId = { data : GetAssetBundles [ "data" ] ; } ; export type GetMultiBundleDetailsOptions = { bundleIds : number [ ] ; } ; export type GetMultiBundleDetails = GetAssetBundles [ "data" ] ; export type GetUserBundlesOptions = { userId : number ; sortOrder ? : "Asc" | "Desc" ; limit ? : 10 | 25 | 50 | 100 ; cursor ? : string ; } ; export type GetUserBundles = GetAssetBundles ; export type GetUserBundlesByTypeOptions = GetUserBundlesOptions & { bundleType : "BodyParts" | "AvatarAnimations" | string ; } ; export type GetUserBundlesByType = GetUserBundles ; export type UnpackBundleOptions = { bundleId : number ; } ; export type UnpackBundle = unknown ; export type GetAssetToCategory = Record < string , number > ; export type GetAssetToSubCategory = GetAssetToCategory ; export type GetCategories = GetAssetToCategory ; export type GetSubCategories = GetAssetToCategory ; export type GetAppStoreExclusiveBundlesOptions = { appStoreType : "iOS" | "GooglePlay" | "Xbox" | "Amazon" ; } ; export type GetAppStoreExclusiveBundles = { data : ProductDetails [ ] ; } ; export type GetAssetFavoriteCountOptions = { assetId : number ; } ; export type GetAssetFavoriteCount = number ; export type GetBundleFavoriteCountOptions = { bundleId : number ; } ; export type GetBundleFavoriteCount = number ; export type RemoveSelfAssetFavoriteOptions = { userId : number ; assetId : number ; } ; export type RemoveSelfAssetFavorite = unknown ; export type GetUserFavoriteAssetOptions = { userId : number ; assetId : number ; } ; export type GetUserFavoriteAsset = { assetId : number ; userId : number ; created : string ; } ; export type FavoriteAssetOptions = { userId : number ; assetId : number ; } ; export type FavoriteAsset = unknown ; export type RemoveFavoriteBundleOptions = { userId : number ; bundleId : number ; } ; export type RemoveFavoriteBundle = unknown ; export type GetSelfFavoriteBundleOptions = { userId : number ; bundleId : number ; } ; export type GetSelfFavoriteBundle = { bundleId : number ; userId : number ; created : string ; } ; export type FavoriteBundleOptions = { userId : number ; bundleId : number ; } ; export type FavoriteBundle = unknown ; export default class CatalogAPI extends BaseAPI { constructor ( client ) { super ( { client , baseUrl : "https://catalog.roblox.com/" } ) ; } getAssetBundles ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/assets/${ options . assetId }/bundles` , qs : options } , json : true } ) . then ( response => response . body ) ; } getBundleDetails ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/bundles/${ options . bundleId }/details` , qs : options } , json : true } ) . then ( response => response . body ) ; } getBundleRecommendationsByBundleId ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/assets/${ options . bundleId }/recommendations` , qs : options } , json : true } ) . then ( response => response . body ) ; } getMultiBundleDetails ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/bundles/details` , qs : { bundleIds : options . bundleIds . join ( "," ) } } , json : true } ) . then ( response => response . body ) ; } getUserBundles ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/users/${ options . userId }/bundles` , qs : options } , json : true } ) . then ( response => response . body ) ; } getUserBundlesByType ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/users/${ options . userId }/bundles/${ options . bundleType }` } , json : true } ) . then ( response => response . body ) ; } unpackBundle ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/bundles/${ options . bundleId }/unpack` , method : "POST" } , json : true } ) . then ( response => response . body ) ; } getAssetToCategory ( ) { return this . request ( { requiresAuth : false , request : { path : `v1/asset-to-category` } , json : true } ) . then ( response => response . body ) ; } getAssetToSubCategory ( ) { return this . request ( { requiresAuth : false , request : { path : `v1/asset-to-subcategory` } , json : true } ) . then ( response => response . body ) ; } getCategories ( ) { return this . request ( { requiresAuth : false , request : { path : `v1/categories` } , json : true } ) . then ( response => response . body ) ; } getSubCategories ( ) { return this . request ( { requiresAuth : false , request : { path : `v1/subcategories` } , json : true } ) . then ( response => response . body ) ; } getAppStoreExclusiveBundles ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/exclusive-items/${ options . appStoreType }/bundles` } , json : true } ) . then ( response => response . body ) ; } getAssetFavoriteCount ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/favorites/assets/${ options . assetId }/count` } , json : true } ) . then ( response => response . body ) ; } getBundleFavoriteCount ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/favorites/bundles/${ options . bundleId }/count` } , json : true } ) . then ( response => response . body ) ; } removeAssetFavorite ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/favorites/users/${ options . userId }/assets/${ options . assetId }/favorite` , method : "DELETE" } , json : true } ) . then ( response => response . body ) ; } getUserFavoriteAsset ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/favorites/users/${ options . userId }/assets/${ options . assetId }/favorite` } , json : true } ) . then ( response => response . body ) ; } favoriteAsset ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/favorites/users/${ options . userId }/assets/${ options . assetId }/favorite` , method : "POST" } , json : true } ) . then ( response => response . body ) ; } removeBundleFavorite ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/favorites/users/${ options . userId }/bundles/${ options . bundleId }/favorite` , method : "DELETE" } , json : true } ) . then ( response => response . body ) ; } getUserFavoriteBundle ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/favorites/users/${ options . userId }/bundles/${ options . bundleId }/favorite` } , json : true } ) . then ( response => response . body ) ; } favoriteBundle ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/favorites/users/${ options . userId }/bundles/${ options . bundleId }/favorite` , method : "POST" } , json : true } ) . then ( response => response . body ) ; } }