Skip to content

Support of context #105

@huttarichard

Description

@huttarichard

Client library should always take context as a first argument of every function using http client or similar. Reason is simple if there is anything in way between client and intercom server it can go forever keeping whatever is using it blocked forever (not really that uncommon).

This would be expected behavior.

ctx, cancel := context.WithCancel(context.Background())
cancel()
_, err := ic.Users.Save(ctx, &user)
// err == context.Canceled  

luckily this can be solved by patching http client for now. But I suggest new release v3 supporting context as every good library does to avoid patching intercom's http client. Or to avoid new release there is an option to add postfix ...Ctx() to every method using http client.

Example:

_, err := ic.Users.SaveCtx(ctx, &user)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions