Skip to content

Adds support for context.Context #41

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

Merged
merged 1 commit into from
Mar 6, 2017
Merged

Conversation

alindeman
Copy link
Contributor

The context package is the most official way to timeout or otherwise cancel requests in Go >= 1.7.

For some prior art from other open source clients, see go-github and go-asana.

Example of generated code:

// Get sends a GET request and decodes the response into v.
func (s *Service) Get(ctx context.Context, v interface{}, path string, query interface{}, lr *ListRange) error {
        return s.Do(ctx, v, "GET", path, nil, query, lr)
}


// Info for account.
func (s *Service) AccountInfo(ctx context.Context) (*AccountInfoResult, error) {
        var account AccountInfoResult
        return &account, s.Get(ctx, &account, fmt.Sprintf("/account"), nil, nil)
}

@cyberdelia
Copy link
Member

Looks fine 👍

@cyberdelia cyberdelia merged commit 2e69bce into interagent:master Mar 6, 2017
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