collect method
- GoogleCloudRetailV2CollectUserEventRequest request,
- String parent, {
- String? $fields,
Writes a single user event from the browser.
For larger user event payload over 16 KB, the POST method should be used instead, otherwise a 400 Bad Request error is returned. This method is used only by the AI Commerce Search API JavaScript pixel and Google Tag Manager. Users should not call this method directly.
request - The metadata request object.
Request parameters:
parent - Required. The parent catalog name, such as
projects/1234/locations/global/catalogs/default_catalog.
Value must have pattern
^projects/\[^/\]+/locations/\[^/\]+/catalogs/\[^/\]+$.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a GoogleApiHttpBody.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<GoogleApiHttpBody> collect(
GoogleCloudRetailV2CollectUserEventRequest request,
core.String parent, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v2/' + core.Uri.encodeFull('$parent') + '/userEvents:collect';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return GoogleApiHttpBody.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}