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

Lilsahil/feature/endpoint metadata #47

Closed

Conversation

lil-sahil
Copy link
Contributor

@lil-sahil lil-sahil commented Jun 21, 2024

Feature: Added endpoint_metadata information to the response struct for 'all' subscription endpoint. Created customString type to handle JSON values that can be either strings or integers. The api response sometimes returns a string or an integer depending on the endpoint that is being hit, so setting the type to a simple int does not resolve the issue - as it will break for other endpoints.

  • Introduced customString type to manage JSON values that may be strings or integers.
  • Implemented custom UnmarshalJSON and MarshalJSON methods for customString.
  • Updated EndpointResponse struct to use customString for fields requiring flexible JSON handling.

Fixes #46

…or 'all' subscription endpoint. Created customString type to handle JSON values that can be either strings or integers. The api response sometimes returns a string or an integer depending on the endpoint that is being hit, so setting the type to a simple int does not resolve the issue - as it will break for other endpoints.

- Introduced customString type to manage JSON values that may be strings or integers.
- Implemented custom UnmarshalJSON and MarshalJSON methods for customString.
- Updated EndpointResponse struct to use customString for fields requiring flexible JSON handling.
}

func (c *customString) MarshalJSON() ([]byte, error) {
return json.Marshal(string(*c))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually on second thought, does it make sense to return these as integers instead as specified in the API?

image

@chili-ios
Copy link

Hi @lil-sahil ,
Any progress on this issue?

@subomi
Copy link
Contributor

subomi commented Jul 10, 2024

I'll be taking a look today. @lil-sahil @chili-ios

@subomi
Copy link
Contributor

subomi commented Jul 11, 2024

Hey @lil-sahil,

endpoint_metadata is legacy code that will be deprecated soon. I advise you to make separate API calls to retrieve the associated endpoint.

Essentially, it's not how I want to handle expanding resources, and that's why it wasn't added to this SDK.

@lil-sahil lil-sahil closed this Jul 17, 2024
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.

Subscription response doesn't contain owner_id and endpoint_id
3 participants