@rachelallyson/planning-center-people-ts 2.2.0 → 2.3.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 +126 -0
- package/README.md +4 -2
- package/dist/client.d.ts +6 -0
- package/dist/client.js +6 -0
- package/dist/index.d.ts +1 -1
- package/dist/modules/forms.d.ts +80 -0
- package/dist/modules/forms.js +77 -0
- package/dist/modules/reports.d.ts +53 -0
- package/dist/modules/reports.js +77 -0
- package/dist/modules/service-time.d.ts +46 -0
- package/dist/modules/service-time.js +66 -0
- package/dist/types/people.d.ts +113 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,132 @@ All notable changes to this project 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
|
+
## [2.3.0] - 2025-01-17
|
|
9
|
+
|
|
10
|
+
### 🚀 **NEW FEATURES - ServiceTime, Forms, and Reports Management**
|
|
11
|
+
|
|
12
|
+
This release adds three high-priority modules to extend the Planning Center People API client with essential church management functionality.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
#### **⏰ ServiceTime Module**
|
|
17
|
+
|
|
18
|
+
- **Campus-Scoped ServiceTime Operations**: Full CRUD operations for service times within campuses
|
|
19
|
+
- **Type-Safe ServiceTime Resource**: Complete TypeScript support for service time attributes and relationships
|
|
20
|
+
- **Pagination Support**: Automatic pagination for service time listings
|
|
21
|
+
|
|
22
|
+
**ServiceTime Operations:**
|
|
23
|
+
|
|
24
|
+
- `client.serviceTime.getAll(campusId, params?)` - Get all service times for a campus
|
|
25
|
+
- `client.serviceTime.getById(campusId, id, include?)` - Get specific service time by ID
|
|
26
|
+
- `client.serviceTime.create(campusId, data)` - Create new service time
|
|
27
|
+
- `client.serviceTime.update(campusId, id, data)` - Update existing service time
|
|
28
|
+
- `client.serviceTime.delete(campusId, id)` - Delete service time
|
|
29
|
+
- `client.serviceTime.getAllPagesPaginated(campusId, params?)` - Get all service times with pagination
|
|
30
|
+
|
|
31
|
+
**ServiceTime Resource Structure:**
|
|
32
|
+
|
|
33
|
+
- **Time Data**: `start_time`, `day` (0-6 for Sunday-Saturday)
|
|
34
|
+
- **Metadata**: `description`, `created_at`, `updated_at`
|
|
35
|
+
- **Relationships**: `organization`, `campus`
|
|
36
|
+
|
|
37
|
+
#### **📝 Forms Module**
|
|
38
|
+
|
|
39
|
+
- **Comprehensive Forms Operations**: Read operations for forms, categories, fields, options, and submissions
|
|
40
|
+
- **Type-Safe Form Resources**: Complete TypeScript support for all form-related resources
|
|
41
|
+
- **Form Data Analysis**: Tools for analyzing form submissions and field data
|
|
42
|
+
|
|
43
|
+
**Forms Operations:**
|
|
44
|
+
|
|
45
|
+
- `client.forms.getAll(params?)` - Get all forms
|
|
46
|
+
- `client.forms.getById(id, include?)` - Get specific form by ID
|
|
47
|
+
- `client.forms.getFormCategory(formId)` - Get form category
|
|
48
|
+
- `client.forms.getFormFields(formId, params?)` - Get form fields
|
|
49
|
+
- `client.forms.getFormFieldOptions(formFieldId, params?)` - Get form field options
|
|
50
|
+
- `client.forms.getFormSubmissions(formId, params?)` - Get form submissions
|
|
51
|
+
- `client.forms.getFormSubmissionById(submissionId, include?)` - Get specific form submission
|
|
52
|
+
- `client.forms.getFormSubmissionValues(submissionId, params?)` - Get form submission values
|
|
53
|
+
|
|
54
|
+
**Forms Resource Structure:**
|
|
55
|
+
|
|
56
|
+
- **Form**: `name`, `description`, `active`, `archived_at`
|
|
57
|
+
- **FormCategory**: `name`, `created_at`, `updated_at`
|
|
58
|
+
- **FormField**: `name`, `field_type`, `required`, `sequence`
|
|
59
|
+
- **FormFieldOption**: `value`, `sequence`
|
|
60
|
+
- **FormSubmission**: `submitted_at`, `created_at`, `updated_at`
|
|
61
|
+
- **FormSubmissionValue**: `value`, `created_at`, `updated_at`
|
|
62
|
+
|
|
63
|
+
#### **📊 Reports Module**
|
|
64
|
+
|
|
65
|
+
- **Complete Reports CRUD Operations**: Create, read, update, and delete reports
|
|
66
|
+
- **Report Metadata**: Get report creator and updater information
|
|
67
|
+
- **Type-Safe Report Resource**: Full TypeScript support for report attributes and relationships
|
|
68
|
+
- **Pagination Support**: Automatic pagination for report listings
|
|
69
|
+
|
|
70
|
+
**Reports Operations:**
|
|
71
|
+
|
|
72
|
+
- `client.reports.getAll(params?)` - Get all reports
|
|
73
|
+
- `client.reports.getById(id, include?)` - Get specific report by ID
|
|
74
|
+
- `client.reports.create(data)` - Create new report
|
|
75
|
+
- `client.reports.update(id, data)` - Update existing report
|
|
76
|
+
- `client.reports.delete(id)` - Delete report
|
|
77
|
+
- `client.reports.getCreatedBy(reportId)` - Get report creator
|
|
78
|
+
- `client.reports.getUpdatedBy(reportId)` - Get report updater
|
|
79
|
+
- `client.reports.getAllPagesPaginated(params?)` - Get all reports with pagination
|
|
80
|
+
|
|
81
|
+
**Reports Resource Structure:**
|
|
82
|
+
|
|
83
|
+
- **Report Data**: `name`, `body`
|
|
84
|
+
- **Metadata**: `created_at`, `updated_at`
|
|
85
|
+
- **Relationships**: `organization`, `created_by`, `updated_by`
|
|
86
|
+
|
|
87
|
+
### Documentation
|
|
88
|
+
|
|
89
|
+
- **Updated README.md** with ServiceTime, Forms, and Reports Management examples
|
|
90
|
+
- **Updated EXAMPLES.md** with comprehensive usage patterns for all three modules
|
|
91
|
+
- **Updated API_REFERENCE.md** with complete module documentation and resource types
|
|
92
|
+
- **Added new resource types** to TypeScript exports
|
|
93
|
+
|
|
94
|
+
### Testing
|
|
95
|
+
|
|
96
|
+
- **Integration Tests**: Complete test suites for ServiceTime, Forms, and Reports operations
|
|
97
|
+
- **Type Safety**: Full TypeScript coverage for all new resources
|
|
98
|
+
- **Error Handling**: Comprehensive error handling for all module operations
|
|
99
|
+
- **Campus-Scoped Testing**: ServiceTime tests properly handle campus-scoped operations
|
|
100
|
+
|
|
101
|
+
### Example Usage
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { PcoClient } from '@rachelallyson/planning-center-people-ts';
|
|
105
|
+
|
|
106
|
+
const client = new PcoClient({
|
|
107
|
+
auth: {
|
|
108
|
+
type: 'personal_access_token',
|
|
109
|
+
personalAccessToken: 'your-token'
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// ServiceTime Management
|
|
114
|
+
const serviceTimes = await client.serviceTime.getAll('campus-id');
|
|
115
|
+
const newServiceTime = await client.serviceTime.create('campus-id', {
|
|
116
|
+
start_time: '09:00:00',
|
|
117
|
+
day: 0, // Sunday
|
|
118
|
+
description: 'Main Service'
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// Forms Management
|
|
122
|
+
const forms = await client.forms.getAll();
|
|
123
|
+
const formFields = await client.forms.getFormFields('form-id');
|
|
124
|
+
const formSubmissions = await client.forms.getFormSubmissions('form-id');
|
|
125
|
+
|
|
126
|
+
// Reports Management
|
|
127
|
+
const reports = await client.reports.getAll();
|
|
128
|
+
const newReport = await client.reports.create({
|
|
129
|
+
name: 'Monthly Attendance Report',
|
|
130
|
+
body: 'Report showing monthly attendance statistics'
|
|
131
|
+
});
|
|
132
|
+
```
|
|
133
|
+
|
|
8
134
|
## [2.2.0] - 2025-01-17
|
|
9
135
|
|
|
10
136
|
### 🏢 **NEW FEATURE - Campus Management Support**
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
# @planning-center-people-ts
|
|
1
|
+
# @rachelallyson/planning-center-people-ts
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A modern, type-safe TypeScript library for interacting with the Planning Center Online People API. Built with a class-based architecture, comprehensive error handling, and advanced features like person matching and batch operations.
|
|
4
|
+
|
|
5
|
+
> **📖 For the latest documentation and examples, see [docs/README.md](docs/README.md)**
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
package/dist/client.d.ts
CHANGED
|
@@ -11,6 +11,9 @@ import { HouseholdsModule } from './modules/households';
|
|
|
11
11
|
import { NotesModule } from './modules/notes';
|
|
12
12
|
import { ListsModule } from './modules/lists';
|
|
13
13
|
import { CampusModule } from './modules/campus';
|
|
14
|
+
import { ServiceTimeModule } from './modules/service-time';
|
|
15
|
+
import { FormsModule } from './modules/forms';
|
|
16
|
+
import { ReportsModule } from './modules/reports';
|
|
14
17
|
import { BatchExecutor } from './batch';
|
|
15
18
|
export declare class PcoClient implements EventEmitter {
|
|
16
19
|
people: PeopleModule;
|
|
@@ -21,6 +24,9 @@ export declare class PcoClient implements EventEmitter {
|
|
|
21
24
|
notes: NotesModule;
|
|
22
25
|
lists: ListsModule;
|
|
23
26
|
campus: CampusModule;
|
|
27
|
+
serviceTime: ServiceTimeModule;
|
|
28
|
+
forms: FormsModule;
|
|
29
|
+
reports: ReportsModule;
|
|
24
30
|
batch: BatchExecutor;
|
|
25
31
|
private httpClient;
|
|
26
32
|
private paginationHelper;
|
package/dist/client.js
CHANGED
|
@@ -15,6 +15,9 @@ const households_1 = require("./modules/households");
|
|
|
15
15
|
const notes_1 = require("./modules/notes");
|
|
16
16
|
const lists_1 = require("./modules/lists");
|
|
17
17
|
const campus_1 = require("./modules/campus");
|
|
18
|
+
const service_time_1 = require("./modules/service-time");
|
|
19
|
+
const forms_1 = require("./modules/forms");
|
|
20
|
+
const reports_1 = require("./modules/reports");
|
|
18
21
|
const batch_1 = require("./batch");
|
|
19
22
|
class PcoClient {
|
|
20
23
|
constructor(config) {
|
|
@@ -31,6 +34,9 @@ class PcoClient {
|
|
|
31
34
|
this.notes = new notes_1.NotesModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
32
35
|
this.lists = new lists_1.ListsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
33
36
|
this.campus = new campus_1.CampusModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
37
|
+
this.serviceTime = new service_time_1.ServiceTimeModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
38
|
+
this.forms = new forms_1.FormsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
39
|
+
this.reports = new reports_1.ReportsModule(this.httpClient, this.paginationHelper, this.eventEmitter);
|
|
34
40
|
this.batch = new batch_1.BatchExecutor(this, this.eventEmitter);
|
|
35
41
|
// Set up event handlers from config
|
|
36
42
|
this.setupEventHandlers();
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { Paginated, Relationship, ResourceIdentifier, ResourceObject, } fro
|
|
|
7
7
|
export type { PersonResource, PersonAttributes, PersonSingle, PeopleList, EmailResource, EmailAttributes, PhoneNumberResource, PhoneNumberAttributes, AddressResource, AddressAttributes, SocialProfileResource, SocialProfileAttributes, } from './types';
|
|
8
8
|
export type { FieldDefinitionResource, FieldDefinitionAttributes, FieldDatumResource, FieldDatumAttributes, FieldOptionResource, FieldOptionAttributes, TabResource, TabAttributes, } from './types';
|
|
9
9
|
export type { WorkflowResource, WorkflowAttributes, WorkflowCardResource, WorkflowCardAttributes, WorkflowCardNoteResource, WorkflowCardNoteAttributes, } from './types';
|
|
10
|
-
export type { HouseholdResource, HouseholdAttributes, NoteResource, NoteAttributes, ListResource, ListAttributes, OrganizationResource, OrganizationAttributes, CampusResource, CampusAttributes, CampusesList, } from './types';
|
|
10
|
+
export type { HouseholdResource, HouseholdAttributes, NoteResource, NoteAttributes, ListResource, ListAttributes, OrganizationResource, OrganizationAttributes, CampusResource, CampusAttributes, CampusesList, ServiceTimeResource, ServiceTimeAttributes, ServiceTimesList, FormResource, FormAttributes, FormsList, FormCategoryResource, FormCategoryAttributes, FormFieldResource, FormFieldAttributes, FormFieldOptionResource, FormFieldOptionAttributes, FormSubmissionResource, FormSubmissionAttributes, FormSubmissionValueResource, FormSubmissionValueAttributes, ReportResource, ReportAttributes, ReportsList, } from './types';
|
|
11
11
|
export * from './types';
|
|
12
12
|
export type { PcoClientConfig as PcoClientConfigV1, PcoClientState } from './core';
|
|
13
13
|
export { createPcoClient, del, getAllPages, getList, getRateLimitInfo, getSingle, patch, post, } from './core';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { BaseModule } from './base';
|
|
2
|
+
import type { PcoHttpClient } from '../core/http';
|
|
3
|
+
import type { PaginationHelper } from '../core/pagination';
|
|
4
|
+
import type { PcoEventEmitter } from '../monitoring';
|
|
5
|
+
import type { FormResource, FormsList, FormCategoryResource, FormFieldResource, FormFieldOptionResource, FormSubmissionResource, FormSubmissionValueResource } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* Forms module for managing form-related operations
|
|
8
|
+
* Most operations are read-only based on API documentation
|
|
9
|
+
*/
|
|
10
|
+
export declare class FormsModule extends BaseModule {
|
|
11
|
+
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
12
|
+
/**
|
|
13
|
+
* Get all forms
|
|
14
|
+
*/
|
|
15
|
+
getAll(params?: {
|
|
16
|
+
where?: Record<string, any>;
|
|
17
|
+
include?: string[];
|
|
18
|
+
per_page?: number;
|
|
19
|
+
page?: number;
|
|
20
|
+
}): Promise<FormsList>;
|
|
21
|
+
/**
|
|
22
|
+
* Get a specific form by ID
|
|
23
|
+
*/
|
|
24
|
+
getById(id: string, include?: string[]): Promise<FormResource>;
|
|
25
|
+
/**
|
|
26
|
+
* Get form category for a specific form
|
|
27
|
+
*/
|
|
28
|
+
getFormCategory(formId: string): Promise<FormCategoryResource>;
|
|
29
|
+
/**
|
|
30
|
+
* Get form fields for a specific form
|
|
31
|
+
*/
|
|
32
|
+
getFormFields(formId: string, params?: {
|
|
33
|
+
where?: Record<string, any>;
|
|
34
|
+
include?: string[];
|
|
35
|
+
per_page?: number;
|
|
36
|
+
page?: number;
|
|
37
|
+
}): Promise<{
|
|
38
|
+
data: FormFieldResource[];
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* Get form field options for a specific form field
|
|
42
|
+
* Note: This requires the formId to get field options
|
|
43
|
+
*/
|
|
44
|
+
getFormFieldOptions(formId: string, formFieldId: string, params?: {
|
|
45
|
+
where?: Record<string, any>;
|
|
46
|
+
include?: string[];
|
|
47
|
+
per_page?: number;
|
|
48
|
+
page?: number;
|
|
49
|
+
}): Promise<{
|
|
50
|
+
data: FormFieldOptionResource[];
|
|
51
|
+
}>;
|
|
52
|
+
/**
|
|
53
|
+
* Get form submissions for a specific form
|
|
54
|
+
*/
|
|
55
|
+
getFormSubmissions(formId: string, params?: {
|
|
56
|
+
where?: Record<string, any>;
|
|
57
|
+
include?: string[];
|
|
58
|
+
per_page?: number;
|
|
59
|
+
page?: number;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
data: FormSubmissionResource[];
|
|
62
|
+
}>;
|
|
63
|
+
/**
|
|
64
|
+
* Get a specific form submission by ID
|
|
65
|
+
* Note: This requires the formId to get the submission
|
|
66
|
+
*/
|
|
67
|
+
getFormSubmissionById(formId: string, formSubmissionId: string, include?: string[]): Promise<FormSubmissionResource>;
|
|
68
|
+
/**
|
|
69
|
+
* Get form submission values for a specific form submission
|
|
70
|
+
* Note: This requires the formId to get submission values
|
|
71
|
+
*/
|
|
72
|
+
getFormSubmissionValues(formId: string, formSubmissionId: string, params?: {
|
|
73
|
+
where?: Record<string, any>;
|
|
74
|
+
include?: string[];
|
|
75
|
+
per_page?: number;
|
|
76
|
+
page?: number;
|
|
77
|
+
}): Promise<{
|
|
78
|
+
data: FormSubmissionValueResource[];
|
|
79
|
+
}>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormsModule = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
/**
|
|
6
|
+
* Forms module for managing form-related operations
|
|
7
|
+
* Most operations are read-only based on API documentation
|
|
8
|
+
*/
|
|
9
|
+
class FormsModule extends base_1.BaseModule {
|
|
10
|
+
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
11
|
+
super(httpClient, paginationHelper, eventEmitter);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get all forms
|
|
15
|
+
*/
|
|
16
|
+
async getAll(params) {
|
|
17
|
+
return this.getList('/forms', params);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get a specific form by ID
|
|
21
|
+
*/
|
|
22
|
+
async getById(id, include) {
|
|
23
|
+
const params = {};
|
|
24
|
+
if (include) {
|
|
25
|
+
params.include = include.join(',');
|
|
26
|
+
}
|
|
27
|
+
return this.getSingle(`/forms/${id}`, params);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get form category for a specific form
|
|
31
|
+
*/
|
|
32
|
+
async getFormCategory(formId) {
|
|
33
|
+
return this.getSingle(`/forms/${formId}/category`);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Get form fields for a specific form
|
|
37
|
+
*/
|
|
38
|
+
async getFormFields(formId, params) {
|
|
39
|
+
const result = await this.getList(`/forms/${formId}/fields`, params);
|
|
40
|
+
return { data: result.data };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get form field options for a specific form field
|
|
44
|
+
* Note: This requires the formId to get field options
|
|
45
|
+
*/
|
|
46
|
+
async getFormFieldOptions(formId, formFieldId, params) {
|
|
47
|
+
const result = await this.getList(`/forms/${formId}/fields/${formFieldId}/options`, params);
|
|
48
|
+
return { data: result.data };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Get form submissions for a specific form
|
|
52
|
+
*/
|
|
53
|
+
async getFormSubmissions(formId, params) {
|
|
54
|
+
const result = await this.getList(`/forms/${formId}/form_submissions`, params);
|
|
55
|
+
return { data: result.data };
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get a specific form submission by ID
|
|
59
|
+
* Note: This requires the formId to get the submission
|
|
60
|
+
*/
|
|
61
|
+
async getFormSubmissionById(formId, formSubmissionId, include) {
|
|
62
|
+
const params = {};
|
|
63
|
+
if (include) {
|
|
64
|
+
params.include = include.join(',');
|
|
65
|
+
}
|
|
66
|
+
return this.getSingle(`/forms/${formId}/form_submissions/${formSubmissionId}`, params);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get form submission values for a specific form submission
|
|
70
|
+
* Note: This requires the formId to get submission values
|
|
71
|
+
*/
|
|
72
|
+
async getFormSubmissionValues(formId, formSubmissionId, params) {
|
|
73
|
+
const result = await this.getList(`/forms/${formId}/form_submissions/${formSubmissionId}/form_submission_values`, params);
|
|
74
|
+
return { data: result.data };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.FormsModule = FormsModule;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BaseModule } from './base';
|
|
2
|
+
import type { PcoHttpClient } from '../core/http';
|
|
3
|
+
import type { PaginationHelper } from '../core/pagination';
|
|
4
|
+
import type { PcoEventEmitter } from '../monitoring';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '../core/pagination';
|
|
6
|
+
import type { ReportResource, ReportAttributes, ReportsList, PersonResource } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* Reports module for managing report-related operations
|
|
9
|
+
*/
|
|
10
|
+
export declare class ReportsModule extends BaseModule {
|
|
11
|
+
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
12
|
+
/**
|
|
13
|
+
* Get all reports
|
|
14
|
+
*/
|
|
15
|
+
getAll(params?: {
|
|
16
|
+
where?: Record<string, any>;
|
|
17
|
+
include?: string[];
|
|
18
|
+
per_page?: number;
|
|
19
|
+
page?: number;
|
|
20
|
+
}): Promise<ReportsList>;
|
|
21
|
+
/**
|
|
22
|
+
* Get a specific report by ID
|
|
23
|
+
*/
|
|
24
|
+
getById(id: string, include?: string[]): Promise<ReportResource>;
|
|
25
|
+
/**
|
|
26
|
+
* Create a new report
|
|
27
|
+
*/
|
|
28
|
+
create(data: ReportAttributes): Promise<ReportResource>;
|
|
29
|
+
/**
|
|
30
|
+
* Update an existing report
|
|
31
|
+
*/
|
|
32
|
+
update(id: string, data: Partial<ReportAttributes>): Promise<ReportResource>;
|
|
33
|
+
/**
|
|
34
|
+
* Delete a report
|
|
35
|
+
*/
|
|
36
|
+
delete(id: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Get the person who created a report
|
|
39
|
+
*/
|
|
40
|
+
getCreatedBy(reportId: string): Promise<PersonResource>;
|
|
41
|
+
/**
|
|
42
|
+
* Get the person who last updated a report
|
|
43
|
+
*/
|
|
44
|
+
getUpdatedBy(reportId: string): Promise<PersonResource>;
|
|
45
|
+
/**
|
|
46
|
+
* Get all reports with pagination support
|
|
47
|
+
*/
|
|
48
|
+
getAllPagesPaginated(params?: {
|
|
49
|
+
where?: Record<string, any>;
|
|
50
|
+
include?: string[];
|
|
51
|
+
per_page?: number;
|
|
52
|
+
}, paginationOptions?: PaginationOptions): Promise<PaginationResult<ReportResource>>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReportsModule = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
/**
|
|
6
|
+
* Reports module for managing report-related operations
|
|
7
|
+
*/
|
|
8
|
+
class ReportsModule extends base_1.BaseModule {
|
|
9
|
+
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
10
|
+
super(httpClient, paginationHelper, eventEmitter);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Get all reports
|
|
14
|
+
*/
|
|
15
|
+
async getAll(params) {
|
|
16
|
+
return this.getList('/reports', params);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get a specific report by ID
|
|
20
|
+
*/
|
|
21
|
+
async getById(id, include) {
|
|
22
|
+
const params = {};
|
|
23
|
+
if (include) {
|
|
24
|
+
params.include = include.join(',');
|
|
25
|
+
}
|
|
26
|
+
return this.getSingle(`/reports/${id}`, params);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a new report
|
|
30
|
+
*/
|
|
31
|
+
async create(data) {
|
|
32
|
+
return this.createResource('/reports', data);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Update an existing report
|
|
36
|
+
*/
|
|
37
|
+
async update(id, data) {
|
|
38
|
+
return this.updateResource(`/reports/${id}`, data);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Delete a report
|
|
42
|
+
*/
|
|
43
|
+
async delete(id) {
|
|
44
|
+
return this.deleteResource(`/reports/${id}`);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get the person who created a report
|
|
48
|
+
*/
|
|
49
|
+
async getCreatedBy(reportId) {
|
|
50
|
+
return this.getSingle(`/reports/${reportId}/created_by`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get the person who last updated a report
|
|
54
|
+
*/
|
|
55
|
+
async getUpdatedBy(reportId) {
|
|
56
|
+
return this.getSingle(`/reports/${reportId}/updated_by`);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get all reports with pagination support
|
|
60
|
+
*/
|
|
61
|
+
async getAllPagesPaginated(params, paginationOptions) {
|
|
62
|
+
const queryParams = {};
|
|
63
|
+
if (params?.where) {
|
|
64
|
+
Object.entries(params.where).forEach(([key, value]) => {
|
|
65
|
+
queryParams[`where[${key}]`] = value;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
if (params?.include) {
|
|
69
|
+
queryParams.include = params.include.join(',');
|
|
70
|
+
}
|
|
71
|
+
if (params?.per_page) {
|
|
72
|
+
queryParams.per_page = params.per_page;
|
|
73
|
+
}
|
|
74
|
+
return this.getAllPages('/reports', queryParams, paginationOptions);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.ReportsModule = ReportsModule;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BaseModule } from './base';
|
|
2
|
+
import type { PcoHttpClient } from '../core/http';
|
|
3
|
+
import type { PaginationHelper } from '../core/pagination';
|
|
4
|
+
import type { PcoEventEmitter } from '../monitoring';
|
|
5
|
+
import type { PaginationOptions, PaginationResult } from '../core/pagination';
|
|
6
|
+
import type { ServiceTimeResource, ServiceTimeAttributes, ServiceTimesList } from '../types';
|
|
7
|
+
/**
|
|
8
|
+
* ServiceTime module for managing service time-related operations
|
|
9
|
+
* ServiceTimes are campus-scoped resources
|
|
10
|
+
*/
|
|
11
|
+
export declare class ServiceTimeModule extends BaseModule {
|
|
12
|
+
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
13
|
+
/**
|
|
14
|
+
* Get all service times for a specific campus
|
|
15
|
+
*/
|
|
16
|
+
getAll(campusId: string, params?: {
|
|
17
|
+
where?: Record<string, any>;
|
|
18
|
+
include?: string[];
|
|
19
|
+
per_page?: number;
|
|
20
|
+
page?: number;
|
|
21
|
+
}): Promise<ServiceTimesList>;
|
|
22
|
+
/**
|
|
23
|
+
* Get a specific service time by ID for a campus
|
|
24
|
+
*/
|
|
25
|
+
getById(campusId: string, id: string, include?: string[]): Promise<ServiceTimeResource>;
|
|
26
|
+
/**
|
|
27
|
+
* Create a new service time for a campus
|
|
28
|
+
*/
|
|
29
|
+
create(campusId: string, data: ServiceTimeAttributes): Promise<ServiceTimeResource>;
|
|
30
|
+
/**
|
|
31
|
+
* Update an existing service time for a campus
|
|
32
|
+
*/
|
|
33
|
+
update(campusId: string, id: string, data: Partial<ServiceTimeAttributes>): Promise<ServiceTimeResource>;
|
|
34
|
+
/**
|
|
35
|
+
* Delete a service time for a campus
|
|
36
|
+
*/
|
|
37
|
+
delete(campusId: string, id: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Get all service times for a campus with pagination support
|
|
40
|
+
*/
|
|
41
|
+
getAllPagesPaginated(campusId: string, params?: {
|
|
42
|
+
where?: Record<string, any>;
|
|
43
|
+
include?: string[];
|
|
44
|
+
per_page?: number;
|
|
45
|
+
}, paginationOptions?: PaginationOptions): Promise<PaginationResult<ServiceTimeResource>>;
|
|
46
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServiceTimeModule = void 0;
|
|
4
|
+
const base_1 = require("./base");
|
|
5
|
+
/**
|
|
6
|
+
* ServiceTime module for managing service time-related operations
|
|
7
|
+
* ServiceTimes are campus-scoped resources
|
|
8
|
+
*/
|
|
9
|
+
class ServiceTimeModule extends base_1.BaseModule {
|
|
10
|
+
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
11
|
+
super(httpClient, paginationHelper, eventEmitter);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Get all service times for a specific campus
|
|
15
|
+
*/
|
|
16
|
+
async getAll(campusId, params) {
|
|
17
|
+
return this.getList(`/campuses/${campusId}/service_times`, params);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get a specific service time by ID for a campus
|
|
21
|
+
*/
|
|
22
|
+
async getById(campusId, id, include) {
|
|
23
|
+
const params = {};
|
|
24
|
+
if (include) {
|
|
25
|
+
params.include = include.join(',');
|
|
26
|
+
}
|
|
27
|
+
return this.getSingle(`/campuses/${campusId}/service_times/${id}`, params);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a new service time for a campus
|
|
31
|
+
*/
|
|
32
|
+
async create(campusId, data) {
|
|
33
|
+
return this.createResource(`/campuses/${campusId}/service_times`, data);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Update an existing service time for a campus
|
|
37
|
+
*/
|
|
38
|
+
async update(campusId, id, data) {
|
|
39
|
+
return this.updateResource(`/campuses/${campusId}/service_times/${id}`, data);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Delete a service time for a campus
|
|
43
|
+
*/
|
|
44
|
+
async delete(campusId, id) {
|
|
45
|
+
return this.deleteResource(`/campuses/${campusId}/service_times/${id}`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get all service times for a campus with pagination support
|
|
49
|
+
*/
|
|
50
|
+
async getAllPagesPaginated(campusId, params, paginationOptions) {
|
|
51
|
+
const queryParams = {};
|
|
52
|
+
if (params?.where) {
|
|
53
|
+
Object.entries(params.where).forEach(([key, value]) => {
|
|
54
|
+
queryParams[`where[${key}]`] = value;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (params?.include) {
|
|
58
|
+
queryParams.include = params.include.join(',');
|
|
59
|
+
}
|
|
60
|
+
if (params?.per_page) {
|
|
61
|
+
queryParams.per_page = params.per_page;
|
|
62
|
+
}
|
|
63
|
+
return this.getAllPages(`/campuses/${campusId}/service_times`, queryParams, paginationOptions);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.ServiceTimeModule = ServiceTimeModule;
|
package/dist/types/people.d.ts
CHANGED
|
@@ -400,4 +400,116 @@ export interface CampusResource extends ResourceObject<'Campus', CampusAttribute
|
|
|
400
400
|
}
|
|
401
401
|
export type CampusesList = Paginated<CampusResource>;
|
|
402
402
|
export type CampusSingle = Response<CampusResource>;
|
|
403
|
-
export
|
|
403
|
+
export interface ServiceTimeAttributes extends Attributes {
|
|
404
|
+
start_time?: number;
|
|
405
|
+
day?: number | string;
|
|
406
|
+
description?: string;
|
|
407
|
+
created_at?: string;
|
|
408
|
+
updated_at?: string;
|
|
409
|
+
}
|
|
410
|
+
export interface ServiceTimeRelationships {
|
|
411
|
+
organization?: Relationship;
|
|
412
|
+
campus?: Relationship;
|
|
413
|
+
}
|
|
414
|
+
export interface ServiceTimeResource extends ResourceObject<'ServiceTime', ServiceTimeAttributes, ServiceTimeRelationships> {
|
|
415
|
+
}
|
|
416
|
+
export type ServiceTimesList = Paginated<ServiceTimeResource>;
|
|
417
|
+
export type ServiceTimeSingle = Response<ServiceTimeResource>;
|
|
418
|
+
export interface FormAttributes extends Attributes {
|
|
419
|
+
name?: string;
|
|
420
|
+
description?: string;
|
|
421
|
+
active?: boolean;
|
|
422
|
+
archived_at?: string | null;
|
|
423
|
+
created_at?: string;
|
|
424
|
+
updated_at?: string;
|
|
425
|
+
}
|
|
426
|
+
export interface FormRelationships {
|
|
427
|
+
organization?: Relationship;
|
|
428
|
+
form_category?: Relationship;
|
|
429
|
+
}
|
|
430
|
+
export interface FormResource extends ResourceObject<'Form', FormAttributes, FormRelationships> {
|
|
431
|
+
}
|
|
432
|
+
export type FormsList = Paginated<FormResource>;
|
|
433
|
+
export type FormSingle = Response<FormResource>;
|
|
434
|
+
export interface FormCategoryAttributes extends Attributes {
|
|
435
|
+
name?: string;
|
|
436
|
+
created_at?: string;
|
|
437
|
+
updated_at?: string;
|
|
438
|
+
}
|
|
439
|
+
export interface FormCategoryRelationships {
|
|
440
|
+
organization?: Relationship;
|
|
441
|
+
}
|
|
442
|
+
export interface FormCategoryResource extends ResourceObject<'FormCategory', FormCategoryAttributes, FormCategoryRelationships> {
|
|
443
|
+
}
|
|
444
|
+
export type FormCategoriesList = Paginated<FormCategoryResource>;
|
|
445
|
+
export type FormCategorySingle = Response<FormCategoryResource>;
|
|
446
|
+
export interface FormFieldAttributes extends Attributes {
|
|
447
|
+
name?: string;
|
|
448
|
+
field_type?: string;
|
|
449
|
+
required?: boolean;
|
|
450
|
+
sequence?: number;
|
|
451
|
+
created_at?: string;
|
|
452
|
+
updated_at?: string;
|
|
453
|
+
}
|
|
454
|
+
export interface FormFieldRelationships {
|
|
455
|
+
form?: Relationship;
|
|
456
|
+
}
|
|
457
|
+
export interface FormFieldResource extends ResourceObject<'FormField', FormFieldAttributes, FormFieldRelationships> {
|
|
458
|
+
}
|
|
459
|
+
export type FormFieldsList = Paginated<FormFieldResource>;
|
|
460
|
+
export type FormFieldSingle = Response<FormFieldResource>;
|
|
461
|
+
export interface FormFieldOptionAttributes extends Attributes {
|
|
462
|
+
value?: string;
|
|
463
|
+
sequence?: number;
|
|
464
|
+
created_at?: string;
|
|
465
|
+
updated_at?: string;
|
|
466
|
+
}
|
|
467
|
+
export interface FormFieldOptionRelationships {
|
|
468
|
+
form_field?: Relationship;
|
|
469
|
+
}
|
|
470
|
+
export interface FormFieldOptionResource extends ResourceObject<'FormFieldOption', FormFieldOptionAttributes, FormFieldOptionRelationships> {
|
|
471
|
+
}
|
|
472
|
+
export type FormFieldOptionsList = Paginated<FormFieldOptionResource>;
|
|
473
|
+
export type FormFieldOptionSingle = Response<FormFieldOptionResource>;
|
|
474
|
+
export interface FormSubmissionAttributes extends Attributes {
|
|
475
|
+
submitted_at?: string;
|
|
476
|
+
created_at?: string;
|
|
477
|
+
updated_at?: string;
|
|
478
|
+
}
|
|
479
|
+
export interface FormSubmissionRelationships {
|
|
480
|
+
form?: Relationship;
|
|
481
|
+
person?: Relationship;
|
|
482
|
+
}
|
|
483
|
+
export interface FormSubmissionResource extends ResourceObject<'FormSubmission', FormSubmissionAttributes, FormSubmissionRelationships> {
|
|
484
|
+
}
|
|
485
|
+
export type FormSubmissionsList = Paginated<FormSubmissionResource>;
|
|
486
|
+
export type FormSubmissionSingle = Response<FormSubmissionResource>;
|
|
487
|
+
export interface FormSubmissionValueAttributes extends Attributes {
|
|
488
|
+
value?: string;
|
|
489
|
+
created_at?: string;
|
|
490
|
+
updated_at?: string;
|
|
491
|
+
}
|
|
492
|
+
export interface FormSubmissionValueRelationships {
|
|
493
|
+
form_submission?: Relationship;
|
|
494
|
+
form_field?: Relationship;
|
|
495
|
+
}
|
|
496
|
+
export interface FormSubmissionValueResource extends ResourceObject<'FormSubmissionValue', FormSubmissionValueAttributes, FormSubmissionValueRelationships> {
|
|
497
|
+
}
|
|
498
|
+
export type FormSubmissionValuesList = Paginated<FormSubmissionValueResource>;
|
|
499
|
+
export type FormSubmissionValueSingle = Response<FormSubmissionValueResource>;
|
|
500
|
+
export interface ReportAttributes extends Attributes {
|
|
501
|
+
name?: string;
|
|
502
|
+
body?: string;
|
|
503
|
+
created_at?: string;
|
|
504
|
+
updated_at?: string;
|
|
505
|
+
}
|
|
506
|
+
export interface ReportRelationships {
|
|
507
|
+
organization?: Relationship;
|
|
508
|
+
created_by?: Relationship;
|
|
509
|
+
updated_by?: Relationship;
|
|
510
|
+
}
|
|
511
|
+
export interface ReportResource extends ResourceObject<'Report', ReportAttributes, ReportRelationships> {
|
|
512
|
+
}
|
|
513
|
+
export type ReportsList = Paginated<ReportResource>;
|
|
514
|
+
export type ReportSingle = Response<ReportResource>;
|
|
515
|
+
export type PeopleIncluded = EmailResource | AddressResource | PhoneNumberResource | HouseholdResource | SocialProfileResource | FieldDatumResource | TabResource | CampusResource | ServiceTimeResource | FormResource | FormCategoryResource | FormFieldResource | FormFieldOptionResource | FormSubmissionResource | FormSubmissionValueResource | ReportResource;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rachelallyson/planning-center-people-ts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "A strictly typed TypeScript client for Planning Center Online People API with smart matching, batch operations, and enhanced developer experience",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|