swagger-pack
Version:
test of swagger generated angular models/services and possibility to reuse them
86 lines (79 loc) • 2.36 kB
text/typescript
/* tslint:disable */
import { Injectable } from '@angular/core';
import { HttpClient, HttpRequest, HttpResponse, HttpHeaders } from '@angular/common/http';
import { BaseService as __BaseService } from '../base-service';
import { ApiConfiguration as __Configuration } from '../api-configuration';
import { StrictHttpResponse as __StrictHttpResponse } from '../strict-http-response';
import { Observable as __Observable } from 'rxjs';
import { map as __map, filter as __filter } from 'rxjs/operators';
import { Organization } from '../models/organization';
({
providedIn: 'root',
})
class OrganizationService extends __BaseService {
constructor(
config: __Configuration,
http: HttpClient
) {
super(config, http);
}
listOrganizationsResponse(): __Observable<__StrictHttpResponse<null>> {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
let req = new HttpRequest<any>(
'GET',
this.rootUrl + `/organizations`,
__body,
{
headers: __headers,
params: __params,
responseType: 'json'
});
return this.http.request<any>(req).pipe(
__filter(_r => _r instanceof HttpResponse),
__map((_r) => {
return _r as __StrictHttpResponse<null>;
})
);
} listOrganizations(): __Observable<null> {
return this.listOrganizationsResponse().pipe(
__map(_r => _r.body as null)
);
}
/**
* @param body undefined
*/
postOrganizationResponse(body?: Organization): __Observable<__StrictHttpResponse<null>> {
let __params = this.newParams();
let __headers = new HttpHeaders();
let __body: any = null;
__body = body;
let req = new HttpRequest<any>(
'POST',
this.rootUrl + `/organizations`,
__body,
{
headers: __headers,
params: __params,
responseType: 'json'
});
return this.http.request<any>(req).pipe(
__filter(_r => _r instanceof HttpResponse),
__map((_r) => {
return _r as __StrictHttpResponse<null>;
})
);
}
/**
* @param body undefined
*/
postOrganization(body?: Organization): __Observable<null> {
return this.postOrganizationResponse(body).pipe(
__map(_r => _r.body as null)
);
}
}
module OrganizationService {
}
export { OrganizationService }