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\ChecksService\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\ChecksService\GoogleChecksReportV1alphaAnalyzeUploadRequest;
|
---|
21 | use Google\Service\ChecksService\Operation;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "media" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $checksService = new Google\Service\ChecksService(...);
|
---|
28 | * $media = $checksService->media;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Media extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Analyzes the uploaded app bundle and returns a google.longrunning.Operation
|
---|
35 | * containing the generated Report. ## Example (upload only) Send a regular POST
|
---|
36 | * request with the header `X-Goog-Upload-Protocol: raw`. ``` POST https://check
|
---|
37 | * s.googleapis.com/upload/v1alpha/{parent=accounts/apps}/reports:analyzeUpload
|
---|
38 | * HTTP/1.1 X-Goog-Upload-Protocol: raw Content-Length: Content-Type:
|
---|
39 | * application/octet-stream ``` ## Example (upload with metadata) Send a
|
---|
40 | * multipart POST request where the first body part contains the metadata JSON
|
---|
41 | * and the second body part contains the binary upload. Include the header
|
---|
42 | * `X-Goog-Upload-Protocol: multipart`. ``` POST https://checks.googleapis.com/u
|
---|
43 | * pload/v1alpha/{parent=accounts/apps}/reports:analyzeUpload HTTP/1.1 X-Goog-
|
---|
44 | * Upload-Protocol: multipart Content-Length: ? Content-Type: multipart/related;
|
---|
45 | * boundary=BOUNDARY --BOUNDARY Content-Type: application/json
|
---|
46 | * {"code_reference_id":"db5bcc20f94055fb5bc08cbb9b0e7a5530308786"} --BOUNDARY
|
---|
47 | * --BOUNDARY-- ``` *Note:* Metadata-only requests are not supported.
|
---|
48 | * (media.upload)
|
---|
49 | *
|
---|
50 | * @param string $parent Required. Resource name of the app. Example:
|
---|
51 | * `accounts/123/apps/456`
|
---|
52 | * @param GoogleChecksReportV1alphaAnalyzeUploadRequest $postBody
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | * @return Operation
|
---|
55 | * @throws \Google\Service\Exception
|
---|
56 | */
|
---|
57 | public function upload($parent, GoogleChecksReportV1alphaAnalyzeUploadRequest $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('upload', [$params], Operation::class);
|
---|
62 | }
|
---|
63 | }
|
---|
64 |
|
---|
65 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
66 | class_alias(Media::class, 'Google_Service_ChecksService_Resource_Media');
|
---|