@dawntech/blip-tools 0.7.0 → 0.7.1

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.
package/dist/index.cjs CHANGED
@@ -793,7 +793,7 @@ class BlipAnalytics {
793
793
  id: crypto.randomUUID(),
794
794
  to: 'postmaster@desk.msging.net',
795
795
  method: 'get',
796
- uri: ['/analytics/reports/timings', encodeBlipParams(params)].filter((p) => p).join('?'),
796
+ uri: createUri('/analytics/reports/timings', params),
797
797
  };
798
798
  const response = await this.api.post('/commands', body);
799
799
  validateResponse(response);
@@ -803,6 +803,29 @@ class BlipAnalytics {
803
803
  throw handleError(error);
804
804
  }
805
805
  }
806
+ /**
807
+ * Returns a summary of tickets grouped by tag. Dates are expected to be in yyyy-mm-dd format.
808
+ */
809
+ async getTagReports({ beginDate, endDate } = {}) {
810
+ try {
811
+ const params = {
812
+ beginDate,
813
+ endDate,
814
+ };
815
+ const body = {
816
+ id: crypto.randomUUID(),
817
+ to: 'postmaster@desk.msging.net',
818
+ method: 'get',
819
+ uri: createUri('/analytics/reports/tags', params),
820
+ };
821
+ const response = await this.api.post('/commands', body);
822
+ validateResponse(response);
823
+ return response.data.resource.items;
824
+ }
825
+ catch (error) {
826
+ throw handleError(error);
827
+ }
828
+ }
806
829
  }
807
830
 
808
831
  class BlipThreads {
package/dist/index.mjs CHANGED
@@ -791,7 +791,7 @@ class BlipAnalytics {
791
791
  id: randomUUID(),
792
792
  to: 'postmaster@desk.msging.net',
793
793
  method: 'get',
794
- uri: ['/analytics/reports/timings', encodeBlipParams(params)].filter((p) => p).join('?'),
794
+ uri: createUri('/analytics/reports/timings', params),
795
795
  };
796
796
  const response = await this.api.post('/commands', body);
797
797
  validateResponse(response);
@@ -801,6 +801,29 @@ class BlipAnalytics {
801
801
  throw handleError(error);
802
802
  }
803
803
  }
804
+ /**
805
+ * Returns a summary of tickets grouped by tag. Dates are expected to be in yyyy-mm-dd format.
806
+ */
807
+ async getTagReports({ beginDate, endDate } = {}) {
808
+ try {
809
+ const params = {
810
+ beginDate,
811
+ endDate,
812
+ };
813
+ const body = {
814
+ id: randomUUID(),
815
+ to: 'postmaster@desk.msging.net',
816
+ method: 'get',
817
+ uri: createUri('/analytics/reports/tags', params),
818
+ };
819
+ const response = await this.api.post('/commands', body);
820
+ validateResponse(response);
821
+ return response.data.resource.items;
822
+ }
823
+ catch (error) {
824
+ throw handleError(error);
825
+ }
826
+ }
804
827
  }
805
828
 
806
829
  class BlipThreads {
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import { TicketAnalyticsReport, TicketAnalyticsTimings } from '../types/analytics';
2
+ import { TagTicketsSummary, TicketAnalyticsReport, TicketAnalyticsTimings } from '../types/analytics';
3
3
  export default class BlipAnalytics {
4
4
  private api;
5
5
  constructor(context: {
@@ -19,4 +19,11 @@ export default class BlipAnalytics {
19
19
  beginDate?: string;
20
20
  endDate?: string;
21
21
  }): Promise<TicketAnalyticsTimings>;
22
+ /**
23
+ * Returns a summary of tickets grouped by tag. Dates are expected to be in yyyy-mm-dd format.
24
+ */
25
+ getTagReports({ beginDate, endDate }?: {
26
+ beginDate?: string;
27
+ endDate?: string;
28
+ }): Promise<TagTicketsSummary[]>;
22
29
  }
@@ -19,3 +19,8 @@ export interface TicketAnalyticsTimings {
19
19
  avgResponseTime: string;
20
20
  avgAttendanceTime: string;
21
21
  }
22
+ export interface TagTicketsSummary {
23
+ name: string;
24
+ closedTickets: number;
25
+ ticketsCount: number;
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dawntech/blip-tools",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "Node package for Blip API",
5
5
  "exports": {
6
6
  ".": {