Skip to content

Commit

Permalink
Coverage create request enrich parameter support
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-ogg committed Oct 3, 2024
1 parent 58f3b5c commit 547edfe
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/endpoints/Coverage/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { CoverageEntry, SelectionValue } from '../../types';
import { Query, SortOrder } from '../../types';

import type {
CreateOptions,
CreateRequest,
ListOptions,
ListResponse,
Expand Down Expand Up @@ -74,9 +75,15 @@ export function createClient(api: DeferredJobsApiClient) {
return coverage[0] || null;
}

async function create(payload: CreateRequest): Promise<CoverageEntry> {
async function create(
payload: CreateRequest,
{ enrich = false }: CreateOptions = {},
): Promise<CoverageEntry> {
const { coverage } = await api.post<{ coverage: CoverageEntry }>(routing.coverageUrl, {
payload,
query: {
enrich: enrich || undefined,
},
});
return coverage;
}
Expand Down
4 changes: 4 additions & 0 deletions src/endpoints/Coverage/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ export interface CreateRequest extends UpdateRequest {
integration_run?: CoverageEntry['integration_run'];
}

export interface CreateOptions {
enrich?: boolean;
}

export interface ListOptions {
includeDeleted?: boolean;
limit?: number;
Expand Down

0 comments on commit 547edfe

Please sign in to comment.