import BaseAPI from "./BaseAPI" ; import Client from "../Client" ; export type ValidateDisplayNameNewUserOptions = { displayName : string ; birthdate : string ; } ; export type ValidateDisplayNameNewUser = unknown ; export type ValidateDisplayNameExistingUserOptions = { userId : number ; displayName : string ; } ; export type ValidateDisplayNameExistingUser = unknown ; export type SetSelfDisplayNameOptions = { userId : number ; newDisplayName : string ; } ; export type SetSelfDisplayName = unknown ; export type GetUserByIdOptions = { userId : number ; } ; export type GetUserById = { description : string ; created : string ; isBanned : boolean ; id : number ; name : string ; displayName : string ; } ; export type GetSelfAuthenticatedUserInformation = { id : number ; name : string ; displayName : string ; } ; export type GetUsersByUsernamesOptions = { usernames : string [ ] ; excludeBannedUsers ? : boolean ; } ; export type GetUsersByUsernames = { data : { requestedUsername : string ; id : number ; name : string ; displayName : string ; } [ ] ; } ; export type GetUsersByUserIdsOptions = { userIds : number [ ] ; excludeBannedUsers ? : boolean ; } ; export type GetUsersByUserIds = { data : Omit < GetUsersByUsernames [ "data" ] [ 0 ] , "requestedUsername" > [ ] ; } ; export type GetUserStatusOptions = { userId : number ; } ; export type GetUserStatus = { status : string ; } ; export type UpdateSelfStatusOptions = { userId : number ; status : string ; } ; export type UpdateSelfStatus = { status : string ; } ; export type SearchUsersOptions = { keyword : string ; limit ? : 10 | 25 | 50 | 100 ; cursor ? : string ; } ; export type SearchUsers = { previousPageCursor : string ; nextPageCursor : string ; data : { previousUsernames : string [ ] ; id : number ; name : string ; displayName : string ; } [ ] ; } ; export default class UsersAPI extends BaseAPI { constructor ( client ) { super ( { client , baseUrl : "https://users.roblox.com/" } ) ; } validateDisplayNameNewUser ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/display-names/validate` , qs : options } , json : true } ) . then ( response => response . body ) ; } validateDisplayNameExistingUser ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ options . userId }/display-names/validate` , qs : options } , json : true } ) . then ( response => response . body ) ; } setDisplayName ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ options . userId }/display-names` , method : "PATCH" , json : options } , json : true } ) . then ( response => response . body ) ; } getUserById ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/users/${ options . userId }` } , json : true } ) . then ( response => response . body ) ; } getAuthenticatedUserInformation ( ) { return this . request ( { requiresAuth : false , request : { path : `v1/users/authenticated` } , json : true } ) . then ( response => response . body ) ; } getUsersByUsernames ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/usernames/users` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } getUsersByIds ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/users` , method : "POST" , json : options } , json : true } ) . then ( response => response . body ) ; } getUserStatus ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/users/${ options . userId }/status` } , json : true } ) . then ( response => response . body ) ; } updateStatus ( options ) { return this . request ( { requiresAuth : true , request : { path : `v1/users/${ options . userId }/status` , method : "PATCH" , json : options } , json : true } ) . then ( response => response . body ) ; } searchUsers ( options ) { return this . request ( { requiresAuth : false , request : { path : `v1/users/search` , qs : options } , json : true } ) . then ( response => response . body ) ; } }