Skip to content

Commit

Permalink
doc: update context awareness with PATCH and CREATE
Browse files Browse the repository at this point in the history
  • Loading branch information
TerraTalpi committed Aug 18, 2021
1 parent 301fd18 commit 330fe47
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/example_Context-awareness.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Two functions have been created to implement context awareness:

* `msgraph.GetWithContext(<context>)`
* `msgraph.ListWithContext(<context>)`
* `msgraph.CreateWithContext(<context>)`
* `msgraph.PatchWithContext(<context>)`

The result of those two functions must be passed as parameter to the respective `Get` or `List` function.

Expand All @@ -23,6 +25,8 @@ ctx, cancel := context.WithCancel(context.Background())
users, err := graphClient.GetUser("[email protected]", msgraph.GetWithContext(ctx))
// example for List-func:
users, err := graphClient.ListUsers(msgraph.ListWithContext(ctx))
// example for Create-func:
user, err := graphClient.CreateUser(msgraph.CreateWithContext(ctx))
````

Note: the use of a context is optional. If no context is given, the context `context.Background()` will automatically be used for all API-calls.

0 comments on commit 330fe47

Please sign in to comment.