@googleapis/safebrowsing 5.0.1 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [6.0.0](https://github.com/googleapis/google-api-nodejs-client/compare/safebrowsing-v5.0.2...safebrowsing-v6.0.0) (2023-10-11)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * This release has breaking changes.
9
+
10
+ ### Features
11
+
12
+ * run the generator ([#3355](https://github.com/googleapis/google-api-nodejs-client/issues/3355)) ([5504c86](https://github.com/googleapis/google-api-nodejs-client/commit/5504c86fd61740886047320e2ed70f02a164acd7))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * **deps:** update dependency googleapis-common to v7 ([9491ec1](https://github.com/googleapis/google-api-nodejs-client/commit/9491ec1cdc3c413e7d73edcfcd59cf5c28a7c855))
18
+ * **safebrowsing:** update the API ([fe23d83](https://github.com/googleapis/google-api-nodejs-client/commit/fe23d83559d427ae9b5aea1a78faaecd0be92c10))
19
+
20
+ ## [5.0.2](https://github.com/googleapis/google-api-nodejs-client/compare/safebrowsing-v5.0.1...safebrowsing-v5.0.2) (2023-08-25)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * **deps:** update dependency googleapis-common to v7 ([9491ec1](https://github.com/googleapis/google-api-nodejs-client/commit/9491ec1cdc3c413e7d73edcfcd59cf5c28a7c855))
26
+
3
27
  ## [5.0.1](https://github.com/googleapis/google-api-nodejs-client/compare/safebrowsing-v5.0.0...safebrowsing-v5.0.1) (2023-08-09)
4
28
 
5
29
 
package/build/index.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  /*! THIS FILE IS AUTO-GENERATED */
2
2
  import { AuthPlus } from 'googleapis-common';
3
3
  import { safebrowsing_v4 } from './v4';
4
+ import { safebrowsing_v5 } from './v5';
4
5
  export declare const VERSIONS: {
5
6
  v4: typeof safebrowsing_v4.Safebrowsing;
7
+ v5: typeof safebrowsing_v5.Safebrowsing;
6
8
  };
7
9
  export declare function safebrowsing(version: 'v4'): safebrowsing_v4.Safebrowsing;
8
10
  export declare function safebrowsing(options: safebrowsing_v4.Options): safebrowsing_v4.Safebrowsing;
11
+ export declare function safebrowsing(version: 'v5'): safebrowsing_v5.Safebrowsing;
12
+ export declare function safebrowsing(options: safebrowsing_v5.Options): safebrowsing_v5.Safebrowsing;
9
13
  declare const auth: AuthPlus;
10
14
  export { auth };
11
15
  export { safebrowsing_v4 };
16
+ export { safebrowsing_v5 };
12
17
  export { AuthPlus, GlobalOptions, APIRequestContext, GoogleConfigurable, StreamMethodOptions, GaxiosPromise, MethodOptions, BodyResponseCallback, } from 'googleapis-common';
package/build/index.js CHANGED
@@ -12,13 +12,16 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AuthPlus = exports.safebrowsing_v4 = exports.auth = exports.safebrowsing = exports.VERSIONS = void 0;
15
+ exports.AuthPlus = exports.safebrowsing_v5 = exports.safebrowsing_v4 = exports.auth = exports.safebrowsing = exports.VERSIONS = void 0;
16
16
  /*! THIS FILE IS AUTO-GENERATED */
17
17
  const googleapis_common_1 = require("googleapis-common");
18
18
  const v4_1 = require("./v4");
19
19
  Object.defineProperty(exports, "safebrowsing_v4", { enumerable: true, get: function () { return v4_1.safebrowsing_v4; } });
20
+ const v5_1 = require("./v5");
21
+ Object.defineProperty(exports, "safebrowsing_v5", { enumerable: true, get: function () { return v5_1.safebrowsing_v5; } });
20
22
  exports.VERSIONS = {
21
23
  v4: v4_1.safebrowsing_v4.Safebrowsing,
24
+ v5: v5_1.safebrowsing_v5.Safebrowsing,
22
25
  };
23
26
  function safebrowsing(versionOrOptions) {
24
27
  return (0, googleapis_common_1.getAPI)('safebrowsing', versionOrOptions, exports.VERSIONS, this);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,kCAAkC;AAElC,yDAAuE;AACvE,6BAAqC;AAmB7B,gGAnBA,oBAAe,OAmBA;AAjBV,QAAA,QAAQ,GAAG;IACtB,EAAE,EAAE,oBAAe,CAAC,YAAY;CACjC,CAAC;AAMF,SAAgB,YAAY,CAE1B,gBAAgD;IAEhD,OAAO,IAAA,0BAAM,EAAI,cAAc,EAAE,gBAAgB,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC;AALD,oCAKC;AAED,MAAM,IAAI,GAAG,IAAI,4BAAQ,EAAE,CAAC;AACpB,oBAAI;AAEZ,uDAS2B;AARzB,6GAAA,QAAQ,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,kCAAkC;AAElC,yDAAuE;AACvE,6BAAqC;AA+B7B,gGA/BA,oBAAe,OA+BA;AA9BvB,6BAAqC;AA+B7B,gGA/BA,oBAAe,OA+BA;AA7BV,QAAA,QAAQ,GAAG;IACtB,EAAE,EAAE,oBAAe,CAAC,YAAY;IAChC,EAAE,EAAE,oBAAe,CAAC,YAAY;CACjC,CAAC;AAUF,SAAgB,YAAY,CAI1B,gBAI2B;IAE3B,OAAO,IAAA,0BAAM,EAAI,cAAc,EAAE,gBAAgB,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC;AAXD,oCAWC;AAED,MAAM,IAAI,GAAG,IAAI,4BAAQ,EAAE,CAAC;AACpB,oBAAI;AAGZ,uDAS2B;AARzB,6GAAA,QAAQ,OAAA"}
package/build/v5.d.ts ADDED
@@ -0,0 +1,138 @@
1
+ /// <reference types="node" />
2
+ import { OAuth2Client, JWT, Compute, UserRefreshClient, BaseExternalAccountClient, GaxiosPromise, GoogleConfigurable, MethodOptions, StreamMethodOptions, GlobalOptions, GoogleAuth, BodyResponseCallback, APIRequestContext } from 'googleapis-common';
3
+ import { Readable } from 'stream';
4
+ export declare namespace safebrowsing_v5 {
5
+ export interface Options extends GlobalOptions {
6
+ version: 'v5';
7
+ }
8
+ interface StandardParameters {
9
+ /**
10
+ * Auth client or API Key for the request
11
+ */
12
+ auth?: string | OAuth2Client | JWT | Compute | UserRefreshClient | BaseExternalAccountClient | GoogleAuth;
13
+ /**
14
+ * V1 error format.
15
+ */
16
+ '$.xgafv'?: string;
17
+ /**
18
+ * OAuth access token.
19
+ */
20
+ access_token?: string;
21
+ /**
22
+ * Data format for response.
23
+ */
24
+ alt?: string;
25
+ /**
26
+ * JSONP
27
+ */
28
+ callback?: string;
29
+ /**
30
+ * Selector specifying which fields to include in a partial response.
31
+ */
32
+ fields?: string;
33
+ /**
34
+ * API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
35
+ */
36
+ key?: string;
37
+ /**
38
+ * OAuth 2.0 token for the current user.
39
+ */
40
+ oauth_token?: string;
41
+ /**
42
+ * Returns response with indentations and line breaks.
43
+ */
44
+ prettyPrint?: boolean;
45
+ /**
46
+ * Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
47
+ */
48
+ quotaUser?: string;
49
+ /**
50
+ * Legacy upload protocol for media (e.g. "media", "multipart").
51
+ */
52
+ uploadType?: string;
53
+ /**
54
+ * Upload protocol for media (e.g. "raw", "multipart").
55
+ */
56
+ upload_protocol?: string;
57
+ }
58
+ /**
59
+ * Safe Browsing API
60
+ *
61
+ * Enables client applications to check web resources (most commonly URLs) against Google-generated lists of unsafe web resources. The Safe Browsing APIs are for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial purposes – meaning “for sale or revenue-generating purposes” – please refer to the Web Risk API.
62
+ *
63
+ * @example
64
+ * ```js
65
+ * const {google} = require('googleapis');
66
+ * const safebrowsing = google.safebrowsing('v5');
67
+ * ```
68
+ */
69
+ export class Safebrowsing {
70
+ context: APIRequestContext;
71
+ hashes: Resource$Hashes;
72
+ constructor(options: GlobalOptions, google?: GoogleConfigurable);
73
+ }
74
+ /**
75
+ * The full hash identified with one or more matches.
76
+ */
77
+ export interface Schema$GoogleSecuritySafebrowsingV5FullHash {
78
+ /**
79
+ * The matching full hash. This is the SHA256 hash. The length will be exactly 32 bytes.
80
+ */
81
+ fullHash?: string | null;
82
+ /**
83
+ * Unordered list. A repeated field identifying the details relevant to this full hash.
84
+ */
85
+ fullHashDetails?: Schema$GoogleSecuritySafebrowsingV5FullHashFullHashDetail[];
86
+ }
87
+ /**
88
+ * Details about a matching full hash. An important note about forward compatibility: new threat types and threat attributes may be added by the server at any time; those additions are considered minor version changes. It is Google's policy not to expose minor version numbers in APIs (see https://cloud.google.com/apis/design/versioning), so clients MUST be prepared to receive FullHashDetail messages containing ThreatType enum values or ThreatAttribute enum values that are considered invalid by the client. Therefore, it is the client's responsibility to check for the validity of all ThreatType and ThreatAttribute enum values; if any value is considered invalid, the client MUST disregard the entire FullHashDetail message.
89
+ */
90
+ export interface Schema$GoogleSecuritySafebrowsingV5FullHashFullHashDetail {
91
+ /**
92
+ * Unordered list. Additional attributes about those full hashes. This may be empty.
93
+ */
94
+ attributes?: string[] | null;
95
+ /**
96
+ * The type of threat. This field will never be empty.
97
+ */
98
+ threatType?: string | null;
99
+ }
100
+ /**
101
+ * The response returned after searching threat hashes. Note that if nothing is found, the server will return an OK status (HTTP status code 200) with the `full_hashes` field empty, rather than returning a NOT_FOUND status (HTTP status code 404).
102
+ */
103
+ export interface Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse {
104
+ /**
105
+ * The client-side cache duration. The client shall add this duration to the current time to determine the expiration time. The expiration time then applies to every hash prefix queried by the client in the request, regardless of how many full hashes are returned in the response. Even if the server returns no full hashes for a particular hash prefix, this fact should also be cached by the client. Important: the client must not assume that the server will return the same cache duration for all responses. The server may choose different cache durations for different responses depending on the situation.
106
+ */
107
+ cacheDuration?: string | null;
108
+ /**
109
+ * Unordered list. The unordered list of full hashes found.
110
+ */
111
+ fullHashes?: Schema$GoogleSecuritySafebrowsingV5FullHash[];
112
+ }
113
+ export class Resource$Hashes {
114
+ context: APIRequestContext;
115
+ constructor(context: APIRequestContext);
116
+ /**
117
+ * Search for full hashes matching the specified prefixes. This is a custom method as described by guidance at https://google.aip.dev/136
118
+ *
119
+ * @param params - Parameters for request
120
+ * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
121
+ * @param callback - Optional callback that handles the response.
122
+ * @returns A promise if used with async/await, or void if used with a callback.
123
+ */
124
+ search(params: Params$Resource$Hashes$Search, options: StreamMethodOptions): GaxiosPromise<Readable>;
125
+ search(params?: Params$Resource$Hashes$Search, options?: MethodOptions): GaxiosPromise<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>;
126
+ search(params: Params$Resource$Hashes$Search, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
127
+ search(params: Params$Resource$Hashes$Search, options: MethodOptions | BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>, callback: BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>): void;
128
+ search(params: Params$Resource$Hashes$Search, callback: BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>): void;
129
+ search(callback: BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>): void;
130
+ }
131
+ export interface Params$Resource$Hashes$Search extends StandardParameters {
132
+ /**
133
+ * Required. The hash prefixes to be looked up.
134
+ */
135
+ hashPrefixes?: string[];
136
+ }
137
+ export {};
138
+ }
package/build/v5.js ADDED
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ // Copyright 2020 Google LLC
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.safebrowsing_v5 = void 0;
16
+ /* eslint-disable @typescript-eslint/no-explicit-any */
17
+ /* eslint-disable @typescript-eslint/no-unused-vars */
18
+ /* eslint-disable @typescript-eslint/no-empty-interface */
19
+ /* eslint-disable @typescript-eslint/no-namespace */
20
+ /* eslint-disable no-irregular-whitespace */
21
+ const googleapis_common_1 = require("googleapis-common");
22
+ var safebrowsing_v5;
23
+ (function (safebrowsing_v5) {
24
+ /**
25
+ * Safe Browsing API
26
+ *
27
+ * Enables client applications to check web resources (most commonly URLs) against Google-generated lists of unsafe web resources. The Safe Browsing APIs are for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial purposes – meaning “for sale or revenue-generating purposes” – please refer to the Web Risk API.
28
+ *
29
+ * @example
30
+ * ```js
31
+ * const {google} = require('googleapis');
32
+ * const safebrowsing = google.safebrowsing('v5');
33
+ * ```
34
+ */
35
+ class Safebrowsing {
36
+ constructor(options, google) {
37
+ this.context = {
38
+ _options: options || {},
39
+ google,
40
+ };
41
+ this.hashes = new Resource$Hashes(this.context);
42
+ }
43
+ }
44
+ safebrowsing_v5.Safebrowsing = Safebrowsing;
45
+ class Resource$Hashes {
46
+ constructor(context) {
47
+ this.context = context;
48
+ }
49
+ search(paramsOrCallback, optionsOrCallback, callback) {
50
+ let params = (paramsOrCallback || {});
51
+ let options = (optionsOrCallback || {});
52
+ if (typeof paramsOrCallback === 'function') {
53
+ callback = paramsOrCallback;
54
+ params = {};
55
+ options = {};
56
+ }
57
+ if (typeof optionsOrCallback === 'function') {
58
+ callback = optionsOrCallback;
59
+ options = {};
60
+ }
61
+ const rootUrl = options.rootUrl || 'https://safebrowsing.googleapis.com/';
62
+ const parameters = {
63
+ options: Object.assign({
64
+ url: (rootUrl + '/v5/hashes:search').replace(/([^:]\/)\/+/g, '$1'),
65
+ method: 'GET',
66
+ }, options),
67
+ params,
68
+ requiredParams: [],
69
+ pathParams: [],
70
+ context: this.context,
71
+ };
72
+ if (callback) {
73
+ (0, googleapis_common_1.createAPIRequest)(parameters, callback);
74
+ }
75
+ else {
76
+ return (0, googleapis_common_1.createAPIRequest)(parameters);
77
+ }
78
+ }
79
+ }
80
+ safebrowsing_v5.Resource$Hashes = Resource$Hashes;
81
+ })(safebrowsing_v5 = exports.safebrowsing_v5 || (exports.safebrowsing_v5 = {}));
82
+ //# sourceMappingURL=v5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v5.js","sourceRoot":"","sources":["../v5.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,gDAAgD;AAChD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,uDAAuD;AACvD,sDAAsD;AACtD,0DAA0D;AAC1D,oDAAoD;AACpD,4CAA4C;AAE5C,yDAe2B;AAG3B,IAAiB,eAAe,CA0O/B;AA1OD,WAAiB,eAAe;IAgE9B;;;;;;;;;;OAUG;IACH,MAAa,YAAY;QAIvB,YAAY,OAAsB,EAAE,MAA2B;YAC7D,IAAI,CAAC,OAAO,GAAG;gBACb,QAAQ,EAAE,OAAO,IAAI,EAAE;gBACvB,MAAM;aACP,CAAC;YAEF,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClD,CAAC;KACF;IAZY,4BAAY,eAYxB,CAAA;IA0CD,MAAa,eAAe;QAE1B,YAAY,OAA0B;YACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QAqCD,MAAM,CACJ,gBAGkC,EAClC,iBAIkC,EAClC,QAEkC;YAKlC,IAAI,MAAM,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAkC,CAAC;YACvE,IAAI,OAAO,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAkB,CAAC;YAEzD,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;gBAC1C,QAAQ,GAAG,gBAAgB,CAAC;gBAC5B,MAAM,GAAG,EAAmC,CAAC;gBAC7C,OAAO,GAAG,EAAE,CAAC;aACd;YAED,IAAI,OAAO,iBAAiB,KAAK,UAAU,EAAE;gBAC3C,QAAQ,GAAG,iBAAiB,CAAC;gBAC7B,OAAO,GAAG,EAAE,CAAC;aACd;YAED,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,sCAAsC,CAAC;YAC1E,MAAM,UAAU,GAAG;gBACjB,OAAO,EAAE,MAAM,CAAC,MAAM,CACpB;oBACE,GAAG,EAAE,CAAC,OAAO,GAAG,mBAAmB,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC;oBAClE,MAAM,EAAE,KAAK;iBACd,EACD,OAAO,CACR;gBACD,MAAM;gBACN,cAAc,EAAE,EAAE;gBAClB,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC;YACF,IAAI,QAAQ,EAAE;gBACZ,IAAA,oCAAgB,EACd,UAAU,EACV,QAAyC,CAC1C,CAAC;aACH;iBAAM;gBACL,OAAO,IAAA,oCAAgB,EACrB,UAAU,CACX,CAAC;aACH;QACH,CAAC;KACF;IAjGY,+BAAe,kBAiG3B,CAAA;AAQH,CAAC,EA1OgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QA0O/B"}
package/index.ts CHANGED
@@ -15,18 +15,30 @@
15
15
 
16
16
  import {AuthPlus, getAPI, GoogleConfigurable} from 'googleapis-common';
17
17
  import {safebrowsing_v4} from './v4';
18
+ import {safebrowsing_v5} from './v5';
18
19
 
19
20
  export const VERSIONS = {
20
21
  v4: safebrowsing_v4.Safebrowsing,
22
+ v5: safebrowsing_v5.Safebrowsing,
21
23
  };
22
24
 
23
25
  export function safebrowsing(version: 'v4'): safebrowsing_v4.Safebrowsing;
24
26
  export function safebrowsing(
25
27
  options: safebrowsing_v4.Options
26
28
  ): safebrowsing_v4.Safebrowsing;
27
- export function safebrowsing<T = safebrowsing_v4.Safebrowsing>(
29
+ export function safebrowsing(version: 'v5'): safebrowsing_v5.Safebrowsing;
30
+ export function safebrowsing(
31
+ options: safebrowsing_v5.Options
32
+ ): safebrowsing_v5.Safebrowsing;
33
+ export function safebrowsing<
34
+ T = safebrowsing_v4.Safebrowsing | safebrowsing_v5.Safebrowsing,
35
+ >(
28
36
  this: GoogleConfigurable,
29
- versionOrOptions: 'v4' | safebrowsing_v4.Options
37
+ versionOrOptions:
38
+ | 'v4'
39
+ | safebrowsing_v4.Options
40
+ | 'v5'
41
+ | safebrowsing_v5.Options
30
42
  ) {
31
43
  return getAPI<T>('safebrowsing', versionOrOptions, VERSIONS, this);
32
44
  }
@@ -34,6 +46,7 @@ export function safebrowsing<T = safebrowsing_v4.Safebrowsing>(
34
46
  const auth = new AuthPlus();
35
47
  export {auth};
36
48
  export {safebrowsing_v4};
49
+ export {safebrowsing_v5};
37
50
  export {
38
51
  AuthPlus,
39
52
  GlobalOptions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@googleapis/safebrowsing",
3
- "version": "5.0.1",
3
+ "version": "6.0.0",
4
4
  "description": "safebrowsing",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -28,12 +28,12 @@
28
28
  "webpack": "webpack"
29
29
  },
30
30
  "dependencies": {
31
- "googleapis-common": "^6.0.3"
31
+ "googleapis-common": "^7.0.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@microsoft/api-documenter": "^7.8.10",
35
35
  "@microsoft/api-extractor": "^7.8.10",
36
- "gts": "^3.1.1",
36
+ "gts": "^5.0.0",
37
37
  "null-loader": "^4.0.0",
38
38
  "ts-loader": "^9.0.0",
39
39
  "typescript": "~4.8.4",
package/v5.ts ADDED
@@ -0,0 +1,272 @@
1
+ // Copyright 2020 Google LLC
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+
14
+ /* eslint-disable @typescript-eslint/no-explicit-any */
15
+ /* eslint-disable @typescript-eslint/no-unused-vars */
16
+ /* eslint-disable @typescript-eslint/no-empty-interface */
17
+ /* eslint-disable @typescript-eslint/no-namespace */
18
+ /* eslint-disable no-irregular-whitespace */
19
+
20
+ import {
21
+ OAuth2Client,
22
+ JWT,
23
+ Compute,
24
+ UserRefreshClient,
25
+ BaseExternalAccountClient,
26
+ GaxiosPromise,
27
+ GoogleConfigurable,
28
+ createAPIRequest,
29
+ MethodOptions,
30
+ StreamMethodOptions,
31
+ GlobalOptions,
32
+ GoogleAuth,
33
+ BodyResponseCallback,
34
+ APIRequestContext,
35
+ } from 'googleapis-common';
36
+ import {Readable} from 'stream';
37
+
38
+ export namespace safebrowsing_v5 {
39
+ export interface Options extends GlobalOptions {
40
+ version: 'v5';
41
+ }
42
+
43
+ interface StandardParameters {
44
+ /**
45
+ * Auth client or API Key for the request
46
+ */
47
+ auth?:
48
+ | string
49
+ | OAuth2Client
50
+ | JWT
51
+ | Compute
52
+ | UserRefreshClient
53
+ | BaseExternalAccountClient
54
+ | GoogleAuth;
55
+
56
+ /**
57
+ * V1 error format.
58
+ */
59
+ '$.xgafv'?: string;
60
+ /**
61
+ * OAuth access token.
62
+ */
63
+ access_token?: string;
64
+ /**
65
+ * Data format for response.
66
+ */
67
+ alt?: string;
68
+ /**
69
+ * JSONP
70
+ */
71
+ callback?: string;
72
+ /**
73
+ * Selector specifying which fields to include in a partial response.
74
+ */
75
+ fields?: string;
76
+ /**
77
+ * API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
78
+ */
79
+ key?: string;
80
+ /**
81
+ * OAuth 2.0 token for the current user.
82
+ */
83
+ oauth_token?: string;
84
+ /**
85
+ * Returns response with indentations and line breaks.
86
+ */
87
+ prettyPrint?: boolean;
88
+ /**
89
+ * Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
90
+ */
91
+ quotaUser?: string;
92
+ /**
93
+ * Legacy upload protocol for media (e.g. "media", "multipart").
94
+ */
95
+ uploadType?: string;
96
+ /**
97
+ * Upload protocol for media (e.g. "raw", "multipart").
98
+ */
99
+ upload_protocol?: string;
100
+ }
101
+
102
+ /**
103
+ * Safe Browsing API
104
+ *
105
+ * Enables client applications to check web resources (most commonly URLs) against Google-generated lists of unsafe web resources. The Safe Browsing APIs are for non-commercial use only. If you need to use APIs to detect malicious URLs for commercial purposes – meaning “for sale or revenue-generating purposes” – please refer to the Web Risk API.
106
+ *
107
+ * @example
108
+ * ```js
109
+ * const {google} = require('googleapis');
110
+ * const safebrowsing = google.safebrowsing('v5');
111
+ * ```
112
+ */
113
+ export class Safebrowsing {
114
+ context: APIRequestContext;
115
+ hashes: Resource$Hashes;
116
+
117
+ constructor(options: GlobalOptions, google?: GoogleConfigurable) {
118
+ this.context = {
119
+ _options: options || {},
120
+ google,
121
+ };
122
+
123
+ this.hashes = new Resource$Hashes(this.context);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * The full hash identified with one or more matches.
129
+ */
130
+ export interface Schema$GoogleSecuritySafebrowsingV5FullHash {
131
+ /**
132
+ * The matching full hash. This is the SHA256 hash. The length will be exactly 32 bytes.
133
+ */
134
+ fullHash?: string | null;
135
+ /**
136
+ * Unordered list. A repeated field identifying the details relevant to this full hash.
137
+ */
138
+ fullHashDetails?: Schema$GoogleSecuritySafebrowsingV5FullHashFullHashDetail[];
139
+ }
140
+ /**
141
+ * Details about a matching full hash. An important note about forward compatibility: new threat types and threat attributes may be added by the server at any time; those additions are considered minor version changes. It is Google's policy not to expose minor version numbers in APIs (see https://cloud.google.com/apis/design/versioning), so clients MUST be prepared to receive FullHashDetail messages containing ThreatType enum values or ThreatAttribute enum values that are considered invalid by the client. Therefore, it is the client's responsibility to check for the validity of all ThreatType and ThreatAttribute enum values; if any value is considered invalid, the client MUST disregard the entire FullHashDetail message.
142
+ */
143
+ export interface Schema$GoogleSecuritySafebrowsingV5FullHashFullHashDetail {
144
+ /**
145
+ * Unordered list. Additional attributes about those full hashes. This may be empty.
146
+ */
147
+ attributes?: string[] | null;
148
+ /**
149
+ * The type of threat. This field will never be empty.
150
+ */
151
+ threatType?: string | null;
152
+ }
153
+ /**
154
+ * The response returned after searching threat hashes. Note that if nothing is found, the server will return an OK status (HTTP status code 200) with the `full_hashes` field empty, rather than returning a NOT_FOUND status (HTTP status code 404).
155
+ */
156
+ export interface Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse {
157
+ /**
158
+ * The client-side cache duration. The client shall add this duration to the current time to determine the expiration time. The expiration time then applies to every hash prefix queried by the client in the request, regardless of how many full hashes are returned in the response. Even if the server returns no full hashes for a particular hash prefix, this fact should also be cached by the client. Important: the client must not assume that the server will return the same cache duration for all responses. The server may choose different cache durations for different responses depending on the situation.
159
+ */
160
+ cacheDuration?: string | null;
161
+ /**
162
+ * Unordered list. The unordered list of full hashes found.
163
+ */
164
+ fullHashes?: Schema$GoogleSecuritySafebrowsingV5FullHash[];
165
+ }
166
+
167
+ export class Resource$Hashes {
168
+ context: APIRequestContext;
169
+ constructor(context: APIRequestContext) {
170
+ this.context = context;
171
+ }
172
+
173
+ /**
174
+ * Search for full hashes matching the specified prefixes. This is a custom method as described by guidance at https://google.aip.dev/136
175
+ *
176
+ * @param params - Parameters for request
177
+ * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
178
+ * @param callback - Optional callback that handles the response.
179
+ * @returns A promise if used with async/await, or void if used with a callback.
180
+ */
181
+ search(
182
+ params: Params$Resource$Hashes$Search,
183
+ options: StreamMethodOptions
184
+ ): GaxiosPromise<Readable>;
185
+ search(
186
+ params?: Params$Resource$Hashes$Search,
187
+ options?: MethodOptions
188
+ ): GaxiosPromise<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>;
189
+ search(
190
+ params: Params$Resource$Hashes$Search,
191
+ options: StreamMethodOptions | BodyResponseCallback<Readable>,
192
+ callback: BodyResponseCallback<Readable>
193
+ ): void;
194
+ search(
195
+ params: Params$Resource$Hashes$Search,
196
+ options:
197
+ | MethodOptions
198
+ | BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>,
199
+ callback: BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>
200
+ ): void;
201
+ search(
202
+ params: Params$Resource$Hashes$Search,
203
+ callback: BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>
204
+ ): void;
205
+ search(
206
+ callback: BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>
207
+ ): void;
208
+ search(
209
+ paramsOrCallback?:
210
+ | Params$Resource$Hashes$Search
211
+ | BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>
212
+ | BodyResponseCallback<Readable>,
213
+ optionsOrCallback?:
214
+ | MethodOptions
215
+ | StreamMethodOptions
216
+ | BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>
217
+ | BodyResponseCallback<Readable>,
218
+ callback?:
219
+ | BodyResponseCallback<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>
220
+ | BodyResponseCallback<Readable>
221
+ ):
222
+ | void
223
+ | GaxiosPromise<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>
224
+ | GaxiosPromise<Readable> {
225
+ let params = (paramsOrCallback || {}) as Params$Resource$Hashes$Search;
226
+ let options = (optionsOrCallback || {}) as MethodOptions;
227
+
228
+ if (typeof paramsOrCallback === 'function') {
229
+ callback = paramsOrCallback;
230
+ params = {} as Params$Resource$Hashes$Search;
231
+ options = {};
232
+ }
233
+
234
+ if (typeof optionsOrCallback === 'function') {
235
+ callback = optionsOrCallback;
236
+ options = {};
237
+ }
238
+
239
+ const rootUrl = options.rootUrl || 'https://safebrowsing.googleapis.com/';
240
+ const parameters = {
241
+ options: Object.assign(
242
+ {
243
+ url: (rootUrl + '/v5/hashes:search').replace(/([^:]\/)\/+/g, '$1'),
244
+ method: 'GET',
245
+ },
246
+ options
247
+ ),
248
+ params,
249
+ requiredParams: [],
250
+ pathParams: [],
251
+ context: this.context,
252
+ };
253
+ if (callback) {
254
+ createAPIRequest<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>(
255
+ parameters,
256
+ callback as BodyResponseCallback<unknown>
257
+ );
258
+ } else {
259
+ return createAPIRequest<Schema$GoogleSecuritySafebrowsingV5SearchHashesResponse>(
260
+ parameters
261
+ );
262
+ }
263
+ }
264
+ }
265
+
266
+ export interface Params$Resource$Hashes$Search extends StandardParameters {
267
+ /**
268
+ * Required. The hash prefixes to be looked up.
269
+ */
270
+ hashPrefixes?: string[];
271
+ }
272
+ }