seatsio 88.1.0 → 89.0.0

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.
@@ -0,0 +1,6 @@
1
+ export declare class Month {
2
+ year: number;
3
+ month: number;
4
+ constructor(year: number, month: number);
5
+ toString(): string;
6
+ }
@@ -0,0 +1,11 @@
1
+ export class Month {
2
+ year;
3
+ month;
4
+ constructor(year, month) {
5
+ this.year = year;
6
+ this.month = month;
7
+ }
8
+ toString() {
9
+ return this.year + '-' + String(this.month).padStart(2, '0');
10
+ }
11
+ }
@@ -0,0 +1,21 @@
1
+ import { Month } from '../Common/Month.js';
2
+ import { WorkspaceBillableRenderings } from './MonthlyBillableRenderings.js';
3
+ export declare class MonthBillableRenderings {
4
+ month: Month;
5
+ usage: {
6
+ [workspaceKey: string]: WorkspaceBillableRenderings;
7
+ };
8
+ constructor(month: Month, usage: {
9
+ [workspaceKey: string]: WorkspaceBillableRenderings;
10
+ });
11
+ }
12
+ export declare class BillableRenderings {
13
+ companyId: number;
14
+ usage: {
15
+ [monthKey: string]: MonthBillableRenderings;
16
+ };
17
+ constructor(companyId: number, usage: {
18
+ [monthKey: string]: MonthBillableRenderings;
19
+ });
20
+ static fromJson(data: any): BillableRenderings;
21
+ }
@@ -0,0 +1,36 @@
1
+ import { Month } from '../Common/Month.js';
2
+ import { ChartBillableRenderings, WorkspaceBillableRenderings } from './MonthlyBillableRenderings.js';
3
+ export class MonthBillableRenderings {
4
+ month;
5
+ usage;
6
+ constructor(month, usage) {
7
+ this.month = month;
8
+ this.usage = usage;
9
+ }
10
+ }
11
+ export class BillableRenderings {
12
+ companyId;
13
+ usage;
14
+ constructor(companyId, usage) {
15
+ this.companyId = companyId;
16
+ this.usage = usage;
17
+ }
18
+ static fromJson(data) {
19
+ const usage = {};
20
+ for (const monthKey of Object.keys(data.usage)) {
21
+ const monthEntry = data.usage[monthKey];
22
+ const month = new Month(monthEntry.month.year, monthEntry.month.month);
23
+ const workspaces = {};
24
+ for (const [workspaceKey, ws] of Object.entries(monthEntry.usage)) {
25
+ const chartUsage = {};
26
+ for (const chartKey of Object.keys(ws.usage)) {
27
+ const c = ws.usage[chartKey];
28
+ chartUsage[chartKey] = new ChartBillableRenderings(c.chartKey, c.numBillableRenderings);
29
+ }
30
+ workspaces[workspaceKey] = new WorkspaceBillableRenderings(ws.workspaceKey, ws.workspaceId, chartUsage);
31
+ }
32
+ usage[monthKey] = new MonthBillableRenderings(month, workspaces);
33
+ }
34
+ return new BillableRenderings(data.companyId, usage);
35
+ }
36
+ }
@@ -0,0 +1,27 @@
1
+ import { Month } from '../Common/Month.js';
2
+ export declare class ChartBillableRenderings {
3
+ chartKey: string;
4
+ numBillableRenderings: number;
5
+ constructor(chartKey: string, numBillableRenderings: number);
6
+ }
7
+ export declare class WorkspaceBillableRenderings {
8
+ workspaceKey: string;
9
+ workspaceId: number;
10
+ usage: {
11
+ [chartKey: string]: ChartBillableRenderings;
12
+ };
13
+ constructor(workspaceKey: string, workspaceId: number, usage: {
14
+ [chartKey: string]: ChartBillableRenderings;
15
+ });
16
+ }
17
+ export declare class MonthlyBillableRenderings {
18
+ companyId: number;
19
+ month: Month;
20
+ usage: {
21
+ [workspaceKey: string]: WorkspaceBillableRenderings;
22
+ };
23
+ constructor(companyId: number, month: Month, usage: {
24
+ [workspaceKey: string]: WorkspaceBillableRenderings;
25
+ });
26
+ static fromJson(data: any): MonthlyBillableRenderings;
27
+ }
@@ -0,0 +1,43 @@
1
+ import { Month } from '../Common/Month.js';
2
+ export class ChartBillableRenderings {
3
+ chartKey;
4
+ numBillableRenderings;
5
+ constructor(chartKey, numBillableRenderings) {
6
+ this.chartKey = chartKey;
7
+ this.numBillableRenderings = numBillableRenderings;
8
+ }
9
+ }
10
+ export class WorkspaceBillableRenderings {
11
+ workspaceKey;
12
+ workspaceId;
13
+ usage;
14
+ constructor(workspaceKey, workspaceId, usage) {
15
+ this.workspaceKey = workspaceKey;
16
+ this.workspaceId = workspaceId;
17
+ this.usage = usage;
18
+ }
19
+ }
20
+ export class MonthlyBillableRenderings {
21
+ companyId;
22
+ month;
23
+ usage;
24
+ constructor(companyId, month, usage) {
25
+ this.companyId = companyId;
26
+ this.month = month;
27
+ this.usage = usage;
28
+ }
29
+ static fromJson(data) {
30
+ const month = new Month(data.month.year, data.month.month);
31
+ const usage = {};
32
+ for (const workspaceKey of Object.keys(data.usage)) {
33
+ const ws = data.usage[workspaceKey];
34
+ const chartUsage = {};
35
+ for (const chartKey of Object.keys(ws.usage)) {
36
+ const c = ws.usage[chartKey];
37
+ chartUsage[chartKey] = new ChartBillableRenderings(c.chartKey, c.numBillableRenderings);
38
+ }
39
+ usage[workspaceKey] = new WorkspaceBillableRenderings(ws.workspaceKey, ws.workspaceId, chartUsage);
40
+ }
41
+ return new MonthlyBillableRenderings(data.companyId, month, usage);
42
+ }
43
+ }
@@ -1,4 +1,7 @@
1
1
  import { Axios } from 'axios';
2
+ import { Month } from '../Common/Month.js';
3
+ import { BillableRenderings } from './BillableRenderings.js';
4
+ import { MonthlyBillableRenderings } from './MonthlyBillableRenderings.js';
2
5
  export declare class UsageReports {
3
6
  client: Axios;
4
7
  constructor(client: Axios);
@@ -6,8 +9,9 @@ export declare class UsageReports {
6
9
  usageCutoffDate: Date;
7
10
  usage: any;
8
11
  }>;
9
- billableRenderingsSummaryForAllMonths(): Promise<any>;
10
- billableRenderingsForChartInMonth(chartKey: string, month: string): Promise<any>;
12
+ billableRenderingsSummaryForAllMonths(): Promise<BillableRenderings>;
13
+ billableRenderingsSummaryForMonth(month: Month): Promise<MonthlyBillableRenderings>;
14
+ billableRenderingsForChartInMonth(chartKey: string, month: Month): Promise<any>;
11
15
  detailsForMonth(month: string): Promise<any>;
12
16
  detailsForEventInMonth(eventId: number, month: string): Promise<any>;
13
17
  subscription(): Promise<any>;
@@ -1,3 +1,5 @@
1
+ import { BillableRenderings } from './BillableRenderings.js';
2
+ import { MonthlyBillableRenderings } from './MonthlyBillableRenderings.js';
1
3
  export class UsageReports {
2
4
  client;
3
5
  constructor(client) {
@@ -10,11 +12,15 @@ export class UsageReports {
10
12
  usage: res.data.usage
11
13
  }));
12
14
  }
13
- billableRenderingsSummaryForAllMonths() {
15
+ async billableRenderingsSummaryForAllMonths() {
14
16
  return this.client.get('/reports/usage/rendering')
15
- .then(res => res.data);
17
+ .then(res => BillableRenderings.fromJson(res.data));
18
+ }
19
+ async billableRenderingsSummaryForMonth(month) {
20
+ return this.client.get(`/reports/usage/rendering/month/${month}`)
21
+ .then(res => MonthlyBillableRenderings.fromJson(res.data));
16
22
  }
17
- billableRenderingsForChartInMonth(chartKey, month) {
23
+ async billableRenderingsForChartInMonth(chartKey, month) {
18
24
  return this.client.get(`/reports/usage/rendering/month/${month}/chart/${chartKey}`)
19
25
  .then(res => res.data);
20
26
  }
@@ -23,6 +23,7 @@ export * from './Common/Floor.js';
23
23
  export * from './Common/IDs.js';
24
24
  export * from './Common/LabelAndType.js';
25
25
  export * from './Common/Labels.js';
26
+ export * from './Common/Month.js';
26
27
  export * from './EventLog/EventLog.js';
27
28
  export * from './EventLog/EventLogItem.js';
28
29
  export * from './Events/AbstractEventParams.js';
@@ -49,8 +50,10 @@ export * from './Events/TableBookingConfig.js';
49
50
  export * from './Events/UpdateEventParams.js';
50
51
  export * from './HoldTokens/HoldToken.js';
51
52
  export * from './HoldTokens/HoldTokens.js';
53
+ export * from './Reports/BillableRenderings.js';
52
54
  export * from './Reports/ChartReports.js';
53
55
  export * from './Reports/EventReports.js';
56
+ export * from './Reports/MonthlyBillableRenderings.js';
54
57
  export * from './Reports/UsageReports.js';
55
58
  export * from './Seasons/CreateSeasonParams.js';
56
59
  export * from './Seasons/Season.js';
package/dist/src/index.js CHANGED
@@ -23,6 +23,7 @@ export * from './Common/Floor.js';
23
23
  export * from './Common/IDs.js';
24
24
  export * from './Common/LabelAndType.js';
25
25
  export * from './Common/Labels.js';
26
+ export * from './Common/Month.js';
26
27
  export * from './EventLog/EventLog.js';
27
28
  export * from './EventLog/EventLogItem.js';
28
29
  export * from './Events/AbstractEventParams.js';
@@ -49,8 +50,10 @@ export * from './Events/TableBookingConfig.js';
49
50
  export * from './Events/UpdateEventParams.js';
50
51
  export * from './HoldTokens/HoldToken.js';
51
52
  export * from './HoldTokens/HoldTokens.js';
53
+ export * from './Reports/BillableRenderings.js';
52
54
  export * from './Reports/ChartReports.js';
53
55
  export * from './Reports/EventReports.js';
56
+ export * from './Reports/MonthlyBillableRenderings.js';
54
57
  export * from './Reports/UsageReports.js';
55
58
  export * from './Seasons/CreateSeasonParams.js';
56
59
  export * from './Seasons/Season.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "seatsio",
3
- "version": "88.1.0",
3
+ "version": "89.0.0",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "type": "module",