@rewiringamerica/rem-test1 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- package/.openapi-generator/FILES +20 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/README.md +2 -0
- package/api/apis.ts +16 -0
- package/api/buildingProfilerApi.ts +161 -0
- package/api/residentialElectrificationModelApi.ts +242 -0
- package/api.ts +3 -0
- package/git_push.sh +57 -0
- package/model/buildingFeatures.ts +165 -0
- package/model/buildingProfile.ts +64 -0
- package/model/buildlingProfileRequest.ts +43 -0
- package/model/fuelData.ts +45 -0
- package/model/hTTPValidationError.ts +31 -0
- package/model/impact.ts +46 -0
- package/model/metrics.ts +58 -0
- package/model/models.ts +299 -0
- package/model/savings.ts +59 -0
- package/model/upgrade.ts +46 -0
- package/model/upgradeType.ts +24 -0
- package/model/validationError.ts +43 -0
- package/model/validationErrorLocInner.ts +25 -0
- package/package.json +46 -0
- package/tsconfig.json +24 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
.gitignore
|
2
|
+
api.ts
|
3
|
+
api/apis.ts
|
4
|
+
api/buildingProfilerApi.ts
|
5
|
+
api/residentialElectrificationModelApi.ts
|
6
|
+
git_push.sh
|
7
|
+
model/buildingFeatures.ts
|
8
|
+
model/buildingProfile.ts
|
9
|
+
model/buildlingProfileRequest.ts
|
10
|
+
model/fuelData.ts
|
11
|
+
model/hTTPValidationError.ts
|
12
|
+
model/impact.ts
|
13
|
+
model/metrics.ts
|
14
|
+
model/models.ts
|
15
|
+
model/savings.ts
|
16
|
+
model/upgrade.ts
|
17
|
+
model/validationError.ts
|
18
|
+
model/validationErrorLocInner.ts
|
19
|
+
package.json
|
20
|
+
tsconfig.json
|
@@ -0,0 +1 @@
|
|
1
|
+
7.10.0
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# OpenAPI Generator Ignore
|
2
|
+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
3
|
+
|
4
|
+
# Use this file to prevent files from being overwritten by the generator.
|
5
|
+
# The patterns follow closely to .gitignore or .dockerignore.
|
6
|
+
|
7
|
+
# As an example, the C# client generator defines ApiClient.cs.
|
8
|
+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
9
|
+
#ApiClient.cs
|
10
|
+
|
11
|
+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
12
|
+
#foo/*/qux
|
13
|
+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
14
|
+
|
15
|
+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
16
|
+
#foo/**/qux
|
17
|
+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
18
|
+
|
19
|
+
# You can also negate patterns with an exclamation (!).
|
20
|
+
# For example, you can ignore all files in a docs folder with the file extension .md:
|
21
|
+
#docs/*.md
|
22
|
+
# Then explicitly reverse the ignore rule for a single file:
|
23
|
+
#!docs/README.md
|
package/README.md
ADDED
package/api/apis.ts
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
export * from './buildingProfilerApi';
|
2
|
+
import { BuildingProfilerApi } from './buildingProfilerApi';
|
3
|
+
export * from './residentialElectrificationModelApi';
|
4
|
+
import { ResidentialElectrificationModelApi } from './residentialElectrificationModelApi';
|
5
|
+
import * as http from 'http';
|
6
|
+
|
7
|
+
export class HttpError extends Error {
|
8
|
+
constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) {
|
9
|
+
super('HTTP request failed');
|
10
|
+
this.name = 'HttpError';
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
export { RequestFile } from '../model/models';
|
15
|
+
|
16
|
+
export const APIS = [BuildingProfilerApi, ResidentialElectrificationModelApi];
|
@@ -0,0 +1,161 @@
|
|
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
|
+
import localVarRequest from 'request';
|
15
|
+
import http from 'http';
|
16
|
+
|
17
|
+
/* tslint:disable:no-unused-locals */
|
18
|
+
import { BuildingProfile } from '../model/buildingProfile';
|
19
|
+
|
20
|
+
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
|
21
|
+
|
22
|
+
import { HttpError } from './apis';
|
23
|
+
|
24
|
+
let defaultBasePath = 'http://localhost';
|
25
|
+
|
26
|
+
// ===============================================
|
27
|
+
// This file is autogenerated - Please do not edit
|
28
|
+
// ===============================================
|
29
|
+
|
30
|
+
export enum BuildingProfilerApiApiKeys {
|
31
|
+
}
|
32
|
+
|
33
|
+
export class BuildingProfilerApi {
|
34
|
+
protected _basePath = defaultBasePath;
|
35
|
+
protected _defaultHeaders : any = {};
|
36
|
+
protected _useQuerystring : boolean = false;
|
37
|
+
|
38
|
+
protected authentications = {
|
39
|
+
'default': <Authentication>new VoidAuth(),
|
40
|
+
}
|
41
|
+
|
42
|
+
protected interceptors: Interceptor[] = [];
|
43
|
+
|
44
|
+
constructor(basePath?: string);
|
45
|
+
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
|
46
|
+
if (password) {
|
47
|
+
if (basePath) {
|
48
|
+
this.basePath = basePath;
|
49
|
+
}
|
50
|
+
} else {
|
51
|
+
if (basePathOrUsername) {
|
52
|
+
this.basePath = basePathOrUsername
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
set useQuerystring(value: boolean) {
|
58
|
+
this._useQuerystring = value;
|
59
|
+
}
|
60
|
+
|
61
|
+
set basePath(basePath: string) {
|
62
|
+
this._basePath = basePath;
|
63
|
+
}
|
64
|
+
|
65
|
+
set defaultHeaders(defaultHeaders: any) {
|
66
|
+
this._defaultHeaders = defaultHeaders;
|
67
|
+
}
|
68
|
+
|
69
|
+
get defaultHeaders() {
|
70
|
+
return this._defaultHeaders;
|
71
|
+
}
|
72
|
+
|
73
|
+
get basePath() {
|
74
|
+
return this._basePath;
|
75
|
+
}
|
76
|
+
|
77
|
+
public setDefaultAuthentication(auth: Authentication) {
|
78
|
+
this.authentications.default = auth;
|
79
|
+
}
|
80
|
+
|
81
|
+
public setApiKey(key: BuildingProfilerApiApiKeys, value: string) {
|
82
|
+
(this.authentications as any)[BuildingProfilerApiApiKeys[key]].apiKey = value;
|
83
|
+
}
|
84
|
+
|
85
|
+
public addInterceptor(interceptor: Interceptor) {
|
86
|
+
this.interceptors.push(interceptor);
|
87
|
+
}
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Use the Kokugikan library to generate a building profile for the specified address. This implementation takes in an address as a required query parameter. However, it is currently not used in any way. The JSON response includes hardcoded values. Parameters ---------- address: The location of a building. Returns ------- BuildingProfile: JSON containing building profile output from Kokugikan.
|
91
|
+
* @summary Get Home Profile
|
92
|
+
* @param address The location of a home.
|
93
|
+
*/
|
94
|
+
public async buildingProfilerGetHomeProfile (address: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BuildingProfile; }> {
|
95
|
+
const localVarPath = this.basePath + '/building_profiler/home/v1';
|
96
|
+
let localVarQueryParameters: any = {};
|
97
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
98
|
+
const produces = ['application/json'];
|
99
|
+
// give precedence to 'application/json'
|
100
|
+
if (produces.indexOf('application/json') >= 0) {
|
101
|
+
localVarHeaderParams.Accept = 'application/json';
|
102
|
+
} else {
|
103
|
+
localVarHeaderParams.Accept = produces.join(',');
|
104
|
+
}
|
105
|
+
let localVarFormParams: any = {};
|
106
|
+
|
107
|
+
// verify required parameter 'address' is not null or undefined
|
108
|
+
if (address === null || address === undefined) {
|
109
|
+
throw new Error('Required parameter address was null or undefined when calling buildingProfilerGetHomeProfile.');
|
110
|
+
}
|
111
|
+
|
112
|
+
if (address !== undefined) {
|
113
|
+
localVarQueryParameters['address'] = ObjectSerializer.serialize(address, "string");
|
114
|
+
}
|
115
|
+
|
116
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
117
|
+
|
118
|
+
let localVarUseFormData = false;
|
119
|
+
|
120
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
121
|
+
method: 'GET',
|
122
|
+
qs: localVarQueryParameters,
|
123
|
+
headers: localVarHeaderParams,
|
124
|
+
uri: localVarPath,
|
125
|
+
useQuerystring: this._useQuerystring,
|
126
|
+
json: true,
|
127
|
+
};
|
128
|
+
|
129
|
+
let authenticationPromise = Promise.resolve();
|
130
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
131
|
+
|
132
|
+
let interceptorPromise = authenticationPromise;
|
133
|
+
for (const interceptor of this.interceptors) {
|
134
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
135
|
+
}
|
136
|
+
|
137
|
+
return interceptorPromise.then(() => {
|
138
|
+
if (Object.keys(localVarFormParams).length) {
|
139
|
+
if (localVarUseFormData) {
|
140
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
141
|
+
} else {
|
142
|
+
localVarRequestOptions.form = localVarFormParams;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
return new Promise<{ response: http.IncomingMessage; body: BuildingProfile; }>((resolve, reject) => {
|
146
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
147
|
+
if (error) {
|
148
|
+
reject(error);
|
149
|
+
} else {
|
150
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
151
|
+
body = ObjectSerializer.deserialize(body, "BuildingProfile");
|
152
|
+
resolve({ response: response, body: body });
|
153
|
+
} else {
|
154
|
+
reject(new HttpError(response, body, response.statusCode));
|
155
|
+
}
|
156
|
+
}
|
157
|
+
});
|
158
|
+
});
|
159
|
+
});
|
160
|
+
}
|
161
|
+
}
|
@@ -0,0 +1,242 @@
|
|
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
|
+
import localVarRequest from 'request';
|
15
|
+
import http from 'http';
|
16
|
+
|
17
|
+
/* tslint:disable:no-unused-locals */
|
18
|
+
import { BuildlingProfileRequest } from '../model/buildlingProfileRequest';
|
19
|
+
import { Savings } from '../model/savings';
|
20
|
+
import { Upgrade } from '../model/upgrade';
|
21
|
+
|
22
|
+
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
|
23
|
+
|
24
|
+
import { HttpError } from './apis';
|
25
|
+
|
26
|
+
let defaultBasePath = 'http://localhost';
|
27
|
+
|
28
|
+
// ===============================================
|
29
|
+
// This file is autogenerated - Please do not edit
|
30
|
+
// ===============================================
|
31
|
+
|
32
|
+
export enum ResidentialElectrificationModelApiApiKeys {
|
33
|
+
}
|
34
|
+
|
35
|
+
export class ResidentialElectrificationModelApi {
|
36
|
+
protected _basePath = defaultBasePath;
|
37
|
+
protected _defaultHeaders : any = {};
|
38
|
+
protected _useQuerystring : boolean = false;
|
39
|
+
|
40
|
+
protected authentications = {
|
41
|
+
'default': <Authentication>new VoidAuth(),
|
42
|
+
}
|
43
|
+
|
44
|
+
protected interceptors: Interceptor[] = [];
|
45
|
+
|
46
|
+
constructor(basePath?: string);
|
47
|
+
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
|
48
|
+
if (password) {
|
49
|
+
if (basePath) {
|
50
|
+
this.basePath = basePath;
|
51
|
+
}
|
52
|
+
} else {
|
53
|
+
if (basePathOrUsername) {
|
54
|
+
this.basePath = basePathOrUsername
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
set useQuerystring(value: boolean) {
|
60
|
+
this._useQuerystring = value;
|
61
|
+
}
|
62
|
+
|
63
|
+
set basePath(basePath: string) {
|
64
|
+
this._basePath = basePath;
|
65
|
+
}
|
66
|
+
|
67
|
+
set defaultHeaders(defaultHeaders: any) {
|
68
|
+
this._defaultHeaders = defaultHeaders;
|
69
|
+
}
|
70
|
+
|
71
|
+
get defaultHeaders() {
|
72
|
+
return this._defaultHeaders;
|
73
|
+
}
|
74
|
+
|
75
|
+
get basePath() {
|
76
|
+
return this._basePath;
|
77
|
+
}
|
78
|
+
|
79
|
+
public setDefaultAuthentication(auth: Authentication) {
|
80
|
+
this.authentications.default = auth;
|
81
|
+
}
|
82
|
+
|
83
|
+
public setApiKey(key: ResidentialElectrificationModelApiApiKeys, value: string) {
|
84
|
+
(this.authentications as any)[ResidentialElectrificationModelApiApiKeys[key]].apiKey = value;
|
85
|
+
}
|
86
|
+
|
87
|
+
public addInterceptor(interceptor: Interceptor) {
|
88
|
+
this.interceptors.push(interceptor);
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Predict a user\'s savings using the Residential Electrification Model using an upgrade and address. This implementation takes in an address as a required query parameter. However, it is currently not used in any way. The JSON response includes hardcoded values. Parameters ---------- address: The location of a user. Returns ------- Savings: JSON containing prediction output from Dohyo.
|
93
|
+
* @summary Get By Address
|
94
|
+
* @param upgrade Building upgrade.
|
95
|
+
* @param address The location of a user.
|
96
|
+
*/
|
97
|
+
public async remGetByAddress (upgrade: Upgrade, address: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Savings; }> {
|
98
|
+
const localVarPath = this.basePath + '/rem/address/v1';
|
99
|
+
let localVarQueryParameters: any = {};
|
100
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
101
|
+
const produces = ['application/json'];
|
102
|
+
// give precedence to 'application/json'
|
103
|
+
if (produces.indexOf('application/json') >= 0) {
|
104
|
+
localVarHeaderParams.Accept = 'application/json';
|
105
|
+
} else {
|
106
|
+
localVarHeaderParams.Accept = produces.join(',');
|
107
|
+
}
|
108
|
+
let localVarFormParams: any = {};
|
109
|
+
|
110
|
+
// verify required parameter 'upgrade' is not null or undefined
|
111
|
+
if (upgrade === null || upgrade === undefined) {
|
112
|
+
throw new Error('Required parameter upgrade was null or undefined when calling remGetByAddress.');
|
113
|
+
}
|
114
|
+
|
115
|
+
// verify required parameter 'address' is not null or undefined
|
116
|
+
if (address === null || address === undefined) {
|
117
|
+
throw new Error('Required parameter address was null or undefined when calling remGetByAddress.');
|
118
|
+
}
|
119
|
+
|
120
|
+
if (upgrade !== undefined) {
|
121
|
+
localVarQueryParameters['upgrade'] = ObjectSerializer.serialize(upgrade, "Upgrade");
|
122
|
+
}
|
123
|
+
|
124
|
+
if (address !== undefined) {
|
125
|
+
localVarQueryParameters['address'] = ObjectSerializer.serialize(address, "string");
|
126
|
+
}
|
127
|
+
|
128
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
129
|
+
|
130
|
+
let localVarUseFormData = false;
|
131
|
+
|
132
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
133
|
+
method: 'GET',
|
134
|
+
qs: localVarQueryParameters,
|
135
|
+
headers: localVarHeaderParams,
|
136
|
+
uri: localVarPath,
|
137
|
+
useQuerystring: this._useQuerystring,
|
138
|
+
json: true,
|
139
|
+
};
|
140
|
+
|
141
|
+
let authenticationPromise = Promise.resolve();
|
142
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
143
|
+
|
144
|
+
let interceptorPromise = authenticationPromise;
|
145
|
+
for (const interceptor of this.interceptors) {
|
146
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
147
|
+
}
|
148
|
+
|
149
|
+
return interceptorPromise.then(() => {
|
150
|
+
if (Object.keys(localVarFormParams).length) {
|
151
|
+
if (localVarUseFormData) {
|
152
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
153
|
+
} else {
|
154
|
+
localVarRequestOptions.form = localVarFormParams;
|
155
|
+
}
|
156
|
+
}
|
157
|
+
return new Promise<{ response: http.IncomingMessage; body: Savings; }>((resolve, reject) => {
|
158
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
159
|
+
if (error) {
|
160
|
+
reject(error);
|
161
|
+
} else {
|
162
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
163
|
+
body = ObjectSerializer.deserialize(body, "Savings");
|
164
|
+
resolve({ response: response, body: body });
|
165
|
+
} else {
|
166
|
+
reject(new HttpError(response, body, response.statusCode));
|
167
|
+
}
|
168
|
+
}
|
169
|
+
});
|
170
|
+
});
|
171
|
+
});
|
172
|
+
}
|
173
|
+
/**
|
174
|
+
* Predict a user\'s savings using Residential Electrification Model using a Building Profile and an Upgrade. This implementation takes in a dictionary of required inputs for the request body. However, it is currently not used in any way. The JSON response includes hardcoded values. Parameters ---------- building_profile_req (BuildingProfileRequest): An object containing all of the necessary inputs for Dohyo: Upgrade, County, PUMA, Climate Zone, ResStock weather file location, state abbreviation, and building features. Returns ------- Savings: JSON containing prediction output from Dohyo.
|
175
|
+
* @summary Get By Profile
|
176
|
+
* @param buildlingProfileRequest
|
177
|
+
*/
|
178
|
+
public async remGetByProfile (buildlingProfileRequest: BuildlingProfileRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Savings; }> {
|
179
|
+
const localVarPath = this.basePath + '/rem/profile/v1';
|
180
|
+
let localVarQueryParameters: any = {};
|
181
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
182
|
+
const produces = ['application/json'];
|
183
|
+
// give precedence to 'application/json'
|
184
|
+
if (produces.indexOf('application/json') >= 0) {
|
185
|
+
localVarHeaderParams.Accept = 'application/json';
|
186
|
+
} else {
|
187
|
+
localVarHeaderParams.Accept = produces.join(',');
|
188
|
+
}
|
189
|
+
let localVarFormParams: any = {};
|
190
|
+
|
191
|
+
// verify required parameter 'buildlingProfileRequest' is not null or undefined
|
192
|
+
if (buildlingProfileRequest === null || buildlingProfileRequest === undefined) {
|
193
|
+
throw new Error('Required parameter buildlingProfileRequest was null or undefined when calling remGetByProfile.');
|
194
|
+
}
|
195
|
+
|
196
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
197
|
+
|
198
|
+
let localVarUseFormData = false;
|
199
|
+
|
200
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
201
|
+
method: 'POST',
|
202
|
+
qs: localVarQueryParameters,
|
203
|
+
headers: localVarHeaderParams,
|
204
|
+
uri: localVarPath,
|
205
|
+
useQuerystring: this._useQuerystring,
|
206
|
+
json: true,
|
207
|
+
body: ObjectSerializer.serialize(buildlingProfileRequest, "BuildlingProfileRequest")
|
208
|
+
};
|
209
|
+
|
210
|
+
let authenticationPromise = Promise.resolve();
|
211
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
212
|
+
|
213
|
+
let interceptorPromise = authenticationPromise;
|
214
|
+
for (const interceptor of this.interceptors) {
|
215
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
216
|
+
}
|
217
|
+
|
218
|
+
return interceptorPromise.then(() => {
|
219
|
+
if (Object.keys(localVarFormParams).length) {
|
220
|
+
if (localVarUseFormData) {
|
221
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
222
|
+
} else {
|
223
|
+
localVarRequestOptions.form = localVarFormParams;
|
224
|
+
}
|
225
|
+
}
|
226
|
+
return new Promise<{ response: http.IncomingMessage; body: Savings; }>((resolve, reject) => {
|
227
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
228
|
+
if (error) {
|
229
|
+
reject(error);
|
230
|
+
} else {
|
231
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
232
|
+
body = ObjectSerializer.deserialize(body, "Savings");
|
233
|
+
resolve({ response: response, body: body });
|
234
|
+
} else {
|
235
|
+
reject(new HttpError(response, body, response.statusCode));
|
236
|
+
}
|
237
|
+
}
|
238
|
+
});
|
239
|
+
});
|
240
|
+
});
|
241
|
+
}
|
242
|
+
}
|
package/api.ts
ADDED
package/git_push.sh
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
|
3
|
+
#
|
4
|
+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
|
5
|
+
|
6
|
+
git_user_id=$1
|
7
|
+
git_repo_id=$2
|
8
|
+
release_note=$3
|
9
|
+
git_host=$4
|
10
|
+
|
11
|
+
if [ "$git_host" = "" ]; then
|
12
|
+
git_host="github.com"
|
13
|
+
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
|
14
|
+
fi
|
15
|
+
|
16
|
+
if [ "$git_user_id" = "" ]; then
|
17
|
+
git_user_id="GIT_USER_ID"
|
18
|
+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
19
|
+
fi
|
20
|
+
|
21
|
+
if [ "$git_repo_id" = "" ]; then
|
22
|
+
git_repo_id="GIT_REPO_ID"
|
23
|
+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
24
|
+
fi
|
25
|
+
|
26
|
+
if [ "$release_note" = "" ]; then
|
27
|
+
release_note="Minor update"
|
28
|
+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
29
|
+
fi
|
30
|
+
|
31
|
+
# Initialize the local directory as a Git repository
|
32
|
+
git init
|
33
|
+
|
34
|
+
# Adds the files in the local repository and stages them for commit.
|
35
|
+
git add .
|
36
|
+
|
37
|
+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
|
38
|
+
git commit -m "$release_note"
|
39
|
+
|
40
|
+
# Sets the new remote
|
41
|
+
git_remote=$(git remote)
|
42
|
+
if [ "$git_remote" = "" ]; then # git remote not defined
|
43
|
+
|
44
|
+
if [ "$GIT_TOKEN" = "" ]; then
|
45
|
+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
46
|
+
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
|
47
|
+
else
|
48
|
+
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
|
49
|
+
fi
|
50
|
+
|
51
|
+
fi
|
52
|
+
|
53
|
+
git pull origin master
|
54
|
+
|
55
|
+
# Pushes (Forces) the changes in the local repository up to the remote repository
|
56
|
+
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
|
57
|
+
git push origin master 2>&1 | grep -v 'To https'
|