Skip to content
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

Implement an ok boolean to signal whether an API request was successful. #904

Open
Tracked by #908
LiranCohen opened this issue Sep 16, 2024 · 6 comments · May be fixed by #959
Open
Tracked by #908

Implement an ok boolean to signal whether an API request was successful. #904

LiranCohen opened this issue Sep 16, 2024 · 6 comments · May be fixed by #959
Assignees
Labels
good first issue Good for newcomers hacktoberfest For the hacking month of October

Comments

@LiranCohen
Copy link
Member

Currently the various DwnApi responses return a DwnResponseStatus object which includes a code and `detail.

It would be helpful to follow a similar pattern as the fetch API to additionally return an ok boolean that determines if the request is considered successful or not. This reduces the overhead for developers to think about which status codes are relevant for which response, and only utilize those codes when they need to act on them.

It's useful to understand the different codes that dwn-sdk-js throws for the various method handlers, for example RecordsWrite can return:

  • 202 - Successful write.
  • 204 - Write was accepted, but no content is assigned to the record, a query/read would not return a result.
  • 409 - Conflict, a newer or equivalent record already exists, write failed.
  • 400 - Message validation error
  • 401 - Authorization error

I would expect that only a 202 of this list would be considered a successful result to the caller.

@LiranCohen LiranCohen added hacktoberfest For the hacking month of October good first issue Good for newcomers labels Sep 16, 2024
@udayempire
Copy link

Hello I am interested to contribute into this issue

@YussifMuniru
Copy link

.take

Copy link
Contributor

github-actions bot commented Oct 2, 2024

Thanks for taking this issue! Let us know if you have any questions!

@taniashiba
Copy link
Contributor

Hello @YussifMuniru - wanted to check in as it's been 2 weeks since you've assigned yourself this issue. We're grateful for all contributions for Hacktoberfest, and if you have any questions we are happy to answer! You can comment here or talk to our team on https://discord.gg/tbd

@Toheeb-Ojuolape
Copy link

Hi @taniashiba can I be reassigned this issue please? Thank you!

@taniashiba
Copy link
Contributor

Hi @Toheeb-Ojuolape - Since it's been over 2 weeks, I've reassigned this issue to you. Let us know if you have any questions, and we'll be happy to assist. Thank you for contributing ❤

@Toheeb-Ojuolape Toheeb-Ojuolape linked a pull request Oct 21, 2024 that will close this issue
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hacktoberfest For the hacking month of October
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants