PGamerX-Legacy / muser

Muser: A powerful Discord music bot made in DJs v13 managed by PGamerX, Peiprjs, and Luckie.
https://muser.pgamerx.com
GNU Affero General Public License v3.0
63 stars 12 forks source link

Inconsistent responses JSON #25

Closed izxxr closed 2 years ago

izxxr commented 3 years ago

The problem that I have run into while using API is inconsistency of responses. By that I mean, That responses are not consistent. For an instance, This is the response JSON on normal AI response:

[{"message": "response"}, {"response_time"}: "Normal"]

Even though this should be a simple JSON without arrays but okay, But why does ratelimit JSON look like this:

["Ratelimit warning message"]

Why can't it be:

[{"message": "Ratelimit Warning"}]

Or better way,

{
  "message": "Ratelimit warning",
  "response_time": "normal"
}

This was just AI endpoint there can be improvements on other endpoints too (Making all responses similar and organised). So, It's easy for developers to make wrappers as well as users to use the API.

sachin-sankar commented 3 years ago

Use status codes

That is better.

pgamerx commented 3 years ago

The problem that I have run into while using API is inconsistency of responses. By that I mean, That responses are not consistent. For an instance, This is the response JSON on normal AI response:

[{"message": "response"}, {"response_time"}: "Normal"]

Even though this should be a simple JSON without arrays but okay, But why does ratelimit JSON look like this:

["Ratelimit warning message"]

Why can't it be:

[{"message": "Ratelimit Warning"}]

Or better way,

{
  "message": "Ratelimit warning",
  "response_time": "normal"
}

This was just AI endpoint there can be improvements on other endpoints too (Making all responses similar and organised). So, It's easy for developers to make wrappers as well as users to use the API.

Don't want to edit v4 response by any chance now because everyone is already using that. v5 will be good!

izxxr commented 3 years ago

Gotcha