40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
|
|
import { Observable } from 'rxjs';
|
|
import { filter, map } from 'rxjs/operators';
|
|
import { StrictHttpResponse } from '../../strict-http-response';
|
|
import { RequestBuilder } from '../../request-builder';
|
|
import { Source } from '../../models/source';
|
|
export interface SourcePreview$Params {
|
|
limit?: number;
|
|
body: Source;
|
|
}
|
|
export function sourcePreview(
|
|
http: HttpClient,
|
|
rootUrl: string,
|
|
params: SourcePreview$Params,
|
|
context?: HttpContext,
|
|
): Observable<
|
|
StrictHttpResponse<
|
|
Array<{
|
|
[key: string]: any;
|
|
}>
|
|
>
|
|
> {
|
|
const rb = new RequestBuilder(rootUrl, sourcePreview.PATH, 'post');
|
|
if (params) {
|
|
rb.query('limit', params.limit, {});
|
|
rb.body(params.body, 'application/json');
|
|
}
|
|
return http.request(rb.build({ responseType: 'json', accept: 'application/json', context })).pipe(
|
|
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
|
|
map((r: HttpResponse<any>) => {
|
|
return r as StrictHttpResponse<
|
|
Array<{
|
|
[key: string]: any;
|
|
}>
|
|
>;
|
|
}),
|
|
);
|
|
}
|
|
sourcePreview.PATH = '/ingest/sources/preview';
|