Skip to content

Commit

Permalink
feat: ✨ added remaining getBatches filters
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRill00 committed Feb 28, 2024
1 parent 0099217 commit 4c2996b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/PrintOne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { CreateCsvOrder, CsvOrder } from "./models/CsvOrder";
import { ICsvOrder } from "./models/_interfaces/ICsvOrder";
import { Batch, CreateBatch } from "./models/Batch";
import { IBatch } from "./models/_interfaces/IBatch";
import { BatchStatus } from "./enums/BatchStatus";

export type RequestHandler = new (
token: string,
Expand Down Expand Up @@ -433,7 +434,9 @@ export class PrintOne {
sendDate?: DateFilter | boolean;
finish?: InFilter;
templates?: InFilter<string | Template>;
//TODO format, status, isBillable
format?: InFilter;
status?: InFilter<BatchStatus>;
isBillable?: InFilter;
};
} = {},
): Promise<PaginatedResponse<Batch>> {
Expand All @@ -444,8 +447,17 @@ export class PrintOne {
...dateFilterToQuery("createdAt", options.filter?.createdAt),
...dateFilterToQuery("updatedAt", options.filter?.updatedAt),
...inFilterToQuery("finish", options.filter?.finish),
...inFilterToQuery("format", options.filter?.format),
...inFilterToQuery("status", options.filter?.status),
};

if (typeof options.filter?.isBillable === "boolean") {
params = {
...params,
"filter.isBillable": `$eq:${options.filter.isBillable}`,
};
}

if (options.filter?.templates) {
if (!Array.isArray(options.filter.templates)) {
options.filter.templates = [options.filter.templates];
Expand Down

0 comments on commit 4c2996b

Please sign in to comment.