@excali-boards/boards-api-client 1.1.14 → 1.1.15

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.
@@ -1,9 +1,10 @@
1
- import { SingleOutput } from 'src/external/types';
1
+ import { SingleOutput } from '../external/types';
2
2
  import { BoardsManager } from '../core/manager';
3
3
  export declare class APICalendar {
4
4
  private web;
5
5
  constructor(web: BoardsManager);
6
6
  getCalendar({ auth, groupId }: CalendarFunctionsInput['getCalendar']): Promise<import("..").WebResponse<GetCalendarResponse>>;
7
+ getHolidays({ auth, countryCode, year }: CalendarFunctionsInput['getHolidays']): Promise<import("..").WebResponse<HolidayEvent[]>>;
7
8
  createEvent({ auth, groupId, event }: CalendarFunctionsInput['createEvent']): Promise<import("..").WebResponse<string>>;
8
9
  updateEvent({ auth, groupId, eventId, event }: CalendarFunctionsInput['updateEvent']): Promise<import("..").WebResponse<string>>;
9
10
  deleteEvent({ auth, groupId, eventId }: CalendarFunctionsInput['deleteEvent']): Promise<import("..").WebResponse<string>>;
@@ -13,6 +14,11 @@ export type CalendarFunctionsInput = {
13
14
  auth: string;
14
15
  groupId: string;
15
16
  };
17
+ 'getHolidays': {
18
+ auth: string;
19
+ countryCode: string;
20
+ year: number;
21
+ };
16
22
  'createEvent': {
17
23
  auth: string;
18
24
  groupId: string;
@@ -57,3 +63,23 @@ export type CalendarEvent = {
57
63
  avatarUrl: string | null;
58
64
  };
59
65
  };
66
+ export type ClosedStatus = 'Public' | 'Bank' | 'School' | 'Authorities' | 'Optional' | 'Observance';
67
+ export type HolidayEvent = {
68
+ date: string;
69
+ localName: string;
70
+ name: string;
71
+ countryCode: string;
72
+ global: boolean;
73
+ counties: string[] | null;
74
+ launchYear: number | null;
75
+ types: ClosedStatus[];
76
+ };
77
+ export type FormattedHoliday = {
78
+ id: string;
79
+ title: string;
80
+ start: Date;
81
+ end: Date;
82
+ color: string;
83
+ description: string;
84
+ types: ClosedStatus[];
85
+ };
@@ -8,32 +8,34 @@ class APICalendar {
8
8
  }
9
9
  async getCalendar({ auth, groupId }) {
10
10
  return await this.web.request({
11
- method: 'GET',
12
- auth,
11
+ method: 'GET', auth,
13
12
  endpoint: `/groups/${groupId}/calendar`,
14
13
  });
15
14
  }
15
+ async getHolidays({ auth, countryCode, year }) {
16
+ return await this.web.request({
17
+ method: 'GET', auth,
18
+ endpoint: `/holidays/${countryCode}/${year}`,
19
+ });
20
+ }
16
21
  async createEvent({ auth, groupId, event }) {
17
22
  return await this.web.request({
18
- method: 'POST',
19
- auth,
20
- endpoint: `/groups/${groupId}/calendar`,
23
+ method: 'POST', auth,
24
+ endpoint: `/ groups / ${groupId} / calendar`,
21
25
  body: event,
22
26
  });
23
27
  }
24
28
  async updateEvent({ auth, groupId, eventId, event }) {
25
29
  return await this.web.request({
26
- method: 'PATCH',
27
- auth,
28
- endpoint: `/groups/${groupId}/calendar/${eventId}`,
30
+ method: 'PATCH', auth,
31
+ endpoint: `/ groups / ${groupId} / calendar / ${eventId}`,
29
32
  body: event,
30
33
  });
31
34
  }
32
35
  async deleteEvent({ auth, groupId, eventId }) {
33
36
  return await this.web.request({
34
- method: 'DELETE',
35
- auth,
36
- endpoint: `/groups/${groupId}/calendar/${eventId}`,
37
+ method: 'DELETE', auth,
38
+ endpoint: `/ groups / ${groupId} / calendar / ${eventId}`,
37
39
  });
38
40
  }
39
41
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.1.14",
2
+ "version": "1.1.15",
3
3
  "name": "@excali-boards/boards-api-client",
4
4
  "description": "A simple API client for the Boards API.",
5
5
  "repository": "https://github.com/Excali-Boards/boards-api-client",