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 Sideloading support #152

Open
senpos opened this issue Dec 22, 2019 · 5 comments
Open

Add Sideloading support #152

senpos opened this issue Dec 22, 2019 · 5 comments
Labels
API Support New API support

Comments

@senpos
Copy link

senpos commented Dec 22, 2019

Hi,

It could be great to have support for sideloading.

Zendesk Documentation

It is useful when you need extra data for the specific entity, like, "slas" for the "ticket".
If I understood correctly, it is not possible to do at the moment.

@nukosuke nukosuke added the API Support New API support label Dec 23, 2019
@tamccall
Copy link
Contributor

tamccall commented Dec 23, 2019

This seems like a fun feature, but i think i need some more information before I could go about implementing it.

Just looking over the the documentation it seems like it might be a little tricky to actually implement, so I would love some feedback before I get started.

Looking at the API it looks like there are a bunch of different options for what can be sideloaded, and that changes api to API.

In order to avoid implementing a bunch of sideloading logic for each api it might be better to emulate the json package and allow the users to pass in the object to marshal the result into.

I'm thinking the API would look something like this when calling the client

var users []User
var groups []Group
ticket, err := client.GetTicket(ctx, 2, SideLoad("users", &users), SideLoad("groups", &groups))
if err != nil {
	return err
}

after calling GetTicket the user and groups lists would be filled with the sideloaded users and groups.

How does that API sound to you @senpos?

@senpos
Copy link
Author

senpos commented Dec 23, 2019

Hi @tamccall,

Thanks for your reply.

Sorry, but I am not a mature Go developer, so I won't be able to help you with the design of this feature.

I am coming from Python and similar library for Zendesk just adds attributes to the ticket object if they were sideloaded. I don't know if it is possible to do easily in Go, so I like your approach. :)

@tamccall
Copy link
Contributor

tamccall commented Dec 27, 2019

I put a couple of prs together that could be used to implement this feature on the GetTicket endpoint

Would love any feedback on how the sideload API is implemented here. There is more work that need to be done in order to support all of the options on the GetTicket api, so I will just put that guy out for now to get some feedback before going to far down that rabbit hole.

Personally i am in favor of the second proposal as i didn't need to rely on as much reflection. That said it came with the downside of some added dependencies.

@nukosuke Let me know what you think.

@abebars
Copy link
Contributor

abebars commented May 13, 2020

@tamccall any update on this? it's very useful to have this in the SDK.

@tamccall
Copy link
Contributor

tamccall commented May 13, 2020

@abebars I have a proposal that has never been reviewed. Maybe look at my proposed implementation and give your comments/concerns?

#154

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

No branches or pull requests

4 participants