MCPcopy Create free account
hub / github.com/GetStream/stream-go2 / Add

Method Add

users.go:26–31  ·  view source on GitHub ↗

Add adds a new user with the specified id and optional extra data.

(ctx context.Context, user User, getOrCreate bool)

Source from the content-addressed store, hash-verified

24
25// Add adds a new user with the specified id and optional extra data.
26func (c *UsersClient) Add(ctx context.Context, user User, getOrCreate bool) (*UserResponse, error) {
27 endpoint := c.client.makeEndpoint("user/")
28 endpoint.addQueryParam(makeRequestOption("get_or_create", getOrCreate))
29
30 return c.decode(c.client.post(ctx, endpoint, user, c.client.authenticator.usersAuth))
31}
32
33// Update updates the user's data.
34func (c *UsersClient) Update(ctx context.Context, id string, data map[string]any) (*UserResponse, error) {

Callers 7

TestAddCollectionObjectFunction · 0.45
TestAddReactionFunction · 0.45
jwtSignRequestMethod · 0.45
TestGetActivitiesFunction · 0.45
TestAddUserFunction · 0.45
addQueryParamMethod · 0.45

Calls 5

decodeMethod · 0.95
makeRequestOptionFunction · 0.85
makeEndpointMethod · 0.80
addQueryParamMethod · 0.80
postMethod · 0.80

Tested by 5

TestAddCollectionObjectFunction · 0.36
TestAddReactionFunction · 0.36
TestGetActivitiesFunction · 0.36
TestAddUserFunction · 0.36