@googleapis/travelimpactmodel 1.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 ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0 (2022-12-22)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **travelimpactmodel:** update the API ([4904f8a](https://github.com/googleapis/google-api-nodejs-client/commit/4904f8a81351dc38b4f9a22a71f5d3413727caef))
package/README.md ADDED
@@ -0,0 +1,28 @@
1
+ <img src="https://avatars0.githubusercontent.com/u/1342004?v=3&s=96" alt="Google Inc. logo" title="Google" align="right" height="96" width="96"/>
2
+
3
+ # travelimpactmodel
4
+
5
+ > Travel Impact Model API lets you query travel carbon emission estimates.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ $ npm install @googleapis/travelimpactmodel
11
+ ```
12
+
13
+ ## Usage
14
+ All documentation and usage information can be found on [GitHub](https://github.com/googleapis/google-api-nodejs-client).
15
+ Information on classes can be found in [Googleapis Documentation](https://googleapis.dev/nodejs/googleapis/latest/travelimpactmodel/classes/Travelimpactmodel.html).
16
+
17
+ ## License
18
+ This library is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/googleapis/google-api-nodejs-client/blob/main/LICENSE).
19
+
20
+ ## Contributing
21
+ We love contributions! Before submitting a Pull Request, it's always good to start with a new issue first. To learn more, see [CONTRIBUTING](https://github.com/google/google-api-nodejs-client/blob/main/.github/CONTRIBUTING.md).
22
+
23
+ ## Questions/problems?
24
+ * Ask your development related questions on [StackOverflow](http://stackoverflow.com/questions/tagged/google-api-nodejs-client).
25
+ * If you've found an bug/issue, please [file it on GitHub](https://github.com/googleapis/google-api-nodejs-client/issues).
26
+
27
+
28
+ *Crafted with ❤️ by the Google Node.js team*
@@ -0,0 +1,12 @@
1
+ /*! THIS FILE IS AUTO-GENERATED */
2
+ import { AuthPlus } from 'googleapis-common';
3
+ import { travelimpactmodel_v1 } from './v1';
4
+ export declare const VERSIONS: {
5
+ v1: typeof travelimpactmodel_v1.Travelimpactmodel;
6
+ };
7
+ export declare function travelimpactmodel(version: 'v1'): travelimpactmodel_v1.Travelimpactmodel;
8
+ export declare function travelimpactmodel(options: travelimpactmodel_v1.Options): travelimpactmodel_v1.Travelimpactmodel;
9
+ declare const auth: AuthPlus;
10
+ export { auth };
11
+ export { travelimpactmodel_v1 };
12
+ export { AuthPlus, GlobalOptions, APIRequestContext, GoogleConfigurable, StreamMethodOptions, GaxiosPromise, MethodOptions, BodyResponseCallback, } from 'googleapis-common';
package/build/index.js ADDED
@@ -0,0 +1,31 @@
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.AuthPlus = exports.travelimpactmodel_v1 = exports.auth = exports.travelimpactmodel = exports.VERSIONS = void 0;
16
+ /*! THIS FILE IS AUTO-GENERATED */
17
+ const googleapis_common_1 = require("googleapis-common");
18
+ const v1_1 = require("./v1");
19
+ Object.defineProperty(exports, "travelimpactmodel_v1", { enumerable: true, get: function () { return v1_1.travelimpactmodel_v1; } });
20
+ exports.VERSIONS = {
21
+ v1: v1_1.travelimpactmodel_v1.Travelimpactmodel,
22
+ };
23
+ function travelimpactmodel(versionOrOptions) {
24
+ return (0, googleapis_common_1.getAPI)('travelimpactmodel', versionOrOptions, exports.VERSIONS, this);
25
+ }
26
+ exports.travelimpactmodel = travelimpactmodel;
27
+ const auth = new googleapis_common_1.AuthPlus();
28
+ exports.auth = auth;
29
+ var googleapis_common_2 = require("googleapis-common");
30
+ Object.defineProperty(exports, "AuthPlus", { enumerable: true, get: function () { return googleapis_common_2.AuthPlus; } });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,6BAA0C;AAqBlC,qGArBA,yBAAoB,OAqBA;AAnBf,QAAA,QAAQ,GAAG;IACtB,EAAE,EAAE,yBAAoB,CAAC,iBAAiB;CAC3C,CAAC;AAQF,SAAgB,iBAAiB,CAE/B,gBAAqD;IAErD,OAAO,IAAA,0BAAM,EAAI,mBAAmB,EAAE,gBAAgB,EAAE,gBAAQ,EAAE,IAAI,CAAC,CAAC;AAC1E,CAAC;AALD,8CAKC;AAED,MAAM,IAAI,GAAG,IAAI,4BAAQ,EAAE,CAAC;AACpB,oBAAI;AAEZ,uDAS2B;AARzB,6GAAA,QAAQ,OAAA"}
package/build/v1.d.ts ADDED
@@ -0,0 +1,266 @@
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 travelimpactmodel_v1 {
5
+ export interface Options extends GlobalOptions {
6
+ version: 'v1';
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
+ * Travel Impact Model API
60
+ *
61
+ * Travel Impact Model API lets you query travel carbon emission estimates.
62
+ *
63
+ * @example
64
+ * ```js
65
+ * const {google} = require('googleapis');
66
+ * const travelimpactmodel = google.travelimpactmodel('v1');
67
+ * ```
68
+ */
69
+ export class Travelimpactmodel {
70
+ context: APIRequestContext;
71
+ flights: Resource$Flights;
72
+ constructor(options: GlobalOptions, google?: GoogleConfigurable);
73
+ }
74
+ /**
75
+ * Input definition for the ComputeFlightEmissions request.
76
+ */
77
+ export interface Schema$ComputeFlightEmissionsRequest {
78
+ /**
79
+ * Required. Direct flights to return emission estimates for.
80
+ */
81
+ flights?: Schema$Flight[];
82
+ }
83
+ /**
84
+ * Output definition for the ComputeFlightEmissions response.
85
+ */
86
+ export interface Schema$ComputeFlightEmissionsResponse {
87
+ /**
88
+ * List of flight legs with emission estimates.
89
+ */
90
+ flightEmissions?: Schema$FlightWithEmissions[];
91
+ /**
92
+ * The model version under which emission estimates for all flights in this response were computed.
93
+ */
94
+ modelVersion?: Schema$ModelVersion;
95
+ }
96
+ /**
97
+ * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
98
+ */
99
+ export interface Schema$Date {
100
+ /**
101
+ * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
102
+ */
103
+ day?: number | null;
104
+ /**
105
+ * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
106
+ */
107
+ month?: number | null;
108
+ /**
109
+ * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
110
+ */
111
+ year?: number | null;
112
+ }
113
+ /**
114
+ * Grouped emissions per seating class results.
115
+ */
116
+ export interface Schema$EmissionsGramsPerPax {
117
+ /**
118
+ * Emissions for one passenger in business class in grams. This field is always computed and populated, regardless of whether the aircraft has business class seats or not.
119
+ */
120
+ business?: number | null;
121
+ /**
122
+ * Emissions for one passenger in economy class in grams. This field is always computed and populated, regardless of whether the aircraft has economy class seats or not.
123
+ */
124
+ economy?: number | null;
125
+ /**
126
+ * Emissions for one passenger in first class in grams. This field is always computed and populated, regardless of whether the aircraft has first class seats or not.
127
+ */
128
+ first?: number | null;
129
+ /**
130
+ * Emissions for one passenger in premium economy class in grams. This field is always computed and populated, regardless of whether the aircraft has premium economy class seats or not.
131
+ */
132
+ premiumEconomy?: number | null;
133
+ }
134
+ /**
135
+ * All details related to a single request item for a direct flight emission estimates.
136
+ */
137
+ export interface Schema$Flight {
138
+ /**
139
+ * Required. Date of the flight in the time zone of the origin airport. Must be a date in the present or future.
140
+ */
141
+ departureDate?: Schema$Date;
142
+ /**
143
+ * Required. IATA airport code for flight destination, e.g. "JFK".
144
+ */
145
+ destination?: string | null;
146
+ /**
147
+ * Required. Flight number, e.g. 324.
148
+ */
149
+ flightNumber?: number | null;
150
+ /**
151
+ * Required. IATA carrier code, e.g. "AA".
152
+ */
153
+ operatingCarrierCode?: string | null;
154
+ /**
155
+ * Required. IATA airport code for flight origin, e.g. "LHR".
156
+ */
157
+ origin?: string | null;
158
+ }
159
+ /**
160
+ * Direct flight with emission estimates.
161
+ */
162
+ export interface Schema$FlightWithEmissions {
163
+ /**
164
+ * Optional. Per-passenger emission estimate numbers. Will not be present if emissions could not be computed. For the list of reasons why emissions could not be computed, see ComputeFlightEmissions.
165
+ */
166
+ emissionsGramsPerPax?: Schema$EmissionsGramsPerPax;
167
+ /**
168
+ * Required. Matches the flight identifiers in the request. Note: all IATA codes are capitalized.
169
+ */
170
+ flight?: Schema$Flight;
171
+ }
172
+ /**
173
+ * Travel Impact Model version. For more information about the model versioning see https://github.com/google/travel-impact-model/#versioning.
174
+ */
175
+ export interface Schema$ModelVersion {
176
+ /**
177
+ * Dated versions: Model datasets are recreated with refreshed input data but no change to the algorithms regularly.
178
+ */
179
+ dated?: string | null;
180
+ /**
181
+ * Major versions: Major changes to methodology (e.g. adding new data sources to the model that lead to major output changes). Such changes will be infrequent and announced well in advance. Might involve API version changes, which will respect guidelines in https://cloud.google.com/endpoints/docs/openapi/versioning-an-api#backwards-incompatible
182
+ */
183
+ major?: number | null;
184
+ /**
185
+ * Minor versions: Changes to the model that, while being consistent across schema versions, change the model parameters or implementation.
186
+ */
187
+ minor?: number | null;
188
+ /**
189
+ * Patch versions: Implementation changes meant to address bugs or inaccuracies in the model implementation.
190
+ */
191
+ patch?: number | null;
192
+ }
193
+ export class Resource$Flights {
194
+ context: APIRequestContext;
195
+ constructor(context: APIRequestContext);
196
+ /**
197
+ * Stateless method to retrieve emission estimates. Details on how emission estimates are computed: https://github.com/google/travel-impact-model The response will contain all entries that match the input flight legs, in the same order. If there are no estimates available for a certain flight leg, the response will return the flight leg object with empty emission fields. The request will still be considered successful. Reasons for missing emission estimates include: - The flight is unknown to the server. - The input flight leg is missing one or more identifiers. - The flight date is in the past. - The aircraft type is not supported by the model. - Missing seat configuration. The request can contain up to 1000 flight legs. If the request has more than 1000 direct flights, if will fail with an INVALID_ARGUMENT error.
198
+ * @example
199
+ * ```js
200
+ * // Before running the sample:
201
+ * // - Enable the API at:
202
+ * // https://console.developers.google.com/apis/api/travelimpactmodel.googleapis.com
203
+ * // - Login into gcloud by running:
204
+ * // `$ gcloud auth application-default login`
205
+ * // - Install the npm module by running:
206
+ * // `$ npm install googleapis`
207
+ *
208
+ * const {google} = require('googleapis');
209
+ * const travelimpactmodel = google.travelimpactmodel('v1');
210
+ *
211
+ * async function main() {
212
+ * const auth = new google.auth.GoogleAuth({
213
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
214
+ * scopes: [],
215
+ * });
216
+ *
217
+ * // Acquire an auth client, and bind it to all future calls
218
+ * const authClient = await auth.getClient();
219
+ * google.options({auth: authClient});
220
+ *
221
+ * // Do the magic
222
+ * const res = await travelimpactmodel.flights.computeFlightEmissions({
223
+ * // Request body metadata
224
+ * requestBody: {
225
+ * // request body parameters
226
+ * // {
227
+ * // "flights": []
228
+ * // }
229
+ * },
230
+ * });
231
+ * console.log(res.data);
232
+ *
233
+ * // Example response
234
+ * // {
235
+ * // "flightEmissions": [],
236
+ * // "modelVersion": {}
237
+ * // }
238
+ * }
239
+ *
240
+ * main().catch(e => {
241
+ * console.error(e);
242
+ * throw e;
243
+ * });
244
+ *
245
+ * ```
246
+ *
247
+ * @param params - Parameters for request
248
+ * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
249
+ * @param callback - Optional callback that handles the response.
250
+ * @returns A promise if used with async/await, or void if used with a callback.
251
+ */
252
+ computeFlightEmissions(params: Params$Resource$Flights$Computeflightemissions, options: StreamMethodOptions): GaxiosPromise<Readable>;
253
+ computeFlightEmissions(params?: Params$Resource$Flights$Computeflightemissions, options?: MethodOptions): GaxiosPromise<Schema$ComputeFlightEmissionsResponse>;
254
+ computeFlightEmissions(params: Params$Resource$Flights$Computeflightemissions, options: StreamMethodOptions | BodyResponseCallback<Readable>, callback: BodyResponseCallback<Readable>): void;
255
+ computeFlightEmissions(params: Params$Resource$Flights$Computeflightemissions, options: MethodOptions | BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>, callback: BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>): void;
256
+ computeFlightEmissions(params: Params$Resource$Flights$Computeflightemissions, callback: BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>): void;
257
+ computeFlightEmissions(callback: BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>): void;
258
+ }
259
+ export interface Params$Resource$Flights$Computeflightemissions extends StandardParameters {
260
+ /**
261
+ * Request body metadata
262
+ */
263
+ requestBody?: Schema$ComputeFlightEmissionsRequest;
264
+ }
265
+ export {};
266
+ }
package/build/v1.js ADDED
@@ -0,0 +1,83 @@
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.travelimpactmodel_v1 = 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 travelimpactmodel_v1;
23
+ (function (travelimpactmodel_v1) {
24
+ /**
25
+ * Travel Impact Model API
26
+ *
27
+ * Travel Impact Model API lets you query travel carbon emission estimates.
28
+ *
29
+ * @example
30
+ * ```js
31
+ * const {google} = require('googleapis');
32
+ * const travelimpactmodel = google.travelimpactmodel('v1');
33
+ * ```
34
+ */
35
+ class Travelimpactmodel {
36
+ constructor(options, google) {
37
+ this.context = {
38
+ _options: options || {},
39
+ google,
40
+ };
41
+ this.flights = new Resource$Flights(this.context);
42
+ }
43
+ }
44
+ travelimpactmodel_v1.Travelimpactmodel = Travelimpactmodel;
45
+ class Resource$Flights {
46
+ constructor(context) {
47
+ this.context = context;
48
+ }
49
+ computeFlightEmissions(paramsOrCallback, optionsOrCallback, callback) {
50
+ let params = (paramsOrCallback ||
51
+ {});
52
+ let options = (optionsOrCallback || {});
53
+ if (typeof paramsOrCallback === 'function') {
54
+ callback = paramsOrCallback;
55
+ params = {};
56
+ options = {};
57
+ }
58
+ if (typeof optionsOrCallback === 'function') {
59
+ callback = optionsOrCallback;
60
+ options = {};
61
+ }
62
+ const rootUrl = options.rootUrl || 'https://travelimpactmodel.googleapis.com/';
63
+ const parameters = {
64
+ options: Object.assign({
65
+ url: (rootUrl + '/v1/flights:computeFlightEmissions').replace(/([^:]\/)\/+/g, '$1'),
66
+ method: 'POST',
67
+ }, options),
68
+ params,
69
+ requiredParams: [],
70
+ pathParams: [],
71
+ context: this.context,
72
+ };
73
+ if (callback) {
74
+ (0, googleapis_common_1.createAPIRequest)(parameters, callback);
75
+ }
76
+ else {
77
+ return (0, googleapis_common_1.createAPIRequest)(parameters);
78
+ }
79
+ }
80
+ }
81
+ travelimpactmodel_v1.Resource$Flights = Resource$Flights;
82
+ })(travelimpactmodel_v1 = exports.travelimpactmodel_v1 || (exports.travelimpactmodel_v1 = {}));
83
+ //# sourceMappingURL=v1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1.js","sourceRoot":"","sources":["../v1.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,oBAAoB,CAgXpC;AAhXD,WAAiB,oBAAoB;IAgEnC;;;;;;;;;;OAUG;IACH,MAAa,iBAAiB;QAI5B,YAAY,OAAsB,EAAE,MAA2B;YAC7D,IAAI,CAAC,OAAO,GAAG;gBACb,QAAQ,EAAE,OAAO,IAAI,EAAE;gBACvB,MAAM;aACP,CAAC;YAEF,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;KACF;IAZY,sCAAiB,oBAY7B,CAAA;IA0HD,MAAa,gBAAgB;QAE3B,YAAY,OAA0B;YACpC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACzB,CAAC;QAqFD,sBAAsB,CACpB,gBAGkC,EAClC,iBAIkC,EAClC,QAEkC;YAKlC,IAAI,MAAM,GAAG,CAAC,gBAAgB;gBAC5B,EAAE,CAAmD,CAAC;YACxD,IAAI,OAAO,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAkB,CAAC;YAEzD,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;gBAC1C,QAAQ,GAAG,gBAAgB,CAAC;gBAC5B,MAAM,GAAG,EAAoD,CAAC;gBAC9D,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,GACX,OAAO,CAAC,OAAO,IAAI,2CAA2C,CAAC;YACjE,MAAM,UAAU,GAAG;gBACjB,OAAO,EAAE,MAAM,CAAC,MAAM,CACpB;oBACE,GAAG,EAAE,CAAC,OAAO,GAAG,oCAAoC,CAAC,CAAC,OAAO,CAC3D,cAAc,EACd,IAAI,CACL;oBACD,MAAM,EAAE,MAAM;iBACf,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;IAtJY,qCAAgB,mBAsJ5B,CAAA;AASH,CAAC,EAhXgB,oBAAoB,GAApB,4BAAoB,KAApB,4BAAoB,QAgXpC"}
package/index.ts ADDED
@@ -0,0 +1,48 @@
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
+ /*! THIS FILE IS AUTO-GENERATED */
15
+
16
+ import {AuthPlus, getAPI, GoogleConfigurable} from 'googleapis-common';
17
+ import {travelimpactmodel_v1} from './v1';
18
+
19
+ export const VERSIONS = {
20
+ v1: travelimpactmodel_v1.Travelimpactmodel,
21
+ };
22
+
23
+ export function travelimpactmodel(
24
+ version: 'v1'
25
+ ): travelimpactmodel_v1.Travelimpactmodel;
26
+ export function travelimpactmodel(
27
+ options: travelimpactmodel_v1.Options
28
+ ): travelimpactmodel_v1.Travelimpactmodel;
29
+ export function travelimpactmodel<T = travelimpactmodel_v1.Travelimpactmodel>(
30
+ this: GoogleConfigurable,
31
+ versionOrOptions: 'v1' | travelimpactmodel_v1.Options
32
+ ) {
33
+ return getAPI<T>('travelimpactmodel', versionOrOptions, VERSIONS, this);
34
+ }
35
+
36
+ const auth = new AuthPlus();
37
+ export {auth};
38
+ export {travelimpactmodel_v1};
39
+ export {
40
+ AuthPlus,
41
+ GlobalOptions,
42
+ APIRequestContext,
43
+ GoogleConfigurable,
44
+ StreamMethodOptions,
45
+ GaxiosPromise,
46
+ MethodOptions,
47
+ BodyResponseCallback,
48
+ } from 'googleapis-common';
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@googleapis/travelimpactmodel",
3
+ "version": "1.0.0",
4
+ "description": "travelimpactmodel",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
7
+ "keywords": [
8
+ "google"
9
+ ],
10
+ "author": "Google LLC",
11
+ "license": "Apache-2.0",
12
+ "homepage": "https://github.com/googleapis/google-api-nodejs-client",
13
+ "bugs": {
14
+ "url": "https://github.com/googleapis/google-api-nodejs-client/issues"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/googleapis/google-api-nodejs-client.git"
19
+ },
20
+ "engines": {
21
+ "node": ">=12.0.0"
22
+ },
23
+ "scripts": {
24
+ "fix": "gts fix",
25
+ "lint": "gts check",
26
+ "compile": "tsc -p .",
27
+ "prepare": "npm run compile",
28
+ "webpack": "webpack"
29
+ },
30
+ "dependencies": {
31
+ "googleapis-common": "^6.0.3"
32
+ },
33
+ "devDependencies": {
34
+ "@microsoft/api-documenter": "^7.8.10",
35
+ "@microsoft/api-extractor": "^7.8.10",
36
+ "gts": "^3.1.1",
37
+ "null-loader": "^4.0.0",
38
+ "ts-loader": "^9.0.0",
39
+ "typescript": "~4.8.4",
40
+ "webpack": "^5.0.0",
41
+ "webpack-cli": "^5.0.0"
42
+ }
43
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./node_modules/gts/tsconfig-google.json",
3
+ "compilerOptions": {
4
+ "rootDir": ".",
5
+ "outDir": "build"
6
+ },
7
+ "include": [
8
+ "*.ts",
9
+ ]
10
+ }
package/v1.ts ADDED
@@ -0,0 +1,406 @@
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 travelimpactmodel_v1 {
39
+ export interface Options extends GlobalOptions {
40
+ version: 'v1';
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
+ * Travel Impact Model API
104
+ *
105
+ * Travel Impact Model API lets you query travel carbon emission estimates.
106
+ *
107
+ * @example
108
+ * ```js
109
+ * const {google} = require('googleapis');
110
+ * const travelimpactmodel = google.travelimpactmodel('v1');
111
+ * ```
112
+ */
113
+ export class Travelimpactmodel {
114
+ context: APIRequestContext;
115
+ flights: Resource$Flights;
116
+
117
+ constructor(options: GlobalOptions, google?: GoogleConfigurable) {
118
+ this.context = {
119
+ _options: options || {},
120
+ google,
121
+ };
122
+
123
+ this.flights = new Resource$Flights(this.context);
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Input definition for the ComputeFlightEmissions request.
129
+ */
130
+ export interface Schema$ComputeFlightEmissionsRequest {
131
+ /**
132
+ * Required. Direct flights to return emission estimates for.
133
+ */
134
+ flights?: Schema$Flight[];
135
+ }
136
+ /**
137
+ * Output definition for the ComputeFlightEmissions response.
138
+ */
139
+ export interface Schema$ComputeFlightEmissionsResponse {
140
+ /**
141
+ * List of flight legs with emission estimates.
142
+ */
143
+ flightEmissions?: Schema$FlightWithEmissions[];
144
+ /**
145
+ * The model version under which emission estimates for all flights in this response were computed.
146
+ */
147
+ modelVersion?: Schema$ModelVersion;
148
+ }
149
+ /**
150
+ * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp
151
+ */
152
+ export interface Schema$Date {
153
+ /**
154
+ * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.
155
+ */
156
+ day?: number | null;
157
+ /**
158
+ * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.
159
+ */
160
+ month?: number | null;
161
+ /**
162
+ * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.
163
+ */
164
+ year?: number | null;
165
+ }
166
+ /**
167
+ * Grouped emissions per seating class results.
168
+ */
169
+ export interface Schema$EmissionsGramsPerPax {
170
+ /**
171
+ * Emissions for one passenger in business class in grams. This field is always computed and populated, regardless of whether the aircraft has business class seats or not.
172
+ */
173
+ business?: number | null;
174
+ /**
175
+ * Emissions for one passenger in economy class in grams. This field is always computed and populated, regardless of whether the aircraft has economy class seats or not.
176
+ */
177
+ economy?: number | null;
178
+ /**
179
+ * Emissions for one passenger in first class in grams. This field is always computed and populated, regardless of whether the aircraft has first class seats or not.
180
+ */
181
+ first?: number | null;
182
+ /**
183
+ * Emissions for one passenger in premium economy class in grams. This field is always computed and populated, regardless of whether the aircraft has premium economy class seats or not.
184
+ */
185
+ premiumEconomy?: number | null;
186
+ }
187
+ /**
188
+ * All details related to a single request item for a direct flight emission estimates.
189
+ */
190
+ export interface Schema$Flight {
191
+ /**
192
+ * Required. Date of the flight in the time zone of the origin airport. Must be a date in the present or future.
193
+ */
194
+ departureDate?: Schema$Date;
195
+ /**
196
+ * Required. IATA airport code for flight destination, e.g. "JFK".
197
+ */
198
+ destination?: string | null;
199
+ /**
200
+ * Required. Flight number, e.g. 324.
201
+ */
202
+ flightNumber?: number | null;
203
+ /**
204
+ * Required. IATA carrier code, e.g. "AA".
205
+ */
206
+ operatingCarrierCode?: string | null;
207
+ /**
208
+ * Required. IATA airport code for flight origin, e.g. "LHR".
209
+ */
210
+ origin?: string | null;
211
+ }
212
+ /**
213
+ * Direct flight with emission estimates.
214
+ */
215
+ export interface Schema$FlightWithEmissions {
216
+ /**
217
+ * Optional. Per-passenger emission estimate numbers. Will not be present if emissions could not be computed. For the list of reasons why emissions could not be computed, see ComputeFlightEmissions.
218
+ */
219
+ emissionsGramsPerPax?: Schema$EmissionsGramsPerPax;
220
+ /**
221
+ * Required. Matches the flight identifiers in the request. Note: all IATA codes are capitalized.
222
+ */
223
+ flight?: Schema$Flight;
224
+ }
225
+ /**
226
+ * Travel Impact Model version. For more information about the model versioning see https://github.com/google/travel-impact-model/#versioning.
227
+ */
228
+ export interface Schema$ModelVersion {
229
+ /**
230
+ * Dated versions: Model datasets are recreated with refreshed input data but no change to the algorithms regularly.
231
+ */
232
+ dated?: string | null;
233
+ /**
234
+ * Major versions: Major changes to methodology (e.g. adding new data sources to the model that lead to major output changes). Such changes will be infrequent and announced well in advance. Might involve API version changes, which will respect guidelines in https://cloud.google.com/endpoints/docs/openapi/versioning-an-api#backwards-incompatible
235
+ */
236
+ major?: number | null;
237
+ /**
238
+ * Minor versions: Changes to the model that, while being consistent across schema versions, change the model parameters or implementation.
239
+ */
240
+ minor?: number | null;
241
+ /**
242
+ * Patch versions: Implementation changes meant to address bugs or inaccuracies in the model implementation.
243
+ */
244
+ patch?: number | null;
245
+ }
246
+
247
+ export class Resource$Flights {
248
+ context: APIRequestContext;
249
+ constructor(context: APIRequestContext) {
250
+ this.context = context;
251
+ }
252
+
253
+ /**
254
+ * Stateless method to retrieve emission estimates. Details on how emission estimates are computed: https://github.com/google/travel-impact-model The response will contain all entries that match the input flight legs, in the same order. If there are no estimates available for a certain flight leg, the response will return the flight leg object with empty emission fields. The request will still be considered successful. Reasons for missing emission estimates include: - The flight is unknown to the server. - The input flight leg is missing one or more identifiers. - The flight date is in the past. - The aircraft type is not supported by the model. - Missing seat configuration. The request can contain up to 1000 flight legs. If the request has more than 1000 direct flights, if will fail with an INVALID_ARGUMENT error.
255
+ * @example
256
+ * ```js
257
+ * // Before running the sample:
258
+ * // - Enable the API at:
259
+ * // https://console.developers.google.com/apis/api/travelimpactmodel.googleapis.com
260
+ * // - Login into gcloud by running:
261
+ * // `$ gcloud auth application-default login`
262
+ * // - Install the npm module by running:
263
+ * // `$ npm install googleapis`
264
+ *
265
+ * const {google} = require('googleapis');
266
+ * const travelimpactmodel = google.travelimpactmodel('v1');
267
+ *
268
+ * async function main() {
269
+ * const auth = new google.auth.GoogleAuth({
270
+ * // Scopes can be specified either as an array or as a single, space-delimited string.
271
+ * scopes: [],
272
+ * });
273
+ *
274
+ * // Acquire an auth client, and bind it to all future calls
275
+ * const authClient = await auth.getClient();
276
+ * google.options({auth: authClient});
277
+ *
278
+ * // Do the magic
279
+ * const res = await travelimpactmodel.flights.computeFlightEmissions({
280
+ * // Request body metadata
281
+ * requestBody: {
282
+ * // request body parameters
283
+ * // {
284
+ * // "flights": []
285
+ * // }
286
+ * },
287
+ * });
288
+ * console.log(res.data);
289
+ *
290
+ * // Example response
291
+ * // {
292
+ * // "flightEmissions": [],
293
+ * // "modelVersion": {}
294
+ * // }
295
+ * }
296
+ *
297
+ * main().catch(e => {
298
+ * console.error(e);
299
+ * throw e;
300
+ * });
301
+ *
302
+ * ```
303
+ *
304
+ * @param params - Parameters for request
305
+ * @param options - Optionally override request options, such as `url`, `method`, and `encoding`.
306
+ * @param callback - Optional callback that handles the response.
307
+ * @returns A promise if used with async/await, or void if used with a callback.
308
+ */
309
+ computeFlightEmissions(
310
+ params: Params$Resource$Flights$Computeflightemissions,
311
+ options: StreamMethodOptions
312
+ ): GaxiosPromise<Readable>;
313
+ computeFlightEmissions(
314
+ params?: Params$Resource$Flights$Computeflightemissions,
315
+ options?: MethodOptions
316
+ ): GaxiosPromise<Schema$ComputeFlightEmissionsResponse>;
317
+ computeFlightEmissions(
318
+ params: Params$Resource$Flights$Computeflightemissions,
319
+ options: StreamMethodOptions | BodyResponseCallback<Readable>,
320
+ callback: BodyResponseCallback<Readable>
321
+ ): void;
322
+ computeFlightEmissions(
323
+ params: Params$Resource$Flights$Computeflightemissions,
324
+ options:
325
+ | MethodOptions
326
+ | BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>,
327
+ callback: BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>
328
+ ): void;
329
+ computeFlightEmissions(
330
+ params: Params$Resource$Flights$Computeflightemissions,
331
+ callback: BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>
332
+ ): void;
333
+ computeFlightEmissions(
334
+ callback: BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>
335
+ ): void;
336
+ computeFlightEmissions(
337
+ paramsOrCallback?:
338
+ | Params$Resource$Flights$Computeflightemissions
339
+ | BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>
340
+ | BodyResponseCallback<Readable>,
341
+ optionsOrCallback?:
342
+ | MethodOptions
343
+ | StreamMethodOptions
344
+ | BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>
345
+ | BodyResponseCallback<Readable>,
346
+ callback?:
347
+ | BodyResponseCallback<Schema$ComputeFlightEmissionsResponse>
348
+ | BodyResponseCallback<Readable>
349
+ ):
350
+ | void
351
+ | GaxiosPromise<Schema$ComputeFlightEmissionsResponse>
352
+ | GaxiosPromise<Readable> {
353
+ let params = (paramsOrCallback ||
354
+ {}) as Params$Resource$Flights$Computeflightemissions;
355
+ let options = (optionsOrCallback || {}) as MethodOptions;
356
+
357
+ if (typeof paramsOrCallback === 'function') {
358
+ callback = paramsOrCallback;
359
+ params = {} as Params$Resource$Flights$Computeflightemissions;
360
+ options = {};
361
+ }
362
+
363
+ if (typeof optionsOrCallback === 'function') {
364
+ callback = optionsOrCallback;
365
+ options = {};
366
+ }
367
+
368
+ const rootUrl =
369
+ options.rootUrl || 'https://travelimpactmodel.googleapis.com/';
370
+ const parameters = {
371
+ options: Object.assign(
372
+ {
373
+ url: (rootUrl + '/v1/flights:computeFlightEmissions').replace(
374
+ /([^:]\/)\/+/g,
375
+ '$1'
376
+ ),
377
+ method: 'POST',
378
+ },
379
+ options
380
+ ),
381
+ params,
382
+ requiredParams: [],
383
+ pathParams: [],
384
+ context: this.context,
385
+ };
386
+ if (callback) {
387
+ createAPIRequest<Schema$ComputeFlightEmissionsResponse>(
388
+ parameters,
389
+ callback as BodyResponseCallback<unknown>
390
+ );
391
+ } else {
392
+ return createAPIRequest<Schema$ComputeFlightEmissionsResponse>(
393
+ parameters
394
+ );
395
+ }
396
+ }
397
+ }
398
+
399
+ export interface Params$Resource$Flights$Computeflightemissions
400
+ extends StandardParameters {
401
+ /**
402
+ * Request body metadata
403
+ */
404
+ requestBody?: Schema$ComputeFlightEmissionsRequest;
405
+ }
406
+ }
@@ -0,0 +1,79 @@
1
+ // Copyright 2019 Google LLC
2
+ //
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
+
15
+ // Use `npm run webpack` to produce Webpack bundle for this library.
16
+
17
+ const path = require('path');
18
+
19
+ module.exports = {
20
+ entry: './index.ts',
21
+ resolve: {
22
+ extensions: ['.ts', '.js', '.json'],
23
+ fallback: {
24
+ crypto: false,
25
+ child_process: false,
26
+ fs: false,
27
+ http2: false,
28
+ buffer: 'browserify',
29
+ process: false,
30
+ os: false,
31
+ querystring: false,
32
+ path: false,
33
+ stream: 'stream-browserify',
34
+ url: false,
35
+ util: false,
36
+ zlib: false,
37
+ },
38
+ },
39
+ output: {
40
+ library: 'Travelimpactmodel',
41
+ filename: 'travelimpactmodel.min.js',
42
+ path: path.resolve(__dirname, 'dist'),
43
+ },
44
+ module: {
45
+ rules: [
46
+ {
47
+ test: /node_modules[\\/]google-auth-library[\\/]src[\\/]crypto[\\/]node[\\/]crypto/,
48
+ use: 'null-loader',
49
+ },
50
+ {
51
+ test: /node_modules[\\/]https-proxy-agent[\\/]/,
52
+ use: 'null-loader',
53
+ },
54
+ {
55
+ test: /node_modules[\\/]gcp-metadata[\\/]/,
56
+ use: 'null-loader',
57
+ },
58
+ {
59
+ test: /node_modules[\\/]gtoken[\\/]/,
60
+ use: 'null-loader',
61
+ },
62
+ {
63
+ test: /node_modules[\\/]pkginfo[\\/]/,
64
+ use: 'null-loader',
65
+ },
66
+ {
67
+ test: /node_modules[\\/]semver[\\/]/,
68
+ use: 'null-loader',
69
+ },
70
+ {
71
+ test: /\.ts$/,
72
+ use: 'ts-loader',
73
+ exclude: /node_modules/,
74
+ },
75
+ ],
76
+ },
77
+ mode: 'production',
78
+ plugins: [],
79
+ };