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

feat: add normalized responses #53

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

feat: add normalized responses #53

wants to merge 10 commits into from

Conversation

ghostrider-05
Copy link
Owner

@ghostrider-05 ghostrider-05 commented Jul 4, 2024

closes #26

  • The functions simplifyFromQuery and normalizeFromQuery will perform the same transformations as mentioned below but are typed based on the query to give the output type.
  • The methods that return the raw API responses can still be found on <Client>.api

Adds two new response types:

normalize:

  • flattens all attributes, included and relationship fields to one object.
  • Exposed on the client with <Client>.normalized

simplify:

  • Will return the same as normalize with camelCase keys
  • Expose on the client

Changes this PR makes

  • fix(PatreonOauthClient): remove undefined from return types
  • fix(PatreonOauthClient): correctly use cursor for paginating
  • feat(rest): add timeout option to client

BREAKING CHANGES

  • client: all fetch* and paginate responses are now simplified, not the raw payload

@ghostrider-05 ghostrider-05 added this to the v0.7.0 milestone Jul 4, 2024
@github-actions github-actions bot added the oauth Oauth2 for Patreon API label Jul 4, 2024
@ghostrider-05 ghostrider-05 added the feature request New feature or request label Jul 4, 2024
Copy link

Deploying patreon-api with  Cloudflare Pages  Cloudflare Pages

Latest commit: 038d9cb
Status: ✅  Deploy successful!
Preview URL: https://a3427f24.patreon-api.pages.dev
Branch Preview URL: https://feat-normalized.patreon-api.pages.dev

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request oauth Oauth2 for Patreon API
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

Simplify payloads
1 participant