import BaseAPI from "./BaseAPI" ; import Client from "../Client" ; import { AssetVersionOptions , ProductOptions } from "../../structures/Asset" ; export declare type GetAssetVersionOptions = number ; export declare type AwardBadgeOptions = { userId : number ; badgeId : number ; placeId : number ; } ; export declare type GetUserFriendsOptions = { userId : number ; page : number ; } ; export declare type AcceptFriendRequestOptions = { userId : number ; } ; export declare type DeclineFriendRequestOptions = { userId : number ; } ; export declare type SendFriendRequestOptions = { userId : number ; } ; export declare type GetUserFriendsCountOptions = { userId : number ; } ; export declare type UnfriendUserOptions = { userId : number ; } ; export declare type IsUserFollowingOptions = { userId : number ; followUserId : number ; } ; export declare type FollowUserOptions = { userId : number ; } ; export declare type UnfollowUserOptions = { userId : number ; } ; export declare type GetUserGroupsOptions = { userId : number ; } ; export declare type GetGroupOptions = { groupId : number ; } ; export declare type GetGroupAlliesOptions = { groupId : number ; page : number ; } ; export declare type GetGroupEnemiesOptions = { groupId : number ; page : number ; } ; export declare type GetProductInfoOptions = { assetId : number ; } ; export declare type GetGamePassProductInfoOptions = { gamePassId : number ; } ; export declare type UserOwnsAssetOptions = { userId : number ; assetId : number ; } ; export declare type BlockUserOptions = { userId : number ; } ; export declare type UnblockUserOptions = { userId : number ; } ; export declare type GetUserByUsernameOptions = { username : string ; } ; export declare type UserCanManageAssetOptions = { userId : number ; assetId : number ; } ; export declare type GetUserByIdOptions = { userId : number ; } ; export declare type GetAssetVersions = AssetVersionOptions [ ] ; export declare type AwardBadge = boolean ; export declare type GetBalance = { robux : number ; } ; export declare type GetUserFriends = { Id : number ; Username : string ; AvatarUri : string ; AvatarFinal : boolean ; IsOnline : boolean ; } [ ] ; export declare type AcceptFriendRequest = boolean ; export declare type DeclineFriendRequest = boolean ; export declare type SendFriendRequest = boolean ; export declare type GetUserFriendsCount = { count : number ; } ; export declare type UnfriendUser = boolean ; export declare type IsUserFollowing = boolean ; export declare type FollowUser = boolean ; export declare type UnfollowUser = boolean ; export declare type GetUserGroups = { id : number ; name : string ; emblemId : number | null ; emblemUrl : string | null ; role : { rank : number ; name : string ; } ; inClan : boolean ; primary : boolean ; } [ ] ; export declare type GetGroup = { Name : string ; Id : number ; Owner : { Name : string ; Id : number ; } ; EmblemUrl : string ; Description : string ; Roles : { Name : string ; Rank : number ; } [ ] ; } ; export declare type GetGroupAllies = { Groups : GetGroup [ ] ; FinalPage : boolean ; } ; export declare type GetGroupEnemies = GetGroupAllies ; export declare type GetIncomingItems = { unreadMessageCount : number ; friendRequestsCount : number ; } ; export declare type GetProductInfo = ProductOptions ; export declare type GetGamePassProductInfo = ProductOptions ; export declare type UserOwnsAsset = boolean ; export declare type GetDeviceInfo = { platformType : string ; deviceType : string ; operatingSystemType : string ; } ; export declare type BlockUser = boolean ; export declare type UnblockUser = boolean ; export declare type GetUserById = { id : number ; name : string ; } ; export declare type GetUserByUsername = GetUserById ; export declare type UserCanManageAsset = boolean ; export default class GeneralAPI extends BaseAPI { constructor ( client ) { super ( { baseUrl : "https://api.roblox.com/" , client } ) ; } getAssetVersions ( options ) { return this . request ( { requiresAuth : true , request : { path : `assets/${ options }/versions` } , json : true } ) . then ( response => response . body ) ; } awardBadge ( options ) { return this . request ( { requiresAuth : true , request : { path : "assets/award-badge" , method : "POST" , qs : options } } ) . then ( ( ) => true ) ; } getBalance ( ) { return this . request ( { requiresAuth : true , request : { path : "currency/balance" } } ) . then ( response => response . body as GetBalance ) ; } getUserFriends ( options ) { return this . request ( { requiresAuth : false , request : { path : `users/${ options . userId }/friends` , qs : { page : options . page } } , json : true } ) . then ( response => response . body ) ; } acceptFriendRequest ( options ) { return this . request ( { requiresAuth : true , request : { path : "user/accept-friend-request" , method : "POST" , qs : { requesterUserId : options . userId } } } ) . then ( ( ) => true as AcceptFriendRequest ) ; } declineFriendRequest ( options ) { return this . request ( { requiresAuth : true , request : { path : "user/decline-friend-request" , method : "POST" , qs : { requesterUserId : options . userId } } } ) . then ( ( ) => true as DeclineFriendRequest ) ; } sendFriendRequest ( options ) { return this . request ( { requiresAuth : true , request : { path : "user/request-friendship" , method : "POST" , qs : { recipientUserId : options . userId } } } ) . then ( ( ) => true as SendFriendRequest ) ; } getUserFriendsCount ( options ) { return this . request ( { requiresAuth : false , request : { path : "user/get-friendship-count" , qs : options } , json : true } ) . then ( response => response . body . count ) ; } unfriendUser ( options ) { return this . request ( { requiresAuth : true , request : { path : "user/unfriend" , method : "POST" , qs : { friendUserId : options . userId } } } ) . then ( ( ) => true as UnfriendUser ) ; } isUserFollowing ( options ) { return this . request ( { requiresAuth : false , request : { path : "user/following-exists" , qs : options } } ) . then ( response => response . body . isFollowing ) ; } followUser ( options ) { return this . request ( { requiresAuth : true , request : { path : "user/follow" , method : "POST" , qs : { followedUserId : options . userId } } } ) . then ( ( ) => true as FollowUser ) ; } unfollowUser ( options ) { return this . request ( { requiresAuth : true , request : { path : "user/unfollow" , method : "POST" , qs : { followedUserId : options . userId } } } ) . then ( ( ) => true as UnfollowUser ) ; } getUserGroups ( options ) { return this . request ( { requiresAuth : false , request : { path : `users/${ options . userId }/groups` } } ) . then ( response => response . body ) ; } getGroup ( options ) { return this . request ( { requiresAuth : false , request : { path : `groups/${ options . groupId }` } , json : true } ) . then ( response => response . body ) ; } getGroupAllies ( options ) { return this . request ( { requiresAuth : true , request : { path : `groups/${ options . groupId }/allies` , qs : { page : options . page } } , json : true } ) . then ( response => response . body ) ; } getGroupEnemies ( options ) { return this . request ( { requiresAuth : true , request : { path : `groups/${ options . groupId }/enemies` , qs : { page : options . page } } , json : true } ) . then ( response => response . body ) ; } getIncomingItems ( ) { return this . request ( { requiresAuth : true , request : { path : "incoming-items/counts" } , json : true } ) . then ( ( response ) => ( { friendRequestsCount : response . body . friendRequestsCount , unreadMessageCount : response . body . unreadMessageCount } ) ) ; } getProductInfo ( options ) { return this . request ( { requiresAuth : false , request : { path : "marketplace/productinfo" , qs : options } , json : true } ) . then ( response => response . body ) ; } getGamePassProductInfo ( options ) { return this . request ( { requiresAuth : false , request : { path : "marketplace/game-pass-product-info" , qs : options } , json : true } ) . then ( response => response . body ) ; } userOwnsAsset ( options ) { return this . request ( { requiresAuth : false , request : { path : "ownership/hasasset" , qs : options } } ) . then ( response => ( response . body as string ) . includes ( "true" ) as UserOwnsAsset ) ; } getDeviceInfo ( ) { return this . request ( { requiresAuth : false , request : { path : "reference/deviceinfo" } } ) . then ( response => ( { deviceType : response . body . DeviceType , operatingSystemType : response . body . OperationSystemType , platformType : response . body . PlatformType } ) ) ; } blockUser ( options ) { return this . request ( { requiresAuth : true , request : { path : "userblock/block" , qs : options , method : "POST" } , json : true } ) . then ( response => response . body . success === true as BlockUser ) ; } unblockUser ( options ) { return this . request ( { requiresAuth : true , request : { path : "userblock/unblock" , qs : options , method : "POST" } , json : true } ) . then ( response => response . body . success === true as UnblockUser ) ; } getUserById ( options ) { return this . request ( { requiresAuth : false , request : { path : `users/${ options . userId }` } , json : true } ) . then ( response => ( { id : response . body . Id , name : response . body . Username } ) ) ; } getUserByUsername ( options ) { return this . request ( { requiresAuth : false , request : { path : "users/get-by-username" , qs : options } , json : true } ) . then ( response => ( { id : response . body . Id , name : response . body . Username } ) ) ; } userCanManageAsset ( options ) { return this . request ( { requiresAuth : false , request : { path : `users/${ options . userId }/canmanage/${ options . assetId }` } , json : true } ) . then ( response => response . body . CanManage === true as UserCanManageAsset ) ; } }