warengonzaga / gathertown.js

Simple and lightweight community contributed unofficial JS/TS SDK for Gather Town's HTTPS and WebSocket APIs. šŸŒšŸ•¹šŸ’¬
https://gathertown.js.org
MIT License
40 stars 6 forks source link

HTTP API support #32

Closed princejoogie closed 2 years ago

princejoogie commented 2 years ago

Finished all HTTP APIs for #11 and fixed bug of #31

NEW CHANGES

  1. Positional arguments to Object arguments

    opted for object arguments because a lot of the remaining apis have optional params which is weird if done with positional arguments. e.g:

    // BEFORE: in createRoom POST route, the parameters map, sourceSpace, and reason are optional
    // if you want to leave sourceSpace null, then you would need to add an..
    // extra comma to surpass that argument; which is not intuitive
    await createRoom(name, map, , reason)
    
    // AFTER: if you want to leave sourceSpace null, then just dont pass it along as an argument
    // intuitive and better practice
    await createRoom({ name, map, reason });
  2. Re-wrote requester and separated each API route

    current function _sendRequest only supports get routes. created an api which contains individual routes per file. Sample: image

EXAMPLES

princejoogie commented 2 years ago

I can send screenshots of my manual tests per route if needed šŸŽ‡

warengonzaga commented 2 years ago

I can send screenshots of my manual tests per route if needed šŸŽ‡

I was thinking of jest for testing the API wrapper. We did a similar approach on BMC.JS but it is not successful. For the examples folder basically these are the manual tests?

princejoogie commented 2 years ago

I can send screenshots of my manual tests per route if needed šŸŽ‡

I was thinking of jest for testing the API wrapper. We did a similar approach on BMC.JS but it is not successful. For the examples folder basically these are the manual tests?

yes it is sort of a manual test. was gonna ask in discussions if we were going to implement jest, but since you mentioned it, ill try to implement it when im free again

warengonzaga commented 2 years ago

I can send screenshots of my manual tests per route if needed šŸŽ‡

I was thinking of jest for testing the API wrapper. We did a similar approach on BMC.JS but it is not successful. For the examples folder basically these are the manual tests?

yes it is sort of a manual test. was gonna ask in discussions if we were going to implement jest, but since you mentioned it, ill try to implement it when im free again

I'll create an issue regarding automated testing with Jest. Also adding a discussion related to this.

warengonzaga commented 2 years ago

Hi, @princejoogie did you change how we use the API? If yes, then how to use it? I'm concerned about documentation.

princejoogie commented 2 years ago

Hi, @princejoogie did you change how we use the API? If yes, then how to use it? I'm concerned about documentation.

the only change i made is mentioned in PR description number 1. from positional arguments to object arguments. yes, this change will need to be redocumented in usage.

warengonzaga commented 2 years ago

Hi, @princejoogie did you change how we use the API? If yes, then how to use it? I'm concerned about documentation.

the only change i made is mentioned in PR description number 1. from positional arguments to object arguments. yes, this change will need to be redocumented in usage.

This is clear to me, basically, the usage now for the API wrapper is OOP?

warengonzaga commented 2 years ago

@princejoogie did you rename the createRoom to createSpace ?

princejoogie commented 2 years ago

@princejoogie did you rename the createRoom to createSpace ?

image image image

warengonzaga commented 2 years ago

@princejoogie next time, use imperative sentences to your commit message. Use add instead of added as an example.