forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add petstore samples for typescript aurelia
- Loading branch information
Showing
28 changed files
with
1,460 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified
0
bin/java-play-framework-petstore-server-no-exception-handling.sh
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
|
||
SCRIPT="$0" | ||
|
||
while [ -h "$SCRIPT" ] ; do | ||
ls=`ls -ld "$SCRIPT"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
SCRIPT="$link" | ||
else | ||
SCRIPT=`dirname "$SCRIPT"`/"$link" | ||
fi | ||
done | ||
|
||
if [ ! -d "${APP_DIR}" ]; then | ||
APP_DIR=`dirname "$SCRIPT"`/.. | ||
APP_DIR=`cd "${APP_DIR}"; pwd` | ||
fi | ||
|
||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" | ||
|
||
if [ ! -f "$executable" ] | ||
then | ||
mvn clean package | ||
fi | ||
|
||
# if you've executed sbt assembly previously it will use that instead. | ||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" | ||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-aurelia -o samples/client/petstore/typescript-aurelia/default" | ||
|
||
java $JAVA_OPTS -jar $executable $ags |
Empty file.
Empty file.
3 changes: 3 additions & 0 deletions
3
samples/client/petstore/typescript-aurelia/default/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
wwwroot/*.js | ||
node_modules | ||
typings |
23 changes: 23 additions & 0 deletions
23
samples/client/petstore/typescript-aurelia/default/.swagger-codegen-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Swagger Codegen Ignore | ||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
1 change: 1 addition & 0 deletions
1
samples/client/petstore/typescript-aurelia/default/.swagger-codegen/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.3.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Swagger Petstore | ||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by the swagger code generator program. | ||
* https://github.com/swagger-api/swagger-codegen.git | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
import { HttpClient } from 'aurelia-http-client'; | ||
import { AuthStorage } from './AuthStorage'; | ||
|
||
const BASE_PATH = 'http://petstore.swagger.io/v2'.replace(/\/+$/, ''); | ||
|
||
export class Api { | ||
basePath: string; | ||
httpClient: HttpClient; | ||
authStorage: AuthStorage; | ||
|
||
constructor(httpClient: HttpClient, authStorage: AuthStorage, basePath: string = BASE_PATH) { | ||
this.basePath = basePath; | ||
this.httpClient = httpClient; | ||
this.authStorage = authStorage; | ||
} | ||
|
||
/** | ||
* Encodes a query string. | ||
* | ||
* @param params The params to encode. | ||
* @return An encoded query string. | ||
*/ | ||
protected queryString(params: { [key: string]: any }): string { | ||
const queries = []; | ||
for (let key in params) { | ||
const value = this.toString(params[key]); | ||
if (value != null) { | ||
queries.push(`${key}=${encodeURIComponent(value)}`); | ||
} | ||
} | ||
|
||
return queries.join('&'); | ||
} | ||
|
||
/** | ||
* Converts a value to string. | ||
* | ||
* @param value The value to convert. | ||
*/ | ||
protected toString(value: any): string | null { | ||
if (value === null) { | ||
return null; | ||
} | ||
switch (typeof value) { | ||
case 'undefined': return null; | ||
case 'boolean': return value ? 'true' : 'false'; | ||
case 'string': return value; | ||
default: return '' + value; | ||
} | ||
} | ||
|
||
/** | ||
* Ensures that a given parameter is set. | ||
* | ||
* @param context A name for the callee's context. | ||
* @param params The parameters being set. | ||
* @param paramName The required parameter to check. | ||
*/ | ||
protected ensureParamIsSet<T>(context: string, params: T, paramName: keyof T): void { | ||
if (null === params[paramName]) { | ||
throw new Error(`Missing required parameter ${paramName} when calling ${context}`); | ||
} | ||
} | ||
} |
72 changes: 72 additions & 0 deletions
72
samples/client/petstore/typescript-aurelia/default/AuthStorage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/** | ||
* Swagger Petstore | ||
* This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. | ||
* | ||
* OpenAPI spec version: 1.0.0 | ||
* Contact: [email protected] | ||
* | ||
* NOTE: This class is auto generated by the swagger code generator program. | ||
* https://github.com/swagger-api/swagger-codegen.git | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
/** | ||
* Class to storage authentication data | ||
*/ | ||
export class AuthStorage { | ||
private storage: Map<string, string>; | ||
|
||
constructor() { | ||
this.storage = new Map(); | ||
} | ||
|
||
/** | ||
* Sets the api_key auth method value. | ||
* | ||
* @param value The new value to set for api_key. | ||
*/ | ||
setapi_key(value: string): this { | ||
this.storage.set('api_key', value); | ||
return this; | ||
} | ||
|
||
/** | ||
* Removes the api_key auth method value. | ||
*/ | ||
removeapi_key(): this { | ||
this.storage.delete('api_key'); | ||
return this; | ||
} | ||
|
||
/** | ||
* Gets the api_key auth method value. | ||
*/ | ||
getapi_key(): null | string { | ||
return this.storage.get('api_key') || null; | ||
} | ||
|
||
/** | ||
* Sets the petstore_auth auth method value. | ||
* | ||
* @param value The new value to set for petstore_auth. | ||
*/ | ||
setpetstore_auth(value: string): this { | ||
this.storage.set('petstore_auth', value); | ||
return this; | ||
} | ||
|
||
/** | ||
* Removes the petstore_auth auth method value. | ||
*/ | ||
removepetstore_auth(): this { | ||
this.storage.delete('petstore_auth'); | ||
return this; | ||
} | ||
|
||
/** | ||
* Gets the petstore_auth auth method value. | ||
*/ | ||
getpetstore_auth(): null | string { | ||
return this.storage.get('petstore_auth') || null; | ||
} | ||
} |
Oops, something went wrong.