Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

import { Inject, Injectable, Optional } from '@angular/core';
{{#useHttpClient}}
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent } from '@angular/common/http';
import { CustomHttpUrlEncodingCodec } from '../encoder';
{{/useHttpClient}}
{{^useHttpClient}}
import { Http, Headers, URLSearchParams } from '@angular/http';
import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
import { Response, ResponseContentType } from '@angular/http';
import { CustomQueryEncoderHelper } from '../encoder';
{{/useHttpClient}}

import { Observable } from 'rxjs/Observable';
Expand All @@ -20,12 +23,6 @@ import { {{classname}} } from '../{{filename}}';

import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
{{#useHttpClient}}
import { CustomHttpUrlEncodingCodec } from '../encoder';
{{/useHttpClient}}
{{^useHttpClient}}
import { CustomQueryEncoderHelper } from '../encoder';
{{/useHttpClient}}
{{#withInterfaces}}
import { {{classname}}Interface } from './{{classname}}Interface';
{{/withInterfaces}}
Expand Down Expand Up @@ -74,8 +71,8 @@ export class {{classname}} {
}

{{^useHttpClient}}
{{! not sure why we used to generate a second method here rather than inlining those few lines of code,
but let's keep it for now for the sake of backwards compatiblity. }}
{{! Before HttpClient implementation or method overloading we relied on 2 functions, 1 to return the straight body as json
and another to get the full response.}}
{{#operation}}
/**
* {{&notes}}
Expand Down Expand Up @@ -109,8 +106,18 @@ export class {{classname}} {
* {{summary}}
* {{notes}}
{{#allParams}}* @param {{paramName}} {{description}}
{{/allParams}}*/
public {{nickname}}{{^useHttpClient}}WithHttpInfo{{/useHttpClient}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{^useHttpClient}}{{#hasParams}}, {{/hasParams}}extraHttpRequestParams?: RequestOptionsArgs{{/useHttpClient}}): Observable<{{#useHttpClient}}{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}{}{{/returnType}}{{/useHttpClient}}{{^useHttpClient}}Response{{/useHttpClient}}> {
{{/allParams}}{{#useHttpClient}}* @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.{{/useHttpClient}}
*/
{{#useHttpClient}}
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe?: 'body', reportProgress?: boolean): Observable<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>;
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>>;
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
{{/useHttpClient}}
{{^useHttpClient}}
public {{nickname}}WithHttpInfo({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
{{/useHttpClient}}
{{#allParams}}
{{#required}}
if ({{paramName}} === null || {{paramName}} === undefined) {
Expand Down Expand Up @@ -151,7 +158,7 @@ export class {{classname}} {
{{/isListContainer}}
{{/queryParams}}

{{/hasQueryParams}}
{{/hasQueryParams}}
let headers = {{#useHttpClient}}this.defaultHeaders;{{/useHttpClient}}{{^useHttpClient}}new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845{{/useHttpClient}}
{{#headerParams}}
{{#isListContainer}}
Expand Down Expand Up @@ -282,17 +289,19 @@ export class {{classname}} {

{{/hasFormParams}}
{{#useHttpClient}}
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<any>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
{
{{#hasQueryParams}}
params: queryParameters,
{{/hasQueryParams}}
headers: headers,
{{#isResponseFile}}
responseType: "blob",
{{/isResponseFile}}
withCredentials: this.configuration.withCredentials,
headers: headers,
observe: observe,
reportProgress: reportProgress
}
);
{{/useHttpClient}}
Expand Down Expand Up @@ -320,7 +329,7 @@ export class {{classname}} {
}

return this.http.request(`${this.basePath}{{{path}}}`, requestOptions);
{{/useHttpClient}}
{{/useHttpClient}}
}

{{/operation}}}
Expand Down
2 changes: 1 addition & 1 deletion modules/swagger-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<goal>wget</goal>
</goals>
<configuration>
<url>http://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>
<url>https://github.com/swagger-api/swagger-ui/archive/master.tar.gz</url>

<unpack>true</unpack>
<skipCache>true</skipCache>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Inject, Injectable, Optional } from '@angular/core
import { Http, Headers, URLSearchParams } from '@angular/http';
import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
import { Response, ResponseContentType } from '@angular/http';
import { CustomQueryEncoderHelper } from '../encoder';

import { Observable } from 'rxjs/Observable';
import '../rxjs-operators';
Expand All @@ -24,7 +25,6 @@ import { Pet } from '../model/pet';

import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { CustomQueryEncoderHelper } from '../encoder';


@Injectable()
Expand Down Expand Up @@ -196,6 +196,7 @@ export class PetService {
* Add a new pet to the store
*
* @param body Pet object that needs to be added to the store

*/
public addPetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (body === null || body === undefined) {
Expand Down Expand Up @@ -251,6 +252,7 @@ export class PetService {
*
* @param petId Pet id to delete
* @param apiKey

*/
public deletePetWithHttpInfo(petId: number, apiKey?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (petId === null || petId === undefined) {
Expand Down Expand Up @@ -301,6 +303,7 @@ export class PetService {
* 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

*/
public findPetsByStatusWithHttpInfo(status: Array<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (status === null || status === undefined) {
Expand Down Expand Up @@ -354,6 +357,7 @@ export class PetService {
* 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

*/
public findPetsByTagsWithHttpInfo(tags: Array<string>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (tags === null || tags === undefined) {
Expand Down Expand Up @@ -407,6 +411,7 @@ export class PetService {
* Find pet by ID
* Returns a single pet
* @param petId ID of pet to return

*/
public getPetByIdWithHttpInfo(petId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (petId === null || petId === undefined) {
Expand Down Expand Up @@ -451,6 +456,7 @@ export class PetService {
* Update an existing pet
*
* @param body Pet object that needs to be added to the store

*/
public updatePetWithHttpInfo(body: Pet, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (body === null || body === undefined) {
Expand Down Expand Up @@ -507,6 +513,7 @@ export class PetService {
* @param petId ID of pet that needs to be updated
* @param name Updated name of the pet
* @param status Updated status of the pet

*/
public updatePetWithFormWithHttpInfo(petId: number, name?: string, status?: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (petId === null || petId === undefined) {
Expand Down Expand Up @@ -580,6 +587,7 @@ export class PetService {
* @param petId ID of pet to update
* @param additionalMetadata Additional data to pass to server
* @param file file to upload

*/
public uploadFileWithHttpInfo(petId: number, additionalMetadata?: string, file?: Blob, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (petId === null || petId === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Inject, Injectable, Optional } from '@angular/core
import { Http, Headers, URLSearchParams } from '@angular/http';
import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
import { Response, ResponseContentType } from '@angular/http';
import { CustomQueryEncoderHelper } from '../encoder';

import { Observable } from 'rxjs/Observable';
import '../rxjs-operators';
Expand All @@ -23,7 +24,6 @@ import { Order } from '../model/order';

import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { CustomQueryEncoderHelper } from '../encoder';


@Injectable()
Expand Down Expand Up @@ -125,6 +125,7 @@ export class StoreService {
* 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

*/
public deleteOrderWithHttpInfo(orderId: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (orderId === null || orderId === undefined) {
Expand Down Expand Up @@ -163,6 +164,7 @@ export class StoreService {
/**
* Returns pet inventories by status
* Returns a map of status codes to quantities

*/
public getInventoryWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {

Expand Down Expand Up @@ -203,6 +205,7 @@ export class StoreService {
* 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

*/
public getOrderByIdWithHttpInfo(orderId: number, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (orderId === null || orderId === undefined) {
Expand Down Expand Up @@ -242,6 +245,7 @@ export class StoreService {
* Place an order for a pet
*
* @param body order placed for purchasing the pet

*/
public placeOrderWithHttpInfo(body: Order, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (body === null || body === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { Inject, Injectable, Optional } from '@angular/core
import { Http, Headers, URLSearchParams } from '@angular/http';
import { RequestMethod, RequestOptions, RequestOptionsArgs } from '@angular/http';
import { Response, ResponseContentType } from '@angular/http';
import { CustomQueryEncoderHelper } from '../encoder';

import { Observable } from 'rxjs/Observable';
import '../rxjs-operators';
Expand All @@ -23,7 +24,6 @@ import { User } from '../model/user';

import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { CustomQueryEncoderHelper } from '../encoder';


@Injectable()
Expand Down Expand Up @@ -191,6 +191,7 @@ export class UserService {
* Create user
* This can only be done by the logged in user.
* @param body Created user object

*/
public createUserWithHttpInfo(body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (body === null || body === undefined) {
Expand Down Expand Up @@ -235,6 +236,7 @@ export class UserService {
* Creates list of users with given input array
*
* @param body List of user object

*/
public createUsersWithArrayInputWithHttpInfo(body: Array<User>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (body === null || body === undefined) {
Expand Down Expand Up @@ -279,6 +281,7 @@ export class UserService {
* Creates list of users with given input array
*
* @param body List of user object

*/
public createUsersWithListInputWithHttpInfo(body: Array<User>, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (body === null || body === undefined) {
Expand Down Expand Up @@ -323,6 +326,7 @@ export class UserService {
* Delete user
* This can only be done by the logged in user.
* @param username The name that needs to be deleted

*/
public deleteUserWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (username === null || username === undefined) {
Expand Down Expand Up @@ -362,6 +366,7 @@ export class UserService {
* Get user by user name
*
* @param username The name that needs to be fetched. Use user1 for testing.

*/
public getUserByNameWithHttpInfo(username: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (username === null || username === undefined) {
Expand Down Expand Up @@ -402,6 +407,7 @@ export class UserService {
*
* @param username The user name for login
* @param password The password for login in clear text

*/
public loginUserWithHttpInfo(username: string, password: string, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (username === null || username === undefined) {
Expand Down Expand Up @@ -452,6 +458,7 @@ export class UserService {
/**
* Logs out current logged in user session
*

*/
public logoutUserWithHttpInfo(extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {

Expand Down Expand Up @@ -489,6 +496,7 @@ export class UserService {
* This can only be done by the logged in user.
* @param username name that need to be deleted
* @param body Updated user object

*/
public updateUserWithHttpInfo(username: string, body: User, extraHttpRequestParams?: RequestOptionsArgs): Observable<Response> {
if (username === null || username === undefined) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ 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 crediential in your environment."
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
Expand Down
Loading