Skip to content
This repository was archived by the owner on Aug 27, 2024. It is now read-only.

Commit e4b1f8b

Browse files
committed
Initial commit generated by OpenAPI Generator
1 parent 3c2a607 commit e4b1f8b

15 files changed

Lines changed: 787 additions & 0 deletions

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
wwwroot/*.js
2+
node_modules
3+
typings
4+
dist

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

.openapi-generator/FILES

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.gitignore
2+
.openapi-generator-ignore
3+
api.ts
4+
api/apis.ts
5+
api/dpApi.ts
6+
git_push.sh
7+
model/citation.ts
8+
model/citedDocument.ts
9+
model/models.ts
10+
model/recollectRequest.ts
11+
model/remember200Response.ts
12+
package.json
13+
tsconfig.json

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
6.6.0

api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// This is the entrypoint for the package
2+
export * from './api/apis';
3+
export * from './model/models';

api/apis.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
export * from './dpApi';
2+
import { DpApi } from './dpApi';
3+
import * as http from 'http';
4+
5+
export class HttpError extends Error {
6+
constructor (public response: http.IncomingMessage, public body: any, public statusCode?: number) {
7+
super('HTTP request failed');
8+
this.name = 'HttpError';
9+
}
10+
}
11+
12+
export { RequestFile } from '../model/models';
13+
14+
export const APIS = [DpApi];

api/dpApi.ts

Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
/**
2+
* MeMaS DP APIs
3+
* This is the Data Plane APIs for MeMaS (Memory Management Service).
4+
*
5+
* The version of the OpenAPI document: 0.1.0
6+
* Contact: max.yu@memas.ai
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 { CitedDocument } from '../model/citedDocument';
19+
import { RecollectRequest } from '../model/recollectRequest';
20+
import { Remember200Response } from '../model/remember200Response';
21+
22+
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
23+
24+
import { HttpError, RequestFile } from './apis';
25+
26+
let defaultBasePath = 'http://localhost';
27+
28+
// ===============================================
29+
// This file is autogenerated - Please do not edit
30+
// ===============================================
31+
32+
export enum DpApiApiKeys {
33+
}
34+
35+
export class DpApi {
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: DpApiApiKeys, value: string) {
84+
(this.authentications as any)[DpApiApiKeys[key]].apiKey = value;
85+
}
86+
87+
public addInterceptor(interceptor: Interceptor) {
88+
this.interceptors.push(interceptor);
89+
}
90+
91+
/**
92+
*
93+
* @summary Recollects
94+
* @param recollectRequest
95+
*/
96+
public async recollect (recollectRequest: RecollectRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Array<CitedDocument>; }> {
97+
const localVarPath = this.basePath + '/dp/recollect';
98+
let localVarQueryParameters: any = {};
99+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
100+
const produces = ['application/json'];
101+
// give precedence to 'application/json'
102+
if (produces.indexOf('application/json') >= 0) {
103+
localVarHeaderParams.Accept = 'application/json';
104+
} else {
105+
localVarHeaderParams.Accept = produces.join(',');
106+
}
107+
let localVarFormParams: any = {};
108+
109+
// verify required parameter 'recollectRequest' is not null or undefined
110+
if (recollectRequest === null || recollectRequest === undefined) {
111+
throw new Error('Required parameter recollectRequest was null or undefined when calling recollect.');
112+
}
113+
114+
(<any>Object).assign(localVarHeaderParams, options.headers);
115+
116+
let localVarUseFormData = false;
117+
118+
let localVarRequestOptions: localVarRequest.Options = {
119+
method: 'POST',
120+
qs: localVarQueryParameters,
121+
headers: localVarHeaderParams,
122+
uri: localVarPath,
123+
useQuerystring: this._useQuerystring,
124+
json: true,
125+
body: ObjectSerializer.serialize(recollectRequest, "RecollectRequest")
126+
};
127+
128+
let authenticationPromise = Promise.resolve();
129+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
130+
131+
let interceptorPromise = authenticationPromise;
132+
for (const interceptor of this.interceptors) {
133+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
134+
}
135+
136+
return interceptorPromise.then(() => {
137+
if (Object.keys(localVarFormParams).length) {
138+
if (localVarUseFormData) {
139+
(<any>localVarRequestOptions).formData = localVarFormParams;
140+
} else {
141+
localVarRequestOptions.form = localVarFormParams;
142+
}
143+
}
144+
return new Promise<{ response: http.IncomingMessage; body: Array<CitedDocument>; }>((resolve, reject) => {
145+
localVarRequest(localVarRequestOptions, (error, response, body) => {
146+
if (error) {
147+
reject(error);
148+
} else {
149+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
150+
body = ObjectSerializer.deserialize(body, "Array<CitedDocument>");
151+
resolve({ response: response, body: body });
152+
} else {
153+
reject(new HttpError(response, body, response.statusCode));
154+
}
155+
}
156+
});
157+
});
158+
});
159+
}
160+
/**
161+
* Memorize information
162+
* @summary Memorize information
163+
* @param citedDocument Remember the following information
164+
*/
165+
public async remember (citedDocument: CitedDocument, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Remember200Response; }> {
166+
const localVarPath = this.basePath + '/dp/remember';
167+
let localVarQueryParameters: any = {};
168+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
169+
const produces = ['application/json'];
170+
// give precedence to 'application/json'
171+
if (produces.indexOf('application/json') >= 0) {
172+
localVarHeaderParams.Accept = 'application/json';
173+
} else {
174+
localVarHeaderParams.Accept = produces.join(',');
175+
}
176+
let localVarFormParams: any = {};
177+
178+
// verify required parameter 'citedDocument' is not null or undefined
179+
if (citedDocument === null || citedDocument === undefined) {
180+
throw new Error('Required parameter citedDocument was null or undefined when calling remember.');
181+
}
182+
183+
(<any>Object).assign(localVarHeaderParams, options.headers);
184+
185+
let localVarUseFormData = false;
186+
187+
let localVarRequestOptions: localVarRequest.Options = {
188+
method: 'POST',
189+
qs: localVarQueryParameters,
190+
headers: localVarHeaderParams,
191+
uri: localVarPath,
192+
useQuerystring: this._useQuerystring,
193+
json: true,
194+
body: ObjectSerializer.serialize(citedDocument, "CitedDocument")
195+
};
196+
197+
let authenticationPromise = Promise.resolve();
198+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
199+
200+
let interceptorPromise = authenticationPromise;
201+
for (const interceptor of this.interceptors) {
202+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
203+
}
204+
205+
return interceptorPromise.then(() => {
206+
if (Object.keys(localVarFormParams).length) {
207+
if (localVarUseFormData) {
208+
(<any>localVarRequestOptions).formData = localVarFormParams;
209+
} else {
210+
localVarRequestOptions.form = localVarFormParams;
211+
}
212+
}
213+
return new Promise<{ response: http.IncomingMessage; body: Remember200Response; }>((resolve, reject) => {
214+
localVarRequest(localVarRequestOptions, (error, response, body) => {
215+
if (error) {
216+
reject(error);
217+
} else {
218+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
219+
body = ObjectSerializer.deserialize(body, "Remember200Response");
220+
resolve({ response: response, body: body });
221+
} else {
222+
reject(new HttpError(response, body, response.statusCode));
223+
}
224+
}
225+
});
226+
});
227+
});
228+
}
229+
}

git_push.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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'

0 commit comments

Comments
 (0)