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

Method Post

personalization.go:39–53  ·  view source on GitHub ↗

Post sends data to the given resource, adding the given params to the request.

(ctx context.Context, resource string, params, data map[string]any)

Source from the content-addressed store, hash-verified

37
38// Post sends data to the given resource, adding the given params to the request.
39func (c *PersonalizationClient) Post(ctx context.Context, resource string, params, data map[string]any) (*PersonalizationResponse, error) {
40 if resource == "" {
41 return nil, errors.New("missing resource")
42 }
43 endpoint := c.client.makeEndpoint("%s/", resource)
44 for k, v := range params {
45 endpoint.addQueryParam(makeRequestOption(k, v))
46 }
47 if data != nil {
48 data = map[string]any{
49 "data": data,
50 }
51 }
52 return c.decode(c.client.post(ctx, endpoint, data, c.client.authenticator.personalizationAuth))
53}
54
55// Delete removes data from the given resource, adding the given params to the request.
56func (c *PersonalizationClient) Delete(ctx context.Context, resource string, params map[string]any) (*PersonalizationResponse, error) {

Callers 1

TestPersonalizationPostFunction · 0.80

Calls 5

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

Tested by 1

TestPersonalizationPostFunction · 0.64