Post sends data to the given resource, adding the given params to the request.
(ctx context.Context, resource string, params, data map[string]any)
| 37 | |
| 38 | // Post sends data to the given resource, adding the given params to the request. |
| 39 | func (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. |
| 56 | func (c *PersonalizationClient) Delete(ctx context.Context, resource string, params map[string]any) (*PersonalizationResponse, error) { |