Inject basepath through configuration in generated service for angular, create test cases for angular 6 (#367)

This commit is contained in:
Raphael Ochsenbein
2018-07-03 11:55:26 +02:00
committed by William Cheng
parent c1eda61874
commit be68ef502e
170 changed files with 22061 additions and 508 deletions

View File

@@ -3,6 +3,7 @@ language: java
jdk:
- openjdk8
cache:
directories:
- $HOME/.m2
@@ -35,6 +36,7 @@ services:
# comment out the host table change to use the public petstore server
addons:
chrome: stable
hosts:
- petstore.swagger.io

View File

@@ -835,6 +835,7 @@
<!-- clients -->
<!-- test non-java projects -->
<module>samples/client/petstore/go</module>
<module>samples/client/petstore/typescript-angular-v6-provided-in-root</module>
<!-- test java-related projects -->
<module>samples/client/petstore/scala-akka</module>
<module>samples/client/petstore/scala-httpclient</module>

View File

@@ -854,6 +854,7 @@
<module>samples/client/petstore/kotlin/</module>
<!-- test non-java projects -->
<!--<module>samples/client/petstore/go</module>-->
<module>samples/client/petstore/typescript-angular-v6-provided-in-root</module>
<!-- servers -->
<module>samples/server/petstore/java-vertx/rx</module>
<module>samples/server/petstore/java-vertx/async</module>

View File

@@ -5,3 +5,7 @@
./bin/typescript-angular-v2-petstore-interfaces.sh
./bin/typescript-angular-v4-petstore-with-npm.sh
./bin/typescript-angular-v4.3-petstore-with-npm.sh
./bin/typescript-angular-v6-petstore-not-provided-in-root.sh
./bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh
./bin/typescript-angular-v6-petstore-provided-in-root.sh
./bin/typescript-angular-v6-petstore-provided-in-root-with-npm.sh

View File

@@ -0,0 +1,6 @@
{
"npmName": "@swagger/typescript-angular-petstore",
"npmVersion": "1.0.0",
"npmRepository" : "https://skimdb.npmjs.com/registry",
"snapshot" : false
}

View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
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/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B 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/openapi-generator/src/test\resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
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/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B 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/openapi-generator/src/test\resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -0,0 +1,6 @@
{
"npmName": "@swagger/typescript-angular-petstore",
"npmVersion": "1.0.0",
"npmRepository" : "https://skimdb.npmjs.com/registry",
"snapshot" : false
}

View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
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/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B 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/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-provided-in-root/builds/with-npm --additional-properties ngVersion=6.0.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
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/openapi-generator-cli/target/openapi-generator-cli.jar"
if [ ! -f "$executable" ]
then
mvn -B 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/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-provided-in-root/builds/default --additional-properties ngVersion=6.0.0 $@"
java $JAVA_OPTS -jar $executable $ags

View File

@@ -4,6 +4,8 @@ call .\bin\windows\typescript-angular-v2.bat
call .\bin\windows\typescript-angular-v4-with-npm.bat
call .\bin\windows\typescript-angular-v4.3-with-npm.bat
call .\bin\windows\typescript-angular-v6-provided-in-root.bat
call .\bin\windows\typescript-angular-v6-provided-in-root-with-npm.bat
call .\bin\windows\typescript-angular-v6-not-provided-in-root.bat
call .\bin\windows\typescript-angular-v6-not-provided-in-root-with-npm.bat

View File

@@ -0,0 +1,10 @@
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
If Not Exist %executable% (
mvn clean package
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -c bin\typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples\client\petstore\typescript-angular-v6-not-provided-in-root\builds\with-npm -D providedInRoot=false --additional-properties ngVersion=6.0.0
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -5,6 +5,6 @@ If Not Exist %executable% (
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -o samples\client\petstore\typescript-angular-v6-not-provided-in-root\default -D providedInRoot=false --additional-properties ngVersion=6.0.0
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -o samples\client\petstore\typescript-angular-v6-not-provided-in-root\builds\default -D providedInRoot=false --additional-properties ngVersion=6.0.0
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -0,0 +1,12 @@
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
If Not Exist %executable% (
mvn clean package
)
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -o samples\client\petstore\typescript-angular-v6-provided-in-root\default --additional-properties ngVersion=6.0.0
REM it is same like like setting -D providedInRoot=true
REM set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -c bin\typescript-angular-v6-petstore-provided-in-root-with-npm.json -o samples\client\petstore\typescript-angular-v6-provided-in-root\builds\with-npm -D providedInRoot=true --additional-properties ngVersion=6.0.0
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -7,6 +7,6 @@ If Not Exist %executable% (
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M
set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -o samples\client\petstore\typescript-angular-v6-provided-in-root\default --additional-properties ngVersion=6.0.0
REM it is same like like setting -D providedInRoot=true
REM set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -o samples\client\petstore\typescript-angular-v6-provided-in-root\default -D providedInRoot=true --additional-properties ngVersion=6.0.0
REM set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -l typescript-angular -o samples\client\petstore\typescript-angular-v6-provided-in-root\builds\default -D providedInRoot=true --additional-properties ngVersion=6.0.0
java %JAVA_OPTS% -jar %executable% %ags%

View File

@@ -43,6 +43,21 @@ jobs:
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq bats
- run: sudo apt-get install -qq curl
# Install latest stable node for angular 6
- run:
name: Install node@stable (for angular 6)
command: |
set +e
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install stable
nvm alias default stable
# Each step uses the same `$BASH_ENV`, so need to modify it
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV
- run: node --version
# - run: docker pull openapitools/openapi-petstore
# - run: docker run -d -e OPENAPI_BASE_PATH=/v3 -e DISABLE_API_KEY=1 -e DISABLE_OAUTH=1 -p 80:8080 openapitools/openapi-petstore
- run: docker pull swaggerapi/petstore

View File

@@ -61,12 +61,13 @@ export class {{classname}} {
public configuration = new Configuration();
constructor(protected {{#useHttpClient}}httpClient: HttpClient{{/useHttpClient}}{{^useHttpClient}}http: Http{{/useHttpClient}}, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -303,7 +304,7 @@ export class {{classname}} {
{{/hasFormParams}}
{{#useHttpClient}}
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.configuration.basePath}{{{path}}}`,{{#isBodyAllowed}}
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
{
{{#hasQueryParams}}
@@ -342,7 +343,7 @@ export class {{classname}} {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}{{{path}}}`, requestOptions);
return this.http.request(`${this.configuration.basePath}{{{path}}}`, requestOptions);
{{/useHttpClient}}
}

View File

@@ -957,6 +957,7 @@
<!--<module>samples/client/petstore/typescript-angular-v2/npm</module>-->
<module>samples/client/petstore/typescript-angular-v4/npm</module>
<module>samples/client/petstore/typescript-angular-v4.3/npm</module>
<module>samples/client/petstore/typescript-angular-v6-provided-in-root</module>
<!--<module>samples/client/petstore/bash</module>-->
<module>samples/client/petstore/ruby</module>
<module>samples/server/petstore/rust-server</module>

View File

@@ -35,12 +35,13 @@ export class PetService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -242,7 +243,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -292,7 +293,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -346,7 +347,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByStatus`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByStatus`, requestOptions);
}
/**
@@ -400,7 +401,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByTags`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByTags`, requestOptions);
}
/**
@@ -445,7 +446,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -498,7 +499,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -570,7 +571,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -646,7 +647,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
}
}

View File

@@ -34,12 +34,13 @@ export class StoreService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -156,7 +157,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -196,7 +197,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/inventory`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/inventory`, requestOptions);
}
/**
@@ -236,7 +237,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -281,7 +282,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order`, requestOptions);
}
}

View File

@@ -34,12 +34,13 @@ export class UserService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -227,7 +228,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user`, requestOptions);
}
/**
@@ -270,7 +271,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithArray`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithArray`, requestOptions);
}
/**
@@ -313,7 +314,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithList`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithList`, requestOptions);
}
/**
@@ -351,7 +352,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -391,7 +392,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -444,7 +445,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/login`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/login`, requestOptions);
}
/**
@@ -478,7 +479,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/logout`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/logout`, requestOptions);
}
/**
@@ -525,7 +526,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
}

View File

@@ -1 +1 @@
3.0.1-SNAPSHOT
3.0.2-SNAPSHOT

View File

@@ -35,12 +35,13 @@ export class PetService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -242,7 +243,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -292,7 +293,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -346,7 +347,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByStatus`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByStatus`, requestOptions);
}
/**
@@ -400,7 +401,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByTags`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByTags`, requestOptions);
}
/**
@@ -445,7 +446,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -498,7 +499,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -570,7 +571,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -646,7 +647,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
}
}

View File

@@ -34,12 +34,13 @@ export class StoreService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -156,7 +157,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -196,7 +197,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/inventory`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/inventory`, requestOptions);
}
/**
@@ -236,7 +237,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -281,7 +282,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order`, requestOptions);
}
}

View File

@@ -34,12 +34,13 @@ export class UserService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -227,7 +228,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user`, requestOptions);
}
/**
@@ -270,7 +271,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithArray`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithArray`, requestOptions);
}
/**
@@ -313,7 +314,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithList`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithList`, requestOptions);
}
/**
@@ -351,7 +352,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -391,7 +392,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -444,7 +445,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/login`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/login`, requestOptions);
}
/**
@@ -478,7 +479,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/logout`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/logout`, requestOptions);
}
/**
@@ -525,7 +526,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
}

View File

@@ -1,10 +1,10 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>TSAngular2PestoreTest</artifactId>
<artifactId>TSAngular2PestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Angular2 Pettore Test</name>
<name>TS Angular 2 Petstore Client Tests</name>
<build>
<plugins>
<plugin>

View File

@@ -36,12 +36,13 @@ export class PetService implements PetServiceInterface {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -243,7 +244,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -293,7 +294,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -347,7 +348,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByStatus`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByStatus`, requestOptions);
}
/**
@@ -401,7 +402,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByTags`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByTags`, requestOptions);
}
/**
@@ -446,7 +447,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -499,7 +500,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -571,7 +572,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -647,7 +648,7 @@ export class PetService implements PetServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
}
}

View File

@@ -35,12 +35,13 @@ export class StoreService implements StoreServiceInterface {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -157,7 +158,7 @@ export class StoreService implements StoreServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -197,7 +198,7 @@ export class StoreService implements StoreServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/inventory`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/inventory`, requestOptions);
}
/**
@@ -237,7 +238,7 @@ export class StoreService implements StoreServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -282,7 +283,7 @@ export class StoreService implements StoreServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order`, requestOptions);
}
}

View File

@@ -35,12 +35,13 @@ export class UserService implements UserServiceInterface {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -228,7 +229,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user`, requestOptions);
}
/**
@@ -271,7 +272,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithArray`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithArray`, requestOptions);
}
/**
@@ -314,7 +315,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithList`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithList`, requestOptions);
}
/**
@@ -352,7 +353,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -392,7 +393,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -445,7 +446,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/login`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/login`, requestOptions);
}
/**
@@ -479,7 +480,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/logout`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/logout`, requestOptions);
}
/**
@@ -526,7 +527,7 @@ export class UserService implements UserServiceInterface {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
}

View File

@@ -33,12 +33,13 @@ export class PetService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -100,7 +101,7 @@ export class PetService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/pet`,
return this.httpClient.post<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
@@ -152,7 +153,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -206,7 +207,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByStatus`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -261,7 +262,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByTags`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -308,7 +309,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.get<Pet>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -361,7 +362,7 @@ export class PetService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/pet`,
return this.httpClient.put<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
@@ -430,7 +431,7 @@ export class PetService {
formParams = formParams.append('status', <any>status) || formParams;
}
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,
@@ -503,7 +504,7 @@ export class PetService {
formParams = formParams.append('file', <any>file) || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -32,12 +32,13 @@ export class StoreService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -85,7 +86,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -126,7 +127,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -167,7 +168,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
return this.httpClient.get<Order>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -212,7 +213,7 @@ export class StoreService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
return this.httpClient.post<Order>(`${this.configuration.basePath}/store/order`,
order,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -32,12 +32,13 @@ export class UserService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -89,7 +90,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -133,7 +134,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithArray`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -177,7 +178,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithList`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -217,7 +218,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -258,7 +259,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.get<User>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -311,7 +312,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<string>(`${this.basePath}/user/login`,
return this.httpClient.get<string>(`${this.configuration.basePath}/user/login`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -347,7 +348,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
return this.httpClient.get<any>(`${this.configuration.basePath}/user/logout`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -394,7 +395,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.put<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
user,
{
withCredentials: this.configuration.withCredentials,

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>TSAngular43PestoreTest</artifactId>
<artifactId>TSAngular43PestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Angular4.3 Pettore Test</name>
<name>TS Angular 4.3 Petstore Client Tests</name>
<build>
<plugins>
<plugin>

View File

@@ -35,12 +35,13 @@ export class PetService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -242,7 +243,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -292,7 +293,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -346,7 +347,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByStatus`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByStatus`, requestOptions);
}
/**
@@ -400,7 +401,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/findByTags`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/findByTags`, requestOptions);
}
/**
@@ -445,7 +446,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -498,7 +499,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet`, requestOptions);
}
/**
@@ -570,7 +571,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`, requestOptions);
}
/**
@@ -646,7 +647,7 @@ export class PetService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
return this.http.request(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`, requestOptions);
}
}

View File

@@ -34,12 +34,13 @@ export class StoreService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -156,7 +157,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -196,7 +197,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/inventory`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/inventory`, requestOptions);
}
/**
@@ -236,7 +237,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`, requestOptions);
}
/**
@@ -281,7 +282,7 @@ export class StoreService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/store/order`, requestOptions);
return this.http.request(`${this.configuration.basePath}/store/order`, requestOptions);
}
}

View File

@@ -34,12 +34,13 @@ export class UserService {
public configuration = new Configuration();
constructor(protected http: Http, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -227,7 +228,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user`, requestOptions);
}
/**
@@ -270,7 +271,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithArray`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithArray`, requestOptions);
}
/**
@@ -313,7 +314,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/createWithList`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/createWithList`, requestOptions);
}
/**
@@ -351,7 +352,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -391,7 +392,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
/**
@@ -444,7 +445,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/login`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/login`, requestOptions);
}
/**
@@ -478,7 +479,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/logout`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/logout`, requestOptions);
}
/**
@@ -525,7 +526,7 @@ export class UserService {
requestOptions = (<any>Object).assign(requestOptions, extraHttpRequestParams);
}
return this.http.request(`${this.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
return this.http.request(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`, requestOptions);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,10 @@
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>TSAngular4PestoreTest</artifactId>
<artifactId>TSAngular4PestoreClientTests</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<name>TS Angular4 Pettore Test</name>
<name>TS Angular 4 Petstore Client Tests</name>
<build>
<plugins>
<plugin>

View File

@@ -33,12 +33,13 @@ export class PetService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -100,7 +101,7 @@ export class PetService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/pet`,
return this.httpClient.post<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
@@ -152,7 +153,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -206,7 +207,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByStatus`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -261,7 +262,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByTags`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -308,7 +309,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.get<Pet>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -361,7 +362,7 @@ export class PetService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/pet`,
return this.httpClient.put<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
@@ -430,7 +431,7 @@ export class PetService {
formParams = formParams.append('status', <any>status) || formParams;
}
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,
@@ -503,7 +504,7 @@ export class PetService {
formParams = formParams.append('file', <any>file) || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -32,12 +32,13 @@ export class StoreService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -85,7 +86,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -126,7 +127,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -167,7 +168,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
return this.httpClient.get<Order>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -212,7 +213,7 @@ export class StoreService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
return this.httpClient.post<Order>(`${this.configuration.basePath}/store/order`,
order,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -32,12 +32,13 @@ export class UserService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -89,7 +90,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -133,7 +134,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithArray`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -177,7 +178,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithList`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -217,7 +218,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -258,7 +259,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.get<User>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -311,7 +312,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<string>(`${this.basePath}/user/login`,
return this.httpClient.get<string>(`${this.configuration.basePath}/user/login`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -347,7 +348,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
return this.httpClient.get<any>(`${this.configuration.basePath}/user/logout`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -394,7 +395,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.put<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
user,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -0,0 +1,178 @@
## @swagger/typescript-angular-petstore@1.0.0
### Building
To install the required dependencies and to build the typescript sources run:
```
npm install
npm run build
```
### publishing
First build the package than run ```npm publish dist``` (don't forget to specify the `dist` folder!)
### consuming
Navigate to the folder of your consuming project and run one of next commands.
_published:_
```
npm install @swagger/typescript-angular-petstore@1.0.0 --save
```
_without publishing (not recommended):_
```
npm install PATH_TO_GENERATED_PACKAGE/dist --save
```
_using `npm link`:_
In PATH_TO_GENERATED_PACKAGE/dist:
```
npm link
```
In your project:
```
npm link @swagger/typescript-angular-petstore
```
__Note for Windows users:__ The Angular CLI has troubles to use linked npm packages.
Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround.
Published packages are not effected by this issue.
#### General usage
In your Angular project:
```
// without configuring providers
import { ApiModule } from '@swagger/typescript-angular-petstore';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from '@swagger/typescript-angular-petstore';
export function apiConfigFactory (): Configuration => {
const params: ConfigurationParameters = {
// set configuration parameters here.
}
return new Configuration(params);
}
@NgModule({
imports: [ ApiModule.forRoot(apiConfigFactory) ],
declarations: [ AppComponent ],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
```
import { DefaultApi } from '@swagger/typescript-angular-petstore';
export class AppComponent {
constructor(private apiGateway: DefaultApi) { }
}
```
Note: The ApiModule is restricted to being instantiated once app wide.
This is to ensure that all services are treated as singletons.
#### Using multiple OpenAPI files / APIs / ApiModules
In order to use multiple `ApiModules` generated from different OpenAPI files,
you can create an alias name when importing the modules
in order to avoid naming conflicts:
```
import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
ApiModule,
OtherApiModule,
// make sure to import the HttpClientModule in the AppModule only,
// see https://github.com/angular/angular/issues/20575
HttpClientModule
]
})
export class AppModule {
}
```
### Set service base path
If different than the generated base path, during app bootstrap, you can provide the base path to your service.
```
import { BASE_PATH } from '@swagger/typescript-angular-petstore';
bootstrap(AppComponent, [
{ provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]);
```
or
```
import { BASE_PATH } from '@swagger/typescript-angular-petstore';
@NgModule({
imports: [],
declarations: [ AppComponent ],
providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```
#### Using @angular/cli
First extend your `src/environments/*.ts` files by adding the corresponding base path:
```
export const environment = {
production: false,
API_BASE_PATH: 'http://127.0.0.1:8080'
};
```
In the src/app/app.module.ts:
```
import { BASE_PATH } from '@swagger/typescript-angular-petstore';
import { environment } from '../environments/environment';
@NgModule({
declarations: [
AppComponent
],
imports: [ ],
providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
bootstrap: [ AppComponent ]
})
export class AppModule { }
```

View File

@@ -0,0 +1,518 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs';
import { ApiResponse } from '../model/apiResponse';
import { Pet } from '../model/pet';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class PetService {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Add a new pet to the store
*
* @param pet Pet object that needs to be added to the store
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public addPet(pet: Pet, observe?: 'body', reportProgress?: boolean): Observable<any>;
public addPet(pet: Pet, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public addPet(pet: Pet, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public addPet(pet: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (pet === null || pet === undefined) {
throw new Error('Required parameter pet was null or undefined when calling addPet.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json',
'application/xml'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Deletes a pet
*
* @param petId Pet id to delete
* @param apiKey
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public deletePet(petId: number, apiKey?: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deletePet(petId: number, apiKey?: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deletePet(petId: number, apiKey?: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deletePet(petId: number, apiKey?: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling deletePet.');
}
let headers = this.defaultHeaders;
if (apiKey !== undefined && apiKey !== null) {
headers = headers.set('api_key', String(apiKey));
}
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Finds Pets by status
* Multiple status values can be provided with comma separated strings
* @param status Status values that need to be considered for filter
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Pet>>>;
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (status === null || status === undefined) {
throw new Error('Required parameter status was null or undefined when calling findPetsByStatus.');
}
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
if (status) {
queryParameters = queryParameters.set('status', status.join(COLLECTION_FORMATS['csv']));
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByStatus`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Finds Pets by tags
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
* @param tags Tags to filter by
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public findPetsByTags(tags: Array<string>, observe?: 'body', reportProgress?: boolean): Observable<Array<Pet>>;
public findPetsByTags(tags: Array<string>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Pet>>>;
public findPetsByTags(tags: Array<string>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Pet>>>;
public findPetsByTags(tags: Array<string>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (tags === null || tags === undefined) {
throw new Error('Required parameter tags was null or undefined when calling findPetsByTags.');
}
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
if (tags) {
queryParameters = queryParameters.set('tags', tags.join(COLLECTION_FORMATS['csv']));
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByTags`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getPetById(petId: number, observe?: 'body', reportProgress?: boolean): Observable<Pet>;
public getPetById(petId: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Pet>>;
public getPetById(petId: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Pet>>;
public getPetById(petId: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling getPetById.');
}
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Pet>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Update an existing pet
*
* @param pet Pet object that needs to be added to the store
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public updatePet(pet: Pet, observe?: 'body', reportProgress?: boolean): Observable<any>;
public updatePet(pet: Pet, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public updatePet(pet: Pet, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public updatePet(pet: Pet, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (pet === null || pet === undefined) {
throw new Error('Required parameter pet was null or undefined when calling updatePet.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'application/json',
'application/xml'
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Updates a pet in the store with form data
*
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public updatePetWithForm(petId: number, name?: string, status?: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'application/x-www-form-urlencoded'
];
const canConsumeForm = this.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): void; };
let useForm = false;
let convertFormParamsToString = false;
if (useForm) {
formParams = new FormData();
} else {
formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
}
if (name !== undefined) {
formParams = formParams.append('name', <any>name) || formParams;
}
if (status !== undefined) {
formParams = formParams.append('status', <any>status) || formParams;
}
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* uploads an image
*
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'body', reportProgress?: boolean): Observable<ApiResponse>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<ApiResponse>>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<ApiResponse>>;
public uploadFile(petId: number, additionalMetadata?: string, file?: Blob, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (petId === null || petId === undefined) {
throw new Error('Required parameter petId was null or undefined when calling uploadFile.');
}
let headers = this.defaultHeaders;
// authentication (petstore_auth) required
if (this.configuration.accessToken) {
const accessToken = typeof this.configuration.accessToken === 'function'
? this.configuration.accessToken()
: this.configuration.accessToken;
headers = headers.set('Authorization', 'Bearer ' + accessToken);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
'multipart/form-data'
];
const canConsumeForm = this.canConsumeForm(consumes);
let formParams: { append(param: string, value: any): void; };
let useForm = false;
let convertFormParamsToString = false;
// use FormData to transmit files using content-type "multipart/form-data"
// see https://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data
useForm = canConsumeForm;
if (useForm) {
formParams = new FormData();
} else {
formParams = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
}
if (additionalMetadata !== undefined) {
formParams = formParams.append('additionalMetadata', <any>additionalMetadata) || formParams;
}
if (file !== undefined) {
formParams = formParams.append('file', <any>file) || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@@ -0,0 +1,227 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs';
import { Order } from '../model/order';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class StoreService {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Delete purchase order by ID
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
* @param orderId ID of the order that needs to be deleted
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public deleteOrder(orderId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deleteOrder(orderId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deleteOrder(orderId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deleteOrder(orderId: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getInventory(observe?: 'body', reportProgress?: boolean): Observable<{ [key: string]: number; }>;
public getInventory(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<{ [key: string]: number; }>>;
public getInventory(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<{ [key: string]: number; }>>;
public getInventory(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
let headers = this.defaultHeaders;
// authentication (api_key) required
if (this.configuration.apiKeys["api_key"]) {
headers = headers.set('api_key', this.configuration.apiKeys["api_key"]);
}
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Find purchase order by ID
* For valid response try integer IDs with value &lt;&#x3D; 5 or &gt; 10. Other values will generated exceptions
* @param orderId ID of pet that needs to be fetched
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getOrderById(orderId: number, observe?: 'body', reportProgress?: boolean): Observable<Order>;
public getOrderById(orderId: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Order>>;
public getOrderById(orderId: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Order>>;
public getOrderById(orderId: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (orderId === null || orderId === undefined) {
throw new Error('Required parameter orderId was null or undefined when calling getOrderById.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<Order>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Place an order for a pet
*
* @param order order placed for purchasing the pet
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public placeOrder(order: Order, observe?: 'body', reportProgress?: boolean): Observable<Order>;
public placeOrder(order: Order, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Order>>;
public placeOrder(order: Order, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Order>>;
public placeOrder(order: Order, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (order === null || order === undefined) {
throw new Error('Required parameter order was null or undefined when calling placeOrder.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<Order>(`${this.configuration.basePath}/store/order`,
order,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@@ -0,0 +1,409 @@
/**
* OpenAPI Petstore
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
import { Observable } from 'rxjs';
import { User } from '../model/user';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
@Injectable()
export class UserService {
protected basePath = 'http://petstore.swagger.io/v2';
public defaultHeaders = new HttpHeaders();
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (configuration) {
this.configuration = configuration;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
/**
* @param consumes string[] mime-types
* @return true: consumes contains 'multipart/form-data', false: otherwise
*/
private canConsumeForm(consumes: string[]): boolean {
const form = 'multipart/form-data';
for (const consume of consumes) {
if (form === consume) {
return true;
}
}
return false;
}
/**
* Create user
* This can only be done by the logged in user.
* @param user Created user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public createUser(user: User, observe?: 'body', reportProgress?: boolean): Observable<any>;
public createUser(user: User, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public createUser(user: User, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public createUser(user: User, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUser.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.configuration.basePath}/user`,
user,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Creates list of users with given input array
*
* @param user List of user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public createUsersWithArrayInput(user: Array<User>, observe?: 'body', reportProgress?: boolean): Observable<any>;
public createUsersWithArrayInput(user: Array<User>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public createUsersWithArrayInput(user: Array<User>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public createUsersWithArrayInput(user: Array<User>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUsersWithArrayInput.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithArray`,
user,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Creates list of users with given input array
*
* @param user List of user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public createUsersWithListInput(user: Array<User>, observe?: 'body', reportProgress?: boolean): Observable<any>;
public createUsersWithListInput(user: Array<User>, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public createUsersWithListInput(user: Array<User>, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public createUsersWithListInput(user: Array<User>, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling createUsersWithListInput.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithList`,
user,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public deleteUser(username: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
public deleteUser(username: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public deleteUser(username: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public deleteUser(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling deleteUser.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getUserByName(username: string, observe?: 'body', reportProgress?: boolean): Observable<User>;
public getUserByName(username: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
public getUserByName(username: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
public getUserByName(username: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling getUserByName.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<User>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Logs user into the system
*
* @param username The user name for login
* @param password The password for login in clear text
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public loginUser(username: string, password: string, observe?: 'body', reportProgress?: boolean): Observable<string>;
public loginUser(username: string, password: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>;
public loginUser(username: string, password: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>;
public loginUser(username: string, password: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling loginUser.');
}
if (password === null || password === undefined) {
throw new Error('Required parameter password was null or undefined when calling loginUser.');
}
let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
if (username !== undefined && username !== null) {
queryParameters = queryParameters.set('username', <any>username);
}
if (password !== undefined && password !== null) {
queryParameters = queryParameters.set('password', <any>password);
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
'application/xml',
'application/json'
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<string>(`${this.configuration.basePath}/user/login`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Logs out current logged in user session
*
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public logoutUser(observe?: 'body', reportProgress?: boolean): Observable<any>;
public logoutUser(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public logoutUser(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public logoutUser(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
return this.httpClient.get<any>(`${this.configuration.basePath}/user/logout`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
/**
* Updated user
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param user Updated user object
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public updateUser(username: string, user: User, observe?: 'body', reportProgress?: boolean): Observable<any>;
public updateUser(username: string, user: User, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
public updateUser(username: string, user: User, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
public updateUser(username: string, user: User, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
if (username === null || username === undefined) {
throw new Error('Required parameter username was null or undefined when calling updateUser.');
}
if (user === null || user === undefined) {
throw new Error('Required parameter user was null or undefined when calling updateUser.');
}
let headers = this.defaultHeaders;
// to determine the Accept header
let httpHeaderAccepts: string[] = [
];
const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
if (httpHeaderAcceptSelected !== undefined) {
headers = headers.set('Accept', httpHeaderAcceptSelected);
}
// to determine the Content-Type header
const consumes: string[] = [
];
const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
if (httpContentTypeSelected !== undefined) {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
user,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
}
}

View File

@@ -0,0 +1,6 @@
{
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "index.ts"
}
}

View File

@@ -0,0 +1,40 @@
{
"name": "@swagger/typescript-angular-petstore",
"version": "1.0.0",
"description": "OpenAPI client for @swagger/typescript-angular-petstore",
"author": "OpenAPI-Generator Contributors",
"keywords": [
"openapi-client",
"openapi-generator"
],
"license": "Unlicense",
"scripts": {
"build": "ng-packagr -p ng-package.json"
},
"peerDependencies": {
"@angular/core": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^6.1.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/compiler-cli": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"ng-packagr": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "^6.1.0",
"zone.js": "^0.7.6",
"typescript": ">=2.1.5 <2.8"
},
"publishConfig": {
"registry": "https://skimdb.npmjs.com/registry"
}
}

View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"removeComments": true,
"sourceMap": true,
"outDir": "./dist",
"noLib": false,
"declaration": true,
"lib": [ "es6", "dom" ]
},
"exclude": [
"node_modules",
"dist"
],
"filesGlob": [
"./model/*.ts",
"./api/*.ts"
]
}

View File

@@ -0,0 +1,5 @@
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160725163759"
}
}

View File

@@ -0,0 +1,13 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

View File

@@ -0,0 +1,39 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db

View File

@@ -0,0 +1,127 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "tests",
"projects": {
"test-default": {
"root": "tests/default",
"sourceRoot": "tests/default/src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "tests/default/dist",
"index": "tests/default/src/index.html",
"main": "tests/default/src/main.ts",
"polyfills": "tests/default/src/polyfills.ts",
"tsConfig": "tests/default/src/tsconfig.app.json",
"assets": [
"tests/default/src/favicon.ico",
"tests/default/src/assets"
],
"styles": [
"tests/default/src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "tests/default/src/environments/environment.ts",
"with": "tests/default/src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "test-default:build"
},
"configurations": {
"production": {
"browserTarget": "test-default:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "test-default:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "tests/default/src/test.ts",
"polyfills": "tests/default/src/polyfills.ts",
"tsConfig": "tests/default/src/tsconfig.spec.json",
"karmaConfig": "tests/default/src/karma.conf.js",
"styles": [
"tests/default/src/styles.css"
],
"scripts": [],
"assets": [
"tests/default/src/favicon.ico",
"tests/default/src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tests/default/src/tsconfig.app.json",
"tests/default/src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"cli-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "tests/default/e2e/protractor.conf.js",
"devServerTarget": "test-default:serve"
},
"configurations": {
"production": {
"devServerTarget": "test-default:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "tests/default/e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "test-default"
}

View File

@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# 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 OpenAPI Generator 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

View File

@@ -0,0 +1,37 @@
import { NgModule, ModuleWithProviders, SkipSelf, Optional } from '@angular/core';
import { Configuration } from './configuration';
import { HttpClient } from '@angular/common/http';
import { PetService } from './api/pet.service';
import { StoreService } from './api/store.service';
import { UserService } from './api/user.service';
@NgModule({
imports: [],
declarations: [],
exports: [],
providers: [
PetService,
StoreService,
UserService ]
})
export class ApiModule {
public static forRoot(configurationFactory: () => Configuration): ModuleWithProviders {
return {
ngModule: ApiModule,
providers: [ { provide: Configuration, useFactory: configurationFactory } ]
};
}
constructor( @Optional() @SkipSelf() parentModule: ApiModule,
@Optional() http: HttpClient) {
if (parentModule) {
throw new Error('ApiModule is already loaded. Import in your base AppModule only.');
}
if (!http) {
throw new Error('You need to import the HttpClientModule in your AppModule! \n' +
'See also https://github.com/angular/angular/issues/20575');
}
}
}

View File

@@ -0,0 +1,7 @@
export * from './pet.service';
import { PetService } from './pet.service';
export * from './store.service';
import { StoreService } from './store.service';
export * from './user.service';
import { UserService } from './user.service';
export const APIS = [PetService, StoreService, UserService];

View File

@@ -35,12 +35,13 @@ export class PetService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -102,7 +103,7 @@ export class PetService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/pet`,
return this.httpClient.post<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
@@ -154,7 +155,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -208,7 +209,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByStatus`,
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByStatus`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -263,7 +264,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Array<Pet>>(`${this.basePath}/pet/findByTags`,
return this.httpClient.get<Array<Pet>>(`${this.configuration.basePath}/pet/findByTags`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -310,7 +311,7 @@ export class PetService {
const consumes: string[] = [
];
return this.httpClient.get<Pet>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.get<Pet>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -363,7 +364,7 @@ export class PetService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/pet`,
return this.httpClient.put<any>(`${this.configuration.basePath}/pet`,
pet,
{
withCredentials: this.configuration.withCredentials,
@@ -432,7 +433,7 @@ export class PetService {
formParams = formParams.append('status', <any>status) || formParams;
}
return this.httpClient.post<any>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}`,
return this.httpClient.post<any>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,
@@ -505,7 +506,7 @@ export class PetService {
formParams = formParams.append('file', <any>file) || formParams;
}
return this.httpClient.post<ApiResponse>(`${this.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
return this.httpClient.post<ApiResponse>(`${this.configuration.basePath}/pet/${encodeURIComponent(String(petId))}/uploadImage`,
convertFormParamsToString ? formParams.toString() : formParams,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -34,12 +34,13 @@ export class StoreService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -87,7 +88,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -128,7 +129,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.get<{ [key: string]: number; }>(`${this.basePath}/store/inventory`,
return this.httpClient.get<{ [key: string]: number; }>(`${this.configuration.basePath}/store/inventory`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -169,7 +170,7 @@ export class StoreService {
const consumes: string[] = [
];
return this.httpClient.get<Order>(`${this.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
return this.httpClient.get<Order>(`${this.configuration.basePath}/store/order/${encodeURIComponent(String(orderId))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -214,7 +215,7 @@ export class StoreService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<Order>(`${this.basePath}/store/order`,
return this.httpClient.post<Order>(`${this.configuration.basePath}/store/order`,
order,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -34,12 +34,13 @@ export class UserService {
public configuration = new Configuration();
constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
if (basePath) {
this.basePath = basePath;
}
if (configuration) {
this.configuration = configuration;
this.basePath = basePath || configuration.basePath || this.basePath;
this.configuration.basePath = configuration.basePath || basePath || this.basePath;
} else {
this.configuration.basePath = basePath || this.basePath;
}
}
@@ -91,7 +92,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -135,7 +136,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithArray`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithArray`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -179,7 +180,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.post<any>(`${this.basePath}/user/createWithList`,
return this.httpClient.post<any>(`${this.configuration.basePath}/user/createWithList`,
user,
{
withCredentials: this.configuration.withCredentials,
@@ -219,7 +220,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.delete<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.delete<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -260,7 +261,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<User>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.get<User>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -313,7 +314,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<string>(`${this.basePath}/user/login`,
return this.httpClient.get<string>(`${this.configuration.basePath}/user/login`,
{
params: queryParameters,
withCredentials: this.configuration.withCredentials,
@@ -349,7 +350,7 @@ export class UserService {
const consumes: string[] = [
];
return this.httpClient.get<any>(`${this.basePath}/user/logout`,
return this.httpClient.get<any>(`${this.configuration.basePath}/user/logout`,
{
withCredentials: this.configuration.withCredentials,
headers: headers,
@@ -396,7 +397,7 @@ export class UserService {
headers = headers.set('Content-Type', httpContentTypeSelected);
}
return this.httpClient.put<any>(`${this.basePath}/user/${encodeURIComponent(String(username))}`,
return this.httpClient.put<any>(`${this.configuration.basePath}/user/${encodeURIComponent(String(username))}`,
user,
{
withCredentials: this.configuration.withCredentials,

View File

@@ -0,0 +1,79 @@
export interface ConfigurationParameters {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
basePath?: string;
withCredentials?: boolean;
}
export class Configuration {
apiKeys?: {[ key: string ]: string};
username?: string;
password?: string;
accessToken?: string | (() => string);
basePath?: string;
withCredentials?: boolean;
constructor(configurationParameters: ConfigurationParameters = {}) {
this.apiKeys = configurationParameters.apiKeys;
this.username = configurationParameters.username;
this.password = configurationParameters.password;
this.accessToken = configurationParameters.accessToken;
this.basePath = configurationParameters.basePath;
this.withCredentials = configurationParameters.withCredentials;
}
/**
* Select the correct content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param contentTypes - the array of content types that are available for selection
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderContentType (contentTypes: string[]): string | undefined {
if (contentTypes.length === 0) {
return undefined;
}
let type = contentTypes.find(x => this.isJsonMime(x));
if (type === undefined) {
return contentTypes[0];
}
return type;
}
/**
* Select the correct accept content-type to use for a request.
* Uses {@link Configuration#isJsonMime} to determine the correct accept content-type.
* If no content type is found return the first found type if the contentTypes is not empty
* @param accepts - the array of content types that are available for selection.
* @returns the selected content-type or <code>undefined</code> if no selection could be made.
*/
public selectHeaderAccept(accepts: string[]): string | undefined {
if (accepts.length === 0) {
return undefined;
}
let type = accepts.find(x => this.isJsonMime(x));
if (type === undefined) {
return accepts[0];
}
return type;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

View File

@@ -0,0 +1,18 @@
import { HttpUrlEncodingCodec } from '@angular/common/http';
/**
* CustomHttpUrlEncodingCodec
* Fix plus sign (+) not encoding, so sent as blank space
* See: https://github.com/angular/angular/issues/11058#issuecomment-247367318
*/
export class CustomHttpUrlEncodingCodec extends HttpUrlEncodingCodec {
encodeKey(k: string): string {
k = super.encodeKey(k);
return k.replace(/\+/gi, '%2B');
}
encodeValue(v: string): string {
v = super.encodeValue(v);
return v.replace(/\+/gi, '%2B');
}
}

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'

Some files were not shown because too many files have changed in this diff Show More