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\DiscoveryEngine\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\DiscoveryEngine\GoogleApiHttpBody;
|
---|
21 | use Google\Service\DiscoveryEngine\GoogleCloudDiscoveryengineV1ImportUserEventsRequest;
|
---|
22 | use Google\Service\DiscoveryEngine\GoogleCloudDiscoveryengineV1UserEvent;
|
---|
23 | use Google\Service\DiscoveryEngine\GoogleLongrunningOperation;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "userEvents" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $discoveryengineService = new Google\Service\DiscoveryEngine(...);
|
---|
30 | * $userEvents = $discoveryengineService->projects_locations_userEvents;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class ProjectsLocationsUserEvents extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Writes a single user event from the browser. This uses a GET request to due
|
---|
37 | * to browser restriction of POST-ing to a third-party domain. This method is
|
---|
38 | * used only by the Discovery Engine API JavaScript pixel and Google Tag
|
---|
39 | * Manager. Users should not call this method directly. (userEvents.collect)
|
---|
40 | *
|
---|
41 | * @param string $parent Required. The parent DataStore resource name, such as `
|
---|
42 | * projects/{project}/locations/{location}/collections/{collection}/dataStores/{
|
---|
43 | * data_store}`.
|
---|
44 | * @param array $optParams Optional parameters.
|
---|
45 | *
|
---|
46 | * @opt_param string ets The event timestamp in milliseconds. This prevents
|
---|
47 | * browser caching of otherwise identical get requests. The name is abbreviated
|
---|
48 | * to reduce the payload bytes.
|
---|
49 | * @opt_param string uri The URL including cgi-parameters but excluding the hash
|
---|
50 | * fragment with a length limit of 5,000 characters. This is often more useful
|
---|
51 | * than the referer URL, because many browsers only send the domain for third-
|
---|
52 | * party requests.
|
---|
53 | * @opt_param string userEvent Required. URL encoded UserEvent proto with a
|
---|
54 | * length limit of 2,000,000 characters.
|
---|
55 | * @return GoogleApiHttpBody
|
---|
56 | * @throws \Google\Service\Exception
|
---|
57 | */
|
---|
58 | public function collect($parent, $optParams = [])
|
---|
59 | {
|
---|
60 | $params = ['parent' => $parent];
|
---|
61 | $params = array_merge($params, $optParams);
|
---|
62 | return $this->call('collect', [$params], GoogleApiHttpBody::class);
|
---|
63 | }
|
---|
64 | /**
|
---|
65 | * Bulk import of user events. Request processing might be synchronous. Events
|
---|
66 | * that already exist are skipped. Use this method for backfilling historical
|
---|
67 | * user events. Operation.response is of type ImportResponse. Note that it is
|
---|
68 | * possible for a subset of the items to be successfully inserted.
|
---|
69 | * Operation.metadata is of type ImportMetadata. (userEvents.import)
|
---|
70 | *
|
---|
71 | * @param string $parent Required. Parent DataStore resource name, of the form `
|
---|
72 | * projects/{project}/locations/{location}/collections/{collection}/dataStores/{
|
---|
73 | * data_store}`
|
---|
74 | * @param GoogleCloudDiscoveryengineV1ImportUserEventsRequest $postBody
|
---|
75 | * @param array $optParams Optional parameters.
|
---|
76 | * @return GoogleLongrunningOperation
|
---|
77 | * @throws \Google\Service\Exception
|
---|
78 | */
|
---|
79 | public function import($parent, GoogleCloudDiscoveryengineV1ImportUserEventsRequest $postBody, $optParams = [])
|
---|
80 | {
|
---|
81 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
82 | $params = array_merge($params, $optParams);
|
---|
83 | return $this->call('import', [$params], GoogleLongrunningOperation::class);
|
---|
84 | }
|
---|
85 | /**
|
---|
86 | * Writes a single user event. (userEvents.write)
|
---|
87 | *
|
---|
88 | * @param string $parent Required. The parent resource name. If the write user
|
---|
89 | * event action is applied in DataStore level, the format is: `projects/{project
|
---|
90 | * }/locations/{location}/collections/{collection}/dataStores/{data_store}`. If
|
---|
91 | * the write user event action is applied in Location level, for example, the
|
---|
92 | * event with Document across multiple DataStore, the format is:
|
---|
93 | * `projects/{project}/locations/{location}`.
|
---|
94 | * @param GoogleCloudDiscoveryengineV1UserEvent $postBody
|
---|
95 | * @param array $optParams Optional parameters.
|
---|
96 | *
|
---|
97 | * @opt_param bool writeAsync If set to true, the user event is written
|
---|
98 | * asynchronously after validation, and the API responds without waiting for the
|
---|
99 | * write.
|
---|
100 | * @return GoogleCloudDiscoveryengineV1UserEvent
|
---|
101 | * @throws \Google\Service\Exception
|
---|
102 | */
|
---|
103 | public function write($parent, GoogleCloudDiscoveryengineV1UserEvent $postBody, $optParams = [])
|
---|
104 | {
|
---|
105 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
106 | $params = array_merge($params, $optParams);
|
---|
107 | return $this->call('write', [$params], GoogleCloudDiscoveryengineV1UserEvent::class);
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
112 | class_alias(ProjectsLocationsUserEvents::class, 'Google_Service_DiscoveryEngine_Resource_ProjectsLocationsUserEvents');
|
---|