-
Notifications
You must be signed in to change notification settings - Fork 2
feat: adapt to v0 #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
velddev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert the public API function names and it seems fine to me
topgg/lib/api.lua
Outdated
| return res; | ||
| if data then | ||
| return data | ||
| else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: else not really needed here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
topgg/lib/api.lua
Outdated
| if type(query.fields) == 'table' then | ||
| query.fields = concat(query.fields, ','); | ||
| end | ||
| function Api:get_bot(id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid renaming the public API please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, with the exception of Api:init(token); to local client = Api:new(token);.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Full diff on the API methods:
PRIVATE METHODS:
- Api:commit(method, url, req, body)
+ Api:__commit(method, url, request, body)
+ Api:__request(method, path, body, query)
PUBLIC METHODS:
- Api:init(token)
+ Api:new(token)
- Api:getVotes()
+ Api:getVotes(page)
+ Api:newAutoposter()
topgg/lib/api.lua
Outdated
| local data = self:__request('GET', string.format('/bots/check?userId=%s', id)) | ||
|
|
||
| return self:request('GET', '/bots/votes'); | ||
| return not not data.voted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the API, voted is an integer, not a boolean. But I'll revise this to data.voted ~= 0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The following pull request is a toned down version of #3. This pull request focuses solely on the
changes done to the SDK in the v0 of the API. Such as:
setmetatable({}, self)to emulate OOP objects over manual copied code that emulates OOP.EventEmitterimplementation for the autoposter.