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\RecommendationsAI\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\RecommendationsAI\GoogleApiHttpBody;
|
---|
21 | use Google\Service\RecommendationsAI\GoogleCloudRecommendationengineV1beta1ImportUserEventsRequest;
|
---|
22 | use Google\Service\RecommendationsAI\GoogleCloudRecommendationengineV1beta1ListUserEventsResponse;
|
---|
23 | use Google\Service\RecommendationsAI\GoogleCloudRecommendationengineV1beta1PurgeUserEventsRequest;
|
---|
24 | use Google\Service\RecommendationsAI\GoogleCloudRecommendationengineV1beta1RejoinUserEventsRequest;
|
---|
25 | use Google\Service\RecommendationsAI\GoogleCloudRecommendationengineV1beta1UserEvent;
|
---|
26 | use Google\Service\RecommendationsAI\GoogleLongrunningOperation;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * The "userEvents" collection of methods.
|
---|
30 | * Typical usage is:
|
---|
31 | * <code>
|
---|
32 | * $recommendationengineService = new Google\Service\RecommendationsAI(...);
|
---|
33 | * $userEvents = $recommendationengineService->projects_locations_catalogs_eventStores_userEvents;
|
---|
34 | * </code>
|
---|
35 | */
|
---|
36 | class ProjectsLocationsCatalogsEventStoresUserEvents extends \Google\Service\Resource
|
---|
37 | {
|
---|
38 | /**
|
---|
39 | * Writes a single user event from the browser. This uses a GET request to due
|
---|
40 | * to browser restriction of POST-ing to a 3rd party domain. This method is used
|
---|
41 | * only by the Recommendations AI JavaScript pixel. Users should not call this
|
---|
42 | * method directly. (userEvents.collect)
|
---|
43 | *
|
---|
44 | * @param string $parent Required. The parent eventStore name, such as `projects
|
---|
45 | * /1234/locations/global/catalogs/default_catalog/eventStores/default_event_sto
|
---|
46 | * re`.
|
---|
47 | * @param array $optParams Optional parameters.
|
---|
48 | *
|
---|
49 | * @opt_param string ets Optional. The event timestamp in milliseconds. This
|
---|
50 | * prevents browser caching of otherwise identical get requests. The name is
|
---|
51 | * abbreviated to reduce the payload bytes.
|
---|
52 | * @opt_param string uri Optional. The url including cgi-parameters but
|
---|
53 | * excluding the hash fragment. The URL must be truncated to 1.5K bytes to
|
---|
54 | * conservatively be under the 2K bytes. This is often more useful than the
|
---|
55 | * referer url, because many browsers only send the domain for 3rd party
|
---|
56 | * requests.
|
---|
57 | * @opt_param string userEvent Required. URL encoded UserEvent proto.
|
---|
58 | * @return GoogleApiHttpBody
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function collect($parent, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['parent' => $parent];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('collect', [$params], GoogleApiHttpBody::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Bulk import of User events. Request processing might be synchronous. Events
|
---|
69 | * that already exist are skipped. Use this method for backfilling historical
|
---|
70 | * user events. Operation.response is of type ImportResponse. Note that it is
|
---|
71 | * possible for a subset of the items to be successfully inserted.
|
---|
72 | * Operation.metadata is of type ImportMetadata. (userEvents.import)
|
---|
73 | *
|
---|
74 | * @param string $parent Required. `projects/1234/locations/global/catalogs/defa
|
---|
75 | * ult_catalog/eventStores/default_event_store`
|
---|
76 | * @param GoogleCloudRecommendationengineV1beta1ImportUserEventsRequest $postBody
|
---|
77 | * @param array $optParams Optional parameters.
|
---|
78 | * @return GoogleLongrunningOperation
|
---|
79 | * @throws \Google\Service\Exception
|
---|
80 | */
|
---|
81 | public function import($parent, GoogleCloudRecommendationengineV1beta1ImportUserEventsRequest $postBody, $optParams = [])
|
---|
82 | {
|
---|
83 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
84 | $params = array_merge($params, $optParams);
|
---|
85 | return $this->call('import', [$params], GoogleLongrunningOperation::class);
|
---|
86 | }
|
---|
87 | /**
|
---|
88 | * Gets a list of user events within a time range, with potential filtering. The
|
---|
89 | * method does not list unjoined user events. Unjoined user event definition:
|
---|
90 | * when a user event is ingested from Recommendations AI User Event APIs, the
|
---|
91 | * catalog item included in the user event is connected with the current
|
---|
92 | * catalog. If a catalog item of the ingested event is not in the current
|
---|
93 | * catalog, it could lead to degraded model quality. This is called an unjoined
|
---|
94 | * event. (userEvents.listProjectsLocationsCatalogsEventStoresUserEvents)
|
---|
95 | *
|
---|
96 | * @param string $parent Required. The parent eventStore resource name, such as
|
---|
97 | * `projects/locations/catalogs/default_catalog/eventStores/default_event_store`
|
---|
98 | * .
|
---|
99 | * @param array $optParams Optional parameters.
|
---|
100 | *
|
---|
101 | * @opt_param string filter Optional. Filtering expression to specify
|
---|
102 | * restrictions over returned events. This is a sequence of terms, where each
|
---|
103 | * term applies some kind of a restriction to the returned user events. Use this
|
---|
104 | * expression to restrict results to a specific time range, or filter events by
|
---|
105 | * eventType. eg: eventTime > "2012-04-23T18:25:43.511Z"
|
---|
106 | * eventsMissingCatalogItems eventTime<"2012-04-23T18:25:43.511Z"
|
---|
107 | * eventType=search We expect only 3 types of fields: * eventTime: this can be
|
---|
108 | * specified a maximum of 2 times, once with a less than operator and once with
|
---|
109 | * a greater than operator. The eventTime restrict should result in one
|
---|
110 | * contiguous valid eventTime range. * eventType: only 1 eventType restriction
|
---|
111 | * can be specified. * eventsMissingCatalogItems: specififying this will
|
---|
112 | * restrict results to events for which catalog items were not found in the
|
---|
113 | * catalog. The default behavior is to return only those events for which
|
---|
114 | * catalog items were found. Some examples of valid filters expressions: *
|
---|
115 | * Example 1: eventTime > "2012-04-23T18:25:43.511Z" eventTime <
|
---|
116 | * "2012-04-23T18:30:43.511Z" * Example 2: eventTime >
|
---|
117 | * "2012-04-23T18:25:43.511Z" eventType = detail-page-view * Example 3:
|
---|
118 | * eventsMissingCatalogItems eventType = search eventTime <
|
---|
119 | * "2018-04-23T18:30:43.511Z" * Example 4: eventTime >
|
---|
120 | * "2012-04-23T18:25:43.511Z" * Example 5: eventType = search * Example 6:
|
---|
121 | * eventsMissingCatalogItems
|
---|
122 | * @opt_param int pageSize Optional. Maximum number of results to return per
|
---|
123 | * page. If zero, the service will choose a reasonable default.
|
---|
124 | * @opt_param string pageToken Optional. The previous
|
---|
125 | * ListUserEventsResponse.next_page_token.
|
---|
126 | * @return GoogleCloudRecommendationengineV1beta1ListUserEventsResponse
|
---|
127 | * @throws \Google\Service\Exception
|
---|
128 | */
|
---|
129 | public function listProjectsLocationsCatalogsEventStoresUserEvents($parent, $optParams = [])
|
---|
130 | {
|
---|
131 | $params = ['parent' => $parent];
|
---|
132 | $params = array_merge($params, $optParams);
|
---|
133 | return $this->call('list', [$params], GoogleCloudRecommendationengineV1beta1ListUserEventsResponse::class);
|
---|
134 | }
|
---|
135 | /**
|
---|
136 | * Deletes permanently all user events specified by the filter provided.
|
---|
137 | * Depending on the number of events specified by the filter, this operation
|
---|
138 | * could take hours or days to complete. To test a filter, use the list command
|
---|
139 | * first. (userEvents.purge)
|
---|
140 | *
|
---|
141 | * @param string $parent Required. The resource name of the event_store under
|
---|
142 | * which the events are created. The format is `projects/${projectId}/locations/
|
---|
143 | * global/catalogs/${catalogId}/eventStores/${eventStoreId}`
|
---|
144 | * @param GoogleCloudRecommendationengineV1beta1PurgeUserEventsRequest $postBody
|
---|
145 | * @param array $optParams Optional parameters.
|
---|
146 | * @return GoogleLongrunningOperation
|
---|
147 | * @throws \Google\Service\Exception
|
---|
148 | */
|
---|
149 | public function purge($parent, GoogleCloudRecommendationengineV1beta1PurgeUserEventsRequest $postBody, $optParams = [])
|
---|
150 | {
|
---|
151 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
152 | $params = array_merge($params, $optParams);
|
---|
153 | return $this->call('purge', [$params], GoogleLongrunningOperation::class);
|
---|
154 | }
|
---|
155 | /**
|
---|
156 | * Triggers a user event rejoin operation with latest catalog data. Events will
|
---|
157 | * not be annotated with detailed catalog information if catalog item is missing
|
---|
158 | * at the time the user event is ingested, and these events are stored as
|
---|
159 | * unjoined events with a limited usage on training and serving. This API can be
|
---|
160 | * used to trigger a 'join' operation on specified events with latest version of
|
---|
161 | * catalog items. It can also be used to correct events joined with wrong
|
---|
162 | * catalog items. (userEvents.rejoin)
|
---|
163 | *
|
---|
164 | * @param string $parent Required. Full resource name of user event, such as `pr
|
---|
165 | * ojects/locations/catalogs/default_catalog/eventStores/default_event_store`.
|
---|
166 | * @param GoogleCloudRecommendationengineV1beta1RejoinUserEventsRequest $postBody
|
---|
167 | * @param array $optParams Optional parameters.
|
---|
168 | * @return GoogleLongrunningOperation
|
---|
169 | * @throws \Google\Service\Exception
|
---|
170 | */
|
---|
171 | public function rejoin($parent, GoogleCloudRecommendationengineV1beta1RejoinUserEventsRequest $postBody, $optParams = [])
|
---|
172 | {
|
---|
173 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
174 | $params = array_merge($params, $optParams);
|
---|
175 | return $this->call('rejoin', [$params], GoogleLongrunningOperation::class);
|
---|
176 | }
|
---|
177 | /**
|
---|
178 | * Writes a single user event. (userEvents.write)
|
---|
179 | *
|
---|
180 | * @param string $parent Required. The parent eventStore resource name, such as
|
---|
181 | * "projects/1234/locations/global/catalogs/default_catalog/eventStores/default_
|
---|
182 | * event_store".
|
---|
183 | * @param GoogleCloudRecommendationengineV1beta1UserEvent $postBody
|
---|
184 | * @param array $optParams Optional parameters.
|
---|
185 | * @return GoogleCloudRecommendationengineV1beta1UserEvent
|
---|
186 | * @throws \Google\Service\Exception
|
---|
187 | */
|
---|
188 | public function write($parent, GoogleCloudRecommendationengineV1beta1UserEvent $postBody, $optParams = [])
|
---|
189 | {
|
---|
190 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
191 | $params = array_merge($params, $optParams);
|
---|
192 | return $this->call('write', [$params], GoogleCloudRecommendationengineV1beta1UserEvent::class);
|
---|
193 | }
|
---|
194 | }
|
---|
195 |
|
---|
196 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
197 | class_alias(ProjectsLocationsCatalogsEventStoresUserEvents::class, 'Google_Service_RecommendationsAI_Resource_ProjectsLocationsCatalogsEventStoresUserEvents');
|
---|