Added gitignore and git_push

This commit is contained in:
Tino Fuhrmann 2019-05-03 20:22:29 +02:00
parent 495ce938f8
commit 8d8e57f1f9
9 changed files with 192 additions and 85 deletions

View File

@ -120,10 +120,12 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
cliOptions.add(new CliOption(CodegenConstants.SUPPORTS_ES6, CodegenConstants.SUPPORTS_ES6_DESC).defaultValue("false"));
// TODO: gen package.json?
//Files for building our lib
//Documentation
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
supportingFiles.add(new SupportingFile("package.mustache", "", "package.json"));
supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json"));
supportingFiles.add(new SupportingFile(".gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
// Util
supportingFiles.add(new SupportingFile("util.mustache", "", "util.ts"));

View File

@ -0,0 +1 @@
dist

View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="{{{gitUserId}}}"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="{{{gitRepoId}}}"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="{{{releaseNote}}}"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -17,14 +17,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
/**
* Add a new pet to the store
* @param pet Pet object that needs to be added to the store
* @param body Pet object that needs to be added to the store
*/
public addPet(pet: Pet, options?: Configuration): RequestContext {
public addPet(body: Pet, options?: Configuration): RequestContext {
let config = options || this.configuration;
// verify required parameter 'pet' is not null or undefined
if (pet === null || pet === undefined) {
throw new RequiredError('Required parameter pet was null or undefined when calling addPet.');
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling addPet.');
}
@ -46,7 +46,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
requestContext.setHeaderParam("Content-Type", "application/json");
// TODO: Should this be handled by ObjectSerializer? imo yes => confidential information included in local object should not be sent
const needsSerialization = (<any>"Pet" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
const serializedBody = needsSerialization ? JSON.stringify(pet || {}) : (pet.toString() || ""); // TODO: `toString` call is unnecessary
const serializedBody = needsSerialization ? JSON.stringify(body || {}) : (body.toString() || ""); // TODO: `toString` call is unnecessary
requestContext.setBody(serializedBody);
let authMethod = null;
@ -231,14 +231,14 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
/**
* Update an existing pet
* @param pet Pet object that needs to be added to the store
* @param body Pet object that needs to be added to the store
*/
public updatePet(pet: Pet, options?: Configuration): RequestContext {
public updatePet(body: Pet, options?: Configuration): RequestContext {
let config = options || this.configuration;
// verify required parameter 'pet' is not null or undefined
if (pet === null || pet === undefined) {
throw new RequiredError('Required parameter pet was null or undefined when calling updatePet.');
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling updatePet.');
}
@ -260,7 +260,7 @@ export class PetApiRequestFactory extends BaseAPIRequestFactory {
requestContext.setHeaderParam("Content-Type", "application/json");
// TODO: Should this be handled by ObjectSerializer? imo yes => confidential information included in local object should not be sent
const needsSerialization = (<any>"Pet" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
const serializedBody = needsSerialization ? JSON.stringify(pet || {}) : (pet.toString() || ""); // TODO: `toString` call is unnecessary
const serializedBody = needsSerialization ? JSON.stringify(body || {}) : (body.toString() || ""); // TODO: `toString` call is unnecessary
requestContext.setBody(serializedBody);
let authMethod = null;

View File

@ -121,14 +121,14 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
/**
* Place an order for a pet
* @param order order placed for purchasing the pet
* @param body order placed for purchasing the pet
*/
public placeOrder(order: Order, options?: Configuration): RequestContext {
public placeOrder(body: Order, options?: Configuration): RequestContext {
let config = options || this.configuration;
// verify required parameter 'order' is not null or undefined
if (order === null || order === undefined) {
throw new RequiredError('Required parameter order was null or undefined when calling placeOrder.');
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling placeOrder.');
}
@ -150,7 +150,7 @@ export class StoreApiRequestFactory extends BaseAPIRequestFactory {
requestContext.setHeaderParam("Content-Type", "application/json");
// TODO: Should this be handled by ObjectSerializer? imo yes => confidential information included in local object should not be sent
const needsSerialization = (<any>"Order" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
const serializedBody = needsSerialization ? JSON.stringify(order || {}) : (order.toString() || ""); // TODO: `toString` call is unnecessary
const serializedBody = needsSerialization ? JSON.stringify(body || {}) : (body.toString() || ""); // TODO: `toString` call is unnecessary
requestContext.setBody(serializedBody);
// Apply auth methods

View File

@ -17,14 +17,14 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
/**
* This can only be done by the logged in user.
* Create user
* @param user Created user object
* @param body Created user object
*/
public createUser(user: User, options?: Configuration): RequestContext {
public createUser(body: User, options?: Configuration): RequestContext {
let config = options || this.configuration;
// verify required parameter 'user' is not null or undefined
if (user === null || user === undefined) {
throw new RequiredError('Required parameter user was null or undefined when calling createUser.');
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUser.');
}
@ -46,7 +46,7 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
requestContext.setHeaderParam("Content-Type", "application/json");
// TODO: Should this be handled by ObjectSerializer? imo yes => confidential information included in local object should not be sent
const needsSerialization = (<any>"User" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
const serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || ""); // TODO: `toString` call is unnecessary
const serializedBody = needsSerialization ? JSON.stringify(body || {}) : (body.toString() || ""); // TODO: `toString` call is unnecessary
requestContext.setBody(serializedBody);
// Apply auth methods
@ -56,14 +56,14 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
/**
* Creates list of users with given input array
* @param user List of user object
* @param body List of user object
*/
public createUsersWithArrayInput(user: Array<User>, options?: Configuration): RequestContext {
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): RequestContext {
let config = options || this.configuration;
// verify required parameter 'user' is not null or undefined
if (user === null || user === undefined) {
throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithArrayInput.');
}
@ -85,7 +85,7 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
requestContext.setHeaderParam("Content-Type", "application/json");
// TODO: Should this be handled by ObjectSerializer? imo yes => confidential information included in local object should not be sent
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
const serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || ""); // TODO: `toString` call is unnecessary
const serializedBody = needsSerialization ? JSON.stringify(body || {}) : (body.toString() || ""); // TODO: `toString` call is unnecessary
requestContext.setBody(serializedBody);
// Apply auth methods
@ -95,14 +95,14 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
/**
* Creates list of users with given input array
* @param user List of user object
* @param body List of user object
*/
public createUsersWithListInput(user: Array<User>, options?: Configuration): RequestContext {
public createUsersWithListInput(body: Array<User>, options?: Configuration): RequestContext {
let config = options || this.configuration;
// verify required parameter 'user' is not null or undefined
if (user === null || user === undefined) {
throw new RequiredError('Required parameter user was null or undefined when calling createUsersWithListInput.');
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling createUsersWithListInput.');
}
@ -124,7 +124,7 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
requestContext.setHeaderParam("Content-Type", "application/json");
// TODO: Should this be handled by ObjectSerializer? imo yes => confidential information included in local object should not be sent
const needsSerialization = (<any>"Array&lt;User&gt;" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
const serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || ""); // TODO: `toString` call is unnecessary
const serializedBody = needsSerialization ? JSON.stringify(body || {}) : (body.toString() || ""); // TODO: `toString` call is unnecessary
requestContext.setBody(serializedBody);
// Apply auth methods
@ -281,9 +281,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
* This can only be done by the logged in user.
* Updated user
* @param username name that need to be deleted
* @param user Updated user object
* @param body Updated user object
*/
public updateUser(username: string, user: User, options?: Configuration): RequestContext {
public updateUser(username: string, body: User, options?: Configuration): RequestContext {
let config = options || this.configuration;
// verify required parameter 'username' is not null or undefined
@ -292,9 +292,9 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
}
// verify required parameter 'user' is not null or undefined
if (user === null || user === undefined) {
throw new RequiredError('Required parameter user was null or undefined when calling updateUser.');
// verify required parameter 'body' is not null or undefined
if (body === null || body === undefined) {
throw new RequiredError('Required parameter body was null or undefined when calling updateUser.');
}
@ -317,7 +317,7 @@ export class UserApiRequestFactory extends BaseAPIRequestFactory {
requestContext.setHeaderParam("Content-Type", "application/json");
// TODO: Should this be handled by ObjectSerializer? imo yes => confidential information included in local object should not be sent
const needsSerialization = (<any>"User" !== "string") || requestContext.getHeaders()['Content-Type'] === 'application/json';
const serializedBody = needsSerialization ? JSON.stringify(user || {}) : (user.toString() || ""); // TODO: `toString` call is unnecessary
const serializedBody = needsSerialization ? JSON.stringify(body || {}) : (body.toString() || ""); // TODO: `toString` call is unnecessary
requestContext.setBody(serializedBody);
// Apply auth methods

View File

@ -0,0 +1,52 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
git_user_id=$1
git_repo_id=$2
release_note=$3
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=`git remote`
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@ -25,10 +25,10 @@ export class ObservablePetApi {
/**
* Add a new pet to the store
* @param pet Pet object that needs to be added to the store
* @param body Pet object that needs to be added to the store
*/
public addPet(pet: Pet, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.addPet(pet, options);
public addPet(body: Pet, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.addPet(body, options);
// build promise chain
let middlewarePreObservable = of(requestContext);
@ -144,10 +144,10 @@ export class ObservablePetApi {
/**
* Update an existing pet
* @param pet Pet object that needs to be added to the store
* @param body Pet object that needs to be added to the store
*/
public updatePet(pet: Pet, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.updatePet(pet, options);
public updatePet(body: Pet, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.updatePet(body, options);
// build promise chain
let middlewarePreObservable = of(requestContext);
@ -306,10 +306,10 @@ export class ObservableStoreApi {
/**
* Place an order for a pet
* @param order order placed for purchasing the pet
* @param body order placed for purchasing the pet
*/
public placeOrder(order: Order, options?: Configuration): Observable<Order> {
const requestContext = this.requestFactory.placeOrder(order, options);
public placeOrder(body: Order, options?: Configuration): Observable<Order> {
const requestContext = this.requestFactory.placeOrder(body, options);
// build promise chain
let middlewarePreObservable = of(requestContext);
@ -348,10 +348,10 @@ export class ObservableUserApi {
/**
* This can only be done by the logged in user.
* Create user
* @param user Created user object
* @param body Created user object
*/
public createUser(user: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUser(user, options);
public createUser(body: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUser(body, options);
// build promise chain
let middlewarePreObservable = of(requestContext);
@ -371,10 +371,10 @@ export class ObservableUserApi {
/**
* Creates list of users with given input array
* @param user List of user object
* @param body List of user object
*/
public createUsersWithArrayInput(user: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithArrayInput(user, options);
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithArrayInput(body, options);
// build promise chain
let middlewarePreObservable = of(requestContext);
@ -394,10 +394,10 @@ export class ObservableUserApi {
/**
* Creates list of users with given input array
* @param user List of user object
* @param body List of user object
*/
public createUsersWithListInput(user: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithListInput(user, options);
public createUsersWithListInput(body: Array<User>, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.createUsersWithListInput(body, options);
// build promise chain
let middlewarePreObservable = of(requestContext);
@ -512,10 +512,10 @@ export class ObservableUserApi {
* This can only be done by the logged in user.
* Updated user
* @param username name that need to be deleted
* @param user Updated user object
* @param body Updated user object
*/
public updateUser(username: string, user: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.updateUser(username, user, options);
public updateUser(username: string, body: User, options?: Configuration): Observable<void> {
const requestContext = this.requestFactory.updateUser(username, body, options);
// build promise chain
let middlewarePreObservable = of(requestContext);

View File

@ -21,10 +21,10 @@ export class PromisePetApi {
/**
* Add a new pet to the store
* @param pet Pet object that needs to be added to the store
* @param body Pet object that needs to be added to the store
*/
public addPet(pet: Pet, options?: Configuration): Promise<void> {
const result = this.api.addPet(pet, options);
public addPet(body: Pet, options?: Configuration): Promise<void> {
const result = this.api.addPet(body, options);
return result.toPromise();
}
@ -70,10 +70,10 @@ export class PromisePetApi {
/**
* Update an existing pet
* @param pet Pet object that needs to be added to the store
* @param body Pet object that needs to be added to the store
*/
public updatePet(pet: Pet, options?: Configuration): Promise<void> {
const result = this.api.updatePet(pet, options);
public updatePet(body: Pet, options?: Configuration): Promise<void> {
const result = this.api.updatePet(body, options);
return result.toPromise();
}
@ -146,10 +146,10 @@ export class PromiseStoreApi {
/**
* Place an order for a pet
* @param order order placed for purchasing the pet
* @param body order placed for purchasing the pet
*/
public placeOrder(order: Order, options?: Configuration): Promise<Order> {
const result = this.api.placeOrder(order, options);
public placeOrder(body: Order, options?: Configuration): Promise<Order> {
const result = this.api.placeOrder(body, options);
return result.toPromise();
}
@ -172,28 +172,28 @@ export class PromiseUserApi {
/**
* This can only be done by the logged in user.
* Create user
* @param user Created user object
* @param body Created user object
*/
public createUser(user: User, options?: Configuration): Promise<void> {
const result = this.api.createUser(user, options);
public createUser(body: User, options?: Configuration): Promise<void> {
const result = this.api.createUser(body, options);
return result.toPromise();
}
/**
* Creates list of users with given input array
* @param user List of user object
* @param body List of user object
*/
public createUsersWithArrayInput(user: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithArrayInput(user, options);
public createUsersWithArrayInput(body: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithArrayInput(body, options);
return result.toPromise();
}
/**
* Creates list of users with given input array
* @param user List of user object
* @param body List of user object
*/
public createUsersWithListInput(user: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithListInput(user, options);
public createUsersWithListInput(body: Array<User>, options?: Configuration): Promise<void> {
const result = this.api.createUsersWithListInput(body, options);
return result.toPromise();
}
@ -238,10 +238,10 @@ export class PromiseUserApi {
* This can only be done by the logged in user.
* Updated user
* @param username name that need to be deleted
* @param user Updated user object
* @param body Updated user object
*/
public updateUser(username: string, user: User, options?: Configuration): Promise<void> {
const result = this.api.updateUser(username, user, options);
public updateUser(username: string, body: User, options?: Configuration): Promise<void> {
const result = this.api.updateUser(username, body, options);
return result.toPromise();
}