Add limit parameter to API client
Signed-off-by: Niklas Granander <ngranander@spotify.com>
This commit is contained in:
@@ -29,9 +29,9 @@ export class XCMetricsClient implements XCMetricsApi {
|
||||
this.discoveryApi = options.discoveryApi;
|
||||
}
|
||||
|
||||
async getBuilds(): Promise<BuildItem[]> {
|
||||
async getBuilds(limit: number = 10): Promise<BuildItem[]> {
|
||||
const baseUrl = `${await this.discoveryApi.getBaseUrl('proxy')}/xcmetrics`;
|
||||
const response = await fetch(`${baseUrl}/build`);
|
||||
const response = await fetch(`${baseUrl}/build?per=${limit}`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw await ResponseError.fromResponse(response);
|
||||
|
||||
@@ -54,7 +54,7 @@ export type BuildsResult = {
|
||||
};
|
||||
|
||||
export interface XCMetricsApi {
|
||||
getBuilds(): Promise<BuildItem[]>;
|
||||
getBuilds(limit?: number): Promise<BuildItem[]>;
|
||||
}
|
||||
|
||||
export const xcmetricsApiRef = createApiRef<XCMetricsApi>({
|
||||
|
||||
Reference in New Issue
Block a user