@rachelallyson/planning-center-people-ts 2.14.1 → 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 +76 -7
- package/README.md +42 -4
- package/dist/auth.d.ts +1 -1
- package/dist/auth.js +14 -6
- package/dist/client.d.ts +33 -8
- package/dist/client.js +47 -22
- package/dist/core.d.ts +4 -2
- package/dist/core.js +3 -2
- package/dist/error-handling.d.ts +4 -4
- package/dist/error-handling.js +13 -2
- package/dist/error-scenarios.d.ts +11 -7
- package/dist/error-scenarios.js +26 -10
- package/dist/helpers.d.ts +124 -48
- package/dist/helpers.js +236 -93
- package/dist/index.d.ts +9 -7
- package/dist/index.js +31 -72
- package/dist/matching/matcher.d.ts +8 -4
- package/dist/matching/matcher.js +51 -58
- package/dist/matching/scoring.d.ts +9 -6
- package/dist/matching/scoring.js +18 -14
- package/dist/modules/campus.d.ts +31 -36
- package/dist/modules/campus.js +36 -49
- package/dist/modules/contacts.d.ts +33 -29
- package/dist/modules/contacts.js +36 -12
- package/dist/modules/fields.d.ts +39 -55
- package/dist/modules/fields.js +65 -105
- package/dist/modules/forms.d.ts +35 -24
- package/dist/modules/forms.js +41 -23
- package/dist/modules/households.d.ts +17 -19
- package/dist/modules/households.js +25 -34
- package/dist/modules/lists.d.ts +30 -28
- package/dist/modules/lists.js +55 -42
- package/dist/modules/notes.d.ts +32 -30
- package/dist/modules/notes.js +40 -52
- package/dist/modules/people.d.ts +83 -71
- package/dist/modules/people.js +323 -172
- package/dist/modules/reports.d.ts +18 -32
- package/dist/modules/reports.js +28 -40
- package/dist/modules/service-time.d.ts +19 -24
- package/dist/modules/service-time.js +28 -28
- package/dist/modules/workflows.d.ts +42 -47
- package/dist/modules/workflows.js +50 -53
- package/dist/performance.d.ts +14 -10
- package/dist/performance.js +61 -25
- package/dist/testing/recorder.js +11 -2
- package/dist/testing/simple-builders.d.ts +6 -4
- package/dist/testing/simple-builders.js +36 -49
- package/dist/testing/types.d.ts +4 -0
- package/dist/types/api-options.d.ts +380 -0
- package/dist/types/api-options.js +6 -0
- package/dist/types/client.d.ts +4 -2
- package/dist/types/client.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/people.d.ts +47 -9
- package/package.json +7 -7
- package/dist/core/http.d.ts +0 -56
- package/dist/core/http.js +0 -360
- package/dist/core/pagination.d.ts +0 -34
- package/dist/core/pagination.js +0 -178
- package/dist/people/contacts.d.ts +0 -43
- package/dist/people/contacts.js +0 -122
- package/dist/people/core.d.ts +0 -28
- package/dist/people/core.js +0 -69
- package/dist/people/fields.d.ts +0 -68
- package/dist/people/fields.js +0 -305
- package/dist/people/households.d.ts +0 -15
- package/dist/people/households.js +0 -31
- package/dist/people/index.d.ts +0 -8
- package/dist/people/index.js +0 -25
- package/dist/people/lists.d.ts +0 -34
- package/dist/people/lists.js +0 -48
- package/dist/people/notes.d.ts +0 -30
- package/dist/people/notes.js +0 -37
- package/dist/people/organization.d.ts +0 -12
- package/dist/people/organization.js +0 -15
- package/dist/people/workflows.d.ts +0 -37
- package/dist/people/workflows.js +0 -75
package/dist/modules/notes.js
CHANGED
|
@@ -7,95 +7,83 @@ exports.NotesModule = void 0;
|
|
|
7
7
|
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
8
8
|
class NotesModule extends planning_center_base_ts_1.BaseModule {
|
|
9
9
|
/**
|
|
10
|
-
* Get all notes
|
|
10
|
+
* Get all notes across all pages
|
|
11
11
|
*/
|
|
12
12
|
async getAll(options = {}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
if (options.include) {
|
|
20
|
-
params.include = options.include.join(',');
|
|
21
|
-
}
|
|
22
|
-
if (options.perPage) {
|
|
23
|
-
params.per_page = options.perPage;
|
|
24
|
-
}
|
|
25
|
-
if (options.page) {
|
|
26
|
-
params.page = options.page;
|
|
27
|
-
}
|
|
28
|
-
return this.getList('/notes', params);
|
|
13
|
+
this.debugLog('notes.getAll', { options });
|
|
14
|
+
return await this.getAllPages('/notes', {
|
|
15
|
+
where: options.where,
|
|
16
|
+
include: options.include,
|
|
17
|
+
order: options.order
|
|
18
|
+
});
|
|
29
19
|
}
|
|
30
20
|
/**
|
|
31
|
-
* Get
|
|
21
|
+
* Get a single page of notes with optional filtering and pagination control
|
|
22
|
+
* Use this when you need a specific page or want to limit the number of results
|
|
23
|
+
* @param options - List options including where, include, perPage, page, and order
|
|
24
|
+
* @returns A single page of results with meta and links for pagination
|
|
32
25
|
*/
|
|
33
|
-
async
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
return this.getAllPages('/notes', params, paginationOptions);
|
|
26
|
+
async getPage(options = {}) {
|
|
27
|
+
this.debugLog('notes.getPage', { options });
|
|
28
|
+
return this.getList('/notes', {
|
|
29
|
+
where: options.where,
|
|
30
|
+
include: options.include,
|
|
31
|
+
per_page: options.perPage,
|
|
32
|
+
page: options.page,
|
|
33
|
+
order: options.order
|
|
34
|
+
});
|
|
44
35
|
}
|
|
45
36
|
/**
|
|
46
37
|
* Get a single note by ID
|
|
47
38
|
*/
|
|
48
39
|
async getById(id, include) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
params.include = include.join(',');
|
|
52
|
-
}
|
|
53
|
-
return this.getSingle(`/notes/${id}`, params);
|
|
40
|
+
this.debugLog('notes.getById', { id, include });
|
|
41
|
+
return this.getSingle(`/notes/${id}`, include);
|
|
54
42
|
}
|
|
55
43
|
/**
|
|
56
44
|
* Get notes for a specific person
|
|
57
45
|
*/
|
|
58
46
|
async getNotesForPerson(personId, options = {}) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
if (options.perPage) {
|
|
69
|
-
params.per_page = options.perPage;
|
|
70
|
-
}
|
|
71
|
-
if (options.page) {
|
|
72
|
-
params.page = options.page;
|
|
73
|
-
}
|
|
74
|
-
return this.getList(`/people/${personId}/notes`, params);
|
|
47
|
+
this.debugLog('notes.getNotesForPerson', { personId, options });
|
|
48
|
+
return this.getList(`/people/${personId}/notes`, {
|
|
49
|
+
where: options.where,
|
|
50
|
+
include: options.include,
|
|
51
|
+
per_page: options.perPage,
|
|
52
|
+
page: options.page,
|
|
53
|
+
order: options.order
|
|
54
|
+
});
|
|
75
55
|
}
|
|
76
56
|
/**
|
|
77
57
|
* Create a note for a person
|
|
78
58
|
*/
|
|
79
59
|
async create(personId, data) {
|
|
60
|
+
this.debugLog('notes.create', { personId, data });
|
|
80
61
|
return this.createResource(`/people/${personId}/notes`, data);
|
|
81
62
|
}
|
|
82
63
|
/**
|
|
83
64
|
* Update a note
|
|
84
65
|
*/
|
|
85
66
|
async update(id, data) {
|
|
67
|
+
this.debugLog('notes.update', { id, data });
|
|
86
68
|
return this.updateResource(`/notes/${id}`, data);
|
|
87
69
|
}
|
|
88
70
|
/**
|
|
89
71
|
* Delete a note
|
|
90
72
|
*/
|
|
91
73
|
async delete(id) {
|
|
74
|
+
this.debugLog('notes.delete', { id });
|
|
92
75
|
return this.deleteResource(`/notes/${id}`);
|
|
93
76
|
}
|
|
94
77
|
/**
|
|
95
78
|
* Get all note categories
|
|
79
|
+
* @param options - Optional pagination options
|
|
96
80
|
*/
|
|
97
|
-
async getNoteCategories() {
|
|
98
|
-
|
|
81
|
+
async getNoteCategories(options) {
|
|
82
|
+
this.debugLog('notes.getNoteCategories', { options });
|
|
83
|
+
return this.getList('/note_categories', options ? {
|
|
84
|
+
per_page: options.perPage,
|
|
85
|
+
page: options.page,
|
|
86
|
+
} : undefined);
|
|
99
87
|
}
|
|
100
88
|
/**
|
|
101
89
|
* Get a single note category by ID
|
package/dist/modules/people.d.ts
CHANGED
|
@@ -2,14 +2,11 @@
|
|
|
2
2
|
* v2.0.0 People Module
|
|
3
3
|
*/
|
|
4
4
|
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
-
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter,
|
|
6
|
-
import type { PersonResource, EmailResource, EmailAttributes, PhoneNumberResource, PhoneNumberAttributes, AddressResource, AddressAttributes,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
perPage?: number;
|
|
11
|
-
page?: number;
|
|
12
|
-
}
|
|
5
|
+
import type { PcoHttpClient, PaginationHelper, PcoEventEmitter, PcoClientConfig } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
+
import type { PersonResource, PersonAttributes, PersonRelationshipMap, EmailResource, EmailAttributes, PhoneNumberResource, PhoneNumberAttributes, AddressResource, AddressAttributes, SocialProfileAttributes, CampusResource, HouseholdResource, PeopleIncluded, FlattenedPersonResource } from '../types';
|
|
7
|
+
import type { Meta, TopLevelLinks } from '../types/json-api';
|
|
8
|
+
import type { PersonListOptions, PersonPageOptions } from '../types/api-options';
|
|
9
|
+
export type PeopleListOptions = PersonListOptions;
|
|
13
10
|
export interface PersonCreateOptions {
|
|
14
11
|
firstName?: string;
|
|
15
12
|
lastName?: string;
|
|
@@ -147,23 +144,26 @@ export declare const DEFAULT_INITIAL_RETRY_CONFIG: Required<Omit<RetryConfig, 'e
|
|
|
147
144
|
export declare const DEFAULT_AGGRESSIVE_RETRY_CONFIG: Required<Omit<RetryConfig, 'enabled'>>;
|
|
148
145
|
export declare class PeopleModule extends BaseModule {
|
|
149
146
|
private personMatcher;
|
|
150
|
-
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
147
|
+
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter, getConfig?: () => PcoClientConfig);
|
|
151
148
|
/**
|
|
152
|
-
* Get all people with optional filtering
|
|
149
|
+
* Get all people across all pages with optional filtering
|
|
153
150
|
*/
|
|
154
|
-
getAll(options?:
|
|
155
|
-
data: PersonResource[];
|
|
156
|
-
meta?: any;
|
|
157
|
-
links?: any;
|
|
158
|
-
}>;
|
|
151
|
+
getAll(options?: PersonListOptions): Promise<import("@rachelallyson/planning-center-base-ts").PaginationResult<PersonResource, PeopleIncluded, PersonRelationshipMap>>;
|
|
159
152
|
/**
|
|
160
|
-
* Get
|
|
153
|
+
* Get a single page of people with optional filtering and pagination control
|
|
154
|
+
* Use this when you need a specific page or want to limit the number of results
|
|
155
|
+
* @param options - List options including where, include, perPage, page, and order
|
|
156
|
+
* @returns A single page of results with meta and links for pagination
|
|
161
157
|
*/
|
|
162
|
-
|
|
158
|
+
getPage(options?: PersonPageOptions): Promise<{
|
|
159
|
+
data: FlattenedPersonResource[];
|
|
160
|
+
meta?: Meta;
|
|
161
|
+
links?: TopLevelLinks;
|
|
162
|
+
}>;
|
|
163
163
|
/**
|
|
164
164
|
* Get a single person by ID
|
|
165
165
|
*/
|
|
166
|
-
getById(id: string, include?: string[]): Promise<
|
|
166
|
+
getById(id: string, include?: string[]): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships>>;
|
|
167
167
|
/**
|
|
168
168
|
* Verify that a person exists in PCO
|
|
169
169
|
*
|
|
@@ -176,7 +176,7 @@ export declare class PeopleModule extends BaseModule {
|
|
|
176
176
|
* @returns True if person exists, false if not found
|
|
177
177
|
* @throws Error if request times out or other error occurs (except 404)
|
|
178
178
|
*
|
|
179
|
-
* @
|
|
179
|
+
* @gmail.com
|
|
180
180
|
* ```typescript
|
|
181
181
|
* const exists = await client.people.verifyPersonExists(cachedPersonId);
|
|
182
182
|
* if (!exists) {
|
|
@@ -188,14 +188,21 @@ export declare class PeopleModule extends BaseModule {
|
|
|
188
188
|
verifyPersonExists(personId: string, options?: {
|
|
189
189
|
timeout?: number;
|
|
190
190
|
}): Promise<boolean>;
|
|
191
|
+
/**
|
|
192
|
+
* Transform PersonCreateOptions (camelCase) to API format (snake_case)
|
|
193
|
+
* Also handles snake_case input directly (passes through)
|
|
194
|
+
*/
|
|
195
|
+
private transformPersonData;
|
|
191
196
|
/**
|
|
192
197
|
* Create a new person
|
|
198
|
+
* Accepts both camelCase (PersonCreateOptions) and snake_case (PersonAttributes) fields
|
|
193
199
|
*/
|
|
194
|
-
create(data: PersonCreateOptions): Promise<
|
|
200
|
+
create(data: PersonCreateOptions | Partial<PersonAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships>>;
|
|
195
201
|
/**
|
|
196
202
|
* Update a person
|
|
203
|
+
* Accepts both camelCase (PersonCreateOptions) and snake_case (PersonAttributes) fields
|
|
197
204
|
*/
|
|
198
|
-
update(id: string, data: Partial<PersonCreateOptions>): Promise<
|
|
205
|
+
update(id: string, data: Partial<PersonCreateOptions> | Partial<PersonAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships>>;
|
|
199
206
|
/**
|
|
200
207
|
* Delete a person
|
|
201
208
|
*/
|
|
@@ -203,42 +210,46 @@ export declare class PeopleModule extends BaseModule {
|
|
|
203
210
|
/**
|
|
204
211
|
* Get a person's primary campus
|
|
205
212
|
*/
|
|
206
|
-
getPrimaryCampus(personId: string): Promise<CampusResource | null>;
|
|
213
|
+
getPrimaryCampus(personId: string): Promise<CampusResource | import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Campus", import("../types").CampusAttributes, import("../types").CampusRelationships> | null>;
|
|
207
214
|
/**
|
|
208
215
|
* Set a person's primary campus
|
|
209
216
|
*/
|
|
210
|
-
setPrimaryCampus(personId: string, campusId: string): Promise<
|
|
217
|
+
setPrimaryCampus(personId: string, campusId: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships>>;
|
|
211
218
|
/**
|
|
212
219
|
* Remove a person's primary campus
|
|
213
220
|
*/
|
|
214
|
-
removePrimaryCampus(personId: string): Promise<
|
|
221
|
+
removePrimaryCampus(personId: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships>>;
|
|
215
222
|
/**
|
|
216
223
|
* Get a person's household
|
|
217
224
|
*/
|
|
218
|
-
getHousehold(personId: string): Promise<HouseholdResource | null>;
|
|
225
|
+
getHousehold(personId: string): Promise<HouseholdResource | import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Household", import("../types").HouseholdAttributes, import("../types").HouseholdRelationships> | null>;
|
|
219
226
|
/**
|
|
220
227
|
* Set a person's household
|
|
228
|
+
* Uses the household_memberships endpoint to create a membership record
|
|
221
229
|
*/
|
|
222
|
-
setHousehold(personId: string, householdId: string): Promise<
|
|
230
|
+
setHousehold(personId: string, householdId: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships>>;
|
|
223
231
|
/**
|
|
224
232
|
* Remove a person from their household
|
|
233
|
+
* Uses the household_memberships endpoint to delete the membership record
|
|
225
234
|
*/
|
|
226
|
-
removeFromHousehold(personId: string): Promise<
|
|
235
|
+
removeFromHousehold(personId: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships>>;
|
|
227
236
|
/**
|
|
228
237
|
* Get all people in a specific household
|
|
238
|
+
* Note: This uses getList() internally, so it returns a single page. Use getAll() with where[household_id] for all pages.
|
|
229
239
|
*/
|
|
230
|
-
getHouseholdMembers(householdId: string, options?:
|
|
231
|
-
data:
|
|
232
|
-
meta?:
|
|
233
|
-
links?:
|
|
240
|
+
getHouseholdMembers(householdId: string, options?: PersonPageOptions): Promise<{
|
|
241
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships, Record<string, never>>[];
|
|
242
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
243
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
234
244
|
}>;
|
|
235
245
|
/**
|
|
236
246
|
* Get people by campus
|
|
247
|
+
* Note: This uses getList() internally, so it returns a single page. Use getAll() with where[primary_campus_id] for all pages.
|
|
237
248
|
*/
|
|
238
|
-
getByCampus(campusId: string, options?:
|
|
239
|
-
data:
|
|
240
|
-
meta?:
|
|
241
|
-
links?:
|
|
249
|
+
getByCampus(campusId: string, options?: PersonPageOptions): Promise<{
|
|
250
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Person", PersonAttributes, import("../types").PersonRelationships, Record<string, never>>[];
|
|
251
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
252
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
242
253
|
}>;
|
|
243
254
|
/**
|
|
244
255
|
* Get a person's workflow cards
|
|
@@ -248,9 +259,9 @@ export declare class PeopleModule extends BaseModule {
|
|
|
248
259
|
perPage?: number;
|
|
249
260
|
page?: number;
|
|
250
261
|
}): Promise<{
|
|
251
|
-
data:
|
|
252
|
-
meta?:
|
|
253
|
-
links?:
|
|
262
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"WorkflowCard", import("../types").WorkflowCardAttributes, import("../types").WorkflowCardRelationships, Record<string, never>>[];
|
|
263
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
264
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
254
265
|
}>;
|
|
255
266
|
/**
|
|
256
267
|
* Get a person's notes
|
|
@@ -260,9 +271,9 @@ export declare class PeopleModule extends BaseModule {
|
|
|
260
271
|
perPage?: number;
|
|
261
272
|
page?: number;
|
|
262
273
|
}): Promise<{
|
|
263
|
-
data:
|
|
264
|
-
meta?:
|
|
265
|
-
links?:
|
|
274
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Note", import("../types").NoteAttributes, import("../types").NoteRelationships, Record<string, never>>[];
|
|
275
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
276
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
266
277
|
}>;
|
|
267
278
|
/**
|
|
268
279
|
* Get a person's field data
|
|
@@ -272,9 +283,9 @@ export declare class PeopleModule extends BaseModule {
|
|
|
272
283
|
perPage?: number;
|
|
273
284
|
page?: number;
|
|
274
285
|
}): Promise<{
|
|
275
|
-
data:
|
|
276
|
-
meta?:
|
|
277
|
-
links?:
|
|
286
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"FieldDatum", import("../types").FieldDatumAttributes, import("../types").FieldDatumRelationships, Record<string, never>>[];
|
|
287
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
288
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
278
289
|
}>;
|
|
279
290
|
/**
|
|
280
291
|
* Get a person's social profiles
|
|
@@ -284,9 +295,9 @@ export declare class PeopleModule extends BaseModule {
|
|
|
284
295
|
perPage?: number;
|
|
285
296
|
page?: number;
|
|
286
297
|
}): Promise<{
|
|
287
|
-
data:
|
|
288
|
-
meta?:
|
|
289
|
-
links?:
|
|
298
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"SocialProfile", SocialProfileAttributes, import("../types").SocialProfileRelationships, Record<string, never>>[];
|
|
299
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
300
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
290
301
|
}>;
|
|
291
302
|
/**
|
|
292
303
|
* Find or create a person with smart matching
|
|
@@ -299,13 +310,13 @@ export declare class PeopleModule extends BaseModule {
|
|
|
299
310
|
* to a person's profile when a match is found. The contacts are added as non-primary
|
|
300
311
|
* to preserve existing primary contacts.
|
|
301
312
|
*
|
|
302
|
-
* @
|
|
313
|
+
* @gmail.com
|
|
303
314
|
* ```typescript
|
|
304
315
|
* // Basic find or create
|
|
305
316
|
* const person = await client.people.findOrCreate({
|
|
306
317
|
* firstName: 'John',
|
|
307
318
|
* lastName: 'Doe',
|
|
308
|
-
* email: 'john@
|
|
319
|
+
* email: 'john@gmail.com',
|
|
309
320
|
* phone: '+1234567890'
|
|
310
321
|
* });
|
|
311
322
|
*
|
|
@@ -313,7 +324,7 @@ export declare class PeopleModule extends BaseModule {
|
|
|
313
324
|
* const person = await client.people.findOrCreate({
|
|
314
325
|
* firstName: 'Jane',
|
|
315
326
|
* lastName: 'Smith',
|
|
316
|
-
* email: 'jane@
|
|
327
|
+
* email: 'jane@gmail.com',
|
|
317
328
|
* phone: '+1987654321',
|
|
318
329
|
* addMissingContactInfo: true // Will add phone if person only has email
|
|
319
330
|
* });
|
|
@@ -321,7 +332,7 @@ export declare class PeopleModule extends BaseModule {
|
|
|
321
332
|
*
|
|
322
333
|
* @returns The found or newly created person
|
|
323
334
|
*/
|
|
324
|
-
findOrCreate(options: PersonMatchOptions): Promise<
|
|
335
|
+
findOrCreate(options: PersonMatchOptions): Promise<FlattenedPersonResource>;
|
|
325
336
|
/**
|
|
326
337
|
* Search people by multiple criteria
|
|
327
338
|
*/
|
|
@@ -331,27 +342,28 @@ export declare class PeopleModule extends BaseModule {
|
|
|
331
342
|
phone?: string;
|
|
332
343
|
status?: string;
|
|
333
344
|
perPage?: number;
|
|
345
|
+
page?: number;
|
|
334
346
|
}): Promise<{
|
|
335
|
-
data:
|
|
336
|
-
meta?:
|
|
337
|
-
links?:
|
|
347
|
+
data: FlattenedPersonResource[];
|
|
348
|
+
meta?: Meta;
|
|
349
|
+
links?: TopLevelLinks;
|
|
338
350
|
}>;
|
|
339
351
|
/**
|
|
340
352
|
* Get person's emails
|
|
341
353
|
*/
|
|
342
354
|
getEmails(personId: string): Promise<{
|
|
343
|
-
data:
|
|
344
|
-
meta?:
|
|
345
|
-
links?:
|
|
355
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Email", EmailAttributes, import("../types").EmailRelationships, Record<string, never>>[];
|
|
356
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
357
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
346
358
|
}>;
|
|
347
359
|
/**
|
|
348
360
|
* Add an email to a person
|
|
349
361
|
*/
|
|
350
|
-
addEmail(personId: string, data: EmailAttributes): Promise<
|
|
362
|
+
addEmail(personId: string, data: EmailAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Email", EmailAttributes, import("../types").EmailRelationships>>;
|
|
351
363
|
/**
|
|
352
364
|
* Update a person's email
|
|
353
365
|
*/
|
|
354
|
-
updateEmail(personId: string, emailId: string, data: Partial<EmailAttributes>): Promise<
|
|
366
|
+
updateEmail(personId: string, emailId: string, data: Partial<EmailAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Email", EmailAttributes, import("../types").EmailRelationships>>;
|
|
355
367
|
/**
|
|
356
368
|
* Delete a person's email
|
|
357
369
|
*/
|
|
@@ -360,18 +372,18 @@ export declare class PeopleModule extends BaseModule {
|
|
|
360
372
|
* Get person's phone numbers
|
|
361
373
|
*/
|
|
362
374
|
getPhoneNumbers(personId: string): Promise<{
|
|
363
|
-
data:
|
|
364
|
-
meta?:
|
|
365
|
-
links?:
|
|
375
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"PhoneNumber", PhoneNumberAttributes, import("../types").PhoneNumberRelationships, Record<string, never>>[];
|
|
376
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
377
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
366
378
|
}>;
|
|
367
379
|
/**
|
|
368
380
|
* Add a phone number to a person
|
|
369
381
|
*/
|
|
370
|
-
addPhoneNumber(personId: string, data: PhoneNumberAttributes): Promise<
|
|
382
|
+
addPhoneNumber(personId: string, data: PhoneNumberAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"PhoneNumber", PhoneNumberAttributes, import("../types").PhoneNumberRelationships>>;
|
|
371
383
|
/**
|
|
372
384
|
* Update a person's phone number
|
|
373
385
|
*/
|
|
374
|
-
updatePhoneNumber(personId: string, phoneId: string, data: Partial<PhoneNumberAttributes>): Promise<
|
|
386
|
+
updatePhoneNumber(personId: string, phoneId: string, data: Partial<PhoneNumberAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"PhoneNumber", PhoneNumberAttributes, import("../types").PhoneNumberRelationships>>;
|
|
375
387
|
/**
|
|
376
388
|
* Delete a person's phone number
|
|
377
389
|
*/
|
|
@@ -380,18 +392,18 @@ export declare class PeopleModule extends BaseModule {
|
|
|
380
392
|
* Get person's addresses
|
|
381
393
|
*/
|
|
382
394
|
getAddresses(personId: string): Promise<{
|
|
383
|
-
data:
|
|
384
|
-
meta?:
|
|
385
|
-
links?:
|
|
395
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Address", AddressAttributes, import("../types").AddressRelationships, Record<string, never>>[];
|
|
396
|
+
meta?: import("@rachelallyson/planning-center-base-ts").Meta;
|
|
397
|
+
links?: import("@rachelallyson/planning-center-base-ts").TopLevelLinks;
|
|
386
398
|
}>;
|
|
387
399
|
/**
|
|
388
400
|
* Add an address to a person
|
|
389
401
|
*/
|
|
390
|
-
addAddress(personId: string, data: AddressAttributes): Promise<
|
|
402
|
+
addAddress(personId: string, data: AddressAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Address", AddressAttributes, import("../types").AddressRelationships>>;
|
|
391
403
|
/**
|
|
392
404
|
* Update a person's address
|
|
393
405
|
*/
|
|
394
|
-
updateAddress(personId: string, addressId: string, data: Partial<AddressAttributes>): Promise<
|
|
406
|
+
updateAddress(personId: string, addressId: string, data: Partial<AddressAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Address", AddressAttributes, import("../types").AddressRelationships>>;
|
|
395
407
|
/**
|
|
396
408
|
* Delete a person's address
|
|
397
409
|
*/
|
|
@@ -399,11 +411,11 @@ export declare class PeopleModule extends BaseModule {
|
|
|
399
411
|
/**
|
|
400
412
|
* Add a social profile to a person
|
|
401
413
|
*/
|
|
402
|
-
addSocialProfile(personId: string, data: SocialProfileAttributes): Promise<
|
|
414
|
+
addSocialProfile(personId: string, data: SocialProfileAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"SocialProfile", SocialProfileAttributes, import("../types").SocialProfileRelationships>>;
|
|
403
415
|
/**
|
|
404
416
|
* Update a person's social profile
|
|
405
417
|
*/
|
|
406
|
-
updateSocialProfile(personId: string, profileId: string, data: Partial<SocialProfileAttributes>): Promise<
|
|
418
|
+
updateSocialProfile(personId: string, profileId: string, data: Partial<SocialProfileAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"SocialProfile", SocialProfileAttributes, import("../types").SocialProfileRelationships>>;
|
|
407
419
|
/**
|
|
408
420
|
* Delete a person's social profile
|
|
409
421
|
*/
|