@rachelallyson/planning-center-check-ins-ts 1.0.0 → 3.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.
- package/CHANGELOG.md +48 -0
- package/README.md +4 -5
- package/dist/client.d.ts +0 -6
- package/dist/client.js +3 -12
- package/dist/index.d.ts +1 -1
- package/dist/modules/attendance-types.d.ts +11 -5
- package/dist/modules/attendance-types.js +20 -14
- package/dist/modules/check-in-groups.d.ts +13 -5
- package/dist/modules/check-in-groups.js +23 -15
- package/dist/modules/check-ins.d.ts +22 -6
- package/dist/modules/check-ins.js +39 -25
- package/dist/modules/event-times.d.ts +11 -5
- package/dist/modules/event-times.js +24 -18
- package/dist/modules/events.d.ts +57 -23
- package/dist/modules/events.js +85 -18
- package/dist/modules/headcounts.d.ts +11 -5
- package/dist/modules/headcounts.js +20 -14
- package/dist/modules/integration-links.d.ts +11 -5
- package/dist/modules/integration-links.js +20 -14
- package/dist/modules/labels.d.ts +12 -30
- package/dist/modules/labels.js +20 -71
- package/dist/modules/locations.d.ts +15 -6
- package/dist/modules/locations.js +27 -18
- package/dist/modules/options.d.ts +11 -5
- package/dist/modules/options.js +20 -14
- package/dist/modules/organization.js +2 -1
- package/dist/modules/passes.d.ts +11 -5
- package/dist/modules/passes.js +20 -14
- package/dist/modules/pre-checks.d.ts +11 -5
- package/dist/modules/pre-checks.js +20 -14
- package/dist/modules/roster-list-persons.d.ts +11 -5
- package/dist/modules/roster-list-persons.js +20 -14
- package/dist/modules/stations.d.ts +11 -5
- package/dist/modules/stations.js +20 -14
- package/dist/modules/themes.d.ts +11 -5
- package/dist/modules/themes.js +20 -14
- package/package.json +6 -6
- package/dist/modules/check-in-times.d.ts +0 -27
- package/dist/modules/check-in-times.js +0 -44
- package/dist/modules/event-periods.d.ts +0 -57
- package/dist/modules/event-periods.js +0 -75
- package/dist/modules/person-events.d.ts +0 -27
- package/dist/modules/person-events.js +0 -44
|
@@ -10,25 +10,31 @@ class EventTimesModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get all event times with optional filtering
|
|
13
|
+
* Get all event times across all pages with optional filtering.
|
|
14
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
14
15
|
*/
|
|
15
16
|
async getAll(options = {}) {
|
|
17
|
+
const params = this.buildParams(options);
|
|
18
|
+
return this.getAllPages('/event_times', params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of event times with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
async getPage(options = {}) {
|
|
24
|
+
const params = this.buildParams(options);
|
|
25
|
+
return this.getList('/event_times', params);
|
|
26
|
+
}
|
|
27
|
+
buildParams(options) {
|
|
16
28
|
const params = {};
|
|
17
|
-
if (options.where)
|
|
18
|
-
Object.entries(options.where).forEach(([
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
if (options.include) {
|
|
29
|
+
if (options.where)
|
|
30
|
+
Object.entries(options.where).forEach(([k, v]) => { params[`where[${k}]`] = v; });
|
|
31
|
+
if (options.include)
|
|
23
32
|
params.include = options.include.join(',');
|
|
24
|
-
|
|
25
|
-
if (options.perPage) {
|
|
33
|
+
if (options.perPage != null)
|
|
26
34
|
params.per_page = options.perPage;
|
|
27
|
-
|
|
28
|
-
if (options.page) {
|
|
35
|
+
if (options.page != null)
|
|
29
36
|
params.page = options.page;
|
|
30
|
-
|
|
31
|
-
return this.getList('/check-ins/v2/event_times', params);
|
|
37
|
+
return params;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Get a single event time by ID
|
|
@@ -38,32 +44,32 @@ class EventTimesModule extends planning_center_base_ts_1.BaseModule {
|
|
|
38
44
|
if (include) {
|
|
39
45
|
params.include = include.join(',');
|
|
40
46
|
}
|
|
41
|
-
return this.getSingle(`/
|
|
47
|
+
return this.getSingle(`/event_times/${id}`, params);
|
|
42
48
|
}
|
|
43
49
|
// ===== Associations =====
|
|
44
50
|
/**
|
|
45
51
|
* Get event for an event time
|
|
46
52
|
*/
|
|
47
53
|
async getEvent(eventTimeId) {
|
|
48
|
-
return this.getSingle(`/
|
|
54
|
+
return this.getSingle(`/event_times/${eventTimeId}/event`);
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* Get event period for an event time
|
|
52
58
|
*/
|
|
53
59
|
async getEventPeriod(eventTimeId) {
|
|
54
|
-
return this.getSingle(`/
|
|
60
|
+
return this.getSingle(`/event_times/${eventTimeId}/event_period`);
|
|
55
61
|
}
|
|
56
62
|
/**
|
|
57
63
|
* Get location event times for an event time
|
|
58
64
|
*/
|
|
59
65
|
async getLocationEventTimes(eventTimeId) {
|
|
60
|
-
return this.getList(`/
|
|
66
|
+
return this.getList(`/event_times/${eventTimeId}/location_event_times`);
|
|
61
67
|
}
|
|
62
68
|
/**
|
|
63
69
|
* Get check-ins for an event time
|
|
64
70
|
*/
|
|
65
71
|
async getCheckIns(eventTimeId) {
|
|
66
|
-
return this.getList(`/
|
|
72
|
+
return this.getList(`/event_times/${eventTimeId}/check_ins`);
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
75
|
exports.EventTimesModule = EventTimesModule;
|
package/dist/modules/events.d.ts
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
* Events Module for Check-Ins API
|
|
3
3
|
*/
|
|
4
4
|
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
-
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
-
import type { EventResource, EventPeriodResource, EventTimeResource, AttendanceTypeResource, CheckInResource, EventLabelResource, LocationResource, PersonEventResource, IntegrationLinkResource } from '../types';
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, Meta, TopLevelLinks, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
import type { EventResource, EventPeriodResource, EventTimeResource, AttendanceTypeResource, CheckInResource, EventLabelResource, LocationResource, PersonEventResource, IntegrationLinkResource, HeadcountResource } from '../types';
|
|
7
7
|
export interface EventsListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
9
|
+
filter?: string | string[];
|
|
9
10
|
include?: string[];
|
|
10
11
|
perPage?: number;
|
|
11
12
|
page?: number;
|
|
@@ -13,13 +14,19 @@ export interface EventsListOptions {
|
|
|
13
14
|
export declare class EventsModule extends BaseModule {
|
|
14
15
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
16
|
/**
|
|
16
|
-
* Get all events with optional filtering
|
|
17
|
+
* Get all events across all pages with optional filtering.
|
|
18
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
17
19
|
*/
|
|
18
|
-
getAll(options?: EventsListOptions): Promise<
|
|
20
|
+
getAll(options?: EventsListOptions): Promise<PaginationResult<EventResource>>;
|
|
21
|
+
/**
|
|
22
|
+
* Get a single page of events with optional filtering and pagination.
|
|
23
|
+
*/
|
|
24
|
+
getPage(options?: EventsListOptions): Promise<{
|
|
19
25
|
data: EventResource[];
|
|
20
|
-
meta?:
|
|
21
|
-
links?:
|
|
26
|
+
meta?: Meta;
|
|
27
|
+
links?: TopLevelLinks;
|
|
22
28
|
}>;
|
|
29
|
+
private buildEventsListParams;
|
|
23
30
|
/**
|
|
24
31
|
* Get a single event by ID
|
|
25
32
|
*/
|
|
@@ -29,8 +36,8 @@ export declare class EventsModule extends BaseModule {
|
|
|
29
36
|
*/
|
|
30
37
|
getAttendanceTypes(eventId: string): Promise<{
|
|
31
38
|
data: AttendanceTypeResource[];
|
|
32
|
-
meta?:
|
|
33
|
-
links?:
|
|
39
|
+
meta?: Meta;
|
|
40
|
+
links?: TopLevelLinks;
|
|
34
41
|
}>;
|
|
35
42
|
/**
|
|
36
43
|
* Get check-ins for an event
|
|
@@ -39,55 +46,82 @@ export declare class EventsModule extends BaseModule {
|
|
|
39
46
|
filter?: string[];
|
|
40
47
|
}): Promise<{
|
|
41
48
|
data: CheckInResource[];
|
|
42
|
-
meta?:
|
|
43
|
-
links?:
|
|
49
|
+
meta?: Meta;
|
|
50
|
+
links?: TopLevelLinks;
|
|
44
51
|
}>;
|
|
45
52
|
/**
|
|
46
53
|
* Get current event times for an event
|
|
47
54
|
*/
|
|
48
55
|
getCurrentEventTimes(eventId: string): Promise<{
|
|
49
56
|
data: EventTimeResource[];
|
|
50
|
-
meta?:
|
|
51
|
-
links?:
|
|
57
|
+
meta?: Meta;
|
|
58
|
+
links?: TopLevelLinks;
|
|
52
59
|
}>;
|
|
53
60
|
/**
|
|
54
61
|
* Get event labels for an event
|
|
55
62
|
*/
|
|
56
63
|
getEventLabels(eventId: string): Promise<{
|
|
57
64
|
data: EventLabelResource[];
|
|
58
|
-
meta?:
|
|
59
|
-
links?:
|
|
65
|
+
meta?: Meta;
|
|
66
|
+
links?: TopLevelLinks;
|
|
60
67
|
}>;
|
|
61
68
|
/**
|
|
62
|
-
* Get event periods for an event
|
|
69
|
+
* Get event periods for an event (single page)
|
|
63
70
|
*/
|
|
64
71
|
getEventPeriods(eventId: string): Promise<{
|
|
65
72
|
data: EventPeriodResource[];
|
|
66
|
-
meta?:
|
|
67
|
-
links?:
|
|
73
|
+
meta?: Meta;
|
|
74
|
+
links?: TopLevelLinks;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Get all event periods for an event (all pages)
|
|
78
|
+
*/
|
|
79
|
+
getAllEventPeriods(eventId: string, options?: {
|
|
80
|
+
perPage?: number;
|
|
81
|
+
}): Promise<EventPeriodResource[]>;
|
|
82
|
+
/**
|
|
83
|
+
* Get all events with pagination (all pages)
|
|
84
|
+
*/
|
|
85
|
+
getAllEvents(options?: {
|
|
86
|
+
filter?: string | string[];
|
|
87
|
+
perPage?: number;
|
|
88
|
+
}): Promise<EventResource[]>;
|
|
89
|
+
/**
|
|
90
|
+
* Get event times for a specific event period
|
|
91
|
+
*
|
|
92
|
+
* Possible included resources: HeadcountResource, AttendanceTypeResource
|
|
93
|
+
*/
|
|
94
|
+
getEventTimesForPeriod(eventId: string, periodId: string, options?: {
|
|
95
|
+
include?: string[] | string;
|
|
96
|
+
perPage?: number;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
data: EventTimeResource[];
|
|
99
|
+
included?: (HeadcountResource | AttendanceTypeResource)[];
|
|
100
|
+
meta?: Meta;
|
|
101
|
+
links?: TopLevelLinks;
|
|
68
102
|
}>;
|
|
69
103
|
/**
|
|
70
104
|
* Get integration links for an event
|
|
71
105
|
*/
|
|
72
106
|
getIntegrationLinks(eventId: string): Promise<{
|
|
73
107
|
data: IntegrationLinkResource[];
|
|
74
|
-
meta?:
|
|
75
|
-
links?:
|
|
108
|
+
meta?: Meta;
|
|
109
|
+
links?: TopLevelLinks;
|
|
76
110
|
}>;
|
|
77
111
|
/**
|
|
78
112
|
* Get locations for an event
|
|
79
113
|
*/
|
|
80
114
|
getLocations(eventId: string): Promise<{
|
|
81
115
|
data: LocationResource[];
|
|
82
|
-
meta?:
|
|
83
|
-
links?:
|
|
116
|
+
meta?: Meta;
|
|
117
|
+
links?: TopLevelLinks;
|
|
84
118
|
}>;
|
|
85
119
|
/**
|
|
86
120
|
* Get person events for an event
|
|
87
121
|
*/
|
|
88
122
|
getPersonEvents(eventId: string): Promise<{
|
|
89
123
|
data: PersonEventResource[];
|
|
90
|
-
meta?:
|
|
91
|
-
links?:
|
|
124
|
+
meta?: Meta;
|
|
125
|
+
links?: TopLevelLinks;
|
|
92
126
|
}>;
|
|
93
127
|
}
|
package/dist/modules/events.js
CHANGED
|
@@ -10,25 +10,42 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get all events with optional filtering
|
|
13
|
+
* Get all events across all pages with optional filtering.
|
|
14
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
14
15
|
*/
|
|
15
16
|
async getAll(options = {}) {
|
|
17
|
+
const params = this.buildEventsListParams(options);
|
|
18
|
+
return this.getAllPages('/events', params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of events with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
async getPage(options = {}) {
|
|
24
|
+
const params = this.buildEventsListParams(options);
|
|
25
|
+
return this.getList('/events', params);
|
|
26
|
+
}
|
|
27
|
+
buildEventsListParams(options) {
|
|
16
28
|
const params = {};
|
|
17
29
|
if (options.where) {
|
|
18
30
|
Object.entries(options.where).forEach(([key, value]) => {
|
|
19
31
|
params[`where[${key}]`] = value;
|
|
20
32
|
});
|
|
21
33
|
}
|
|
22
|
-
if (options.
|
|
23
|
-
|
|
34
|
+
if (options.filter) {
|
|
35
|
+
if (Array.isArray(options.filter)) {
|
|
36
|
+
options.filter.forEach(filter => { params.filter = filter; });
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
params.filter = options.filter;
|
|
40
|
+
}
|
|
24
41
|
}
|
|
25
|
-
if (options.
|
|
42
|
+
if (options.include)
|
|
43
|
+
params.include = options.include.join(',');
|
|
44
|
+
if (options.perPage != null)
|
|
26
45
|
params.per_page = options.perPage;
|
|
27
|
-
|
|
28
|
-
if (options.page) {
|
|
46
|
+
if (options.page != null)
|
|
29
47
|
params.page = options.page;
|
|
30
|
-
|
|
31
|
-
return this.getList('/check-ins/v2/events', params);
|
|
48
|
+
return params;
|
|
32
49
|
}
|
|
33
50
|
/**
|
|
34
51
|
* Get a single event by ID
|
|
@@ -38,14 +55,14 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
38
55
|
if (include) {
|
|
39
56
|
params.include = include.join(',');
|
|
40
57
|
}
|
|
41
|
-
return this.getSingle(`/
|
|
58
|
+
return this.getSingle(`/events/${id}`, params);
|
|
42
59
|
}
|
|
43
60
|
// ===== Associations =====
|
|
44
61
|
/**
|
|
45
62
|
* Get attendance types for an event
|
|
46
63
|
*/
|
|
47
64
|
async getAttendanceTypes(eventId) {
|
|
48
|
-
return this.getList(`/
|
|
65
|
+
return this.getList(`/events/${eventId}/attendance_types`);
|
|
49
66
|
}
|
|
50
67
|
/**
|
|
51
68
|
* Get check-ins for an event
|
|
@@ -59,43 +76,93 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
59
76
|
params[filter] = 'true';
|
|
60
77
|
});
|
|
61
78
|
}
|
|
62
|
-
return this.getList(`/
|
|
79
|
+
return this.getList(`/events/${eventId}/check_ins`, params);
|
|
63
80
|
}
|
|
64
81
|
/**
|
|
65
82
|
* Get current event times for an event
|
|
66
83
|
*/
|
|
67
84
|
async getCurrentEventTimes(eventId) {
|
|
68
|
-
return this.getList(`/
|
|
85
|
+
return this.getList(`/events/${eventId}/current_event_times`);
|
|
69
86
|
}
|
|
70
87
|
/**
|
|
71
88
|
* Get event labels for an event
|
|
72
89
|
*/
|
|
73
90
|
async getEventLabels(eventId) {
|
|
74
|
-
return this.getList(`/
|
|
91
|
+
return this.getList(`/events/${eventId}/event_labels`);
|
|
75
92
|
}
|
|
76
93
|
/**
|
|
77
|
-
* Get event periods for an event
|
|
94
|
+
* Get event periods for an event (single page)
|
|
78
95
|
*/
|
|
79
96
|
async getEventPeriods(eventId) {
|
|
80
|
-
return this.getList(`/
|
|
97
|
+
return this.getList(`/events/${eventId}/event_periods`);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get all event periods for an event (all pages)
|
|
101
|
+
*/
|
|
102
|
+
async getAllEventPeriods(eventId, options) {
|
|
103
|
+
const result = await this.getAllPages(`/events/${eventId}/event_periods`, {}, { perPage: options?.perPage || 100 });
|
|
104
|
+
return result.data;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Get all events with pagination (all pages)
|
|
108
|
+
*/
|
|
109
|
+
async getAllEvents(options) {
|
|
110
|
+
const params = {};
|
|
111
|
+
if (options?.filter) {
|
|
112
|
+
if (Array.isArray(options.filter)) {
|
|
113
|
+
params.filter = options.filter[0]; // Use first filter if array
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
params.filter = options.filter;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const result = await this.getAllPages('/events', params, { perPage: options?.perPage || 100 });
|
|
120
|
+
return result.data;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Get event times for a specific event period
|
|
124
|
+
*
|
|
125
|
+
* Possible included resources: HeadcountResource, AttendanceTypeResource
|
|
126
|
+
*/
|
|
127
|
+
async getEventTimesForPeriod(eventId, periodId, options) {
|
|
128
|
+
const params = {};
|
|
129
|
+
if (options?.include) {
|
|
130
|
+
params.include = Array.isArray(options.include)
|
|
131
|
+
? options.include.join(',')
|
|
132
|
+
: options.include;
|
|
133
|
+
}
|
|
134
|
+
if (options?.perPage) {
|
|
135
|
+
params.per_page = options.perPage;
|
|
136
|
+
}
|
|
137
|
+
const response = await this.httpClient.request({
|
|
138
|
+
method: 'GET',
|
|
139
|
+
endpoint: `/events/${eventId}/event_periods/${periodId}/event_times`,
|
|
140
|
+
params,
|
|
141
|
+
});
|
|
142
|
+
return {
|
|
143
|
+
data: response.data.data,
|
|
144
|
+
included: response.data.included,
|
|
145
|
+
meta: response.data.meta,
|
|
146
|
+
links: response.data.links,
|
|
147
|
+
};
|
|
81
148
|
}
|
|
82
149
|
/**
|
|
83
150
|
* Get integration links for an event
|
|
84
151
|
*/
|
|
85
152
|
async getIntegrationLinks(eventId) {
|
|
86
|
-
return this.getList(`/
|
|
153
|
+
return this.getList(`/events/${eventId}/integration_links`);
|
|
87
154
|
}
|
|
88
155
|
/**
|
|
89
156
|
* Get locations for an event
|
|
90
157
|
*/
|
|
91
158
|
async getLocations(eventId) {
|
|
92
|
-
return this.getList(`/
|
|
159
|
+
return this.getList(`/events/${eventId}/locations`);
|
|
93
160
|
}
|
|
94
161
|
/**
|
|
95
162
|
* Get person events for an event
|
|
96
163
|
*/
|
|
97
164
|
async getPersonEvents(eventId) {
|
|
98
|
-
return this.getList(`/
|
|
165
|
+
return this.getList(`/events/${eventId}/person_events`);
|
|
99
166
|
}
|
|
100
167
|
}
|
|
101
168
|
exports.EventsModule = EventsModule;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Headcounts Module for Check-Ins API
|
|
3
3
|
*/
|
|
4
4
|
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
-
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PaginationResult, Meta, TopLevelLinks } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { HeadcountResource } from '../types';
|
|
7
7
|
export interface HeadcountsListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
@@ -13,13 +13,19 @@ export interface HeadcountsListOptions {
|
|
|
13
13
|
export declare class HeadcountsModule extends BaseModule {
|
|
14
14
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
15
|
/**
|
|
16
|
-
* Get all headcounts with optional filtering
|
|
16
|
+
* Get all headcounts across all pages with optional filtering.
|
|
17
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
17
18
|
*/
|
|
18
|
-
getAll(options?: HeadcountsListOptions): Promise<
|
|
19
|
+
getAll(options?: HeadcountsListOptions): Promise<PaginationResult<HeadcountResource>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of headcounts with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
getPage(options?: HeadcountsListOptions): Promise<{
|
|
19
24
|
data: HeadcountResource[];
|
|
20
|
-
meta?:
|
|
21
|
-
links?:
|
|
25
|
+
meta?: Meta;
|
|
26
|
+
links?: TopLevelLinks;
|
|
22
27
|
}>;
|
|
28
|
+
private buildParams;
|
|
23
29
|
/**
|
|
24
30
|
* Get a single headcount by ID
|
|
25
31
|
*/
|
|
@@ -10,25 +10,31 @@ class HeadcountsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get all headcounts with optional filtering
|
|
13
|
+
* Get all headcounts across all pages with optional filtering.
|
|
14
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
14
15
|
*/
|
|
15
16
|
async getAll(options = {}) {
|
|
17
|
+
const params = this.buildParams(options);
|
|
18
|
+
return this.getAllPages('/headcounts', params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of headcounts with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
async getPage(options = {}) {
|
|
24
|
+
const params = this.buildParams(options);
|
|
25
|
+
return this.getList('/headcounts', params);
|
|
26
|
+
}
|
|
27
|
+
buildParams(options) {
|
|
16
28
|
const params = {};
|
|
17
|
-
if (options.where)
|
|
18
|
-
Object.entries(options.where).forEach(([
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
if (options.include) {
|
|
29
|
+
if (options.where)
|
|
30
|
+
Object.entries(options.where).forEach(([k, v]) => { params[`where[${k}]`] = v; });
|
|
31
|
+
if (options.include)
|
|
23
32
|
params.include = options.include.join(',');
|
|
24
|
-
|
|
25
|
-
if (options.perPage) {
|
|
33
|
+
if (options.perPage != null)
|
|
26
34
|
params.per_page = options.perPage;
|
|
27
|
-
|
|
28
|
-
if (options.page) {
|
|
35
|
+
if (options.page != null)
|
|
29
36
|
params.page = options.page;
|
|
30
|
-
|
|
31
|
-
return this.getList('/check-ins/v2/headcounts', params);
|
|
37
|
+
return params;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Get a single headcount by ID
|
|
@@ -38,7 +44,7 @@ class HeadcountsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
38
44
|
if (include) {
|
|
39
45
|
params.include = include.join(',');
|
|
40
46
|
}
|
|
41
|
-
return this.getSingle(`/
|
|
47
|
+
return this.getSingle(`/headcounts/${id}`, params);
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
exports.HeadcountsModule = HeadcountsModule;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* IntegrationLinks Module for Check-Ins API
|
|
3
3
|
*/
|
|
4
4
|
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
-
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PaginationResult, Meta, TopLevelLinks } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
import type { IntegrationLinkResource } from '../types';
|
|
7
7
|
export interface IntegrationLinksListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
@@ -13,13 +13,19 @@ export interface IntegrationLinksListOptions {
|
|
|
13
13
|
export declare class IntegrationLinksModule extends BaseModule {
|
|
14
14
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
15
|
/**
|
|
16
|
-
* Get all integration links with optional filtering
|
|
16
|
+
* Get all integration links across all pages with optional filtering.
|
|
17
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
17
18
|
*/
|
|
18
|
-
getAll(options?: IntegrationLinksListOptions): Promise<
|
|
19
|
+
getAll(options?: IntegrationLinksListOptions): Promise<PaginationResult<IntegrationLinkResource>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of integration links with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
getPage(options?: IntegrationLinksListOptions): Promise<{
|
|
19
24
|
data: IntegrationLinkResource[];
|
|
20
|
-
meta?:
|
|
21
|
-
links?:
|
|
25
|
+
meta?: Meta;
|
|
26
|
+
links?: TopLevelLinks;
|
|
22
27
|
}>;
|
|
28
|
+
private buildParams;
|
|
23
29
|
/**
|
|
24
30
|
* Get a single integration link by ID
|
|
25
31
|
*/
|
|
@@ -10,25 +10,31 @@ class IntegrationLinksModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get all integration links with optional filtering
|
|
13
|
+
* Get all integration links across all pages with optional filtering.
|
|
14
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
14
15
|
*/
|
|
15
16
|
async getAll(options = {}) {
|
|
17
|
+
const params = this.buildParams(options);
|
|
18
|
+
return this.getAllPages('/integration_links', params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of integration links with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
async getPage(options = {}) {
|
|
24
|
+
const params = this.buildParams(options);
|
|
25
|
+
return this.getList('/integration_links', params);
|
|
26
|
+
}
|
|
27
|
+
buildParams(options) {
|
|
16
28
|
const params = {};
|
|
17
|
-
if (options.where)
|
|
18
|
-
Object.entries(options.where).forEach(([
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
if (options.include) {
|
|
29
|
+
if (options.where)
|
|
30
|
+
Object.entries(options.where).forEach(([k, v]) => { params[`where[${k}]`] = v; });
|
|
31
|
+
if (options.include)
|
|
23
32
|
params.include = options.include.join(',');
|
|
24
|
-
|
|
25
|
-
if (options.perPage) {
|
|
33
|
+
if (options.perPage != null)
|
|
26
34
|
params.per_page = options.perPage;
|
|
27
|
-
|
|
28
|
-
if (options.page) {
|
|
35
|
+
if (options.page != null)
|
|
29
36
|
params.page = options.page;
|
|
30
|
-
|
|
31
|
-
return this.getList('/check-ins/v2/integration_links', params);
|
|
37
|
+
return params;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Get a single integration link by ID
|
|
@@ -38,7 +44,7 @@ class IntegrationLinksModule extends planning_center_base_ts_1.BaseModule {
|
|
|
38
44
|
if (include) {
|
|
39
45
|
params.include = include.join(',');
|
|
40
46
|
}
|
|
41
|
-
return this.getSingle(`/
|
|
47
|
+
return this.getSingle(`/integration_links/${id}`, params);
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
exports.IntegrationLinksModule = IntegrationLinksModule;
|
package/dist/modules/labels.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Labels Module for Check-Ins API
|
|
3
3
|
*/
|
|
4
4
|
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
-
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
-
import type { LabelResource
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PaginationResult, Meta, TopLevelLinks } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
import type { LabelResource } from '../types';
|
|
7
7
|
export interface LabelsListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
9
9
|
include?: string[];
|
|
@@ -13,39 +13,21 @@ export interface LabelsListOptions {
|
|
|
13
13
|
export declare class LabelsModule extends BaseModule {
|
|
14
14
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
15
|
/**
|
|
16
|
-
* Get all labels with optional filtering
|
|
16
|
+
* Get all labels across all pages with optional filtering.
|
|
17
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
17
18
|
*/
|
|
18
|
-
getAll(options?: LabelsListOptions): Promise<
|
|
19
|
+
getAll(options?: LabelsListOptions): Promise<PaginationResult<LabelResource>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of labels with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
getPage(options?: LabelsListOptions): Promise<{
|
|
19
24
|
data: LabelResource[];
|
|
20
|
-
meta?:
|
|
21
|
-
links?:
|
|
25
|
+
meta?: Meta;
|
|
26
|
+
links?: TopLevelLinks;
|
|
22
27
|
}>;
|
|
28
|
+
private buildLabelsParams;
|
|
23
29
|
/**
|
|
24
30
|
* Get a single label by ID
|
|
25
31
|
*/
|
|
26
32
|
getById(id: string, include?: string[]): Promise<LabelResource>;
|
|
27
|
-
/**
|
|
28
|
-
* Get all event labels
|
|
29
|
-
*/
|
|
30
|
-
getEventLabels(options?: LabelsListOptions): Promise<{
|
|
31
|
-
data: EventLabelResource[];
|
|
32
|
-
meta?: any;
|
|
33
|
-
links?: any;
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* Get a single event label by ID
|
|
37
|
-
*/
|
|
38
|
-
getEventLabelById(id: string, include?: string[]): Promise<EventLabelResource>;
|
|
39
|
-
/**
|
|
40
|
-
* Get all location labels
|
|
41
|
-
*/
|
|
42
|
-
getLocationLabels(options?: LabelsListOptions): Promise<{
|
|
43
|
-
data: LocationLabelResource[];
|
|
44
|
-
meta?: any;
|
|
45
|
-
links?: any;
|
|
46
|
-
}>;
|
|
47
|
-
/**
|
|
48
|
-
* Get a single location label by ID
|
|
49
|
-
*/
|
|
50
|
-
getLocationLabelById(id: string, include?: string[]): Promise<LocationLabelResource>;
|
|
51
33
|
}
|