@rachelallyson/planning-center-check-ins-ts 2.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.
@@ -10,9 +10,21 @@ 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]) => {
@@ -20,26 +32,20 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
20
32
  });
21
33
  }
22
34
  if (options.filter) {
23
- // Support both string and array formats
24
35
  if (Array.isArray(options.filter)) {
25
- options.filter.forEach(filter => {
26
- params.filter = filter; // Use the last filter value, or combine them
27
- });
36
+ options.filter.forEach(filter => { params.filter = filter; });
28
37
  }
29
38
  else {
30
39
  params.filter = options.filter;
31
40
  }
32
41
  }
33
- if (options.include) {
42
+ if (options.include)
34
43
  params.include = options.include.join(',');
35
- }
36
- if (options.perPage) {
44
+ if (options.perPage != null)
37
45
  params.per_page = options.perPage;
38
- }
39
- if (options.page) {
46
+ if (options.page != null)
40
47
  params.page = options.page;
41
- }
42
- return this.getList('/check-ins/v2/events', params);
48
+ return params;
43
49
  }
44
50
  /**
45
51
  * Get a single event by ID
@@ -49,14 +55,14 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
49
55
  if (include) {
50
56
  params.include = include.join(',');
51
57
  }
52
- return this.getSingle(`/check-ins/v2/events/${id}`, params);
58
+ return this.getSingle(`/events/${id}`, params);
53
59
  }
54
60
  // ===== Associations =====
55
61
  /**
56
62
  * Get attendance types for an event
57
63
  */
58
64
  async getAttendanceTypes(eventId) {
59
- return this.getList(`/check-ins/v2/events/${eventId}/attendance_types`);
65
+ return this.getList(`/events/${eventId}/attendance_types`);
60
66
  }
61
67
  /**
62
68
  * Get check-ins for an event
@@ -70,31 +76,31 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
70
76
  params[filter] = 'true';
71
77
  });
72
78
  }
73
- return this.getList(`/check-ins/v2/events/${eventId}/check_ins`, params);
79
+ return this.getList(`/events/${eventId}/check_ins`, params);
74
80
  }
75
81
  /**
76
82
  * Get current event times for an event
77
83
  */
78
84
  async getCurrentEventTimes(eventId) {
79
- return this.getList(`/check-ins/v2/events/${eventId}/current_event_times`);
85
+ return this.getList(`/events/${eventId}/current_event_times`);
80
86
  }
81
87
  /**
82
88
  * Get event labels for an event
83
89
  */
84
90
  async getEventLabels(eventId) {
85
- return this.getList(`/check-ins/v2/events/${eventId}/event_labels`);
91
+ return this.getList(`/events/${eventId}/event_labels`);
86
92
  }
87
93
  /**
88
94
  * Get event periods for an event (single page)
89
95
  */
90
96
  async getEventPeriods(eventId) {
91
- return this.getList(`/check-ins/v2/events/${eventId}/event_periods`);
97
+ return this.getList(`/events/${eventId}/event_periods`);
92
98
  }
93
99
  /**
94
100
  * Get all event periods for an event (all pages)
95
101
  */
96
102
  async getAllEventPeriods(eventId, options) {
97
- const result = await this.getAllPages(`/check-ins/v2/events/${eventId}/event_periods`, {}, { perPage: options?.perPage || 100 });
103
+ const result = await this.getAllPages(`/events/${eventId}/event_periods`, {}, { perPage: options?.perPage || 100 });
98
104
  return result.data;
99
105
  }
100
106
  /**
@@ -110,7 +116,7 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
110
116
  params.filter = options.filter;
111
117
  }
112
118
  }
113
- const result = await this.getAllPages('/check-ins/v2/events', params, { perPage: options?.perPage || 100 });
119
+ const result = await this.getAllPages('/events', params, { perPage: options?.perPage || 100 });
114
120
  return result.data;
115
121
  }
116
122
  /**
@@ -130,7 +136,7 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
130
136
  }
131
137
  const response = await this.httpClient.request({
132
138
  method: 'GET',
133
- endpoint: `/check-ins/v2/events/${eventId}/event_periods/${periodId}/event_times`,
139
+ endpoint: `/events/${eventId}/event_periods/${periodId}/event_times`,
134
140
  params,
135
141
  });
136
142
  return {
@@ -144,19 +150,19 @@ class EventsModule extends planning_center_base_ts_1.BaseModule {
144
150
  * Get integration links for an event
145
151
  */
146
152
  async getIntegrationLinks(eventId) {
147
- return this.getList(`/check-ins/v2/events/${eventId}/integration_links`);
153
+ return this.getList(`/events/${eventId}/integration_links`);
148
154
  }
149
155
  /**
150
156
  * Get locations for an event
151
157
  */
152
158
  async getLocations(eventId) {
153
- return this.getList(`/check-ins/v2/events/${eventId}/locations`);
159
+ return this.getList(`/events/${eventId}/locations`);
154
160
  }
155
161
  /**
156
162
  * Get person events for an event
157
163
  */
158
164
  async getPersonEvents(eventId) {
159
- return this.getList(`/check-ins/v2/events/${eventId}/person_events`);
165
+ return this.getList(`/events/${eventId}/person_events`);
160
166
  }
161
167
  }
162
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?: any;
21
- links?: any;
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(([key, value]) => {
19
- params[`where[${key}]`] = value;
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(`/check-ins/v2/headcounts/${id}`, params);
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?: any;
21
- links?: any;
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(([key, value]) => {
19
- params[`where[${key}]`] = value;
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(`/check-ins/v2/integration_links/${id}`, params);
47
+ return this.getSingle(`/integration_links/${id}`, params);
42
48
  }
43
49
  }
44
50
  exports.IntegrationLinksModule = IntegrationLinksModule;
@@ -2,7 +2,7 @@
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';
5
+ import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PaginationResult, Meta, TopLevelLinks } from '@rachelallyson/planning-center-base-ts';
6
6
  import type { LabelResource } from '../types';
7
7
  export interface LabelsListOptions {
8
8
  where?: Record<string, any>;
@@ -13,13 +13,19 @@ 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?: any;
21
- links?: any;
25
+ meta?: Meta;
26
+ links?: TopLevelLinks;
22
27
  }>;
28
+ private buildLabelsParams;
23
29
  /**
24
30
  * Get a single label by ID
25
31
  */
@@ -10,25 +10,38 @@ class LabelsModule extends planning_center_base_ts_1.BaseModule {
10
10
  super(httpClient, paginationHelper, eventEmitter);
11
11
  }
12
12
  /**
13
- * Get all labels with optional filtering
13
+ * Get all labels 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.buildLabelsParams(options);
18
+ return this.getAllPages('/labels', params);
19
+ }
20
+ /**
21
+ * Get a single page of labels with optional filtering and pagination.
22
+ */
23
+ async getPage(options = {}) {
24
+ return this.getList('/labels', {
25
+ where: options.where,
26
+ include: options.include,
27
+ per_page: options.perPage,
28
+ page: options.page,
29
+ });
30
+ }
31
+ buildLabelsParams(options) {
16
32
  const params = {};
17
33
  if (options.where) {
18
34
  Object.entries(options.where).forEach(([key, value]) => {
19
35
  params[`where[${key}]`] = value;
20
36
  });
21
37
  }
22
- if (options.include) {
38
+ if (options.include)
23
39
  params.include = options.include.join(',');
24
- }
25
- if (options.perPage) {
40
+ if (options.perPage != null)
26
41
  params.per_page = options.perPage;
27
- }
28
- if (options.page) {
42
+ if (options.page != null)
29
43
  params.page = options.page;
30
- }
31
- return this.getList('/check-ins/v2/labels', params);
44
+ return params;
32
45
  }
33
46
  /**
34
47
  * Get a single label by ID
@@ -38,7 +51,7 @@ class LabelsModule extends planning_center_base_ts_1.BaseModule {
38
51
  if (include) {
39
52
  params.include = include.join(',');
40
53
  }
41
- return this.getSingle(`/check-ins/v2/labels/${id}`, params);
54
+ return this.getSingle(`/labels/${id}`, params);
42
55
  }
43
56
  }
44
57
  exports.LabelsModule = LabelsModule;
@@ -2,7 +2,7 @@
2
2
  * Locations 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 { LocationResource, LocationEventPeriodResource, LocationEventTimeResource, LocationLabelResource } from '../types';
7
7
  export interface LocationsListOptions {
8
8
  where?: Record<string, any>;
@@ -13,13 +13,19 @@ export interface LocationsListOptions {
13
13
  export declare class LocationsModule extends BaseModule {
14
14
  constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
15
15
  /**
16
- * Get all locations with optional filtering
16
+ * Get all locations across all pages with optional filtering.
17
+ * Use getPage() when you need a single page or custom perPage/page.
17
18
  */
18
- getAll(options?: LocationsListOptions): Promise<{
19
+ getAll(options?: LocationsListOptions): Promise<PaginationResult<LocationResource>>;
20
+ /**
21
+ * Get a single page of locations with optional filtering and pagination.
22
+ */
23
+ getPage(options?: LocationsListOptions): Promise<{
19
24
  data: LocationResource[];
20
- meta?: any;
21
- links?: any;
25
+ meta?: Meta;
26
+ links?: TopLevelLinks;
22
27
  }>;
28
+ private buildParams;
23
29
  /**
24
30
  * Get a single location by ID
25
31
  */
@@ -41,7 +47,10 @@ export declare class LocationsModule extends BaseModule {
41
47
  links?: any;
42
48
  }>;
43
49
  /**
44
- * Get location labels for a location
50
+ * Get location labels for a location.
51
+ * Note: The API docs list location_labels only under check_ins (check_in_id + location_id).
52
+ * If this returns empty or 404, use checkIns.getLocationLabels(checkInId, locationId) instead.
53
+ * @see https://developer.planning.center/docs/#/apps/check-ins/2025-05-28/vertices/location_label
45
54
  */
46
55
  getLocationLabels(locationId: string): Promise<{
47
56
  data: LocationLabelResource[];
@@ -10,25 +10,31 @@ class LocationsModule extends planning_center_base_ts_1.BaseModule {
10
10
  super(httpClient, paginationHelper, eventEmitter);
11
11
  }
12
12
  /**
13
- * Get all locations with optional filtering
13
+ * Get all locations 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('/locations', params);
19
+ }
20
+ /**
21
+ * Get a single page of locations with optional filtering and pagination.
22
+ */
23
+ async getPage(options = {}) {
24
+ const params = this.buildParams(options);
25
+ return this.getList('/locations', params);
26
+ }
27
+ buildParams(options) {
16
28
  const params = {};
17
- if (options.where) {
18
- Object.entries(options.where).forEach(([key, value]) => {
19
- params[`where[${key}]`] = value;
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/locations', params);
37
+ return params;
32
38
  }
33
39
  /**
34
40
  * Get a single location by ID
@@ -38,26 +44,29 @@ class LocationsModule extends planning_center_base_ts_1.BaseModule {
38
44
  if (include) {
39
45
  params.include = include.join(',');
40
46
  }
41
- return this.getSingle(`/check-ins/v2/locations/${id}`, params);
47
+ return this.getSingle(`/locations/${id}`, params);
42
48
  }
43
49
  // ===== Associations =====
44
50
  /**
45
51
  * Get location event periods for a location
46
52
  */
47
53
  async getLocationEventPeriods(locationId) {
48
- return this.getList(`/check-ins/v2/locations/${locationId}/location_event_periods`);
54
+ return this.getList(`/locations/${locationId}/location_event_periods`);
49
55
  }
50
56
  /**
51
57
  * Get location event times for a location
52
58
  */
53
59
  async getLocationEventTimes(locationId) {
54
- return this.getList(`/check-ins/v2/locations/${locationId}/location_event_times`);
60
+ return this.getList(`/locations/${locationId}/location_event_times`);
55
61
  }
56
62
  /**
57
- * Get location labels for a location
63
+ * Get location labels for a location.
64
+ * Note: The API docs list location_labels only under check_ins (check_in_id + location_id).
65
+ * If this returns empty or 404, use checkIns.getLocationLabels(checkInId, locationId) instead.
66
+ * @see https://developer.planning.center/docs/#/apps/check-ins/2025-05-28/vertices/location_label
58
67
  */
59
68
  async getLocationLabels(locationId) {
60
- return this.getList(`/check-ins/v2/locations/${locationId}/location_labels`);
69
+ return this.getList(`/locations/${locationId}/location_labels`);
61
70
  }
62
71
  }
63
72
  exports.LocationsModule = LocationsModule;
@@ -2,7 +2,7 @@
2
2
  * Options 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 { OptionResource } from '../types';
7
7
  export interface OptionsListOptions {
8
8
  where?: Record<string, any>;
@@ -13,13 +13,19 @@ export interface OptionsListOptions {
13
13
  export declare class OptionsModule extends BaseModule {
14
14
  constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
15
15
  /**
16
- * Get all options with optional filtering
16
+ * Get all options across all pages with optional filtering.
17
+ * Use getPage() when you need a single page or custom perPage/page.
17
18
  */
18
- getAll(options?: OptionsListOptions): Promise<{
19
+ getAll(options?: OptionsListOptions): Promise<PaginationResult<OptionResource>>;
20
+ /**
21
+ * Get a single page of options with optional filtering and pagination.
22
+ */
23
+ getPage(options?: OptionsListOptions): Promise<{
19
24
  data: OptionResource[];
20
- meta?: any;
21
- links?: any;
25
+ meta?: Meta;
26
+ links?: TopLevelLinks;
22
27
  }>;
28
+ private buildParams;
23
29
  /**
24
30
  * Get a single option by ID
25
31
  */
@@ -10,25 +10,31 @@ class OptionsModule extends planning_center_base_ts_1.BaseModule {
10
10
  super(httpClient, paginationHelper, eventEmitter);
11
11
  }
12
12
  /**
13
- * Get all options with optional filtering
13
+ * Get all options 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('/options', params);
19
+ }
20
+ /**
21
+ * Get a single page of options with optional filtering and pagination.
22
+ */
23
+ async getPage(options = {}) {
24
+ const params = this.buildParams(options);
25
+ return this.getList('/options', params);
26
+ }
27
+ buildParams(options) {
16
28
  const params = {};
17
- if (options.where) {
18
- Object.entries(options.where).forEach(([key, value]) => {
19
- params[`where[${key}]`] = value;
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/options', params);
37
+ return params;
32
38
  }
33
39
  /**
34
40
  * Get a single option by ID
@@ -38,7 +44,7 @@ class OptionsModule extends planning_center_base_ts_1.BaseModule {
38
44
  if (include) {
39
45
  params.include = include.join(',');
40
46
  }
41
- return this.getSingle(`/check-ins/v2/options/${id}`, params);
47
+ return this.getSingle(`/options/${id}`, params);
42
48
  }
43
49
  }
44
50
  exports.OptionsModule = OptionsModule;
@@ -13,8 +13,8 @@ class OrganizationModule extends planning_center_base_ts_1.BaseModule {
13
13
  * Get organization information
14
14
  */
15
15
  async get() {
16
- // The organization endpoint is at /check-ins/v2 (not /check-ins/v2/organization)
17
- return this.getSingle('/check-ins/v2');
16
+ // Organization is the root of the Check-Ins API (baseURL is .../check-ins/v2)
17
+ return this.getSingle('/');
18
18
  }
19
19
  }
20
20
  exports.OrganizationModule = OrganizationModule;