This PR removes and changes alot of the RPC functions as they have been (presumably) removed, or the API has changed (docs reference)
resolves #71
resolves #76
This is most definetly a semver: major change, version has been bumped to 4.0.0
This PR will be a draft for the time being, there are still some things that need tweaking slightly
A full list of changes
Version bumped to 4.0.0
Added typings
Added typescript^4.0.2 as a dev-dependency
Added/Updated all JSDoc documentation
Changed RPCClient#accessToken to non-enurmerable
Added RPCClient#config as a private object
Added RPCClient#apiURL as a public getter
Added RPCClient#cdnURL as a public getter
Refactored RPCClient#fetch
It is no longer set in the constructor
The path parameter has been changed to longer require a leading /
It is now an async function
Refactored RPCClient#connect
Gave it a general refactor
Added a capital C to the closed connection error
Changed parmeter names of RPCClient#request
cmd to command
evt to event
Added private method RPCClient#_onRpcClose to handle rpc close
Refactored RPCClient#_onRpcMessage
Destructured the message parameter
Removed RPCClient#_subscriptions
Removed in favour of a better subscription handler
Refactored RPCClient#authorize
Re-ordered destructured parameters
Refactored RPCClient#authorize to be an async function
Refactored all RPCClient#get* functions to be async
Refactored getChannel, getChannels, getGuild, getUser to use new Channel, and Guild structures respectively
Added new structures
Guild
Channel
User
UserFlags
ClientApplication
Refactored some functions to have no return value (void) and be async
RPCClient#setCertifiedDevices
RPCClient#setActivity
RPCClient#clearActivity
RPCClient#sendJoinInvite
RPCClient#closeJoinRequest
Removed RPCClient#sendJoinRequest as it doesn't seem to be documented anymore - not sure on that so if someone could confirm that
Refactored RPCClient#setUserVoiceSettings to use less lines
Refactored RPCClient#select* to be async and use the new Channel structure
RPCClient#selectTextChannel no longer has a force parameter, as its no longer effected
RPCClient#selectTextChannel no longer takes an object as its second parameter
RPCClient#getVoiceSettings and RPCClient#setVoiceSettings use a private function to resolve the data returned by the RPC API
Refactored RPCClient#captureShortcut
Now returns a promise which resolves with the first parameter to the callback function passed in the callback!
A bit funky I know, perhaps this needs another refactor?
No longer uses RPCClient#_subscriptions and instead attaches an event listener
All events now emit its RPCEvent on the client
Returns a function to unsubscribe, rather than object with a single key unsubscrbibe
Is now async
RPCClient#destroy is no longer async
Removed undocumented events and commands from Constants (see diff for full list)
Re-ordered events and commands alphabetically
Added API_BASE_URL, CDN_URL, UserFlags, and ChannelTypes into constants
Removed undocumented RPC Errors codes and re-organized them
Removed now-unused constants
LobbyTypes
RelationshipTypes
Changed IPCTransport to emit an error on the client if it encounters an (what would've been) an unhandled promise rejection
Removed the 2nd parameter for new Websocket(...) in WebSocketTransport, intellisense showed that it wasnt the correct type? can't test this due to whitelist-only feature
This PR removes and changes alot of the RPC functions as they have been (presumably) removed, or the API has changed (docs reference)
resolves #71 resolves #76
This is most definetly a semver: major change, version has been bumped to 4.0.0 This PR will be a draft for the time being, there are still some things that need tweaking slightly
A full list of changes
typescript^4.0.2
as a dev-dependencyRPCClient#accessToken
to non-enurmerableRPCClient#config
as a private objectRPCClient#apiURL
as a public getterRPCClient#cdnURL
as a public getterRPCClient#fetch
path
parameter has been changed to longer require a leading/
RPCClient#connect
RPCClient#request
cmd
tocommand
evt
toevent
RPCClient#_onRpcClose
to handle rpc closeRPCClient#_onRpcMessage
message
parameterRPCClient#_subscriptions
RPCClient#authorize
RPCClient#authorize
to be an async functionRPCClient#get*
functions to be asyncgetChannel
,getChannels
,getGuild
,getUser
to use newChannel
, andGuild
structures respectivelyGuild
Channel
User
UserFlags
ClientApplication
RPCClient#setCertifiedDevices
RPCClient#setActivity
RPCClient#clearActivity
RPCClient#sendJoinInvite
RPCClient#closeJoinRequest
RPCClient#sendJoinRequest
as it doesn't seem to be documented anymore - not sure on that so if someone could confirm thatRPCClient#setUserVoiceSettings
to use less linesRPCClient#select*
to be async and use the newChannel
structureRPCClient#selectTextChannel
no longer has aforce
parameter, as its no longer effectedRPCClient#selectTextChannel
no longer takes an object as its second parameterRPCClient#getVoiceSettings
andRPCClient#setVoiceSettings
use a private function to resolve the data returned by the RPC APIRPCClient#captureShortcut
RPCClient#setActivity
(general refactor)RPCClient#createLobby
RPCClient#updateLobby
RPCClient#deleteLobby
RPCClient#connectToLobby
RPCClient#sendToLobby
RPCClient#disconnectFromLobby
RPCClient#getLobbyMember
RPCClient#getRelationships
RPCClient#subscribe
RPCClient#_subscriptions
and instead attaches an event listenerRPCEvent
on the clientunsubscrbibe
RPCClient#destroy
is no longer asyncAPI_BASE_URL
,CDN_URL
,UserFlags
, andChannelTypes
into constantsLobbyTypes
RelationshipTypes
IPCTransport
to emit an error on the client if it encounters an (what would've been) an unhandled promise rejectionnew Websocket(...)
inWebSocketTransport
, intellisense showed that it wasnt the correct type? can't test this due to whitelist-only featurerpc.js