1 | <?php
|
---|
2 | /*
|
---|
3 | * Copyright 2014 Google Inc.
|
---|
4 | *
|
---|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
7 | * the License at
|
---|
8 | *
|
---|
9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 | *
|
---|
11 | * Unless required by applicable law or agreed to in writing, software
|
---|
12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
14 | * License for the specific language governing permissions and limitations under
|
---|
15 | * the License.
|
---|
16 | */
|
---|
17 |
|
---|
18 | namespace Google\Service\CloudRetail\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudRetail\GoogleApiHttpBody;
|
---|
21 | use Google\Service\CloudRetail\GoogleCloudRetailV2ImportUserEventsRequest;
|
---|
22 | use Google\Service\CloudRetail\GoogleCloudRetailV2PurgeUserEventsRequest;
|
---|
23 | use Google\Service\CloudRetail\GoogleCloudRetailV2RejoinUserEventsRequest;
|
---|
24 | use Google\Service\CloudRetail\GoogleCloudRetailV2UserEvent;
|
---|
25 | use Google\Service\CloudRetail\GoogleLongrunningOperation;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "userEvents" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $retailService = new Google\Service\CloudRetail(...);
|
---|
32 | * $userEvents = $retailService->projects_locations_catalogs_userEvents;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class ProjectsLocationsCatalogsUserEvents extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Writes a single user event from the browser. This uses a GET request to due
|
---|
39 | * to browser restriction of POST-ing to a 3rd party domain. This method is used
|
---|
40 | * only by the Retail API JavaScript pixel and Google Tag Manager. Users should
|
---|
41 | * not call this method directly. (userEvents.collect)
|
---|
42 | *
|
---|
43 | * @param string $parent Required. The parent catalog name, such as
|
---|
44 | * `projects/1234/locations/global/catalogs/default_catalog`.
|
---|
45 | * @param array $optParams Optional parameters.
|
---|
46 | *
|
---|
47 | * @opt_param string ets The event timestamp in milliseconds. This prevents
|
---|
48 | * browser caching of otherwise identical get requests. The name is abbreviated
|
---|
49 | * to reduce the payload bytes.
|
---|
50 | * @opt_param string prebuiltRule The prebuilt rule name that can convert a
|
---|
51 | * specific type of raw_json. For example: "ga4_bq" rule for the GA4 user event
|
---|
52 | * schema.
|
---|
53 | * @opt_param string rawJson An arbitrary serialized JSON string that contains
|
---|
54 | * necessary information that can comprise a user event. When this field is
|
---|
55 | * specified, the user_event field will be ignored. Note: line-delimited JSON is
|
---|
56 | * not supported, a single JSON only.
|
---|
57 | * @opt_param string uri The URL including cgi-parameters but excluding the hash
|
---|
58 | * fragment with a length limit of 5,000 characters. This is often more useful
|
---|
59 | * than the referer URL, because many browsers only send the domain for 3rd
|
---|
60 | * party requests.
|
---|
61 | * @opt_param string userEvent Required. URL encoded UserEvent proto with a
|
---|
62 | * length limit of 2,000,000 characters.
|
---|
63 | * @return GoogleApiHttpBody
|
---|
64 | * @throws \Google\Service\Exception
|
---|
65 | */
|
---|
66 | public function collect($parent, $optParams = [])
|
---|
67 | {
|
---|
68 | $params = ['parent' => $parent];
|
---|
69 | $params = array_merge($params, $optParams);
|
---|
70 | return $this->call('collect', [$params], GoogleApiHttpBody::class);
|
---|
71 | }
|
---|
72 | /**
|
---|
73 | * Bulk import of User events. Request processing might be synchronous. Events
|
---|
74 | * that already exist are skipped. Use this method for backfilling historical
|
---|
75 | * user events. `Operation.response` is of type `ImportResponse`. Note that it
|
---|
76 | * is possible for a subset of the items to be successfully inserted.
|
---|
77 | * `Operation.metadata` is of type `ImportMetadata`. (userEvents.import)
|
---|
78 | *
|
---|
79 | * @param string $parent Required.
|
---|
80 | * `projects/1234/locations/global/catalogs/default_catalog`
|
---|
81 | * @param GoogleCloudRetailV2ImportUserEventsRequest $postBody
|
---|
82 | * @param array $optParams Optional parameters.
|
---|
83 | * @return GoogleLongrunningOperation
|
---|
84 | * @throws \Google\Service\Exception
|
---|
85 | */
|
---|
86 | public function import($parent, GoogleCloudRetailV2ImportUserEventsRequest $postBody, $optParams = [])
|
---|
87 | {
|
---|
88 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
89 | $params = array_merge($params, $optParams);
|
---|
90 | return $this->call('import', [$params], GoogleLongrunningOperation::class);
|
---|
91 | }
|
---|
92 | /**
|
---|
93 | * Deletes permanently all user events specified by the filter provided.
|
---|
94 | * Depending on the number of events specified by the filter, this operation
|
---|
95 | * could take hours or days to complete. To test a filter, use the list command
|
---|
96 | * first. (userEvents.purge)
|
---|
97 | *
|
---|
98 | * @param string $parent Required. The resource name of the catalog under which
|
---|
99 | * the events are created. The format is
|
---|
100 | * `projects/${projectId}/locations/global/catalogs/${catalogId}`
|
---|
101 | * @param GoogleCloudRetailV2PurgeUserEventsRequest $postBody
|
---|
102 | * @param array $optParams Optional parameters.
|
---|
103 | * @return GoogleLongrunningOperation
|
---|
104 | * @throws \Google\Service\Exception
|
---|
105 | */
|
---|
106 | public function purge($parent, GoogleCloudRetailV2PurgeUserEventsRequest $postBody, $optParams = [])
|
---|
107 | {
|
---|
108 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
109 | $params = array_merge($params, $optParams);
|
---|
110 | return $this->call('purge', [$params], GoogleLongrunningOperation::class);
|
---|
111 | }
|
---|
112 | /**
|
---|
113 | * Starts a user-event rejoin operation with latest product catalog. Events are
|
---|
114 | * not annotated with detailed product information for products that are missing
|
---|
115 | * from the catalog when the user event is ingested. These events are stored as
|
---|
116 | * unjoined events with limited usage on training and serving. You can use this
|
---|
117 | * method to start a join operation on specified events with the latest version
|
---|
118 | * of product catalog. You can also use this method to correct events joined
|
---|
119 | * with the wrong product catalog. A rejoin operation can take hours or days to
|
---|
120 | * complete. (userEvents.rejoin)
|
---|
121 | *
|
---|
122 | * @param string $parent Required. The parent catalog resource name, such as
|
---|
123 | * `projects/1234/locations/global/catalogs/default_catalog`.
|
---|
124 | * @param GoogleCloudRetailV2RejoinUserEventsRequest $postBody
|
---|
125 | * @param array $optParams Optional parameters.
|
---|
126 | * @return GoogleLongrunningOperation
|
---|
127 | * @throws \Google\Service\Exception
|
---|
128 | */
|
---|
129 | public function rejoin($parent, GoogleCloudRetailV2RejoinUserEventsRequest $postBody, $optParams = [])
|
---|
130 | {
|
---|
131 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
132 | $params = array_merge($params, $optParams);
|
---|
133 | return $this->call('rejoin', [$params], GoogleLongrunningOperation::class);
|
---|
134 | }
|
---|
135 | /**
|
---|
136 | * Writes a single user event. (userEvents.write)
|
---|
137 | *
|
---|
138 | * @param string $parent Required. The parent catalog resource name, such as
|
---|
139 | * `projects/1234/locations/global/catalogs/default_catalog`.
|
---|
140 | * @param GoogleCloudRetailV2UserEvent $postBody
|
---|
141 | * @param array $optParams Optional parameters.
|
---|
142 | *
|
---|
143 | * @opt_param bool writeAsync If set to true, the user event will be written
|
---|
144 | * asynchronously after validation, and the API will respond without waiting for
|
---|
145 | * the write. Therefore, silent failures can occur even if the API returns
|
---|
146 | * success. In case of silent failures, error messages can be found in
|
---|
147 | * Stackdriver logs.
|
---|
148 | * @return GoogleCloudRetailV2UserEvent
|
---|
149 | * @throws \Google\Service\Exception
|
---|
150 | */
|
---|
151 | public function write($parent, GoogleCloudRetailV2UserEvent $postBody, $optParams = [])
|
---|
152 | {
|
---|
153 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
154 | $params = array_merge($params, $optParams);
|
---|
155 | return $this->call('write', [$params], GoogleCloudRetailV2UserEvent::class);
|
---|
156 | }
|
---|
157 | }
|
---|
158 |
|
---|
159 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
160 | class_alias(ProjectsLocationsCatalogsUserEvents::class, 'Google_Service_CloudRetail_Resource_ProjectsLocationsCatalogsUserEvents');
|
---|