@go-avro/avro-js 0.0.2-beta.25 → 0.0.2-beta.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,10 +23,43 @@ export declare class AvroQueryClient {
23
23
  password: string;
24
24
  }, cancelToken?: CancelToken): Promise<Boolean>;
25
25
  logout(cancelToken?: CancelToken): Promise<void>;
26
- fetchJobs(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
27
- fetchEvents(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, unbilled?: boolean, billed?: boolean, paid?: boolean, jobId?: string | null, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
28
- fetchMonths(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, unbilled?: boolean, billed?: boolean, paid?: boolean, jobId?: string | null, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
29
- fetchBills(companyGuid: string, amt?: number, knownIds?: string[], unknownIds?: string[], keyword?: string, offset?: number, paid?: boolean, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
26
+ fetchJobs(companyGuid: string, body?: {
27
+ amt?: number;
28
+ knownIds?: string[];
29
+ unknownIds?: string[];
30
+ query?: string;
31
+ offset?: number;
32
+ }, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
33
+ fetchEvents(companyGuid: string, body?: {
34
+ amt?: number;
35
+ knownIds?: string[];
36
+ unknownIds?: string[];
37
+ query?: string;
38
+ offset?: number;
39
+ unbilled?: boolean;
40
+ billed?: boolean;
41
+ paid?: boolean;
42
+ jobId?: string | null;
43
+ }, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
44
+ fetchMonths(companyGuid: string, body?: {
45
+ amt?: number;
46
+ knownIds?: string[];
47
+ unknownIds?: string[];
48
+ query?: string;
49
+ offset?: number;
50
+ unbilled?: boolean;
51
+ billed?: boolean;
52
+ paid?: boolean;
53
+ jobId?: string | null;
54
+ }, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
55
+ fetchBills(companyGuid: string, body?: {
56
+ amt?: number;
57
+ knownIds?: string[];
58
+ unknownIds?: string[];
59
+ query?: string;
60
+ offset?: number;
61
+ paid?: boolean;
62
+ }, cancelToken?: CancelToken, headers?: Record<string, string>): Promise<any>;
30
63
  sendEmail(emailId: string, formData: FormData): Promise<void>;
31
64
  createBill(companyGuid: string, data: {
32
65
  line_items: LineItem[];
@@ -202,17 +202,11 @@ export class AvroQueryClient {
202
202
  throw new StandardError(500, 'Logout failed');
203
203
  });
204
204
  }
205
- fetchJobs(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, cancelToken, headers = {}) {
206
- const body = {
207
- amt,
208
- known_ids: knownIds,
209
- unknown_ids: unknownIds,
210
- query: keyword,
211
- };
212
- if (!companyGuid) {
205
+ fetchJobs(companyGuid, body = {}, cancelToken, headers = {}) {
206
+ if (!companyGuid || companyGuid.trim() === '') {
213
207
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
214
208
  }
215
- return this._fetch('POST', `/company/${companyGuid}/jobs?amt=${amt}&offset=${offset}`, body, cancelToken, headers)
209
+ return this._fetch('POST', `/company/${companyGuid}/jobs`, body, cancelToken, headers)
216
210
  .then(response => {
217
211
  if (!response || !Array.isArray(response)) {
218
212
  throw new StandardError(400, 'Invalid jobs response');
@@ -224,18 +218,11 @@ export class AvroQueryClient {
224
218
  throw new StandardError(500, 'Failed to fetch jobs');
225
219
  });
226
220
  }
227
- fetchEvents(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, unbilled = true, billed = true, paid = true, jobId = null, cancelToken, headers = {}) {
228
- const body = {
229
- amt,
230
- known_ids: knownIds,
231
- unknown_ids: unknownIds,
232
- query: keyword,
233
- job_id: jobId,
234
- };
235
- if (!companyGuid) {
221
+ fetchEvents(companyGuid, body = {}, cancelToken, headers = {}) {
222
+ if (!companyGuid || companyGuid.trim() === '') {
236
223
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
237
224
  }
238
- return this._fetch('POST', `/company/${companyGuid}/events?amt=${amt}&offset=${offset}&unbilled=${unbilled}&billed=${billed}&paid=${paid}`, body, cancelToken, headers)
225
+ return this._fetch('POST', `/company/${companyGuid}/events`, body, cancelToken, headers)
239
226
  .then(response => {
240
227
  if (!response || !Array.isArray(response)) {
241
228
  throw new StandardError(400, 'Invalid events response');
@@ -247,18 +234,11 @@ export class AvroQueryClient {
247
234
  throw new StandardError(500, 'Failed to fetch events');
248
235
  });
249
236
  }
250
- fetchMonths(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, unbilled = true, billed = true, paid = true, jobId = null, cancelToken, headers = {}) {
251
- const body = {
252
- amt,
253
- known_ids: knownIds,
254
- unknown_ids: unknownIds,
255
- query: keyword,
256
- job_id: jobId,
257
- };
258
- if (!companyGuid) {
237
+ fetchMonths(companyGuid, body = {}, cancelToken, headers = {}) {
238
+ if (!companyGuid || companyGuid.trim() === '') {
259
239
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
260
240
  }
261
- return this._fetch('POST', `/company/${companyGuid}/months?amt=${amt}&offset=${offset}&unbilled=${unbilled}&billed=${billed}&paid=${paid}`, body, cancelToken, headers)
241
+ return this._fetch('POST', `/company/${companyGuid}/months`, body, cancelToken, headers)
262
242
  .then(response => {
263
243
  if (!response || !Array.isArray(response)) {
264
244
  throw new StandardError(400, 'Invalid months response');
@@ -270,17 +250,11 @@ export class AvroQueryClient {
270
250
  throw new StandardError(500, 'Failed to fetch months');
271
251
  });
272
252
  }
273
- fetchBills(companyGuid, amt = 50, knownIds = [], unknownIds = [], keyword = '', offset = 0, paid = true, cancelToken, headers = {}) {
274
- const body = {
275
- amt,
276
- known_ids: knownIds,
277
- unknown_ids: unknownIds,
278
- query: keyword,
279
- };
280
- if (!companyGuid) {
253
+ fetchBills(companyGuid, body = {}, cancelToken, headers = {}) {
254
+ if (!companyGuid || companyGuid.trim() === '') {
281
255
  return Promise.reject(new StandardError(400, 'Company GUID is required'));
282
256
  }
283
- return this._fetch('POST', `/company/${companyGuid}/bills?amt=${amt}&offset=${offset}&paid=${paid}`, body, cancelToken, headers)
257
+ return this._fetch('POST', `/company/${companyGuid}/bills`, body, cancelToken, headers)
284
258
  .then(response => {
285
259
  if (!response || !Array.isArray(response)) {
286
260
  throw new StandardError(400, 'Invalid bills response');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.25",
3
+ "version": "0.0.2-beta.27",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",