@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.
- package/CHANGELOG.md +25 -0
- package/dist/client.js +2 -2
- 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 +9 -3
- package/dist/modules/events.js +30 -24
- 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 +11 -5
- package/dist/modules/labels.js +22 -9
- 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 -2
- 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 +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,31 @@ All notable changes to this package will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.0.0] - 2026-02-02
|
|
9
|
+
|
|
10
|
+
### ⚠️ **Breaking Changes**
|
|
11
|
+
|
|
12
|
+
- **`getAll()` now fetches all pages**: `getAll()` previously called `getList()` and returned a single page. It now calls `getAllPages()` and returns **all** pages. The return type is now `PaginationResult<T>` (from base), which includes `data`, `totalCount`, `pagesFetched`, `duration`, `meta?`, and `links?`. If you need a single page, use **`getPage(options)`** instead.
|
|
13
|
+
- **`getPage()` for single-page fetching**: New method on all list-capable modules. Use `getPage({ perPage, page, where, include, ... })` when you want one page with full control. Use `getAll()` when you want every page automatically.
|
|
14
|
+
- **Flattened responses (from base)**: All methods that return resources use the base package’s flattened shape: **attributes and relationships are at the top level** (e.g. `resource.name` instead of `resource.attributes.name`, and related data at `resource.relation_name` instead of `resource.relationships.relation_name.data`). This matches the People and Base packages.
|
|
15
|
+
- **Same item shape for `getAll()` and `getPage()`**: Both return flattened items. `getAll().data` and `getPage().data` contain the same shape per item; only the wrapper differs—`getAll()` returns `PaginationResult<T>` (adds `totalCount`, `pagesFetched`, `duration`), while `getPage()` returns `{ data, meta?, links? }`.
|
|
16
|
+
- **Check-in groups require `stationId`**: `checkInGroups.getAll()` and `checkInGroups.getPage()` now require `stationId` in options. The API lists check-in groups per station: `GET /stations/:station_id/check_in_groups`. Pass `stationId` from a station you’ve fetched (e.g. `client.stations.getPage()`).
|
|
17
|
+
|
|
18
|
+
### ✨ **New Features**
|
|
19
|
+
|
|
20
|
+
- **`getPage()`** on all list-capable modules: `checkIns`, `events`, `labels`, `themes`, `stations`, `rosterListPersons`, `preChecks`, `passes`, `options`, `locations`, `integrationLinks`, `headcounts`, `eventTimes`, `checkInGroups`, `attendanceTypes`. Single-page fetch with full option support.
|
|
21
|
+
- **Consistent with People package**: Same `getAll()` (all pages) vs `getPage()` (one page) pattern, same flattened item shape from both methods.
|
|
22
|
+
- **`checkIns.getLocationLabels(checkInId, locationId)`**: New method to fetch location labels for a check-in at a specific location. The API exposes location labels under the check-in scope; use this when `locations.getLocationLabels(locationId)` is unsupported or returns empty.
|
|
23
|
+
|
|
24
|
+
### 🔄 **Dependency**
|
|
25
|
+
|
|
26
|
+
- **Base package**: `@rachelallyson/planning-center-base-ts` `^1.1.2`. Richer request events and flattened responses.
|
|
27
|
+
|
|
28
|
+
### 🧪 **Testing**
|
|
29
|
+
|
|
30
|
+
- **Integration tests**: Pre-checks tests skip when the Pre-checks API returns 404 (e.g. Church Center PreCheck not enabled). The “All Modules” test also skips optional modules (integrationLinks, themes, rosterListPersons) when they 404 or return empty.
|
|
31
|
+
- **Unit tests**: Default `npm test` excludes integration tests (`testPathIgnorePatterns`). Run integration tests with `npm run test:integration` (requires `.env.test` and Check-Ins scope).
|
|
32
|
+
|
|
8
33
|
## [2.0.0] - 2026-01-20
|
|
9
34
|
|
|
10
35
|
### ⚠️ **Breaking Changes**
|
package/dist/client.js
CHANGED
|
@@ -54,7 +54,7 @@ class PcoCheckInsClient {
|
|
|
54
54
|
// Set up event handlers from config
|
|
55
55
|
this.setupEventHandlers();
|
|
56
56
|
}
|
|
57
|
-
// EventEmitter implementation
|
|
57
|
+
// EventEmitter implementation (call generic overload explicitly to avoid overload resolution picking 'error' only)
|
|
58
58
|
on(eventType, handler) {
|
|
59
59
|
this.eventEmitter.on(eventType, handler);
|
|
60
60
|
}
|
|
@@ -78,7 +78,7 @@ class PcoCheckInsClient {
|
|
|
78
78
|
const { baseUrl, ...restConfig } = this.config;
|
|
79
79
|
const fullConfig = {
|
|
80
80
|
...restConfig,
|
|
81
|
-
baseURL: baseUrl || 'https://api.planningcenteronline.com',
|
|
81
|
+
baseURL: baseUrl || 'https://api.planningcenteronline.com/check-ins/v2',
|
|
82
82
|
};
|
|
83
83
|
// Recreate HTTP client with new config
|
|
84
84
|
this.httpClient = new planning_center_base_ts_1.PcoHttpClient(fullConfig, this.eventEmitter);
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { PcoCheckInsClient } from './client';
|
|
|
2
2
|
export type { PcoCheckInsClientConfig, } from './types/client';
|
|
3
3
|
export type { PcoEvent, EventHandler, EventType } from '@rachelallyson/planning-center-base-ts';
|
|
4
4
|
export type { BatchOperation, BatchResult, BatchOptions, BatchSummary } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
-
export type { Paginated, Relationship, ResourceIdentifier, ResourceObject, Response, } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
export type { Paginated, PaginationResult, Relationship, ResourceIdentifier, ResourceObject, Response, } from '@rachelallyson/planning-center-base-ts';
|
|
6
6
|
export type { EventResource, EventAttributes, EventRelationships, EventsList, EventSingle, CheckInResource, CheckInAttributes, CheckInRelationships, CheckInsList, CheckInSingle, LocationResource, LocationAttributes, LocationRelationships, LocationsList, LocationSingle, EventPeriodResource, EventPeriodAttributes, EventPeriodRelationships, EventPeriodsList, EventPeriodSingle, EventTimeResource, EventTimeAttributes, EventTimeRelationships, EventTimesList, EventTimeSingle, StationResource, StationAttributes, StationRelationships, StationsList, StationSingle, LabelResource, LabelAttributes, LabelRelationships, LabelsList, LabelSingle, EventLabelResource, EventLabelAttributes, EventLabelRelationships, EventLabelsList, EventLabelSingle, LocationLabelResource, LocationLabelAttributes, LocationLabelRelationships, LocationLabelsList, LocationLabelSingle, OptionResource, OptionAttributes, OptionRelationships, OptionsList, OptionSingle, CheckInGroupResource, CheckInGroupAttributes, CheckInGroupRelationships, CheckInGroupsList, CheckInGroupSingle, CheckInTimeResource, CheckInTimeAttributes, CheckInTimeRelationships, CheckInTimesList, CheckInTimeSingle, PersonEventResource, PersonEventAttributes, PersonEventRelationships, PersonEventsList, PersonEventSingle, PreCheckResource, PreCheckAttributes, PreCheckRelationships, PreChecksList, PreCheckSingle, PassResource, PassAttributes, PassRelationships, PassesList, PassSingle, HeadcountResource, HeadcountAttributes, HeadcountRelationships, HeadcountsList, HeadcountSingle, AttendanceTypeResource, AttendanceTypeAttributes, AttendanceTypeRelationships, AttendanceTypesList, AttendanceTypeSingle, RosterListPersonResource, RosterListPersonAttributes, RosterListPersonRelationships, RosterListPersonsList, RosterListPersonSingle, OrganizationResource, OrganizationAttributes, OrganizationRelationships, OrganizationsList, OrganizationSingle, IntegrationLinkResource, IntegrationLinkAttributes, IntegrationLinkRelationships, IntegrationLinksList, IntegrationLinkSingle, ThemeResource, ThemeAttributes, ThemeRelationships, ThemesList, ThemeSingle, LocationEventPeriodResource, LocationEventPeriodAttributes, LocationEventPeriodRelationships, LocationEventPeriodsList, LocationEventPeriodSingle, LocationEventTimeResource, LocationEventTimeAttributes, LocationEventTimeRelationships, LocationEventTimesList, LocationEventTimeSingle, } from './types';
|
|
7
7
|
export * from './types';
|
|
8
8
|
export { PcoApiError } from '@rachelallyson/planning-center-base-ts';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* AttendanceTypes 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 { AttendanceTypeResource } from '../types';
|
|
7
7
|
export interface AttendanceTypesListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
@@ -13,13 +13,19 @@ export interface AttendanceTypesListOptions {
|
|
|
13
13
|
export declare class AttendanceTypesModule extends BaseModule {
|
|
14
14
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
15
|
/**
|
|
16
|
-
* Get all attendance types with optional filtering
|
|
16
|
+
* Get all attendance types across all pages with optional filtering.
|
|
17
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
17
18
|
*/
|
|
18
|
-
getAll(options?: AttendanceTypesListOptions): Promise<
|
|
19
|
+
getAll(options?: AttendanceTypesListOptions): Promise<PaginationResult<AttendanceTypeResource>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of attendance types with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
getPage(options?: AttendanceTypesListOptions): Promise<{
|
|
19
24
|
data: AttendanceTypeResource[];
|
|
20
|
-
meta?:
|
|
21
|
-
links?:
|
|
25
|
+
meta?: Meta;
|
|
26
|
+
links?: TopLevelLinks;
|
|
22
27
|
}>;
|
|
28
|
+
private buildParams;
|
|
23
29
|
/**
|
|
24
30
|
* Get a single attendance type by ID
|
|
25
31
|
*/
|
|
@@ -10,25 +10,31 @@ class AttendanceTypesModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get all attendance types with optional filtering
|
|
13
|
+
* Get all attendance types 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('/attendance_types', params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of attendance types with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
async getPage(options = {}) {
|
|
24
|
+
const params = this.buildParams(options);
|
|
25
|
+
return this.getList('/attendance_types', 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/attendance_types', params);
|
|
37
|
+
return params;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Get a single attendance type by ID
|
|
@@ -38,7 +44,7 @@ class AttendanceTypesModule 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(`/attendance_types/${id}`, params);
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
50
|
exports.AttendanceTypesModule = AttendanceTypesModule;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* CheckInGroups 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 { CheckInGroupResource } from '../types';
|
|
7
7
|
export interface CheckInGroupsListOptions {
|
|
8
|
+
/** Required: check-in groups are listed per station. */
|
|
9
|
+
stationId: string;
|
|
8
10
|
where?: Record<string, any>;
|
|
9
11
|
include?: string[];
|
|
10
12
|
perPage?: number;
|
|
@@ -13,13 +15,19 @@ export interface CheckInGroupsListOptions {
|
|
|
13
15
|
export declare class CheckInGroupsModule extends BaseModule {
|
|
14
16
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
17
|
/**
|
|
16
|
-
* Get all check-in groups
|
|
18
|
+
* Get all check-in groups for a station across all pages.
|
|
19
|
+
* Check-Ins API lists check-in groups under a station: GET /stations/:station_id/check_in_groups.
|
|
17
20
|
*/
|
|
18
|
-
getAll(options
|
|
21
|
+
getAll(options: CheckInGroupsListOptions): Promise<PaginationResult<CheckInGroupResource>>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a single page of check-in groups for a station.
|
|
24
|
+
*/
|
|
25
|
+
getPage(options: CheckInGroupsListOptions): Promise<{
|
|
19
26
|
data: CheckInGroupResource[];
|
|
20
|
-
meta?:
|
|
21
|
-
links?:
|
|
27
|
+
meta?: Meta;
|
|
28
|
+
links?: TopLevelLinks;
|
|
22
29
|
}>;
|
|
30
|
+
private buildParams;
|
|
23
31
|
/**
|
|
24
32
|
* Get a single check-in group by ID
|
|
25
33
|
*/
|
|
@@ -10,25 +10,33 @@ class CheckInGroupsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get all check-in groups
|
|
13
|
+
* Get all check-in groups for a station across all pages.
|
|
14
|
+
* Check-Ins API lists check-in groups under a station: GET /stations/:station_id/check_in_groups.
|
|
14
15
|
*/
|
|
15
|
-
async getAll(options
|
|
16
|
+
async getAll(options) {
|
|
17
|
+
const { stationId, ...rest } = options;
|
|
18
|
+
const params = this.buildParams(rest);
|
|
19
|
+
return this.getAllPages(`/stations/${stationId}/check_in_groups`, params);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get a single page of check-in groups for a station.
|
|
23
|
+
*/
|
|
24
|
+
async getPage(options) {
|
|
25
|
+
const { stationId, ...rest } = options;
|
|
26
|
+
const params = this.buildParams(rest);
|
|
27
|
+
return this.getList(`/stations/${stationId}/check_in_groups`, params);
|
|
28
|
+
}
|
|
29
|
+
buildParams(options) {
|
|
16
30
|
const params = {};
|
|
17
|
-
if (options.where)
|
|
18
|
-
Object.entries(options.where).forEach(([
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
if (options.include) {
|
|
31
|
+
if (options.where)
|
|
32
|
+
Object.entries(options.where).forEach(([k, v]) => { params[`where[${k}]`] = v; });
|
|
33
|
+
if (options.include)
|
|
23
34
|
params.include = options.include.join(',');
|
|
24
|
-
|
|
25
|
-
if (options.perPage) {
|
|
35
|
+
if (options.perPage != null)
|
|
26
36
|
params.per_page = options.perPage;
|
|
27
|
-
|
|
28
|
-
if (options.page) {
|
|
37
|
+
if (options.page != null)
|
|
29
38
|
params.page = options.page;
|
|
30
|
-
|
|
31
|
-
return this.getList('/check-ins/v2/check_in_groups', params);
|
|
39
|
+
return params;
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* Get a single check-in group by ID
|
|
@@ -38,7 +46,7 @@ class CheckInGroupsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
38
46
|
if (include) {
|
|
39
47
|
params.include = include.join(',');
|
|
40
48
|
}
|
|
41
|
-
return this.getSingle(`/
|
|
49
|
+
return this.getSingle(`/check_in_groups/${id}`, params);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
52
|
exports.CheckInGroupsModule = CheckInGroupsModule;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* CheckIns 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 { CheckInResource, CheckInGroupResource, CheckInTimeResource, StationResource, EventResource, EventPeriodResource, EventTimeResource, LocationResource, OptionResource } from '../types';
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PaginationResult, Meta, TopLevelLinks } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
import type { CheckInResource, CheckInGroupResource, CheckInTimeResource, StationResource, EventResource, EventPeriodResource, EventTimeResource, LocationResource, LocationLabelResource, OptionResource } from '../types';
|
|
7
7
|
export interface CheckInsListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
9
9
|
include?: string[];
|
|
@@ -14,13 +14,19 @@ export interface CheckInsListOptions {
|
|
|
14
14
|
export declare class CheckInsModule extends BaseModule {
|
|
15
15
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
16
16
|
/**
|
|
17
|
-
* Get all check-ins with optional filtering
|
|
17
|
+
* Get all check-ins across all pages with optional filtering.
|
|
18
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
18
19
|
*/
|
|
19
|
-
getAll(options?: CheckInsListOptions): Promise<
|
|
20
|
+
getAll(options?: CheckInsListOptions): Promise<PaginationResult<CheckInResource>>;
|
|
21
|
+
/**
|
|
22
|
+
* Get a single page of check-ins with optional filtering and pagination.
|
|
23
|
+
*/
|
|
24
|
+
getPage(options?: CheckInsListOptions): Promise<{
|
|
20
25
|
data: CheckInResource[];
|
|
21
|
-
meta?:
|
|
22
|
-
links?:
|
|
26
|
+
meta?: Meta;
|
|
27
|
+
links?: TopLevelLinks;
|
|
23
28
|
}>;
|
|
29
|
+
private buildCheckInsListParams;
|
|
24
30
|
/**
|
|
25
31
|
* Get a single check-in by ID
|
|
26
32
|
*/
|
|
@@ -73,6 +79,16 @@ export declare class CheckInsModule extends BaseModule {
|
|
|
73
79
|
meta?: any;
|
|
74
80
|
links?: any;
|
|
75
81
|
}>;
|
|
82
|
+
/**
|
|
83
|
+
* Get location labels for a check-in at a specific location.
|
|
84
|
+
* Per API docs, location_labels are only available under check_ins, not under locations.
|
|
85
|
+
* @see https://developer.planning.center/docs/#/apps/check-ins/2025-05-28/vertices/location_label
|
|
86
|
+
*/
|
|
87
|
+
getLocationLabels(checkInId: string, locationId: string): Promise<{
|
|
88
|
+
data: LocationLabelResource[];
|
|
89
|
+
meta?: any;
|
|
90
|
+
links?: any;
|
|
91
|
+
}>;
|
|
76
92
|
/**
|
|
77
93
|
* Get options for a check-in
|
|
78
94
|
*/
|
|
@@ -10,31 +10,37 @@ class CheckInsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
super(httpClient, paginationHelper, eventEmitter);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Get all check-ins with optional filtering
|
|
13
|
+
* Get all check-ins 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.buildCheckInsListParams(options);
|
|
18
|
+
return this.getAllPages('/check_ins', params);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of check-ins with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
async getPage(options = {}) {
|
|
24
|
+
const params = this.buildCheckInsListParams(options);
|
|
25
|
+
return this.getList('/check_ins', params);
|
|
26
|
+
}
|
|
27
|
+
buildCheckInsListParams(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.include)
|
|
34
|
+
if (options.include)
|
|
23
35
|
params.include = options.include.join(',');
|
|
24
|
-
|
|
25
|
-
if (options.perPage) {
|
|
36
|
+
if (options.perPage != null)
|
|
26
37
|
params.per_page = options.perPage;
|
|
27
|
-
|
|
28
|
-
if (options.page) {
|
|
38
|
+
if (options.page != null)
|
|
29
39
|
params.page = options.page;
|
|
40
|
+
if (options.filter?.length) {
|
|
41
|
+
options.filter.forEach(filter => { params[filter] = 'true'; });
|
|
30
42
|
}
|
|
31
|
-
|
|
32
|
-
if (options.filter && options.filter.length > 0) {
|
|
33
|
-
options.filter.forEach(filter => {
|
|
34
|
-
params[filter] = 'true';
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
return this.getList('/check-ins/v2/check_ins', params);
|
|
43
|
+
return params;
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
46
|
* Get a single check-in by ID
|
|
@@ -44,7 +50,7 @@ class CheckInsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
44
50
|
if (include) {
|
|
45
51
|
params.include = include.join(',');
|
|
46
52
|
}
|
|
47
|
-
return this.getSingle(`/
|
|
53
|
+
return this.getSingle(`/check_ins/${id}`, params);
|
|
48
54
|
}
|
|
49
55
|
// ===== Associations =====
|
|
50
56
|
/**
|
|
@@ -52,7 +58,7 @@ class CheckInsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
52
58
|
*/
|
|
53
59
|
async getCheckInGroup(checkInId) {
|
|
54
60
|
try {
|
|
55
|
-
return await this.getSingle(`/
|
|
61
|
+
return await this.getSingle(`/check_ins/${checkInId}/check_in_group`);
|
|
56
62
|
}
|
|
57
63
|
catch (error) {
|
|
58
64
|
if (error?.status === 404) {
|
|
@@ -65,14 +71,14 @@ class CheckInsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
65
71
|
* Get check-in times for a check-in
|
|
66
72
|
*/
|
|
67
73
|
async getCheckInTimes(checkInId) {
|
|
68
|
-
return this.getList(`/
|
|
74
|
+
return this.getList(`/check_ins/${checkInId}/check_in_times`);
|
|
69
75
|
}
|
|
70
76
|
/**
|
|
71
77
|
* Get station where check-in occurred (checked_in_at)
|
|
72
78
|
*/
|
|
73
79
|
async getCheckedInAt(checkInId) {
|
|
74
80
|
try {
|
|
75
|
-
return await this.getSingle(`/
|
|
81
|
+
return await this.getSingle(`/check_ins/${checkInId}/checked_in_at`);
|
|
76
82
|
}
|
|
77
83
|
catch (error) {
|
|
78
84
|
if (error?.status === 404) {
|
|
@@ -86,7 +92,7 @@ class CheckInsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
86
92
|
*/
|
|
87
93
|
async getCheckedInBy(checkInId) {
|
|
88
94
|
try {
|
|
89
|
-
return await this.getSingle(`/
|
|
95
|
+
return await this.getSingle(`/check_ins/${checkInId}/checked_in_by`);
|
|
90
96
|
}
|
|
91
97
|
catch (error) {
|
|
92
98
|
if (error?.status === 404) {
|
|
@@ -100,7 +106,7 @@ class CheckInsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
100
106
|
*/
|
|
101
107
|
async getCheckedOutBy(checkInId) {
|
|
102
108
|
try {
|
|
103
|
-
return await this.getSingle(`/
|
|
109
|
+
return await this.getSingle(`/check_ins/${checkInId}/checked_out_by`);
|
|
104
110
|
}
|
|
105
111
|
catch (error) {
|
|
106
112
|
if (error?.status === 404) {
|
|
@@ -113,38 +119,46 @@ class CheckInsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
113
119
|
* Get event for a check-in
|
|
114
120
|
*/
|
|
115
121
|
async getEvent(checkInId) {
|
|
116
|
-
return this.getSingle(`/
|
|
122
|
+
return this.getSingle(`/check_ins/${checkInId}/event`);
|
|
117
123
|
}
|
|
118
124
|
/**
|
|
119
125
|
* Get event period for a check-in
|
|
120
126
|
*/
|
|
121
127
|
async getEventPeriod(checkInId) {
|
|
122
|
-
return this.getSingle(`/
|
|
128
|
+
return this.getSingle(`/check_ins/${checkInId}/event_period`);
|
|
123
129
|
}
|
|
124
130
|
/**
|
|
125
131
|
* Get event times for a check-in
|
|
126
132
|
*/
|
|
127
133
|
async getEventTimes(checkInId) {
|
|
128
|
-
return this.getList(`/
|
|
134
|
+
return this.getList(`/check_ins/${checkInId}/event_times`);
|
|
129
135
|
}
|
|
130
136
|
/**
|
|
131
137
|
* Get locations for a check-in
|
|
132
138
|
*/
|
|
133
139
|
async getLocations(checkInId) {
|
|
134
|
-
return this.getList(`/
|
|
140
|
+
return this.getList(`/check_ins/${checkInId}/locations`);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get location labels for a check-in at a specific location.
|
|
144
|
+
* Per API docs, location_labels are only available under check_ins, not under locations.
|
|
145
|
+
* @see https://developer.planning.center/docs/#/apps/check-ins/2025-05-28/vertices/location_label
|
|
146
|
+
*/
|
|
147
|
+
async getLocationLabels(checkInId, locationId) {
|
|
148
|
+
return this.getList(`/check_ins/${checkInId}/locations/${locationId}/location_labels`);
|
|
135
149
|
}
|
|
136
150
|
/**
|
|
137
151
|
* Get options for a check-in
|
|
138
152
|
*/
|
|
139
153
|
async getOptions(checkInId) {
|
|
140
|
-
return this.getList(`/
|
|
154
|
+
return this.getList(`/check_ins/${checkInId}/options`);
|
|
141
155
|
}
|
|
142
156
|
/**
|
|
143
157
|
* Get person for a check-in
|
|
144
158
|
*/
|
|
145
159
|
async getPerson(checkInId) {
|
|
146
160
|
try {
|
|
147
|
-
return await this.getSingle(`/
|
|
161
|
+
return await this.getSingle(`/check_ins/${checkInId}/person`);
|
|
148
162
|
}
|
|
149
163
|
catch (error) {
|
|
150
164
|
if (error?.status === 404) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* EventTimes 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 { EventTimeResource, EventResource, EventPeriodResource, LocationEventTimeResource, CheckInResource } from '../types';
|
|
7
7
|
export interface EventTimesListOptions {
|
|
8
8
|
where?: Record<string, any>;
|
|
@@ -13,13 +13,19 @@ export interface EventTimesListOptions {
|
|
|
13
13
|
export declare class EventTimesModule extends BaseModule {
|
|
14
14
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
15
15
|
/**
|
|
16
|
-
* Get all event times with optional filtering
|
|
16
|
+
* Get all event times across all pages with optional filtering.
|
|
17
|
+
* Use getPage() when you need a single page or custom perPage/page.
|
|
17
18
|
*/
|
|
18
|
-
getAll(options?: EventTimesListOptions): Promise<
|
|
19
|
+
getAll(options?: EventTimesListOptions): Promise<PaginationResult<EventTimeResource>>;
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of event times with optional filtering and pagination.
|
|
22
|
+
*/
|
|
23
|
+
getPage(options?: EventTimesListOptions): Promise<{
|
|
19
24
|
data: EventTimeResource[];
|
|
20
|
-
meta?:
|
|
21
|
-
links?:
|
|
25
|
+
meta?: Meta;
|
|
26
|
+
links?: TopLevelLinks;
|
|
22
27
|
}>;
|
|
28
|
+
private buildParams;
|
|
23
29
|
/**
|
|
24
30
|
* Get a single event time by ID
|
|
25
31
|
*/
|
|
@@ -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,7 +2,7 @@
|
|
|
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, Meta, TopLevelLinks } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, Meta, TopLevelLinks, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
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>;
|
|
@@ -14,13 +14,19 @@ export interface EventsListOptions {
|
|
|
14
14
|
export declare class EventsModule extends BaseModule {
|
|
15
15
|
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
16
16
|
/**
|
|
17
|
-
* 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.
|
|
18
19
|
*/
|
|
19
|
-
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<{
|
|
20
25
|
data: EventResource[];
|
|
21
26
|
meta?: Meta;
|
|
22
27
|
links?: TopLevelLinks;
|
|
23
28
|
}>;
|
|
29
|
+
private buildEventsListParams;
|
|
24
30
|
/**
|
|
25
31
|
* Get a single event by ID
|
|
26
32
|
*/
|