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

Add method to retrieve parcel documents #14

Merged

Conversation

roeldev
Copy link
Contributor

@roeldev roeldev commented Jul 27, 2023

This PR add a new method to retrieve parcel documents. Because the endpoint https://api.sendcloud.dev/docs/sendcloud-public-api/parcel-documents/operations/get-a-parcel-document returns binary data representing a pdf/zpl/png, the Request method could not be used in its current form. Therefore I split the method into two methods, one for creating a new request (NewRequest) and one for validating the response from the api (ValidateResponse), while keeping Request backwards compatible.

  • add NewRequest function
  • add ValidateResponse function
  • add Document struct
  • add DocumentFormat type
  • add GetDocument method to parcel.Client

Because this endpoints returns binary data representing a pdf/zpl/png, the Request method could not be used in its current form. Therefore I split the method into two methods, one for creating a new request (NewRequest) and one for validating the response from the api (ValidateResponse), while keeping Request backwards compatible.

- add NewRequest function
- add ValidateResponse function
- add Document struct
- add GetDocument method to parcel.Client
@roeldev
Copy link
Contributor Author

roeldev commented Sep 28, 2023

Can someone please have a look at this PR?

@roelofjan-elsinga roelofjan-elsinga merged commit 1061427 into afosto:master Jan 29, 2024
@roelofjan-elsinga
Copy link
Contributor

Looks good! Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants