@rewiringamerica/rem-test1 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,299 @@
1
+ import localVarRequest from 'request';
2
+
3
+ export * from './buildingFeatures';
4
+ export * from './buildingProfile';
5
+ export * from './buildlingProfileRequest';
6
+ export * from './fuelData';
7
+ export * from './hTTPValidationError';
8
+ export * from './impact';
9
+ export * from './metrics';
10
+ export * from './savings';
11
+ export * from './upgrade';
12
+ export * from './validationError';
13
+ export * from './validationErrorLocInner';
14
+
15
+ import * as fs from 'fs';
16
+
17
+ export interface RequestDetailedFile {
18
+ value: Buffer;
19
+ options?: {
20
+ filename?: string;
21
+ contentType?: string;
22
+ }
23
+ }
24
+
25
+ export type RequestFile = string | Buffer | fs.ReadStream | RequestDetailedFile;
26
+
27
+
28
+ import { BuildingFeatures } from './buildingFeatures';
29
+ import { BuildingProfile } from './buildingProfile';
30
+ import { BuildlingProfileRequest } from './buildlingProfileRequest';
31
+ import { FuelData } from './fuelData';
32
+ import { HTTPValidationError } from './hTTPValidationError';
33
+ import { Impact } from './impact';
34
+ import { Metrics } from './metrics';
35
+ import { Savings } from './savings';
36
+ import { Upgrade } from './upgrade';
37
+ import { ValidationError } from './validationError';
38
+ import { ValidationErrorLocInner } from './validationErrorLocInner';
39
+
40
+ /* tslint:disable:no-unused-variable */
41
+ let primitives = [
42
+ "string",
43
+ "boolean",
44
+ "double",
45
+ "integer",
46
+ "long",
47
+ "float",
48
+ "number",
49
+ "any"
50
+ ];
51
+
52
+ let enumsMap: {[index: string]: any} = {
53
+ "Upgrade": Upgrade,
54
+ }
55
+
56
+ let typeMap: {[index: string]: any} = {
57
+ "BuildingFeatures": BuildingFeatures,
58
+ "BuildingProfile": BuildingProfile,
59
+ "BuildlingProfileRequest": BuildlingProfileRequest,
60
+ "FuelData": FuelData,
61
+ "HTTPValidationError": HTTPValidationError,
62
+ "Impact": Impact,
63
+ "Metrics": Metrics,
64
+ "Savings": Savings,
65
+ "ValidationError": ValidationError,
66
+ "ValidationErrorLocInner": ValidationErrorLocInner,
67
+ }
68
+
69
+ // Check if a string starts with another string without using es6 features
70
+ function startsWith(str: string, match: string): boolean {
71
+ return str.substring(0, match.length) === match;
72
+ }
73
+
74
+ // Check if a string ends with another string without using es6 features
75
+ function endsWith(str: string, match: string): boolean {
76
+ return str.length >= match.length && str.substring(str.length - match.length) === match;
77
+ }
78
+
79
+ const nullableSuffix = " | null";
80
+ const optionalSuffix = " | undefined";
81
+ const arrayPrefix = "Array<";
82
+ const arraySuffix = ">";
83
+ const mapPrefix = "{ [key: string]: ";
84
+ const mapSuffix = "; }";
85
+
86
+ export class ObjectSerializer {
87
+ public static findCorrectType(data: any, expectedType: string) {
88
+ if (data == undefined) {
89
+ return expectedType;
90
+ } else if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
91
+ return expectedType;
92
+ } else if (expectedType === "Date") {
93
+ return expectedType;
94
+ } else {
95
+ if (enumsMap[expectedType]) {
96
+ return expectedType;
97
+ }
98
+
99
+ if (!typeMap[expectedType]) {
100
+ return expectedType; // w/e we don't know the type
101
+ }
102
+
103
+ // Check the discriminator
104
+ let discriminatorProperty = typeMap[expectedType].discriminator;
105
+ if (discriminatorProperty == null) {
106
+ return expectedType; // the type does not have a discriminator. use it.
107
+ } else {
108
+ if (data[discriminatorProperty]) {
109
+ var discriminatorType = data[discriminatorProperty];
110
+ if(typeMap[discriminatorType]){
111
+ return discriminatorType; // use the type given in the discriminator
112
+ } else {
113
+ return expectedType; // discriminator did not map to a type
114
+ }
115
+ } else {
116
+ return expectedType; // discriminator was not present (or an empty string)
117
+ }
118
+ }
119
+ }
120
+ }
121
+
122
+ public static serialize(data: any, type: string): any {
123
+ if (data == undefined) {
124
+ return data;
125
+ } else if (primitives.indexOf(type.toLowerCase()) !== -1) {
126
+ return data;
127
+ } else if (endsWith(type, nullableSuffix)) {
128
+ let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type
129
+ return ObjectSerializer.serialize(data, subType);
130
+ } else if (endsWith(type, optionalSuffix)) {
131
+ let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type
132
+ return ObjectSerializer.serialize(data, subType);
133
+ } else if (startsWith(type, arrayPrefix)) {
134
+ let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array<Type> => Type
135
+ let transformedData: any[] = [];
136
+ for (let index = 0; index < data.length; index++) {
137
+ let datum = data[index];
138
+ transformedData.push(ObjectSerializer.serialize(datum, subType));
139
+ }
140
+ return transformedData;
141
+ } else if (startsWith(type, mapPrefix)) {
142
+ let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type
143
+ let transformedData: { [key: string]: any } = {};
144
+ for (let key in data) {
145
+ transformedData[key] = ObjectSerializer.serialize(
146
+ data[key],
147
+ subType,
148
+ );
149
+ }
150
+ return transformedData;
151
+ } else if (type === "Date") {
152
+ return data.toISOString();
153
+ } else {
154
+ if (enumsMap[type]) {
155
+ return data;
156
+ }
157
+ if (!typeMap[type]) { // in case we dont know the type
158
+ return data;
159
+ }
160
+
161
+ // Get the actual type of this object
162
+ type = this.findCorrectType(data, type);
163
+
164
+ // get the map for the correct type.
165
+ let attributeTypes = typeMap[type].getAttributeTypeMap();
166
+ let instance: {[index: string]: any} = {};
167
+ for (let index = 0; index < attributeTypes.length; index++) {
168
+ let attributeType = attributeTypes[index];
169
+ instance[attributeType.baseName] = ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
170
+ }
171
+ return instance;
172
+ }
173
+ }
174
+
175
+ public static deserialize(data: any, type: string): any {
176
+ // polymorphism may change the actual type.
177
+ type = ObjectSerializer.findCorrectType(data, type);
178
+ if (data == undefined) {
179
+ return data;
180
+ } else if (primitives.indexOf(type.toLowerCase()) !== -1) {
181
+ return data;
182
+ } else if (endsWith(type, nullableSuffix)) {
183
+ let subType: string = type.slice(0, -nullableSuffix.length); // Type | null => Type
184
+ return ObjectSerializer.deserialize(data, subType);
185
+ } else if (endsWith(type, optionalSuffix)) {
186
+ let subType: string = type.slice(0, -optionalSuffix.length); // Type | undefined => Type
187
+ return ObjectSerializer.deserialize(data, subType);
188
+ } else if (startsWith(type, arrayPrefix)) {
189
+ let subType: string = type.slice(arrayPrefix.length, -arraySuffix.length); // Array<Type> => Type
190
+ let transformedData: any[] = [];
191
+ for (let index = 0; index < data.length; index++) {
192
+ let datum = data[index];
193
+ transformedData.push(ObjectSerializer.deserialize(datum, subType));
194
+ }
195
+ return transformedData;
196
+ } else if (startsWith(type, mapPrefix)) {
197
+ let subType: string = type.slice(mapPrefix.length, -mapSuffix.length); // { [key: string]: Type; } => Type
198
+ let transformedData: { [key: string]: any } = {};
199
+ for (let key in data) {
200
+ transformedData[key] = ObjectSerializer.deserialize(
201
+ data[key],
202
+ subType,
203
+ );
204
+ }
205
+ return transformedData;
206
+ } else if (type === "Date") {
207
+ return new Date(data);
208
+ } else {
209
+ if (enumsMap[type]) {// is Enum
210
+ return data;
211
+ }
212
+
213
+ if (!typeMap[type]) { // dont know the type
214
+ return data;
215
+ }
216
+ let instance = new typeMap[type]();
217
+ let attributeTypes = typeMap[type].getAttributeTypeMap();
218
+ for (let index = 0; index < attributeTypes.length; index++) {
219
+ let attributeType = attributeTypes[index];
220
+ instance[attributeType.name] = ObjectSerializer.deserialize(data[attributeType.baseName], attributeType.type);
221
+ }
222
+ return instance;
223
+ }
224
+ }
225
+ }
226
+
227
+ export interface Authentication {
228
+ /**
229
+ * Apply authentication settings to header and query params.
230
+ */
231
+ applyToRequest(requestOptions: localVarRequest.Options): Promise<void> | void;
232
+ }
233
+
234
+ export class HttpBasicAuth implements Authentication {
235
+ public username: string = '';
236
+ public password: string = '';
237
+
238
+ applyToRequest(requestOptions: localVarRequest.Options): void {
239
+ requestOptions.auth = {
240
+ username: this.username, password: this.password
241
+ }
242
+ }
243
+ }
244
+
245
+ export class HttpBearerAuth implements Authentication {
246
+ public accessToken: string | (() => string) = '';
247
+
248
+ applyToRequest(requestOptions: localVarRequest.Options): void {
249
+ if (requestOptions && requestOptions.headers) {
250
+ const accessToken = typeof this.accessToken === 'function'
251
+ ? this.accessToken()
252
+ : this.accessToken;
253
+ requestOptions.headers["Authorization"] = "Bearer " + accessToken;
254
+ }
255
+ }
256
+ }
257
+
258
+ export class ApiKeyAuth implements Authentication {
259
+ public apiKey: string = '';
260
+
261
+ constructor(private location: string, private paramName: string) {
262
+ }
263
+
264
+ applyToRequest(requestOptions: localVarRequest.Options): void {
265
+ if (this.location == "query") {
266
+ (<any>requestOptions.qs)[this.paramName] = this.apiKey;
267
+ } else if (this.location == "header" && requestOptions && requestOptions.headers) {
268
+ requestOptions.headers[this.paramName] = this.apiKey;
269
+ } else if (this.location == 'cookie' && requestOptions && requestOptions.headers) {
270
+ if (requestOptions.headers['Cookie']) {
271
+ requestOptions.headers['Cookie'] += '; ' + this.paramName + '=' + encodeURIComponent(this.apiKey);
272
+ }
273
+ else {
274
+ requestOptions.headers['Cookie'] = this.paramName + '=' + encodeURIComponent(this.apiKey);
275
+ }
276
+ }
277
+ }
278
+ }
279
+
280
+ export class OAuth implements Authentication {
281
+ public accessToken: string = '';
282
+
283
+ applyToRequest(requestOptions: localVarRequest.Options): void {
284
+ if (requestOptions && requestOptions.headers) {
285
+ requestOptions.headers["Authorization"] = "Bearer " + this.accessToken;
286
+ }
287
+ }
288
+ }
289
+
290
+ export class VoidAuth implements Authentication {
291
+ public username: string = '';
292
+ public password: string = '';
293
+
294
+ applyToRequest(_: localVarRequest.Options): void {
295
+ // Do nothing
296
+ }
297
+ }
298
+
299
+ export type Interceptor = (requestOptions: localVarRequest.Options) => (Promise<void> | void);
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Dohyo
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import { FuelData } from './fuelData';
14
+ import { Impact } from './impact';
15
+
16
+ /**
17
+ * A class to represent savings data. Attributes ---------- baseline (Impact): The data if no upgrade is passed into the surrogate model. upgrade (Impact): The data if an upgrade is passed into the surrogate model. delta (Impact): The deltas if an upgrade is passed into the surrogate model. rates (List[FuelData]): The cost/fuel unit rates for each fuel type. emissions_factors (List[FuelData]): The kgCO2e/fuel unit rates for each fuel type.
18
+ */
19
+ export class Savings {
20
+ 'baseline': Impact;
21
+ 'upgrade': Impact;
22
+ 'delta': Impact;
23
+ 'rates': Array<FuelData>;
24
+ 'emissionsFactors': Array<FuelData>;
25
+
26
+ static discriminator: string | undefined = undefined;
27
+
28
+ static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
29
+ {
30
+ "name": "baseline",
31
+ "baseName": "baseline",
32
+ "type": "Impact"
33
+ },
34
+ {
35
+ "name": "upgrade",
36
+ "baseName": "upgrade",
37
+ "type": "Impact"
38
+ },
39
+ {
40
+ "name": "delta",
41
+ "baseName": "delta",
42
+ "type": "Impact"
43
+ },
44
+ {
45
+ "name": "rates",
46
+ "baseName": "rates",
47
+ "type": "Array<FuelData>"
48
+ },
49
+ {
50
+ "name": "emissionsFactors",
51
+ "baseName": "emissions_factors",
52
+ "type": "Array<FuelData>"
53
+ } ];
54
+
55
+ static getAttributeTypeMap() {
56
+ return Savings.attributeTypeMap;
57
+ }
58
+ }
59
+
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Dohyo
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+
14
+ /**
15
+ * Names for each upgrade type.
16
+ */
17
+ export enum Upgrade {
18
+ Baseline20221 = <any> 'baseline_2022_1',
19
+ Baseline20242NoSetback = <any> 'baseline_2024_2_no_setback',
20
+ BasicEnclosure = <any> 'basic_enclosure',
21
+ EnhancedEnclosure = <any> 'enhanced_enclosure',
22
+ MinEffHpElecBackup = <any> 'min_eff_hp_elec_backup',
23
+ HighEffHpElecBackup = <any> 'high_eff_hp_elec_backup',
24
+ MinEffHpExistingBackup = <any> 'min_eff_hp_existing_backup',
25
+ HpWaterHeater = <any> 'hp_water_heater',
26
+ WholeHomeElectricMinEff = <any> 'whole_home_electric_min_eff',
27
+ WholeHomeElectricHighEff = <any> 'whole_home_electric_high_eff',
28
+ WholeHomeElectricMaxEffBasicEnclosure = <any> 'whole_home_electric_max_eff_basic_enclosure',
29
+ WholeHomeElectricMaxEffEnhancedEnclosure = <any> 'whole_home_electric_max_eff_enhanced_enclosure',
30
+ MedEffHpMaxLoadSizingWithSetback = <any> 'med_eff_hp_max_load_sizing_with_setback',
31
+ MedEffHpHersSizingWithSetback = <any> 'med_eff_hp_hers_sizing_with_setback',
32
+ MedEffHpAccaSizingWithSetback = <any> 'med_eff_hp_acca_sizing_with_setback',
33
+ MedEffHpMaxLoadSizingNoSetback = <any> 'med_eff_hp_max_load_sizing_no_setback',
34
+ MedEffHpHersSizingNoSetback = <any> 'med_eff_hp_hers_sizing_no_setback',
35
+ MedEffHpAccaSizingNoSetback = <any> 'med_eff_hp_acca_sizing_no_setback',
36
+ RooftopSolar = <any> 'rooftop_solar',
37
+ MedEffHpHersSizingNoSetbackBasicEnclosure = <any> 'med_eff_hp_hers_sizing_no_setback_basic_enclosure',
38
+ HighEffGshpHersSizingWithSetback = <any> 'high_eff_gshp_hers_sizing_with_setback',
39
+ HighEffGshpHersSizingNoSetback = <any> 'high_eff_gshp_hers_sizing_no_setback',
40
+ ColdClimateHpHersNoSetback = <any> 'cold_climate_hp_hers_no_setback',
41
+ ColdClimateHpAccaNoSetback = <any> 'cold_climate_hp_acca_no_setback',
42
+ ColdClimateHpHersWithSetback = <any> 'cold_climate_hp_hers_with_setback',
43
+ DaikinColdClimateHpHersNoSetback = <any> 'daikin_cold_climate_hp_hers_no_setback',
44
+ CarrierColdClimateHpHersNoSetback = <any> 'carrier_cold_climate_hp_hers_no_setback',
45
+ YorkColdClimateHpHersNoSetback = <any> 'york_cold_climate_hp_hers_no_setback'
46
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Dohyo
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+
14
+ /**
15
+ * A class representing enums of different upgrade types. Attributes ---------- baseline (str): The baseline surrogate model features. basic_enclosure (str): An upgrade with basic enclosure. min_efficiency_hp_and_elec_backup (str): An upgrade with heat pumps, min-efficiency, and electric backup. high_efficiency_hp_and_elec_backup (str): An upgrade with heat pumps, high-efficiency, and electric backup. hp_water_heater (str): An upgrade with a heat pump water heater. whole_home_electrification (str): An upgrade with basic enclosure, min-efficiency heat pumps, heat pump water heaters, heat pump dryers, and induction ranges.
16
+ */
17
+ export enum UpgradeType {
18
+ Baseline = <any> 'baseline',
19
+ BasicEnclosure = <any> 'basic_enclosure',
20
+ MinEfficiencyHpAndElecBackup = <any> 'min_efficiency_hp_and_elec_backup',
21
+ HighEfficiencyHpAndElecBackup = <any> 'high_efficiency_hp_and_elec_backup',
22
+ HpWaterHeater = <any> 'hp_water_heater',
23
+ WholeHomeElectrification = <any> 'whole_home_electrification'
24
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Dohyo
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import { ValidationErrorLocInner } from './validationErrorLocInner';
14
+
15
+ export class ValidationError {
16
+ 'loc': Array<ValidationErrorLocInner>;
17
+ 'msg': string;
18
+ 'type': string;
19
+
20
+ static discriminator: string | undefined = undefined;
21
+
22
+ static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
23
+ {
24
+ "name": "loc",
25
+ "baseName": "loc",
26
+ "type": "Array<ValidationErrorLocInner>"
27
+ },
28
+ {
29
+ "name": "msg",
30
+ "baseName": "msg",
31
+ "type": "string"
32
+ },
33
+ {
34
+ "name": "type",
35
+ "baseName": "type",
36
+ "type": "string"
37
+ } ];
38
+
39
+ static getAttributeTypeMap() {
40
+ return ValidationError.attributeTypeMap;
41
+ }
42
+ }
43
+
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Dohyo
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+
14
+ export class ValidationErrorLocInner {
15
+
16
+ static discriminator: string | undefined = undefined;
17
+
18
+ static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
19
+ ];
20
+
21
+ static getAttributeTypeMap() {
22
+ return ValidationErrorLocInner.attributeTypeMap;
23
+ }
24
+ }
25
+
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@rewiringamerica/rem-test1",
3
+ "version": "0.1.8",
4
+ "description": "NodeJS client for rem",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/rewiringamerica/rwapi-rem-ts-node.git"
8
+ },
9
+ "main": "dist/api.js",
10
+ "types": "dist/api.d.ts",
11
+ "scripts": {
12
+ "clean": "rm -Rf node_modules/ *.js",
13
+ "build": "tsc",
14
+ "test": "npm run build && node dist/client.js",
15
+ "artifactregistry-login": "npx google-artifactregistry-auth"
16
+ },
17
+ "author": "OpenAPI-Generator Contributors",
18
+ "license": "Apache-2.0",
19
+ "dependencies": {
20
+ "bluebird": "^3.7.2",
21
+ "request": "^2.88.2"
22
+ },
23
+ "devDependencies": {
24
+ "@types/bluebird": "^3.5.33",
25
+ "@types/node": "^12",
26
+ "@types/request": "^2.48.8",
27
+ "typescript": "^4.0 || ^5.0"
28
+ },
29
+ "publishConfig": {
30
+ "registry": "https://us-central1-npm.pkg.dev/cube-machine-learning/rewiring-america-js-repo"
31
+ },
32
+ "keywords": [
33
+ "rewiring-america",
34
+ "rem",
35
+ "dohyo-api",
36
+ "electrification",
37
+ "utility",
38
+ "energy",
39
+ "emissions",
40
+ "savings"
41
+ ],
42
+ "bugs": {
43
+ "url": "https://github.com/rewiringamerica/rwapi-rem-ts-node/issues"
44
+ },
45
+ "homepage": "https://github.com/rewiringamerica/rwapi-rem-ts-node#readme"
46
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "module": "commonjs",
4
+ "noImplicitAny": false,
5
+ "target": "ES6",
6
+ "allowSyntheticDefaultImports": true,
7
+ "esModuleInterop": true,
8
+ "strict": true,
9
+ "moduleResolution": "node",
10
+ "removeComments": true,
11
+ "sourceMap": true,
12
+ "noLib": false,
13
+ "declaration": true,
14
+ "lib": ["dom", "es6", "es5", "dom.iterable", "scripthost"],
15
+ "outDir": "dist",
16
+ "typeRoots": [
17
+ "node_modules/@types"
18
+ ]
19
+ },
20
+ "exclude": [
21
+ "dist",
22
+ "node_modules"
23
+ ]
24
+ }