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

Support more api versions than just 2 #498

Open
catouc opened this issue Aug 29, 2022 · 2 comments
Open

Support more api versions than just 2 #498

catouc opened this issue Aug 29, 2022 · 2 comments
Labels
Milestone

Comments

@catouc
Copy link

catouc commented Aug 29, 2022

Is your feature request related to a problem? Please describe.

Our internal Jira server at work only responds to /jira/rest/api/latest/ but this library only supports /jira/rest/api/2/.

Describe the solution you'd like

I was thinking of having a field in the client like:

// A Client manages communication with the Jira API.
type Client struct {
	// HTTP client used to communicate with the API.
	client httpClient

	// Base URL for API requests.
	baseURL *url.URL
        apiVersion string

Then in the methods:

func (s *IssueService) GetWithContext(ctx context.Context, issueID string, options *GetQueryOptions) (*Issue, *Response, error) {
	apiEndpoint := fmt.Sprintf("rest/api/%s/issue/%s", s.apiVersion, issueID)

Then however we want to pass the configuration to the client to accept that apiVersion (in my local implementation I just let people overwrite the struct, but an option pattern is also worth considering I suppose, would break the existing interface somewhat with the baseURL)

Describe alternatives you've considered

Writing my own client and just using the types from this package is the only alternative possible right now.

Additional context

I'm happy to start a bit of work on this, refactoring the code to use that new value is easy enough, but the entire test suite seemed to be a bit more of a complex task - if someone is willing to walk me through that a bit I'm happy to write the change as well :) .

@catouc
Copy link
Author

catouc commented Aug 29, 2022

Added #499 to suggest an implementation that's similar to what I'm currently maintaining.

@andygrunwald
Copy link
Owner

@catouc Thanks!
The new v2 will reflect this!

@andygrunwald andygrunwald added this to the Road to v2 milestone Sep 5, 2022
@andygrunwald andygrunwald added the v2 label Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants