@rachelallyson/planning-center-people-ts 2.14.1 → 3.1.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 +82 -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 +237 -93
- package/dist/index.d.ts +10 -8
- 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 +38 -28
- package/dist/modules/lists.js +62 -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 +52 -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 +61 -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/matching/scoring.js
CHANGED
|
@@ -4,10 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MatchScorer = void 0;
|
|
7
|
+
const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-ts");
|
|
7
8
|
const helpers_1 = require("../helpers");
|
|
8
9
|
class MatchScorer {
|
|
9
|
-
constructor(peopleModule) {
|
|
10
|
+
constructor(peopleModule, getConfig) {
|
|
10
11
|
this.peopleModule = peopleModule;
|
|
12
|
+
this.getConfig = getConfig;
|
|
13
|
+
}
|
|
14
|
+
debugLog(message, data) {
|
|
15
|
+
const logger = (0, planning_center_base_ts_1.createDebugLogger)(this.getConfig?.());
|
|
16
|
+
if (logger.enabled)
|
|
17
|
+
logger.log(message, data);
|
|
11
18
|
}
|
|
12
19
|
/**
|
|
13
20
|
* Score a person match based on various criteria
|
|
@@ -74,7 +81,7 @@ class MatchScorer {
|
|
|
74
81
|
// Add age-based match reasons
|
|
75
82
|
const ageScore = this.scoreAgeMatch(person, options);
|
|
76
83
|
if (ageScore > 0.8) {
|
|
77
|
-
const age = (0, helpers_1.calculateAgeSafe)(person.
|
|
84
|
+
const age = (0, helpers_1.calculateAgeSafe)(person.birthdate);
|
|
78
85
|
if (age !== null) {
|
|
79
86
|
if (options.agePreference === 'adults') {
|
|
80
87
|
reasons.push('adult age match');
|
|
@@ -100,11 +107,11 @@ class MatchScorer {
|
|
|
100
107
|
const personEmails = await this.peopleModule.getEmails(person.id);
|
|
101
108
|
const normalizedSearchEmail = (0, helpers_1.normalizeEmail)(email);
|
|
102
109
|
// Check if any of the person's emails match
|
|
103
|
-
const emails = personEmails.data?.map(e => (0, helpers_1.normalizeEmail)(e.
|
|
110
|
+
const emails = personEmails.data?.map(e => (0, helpers_1.normalizeEmail)(e.address || '')).filter(Boolean) || [];
|
|
104
111
|
return emails.includes(normalizedSearchEmail) ? 1.0 : 0.0;
|
|
105
112
|
}
|
|
106
113
|
catch (error) {
|
|
107
|
-
|
|
114
|
+
this.debugLog('scoring failed to verify email match', { personId: person.id, error: String(error) });
|
|
108
115
|
return 0.0;
|
|
109
116
|
}
|
|
110
117
|
}
|
|
@@ -115,11 +122,11 @@ class MatchScorer {
|
|
|
115
122
|
try {
|
|
116
123
|
const personPhones = await this.peopleModule.getPhoneNumbers(person.id);
|
|
117
124
|
const normalizedSearchPhone = (0, helpers_1.normalizePhone)(phone);
|
|
118
|
-
const phones = personPhones.data?.map(p => (0, helpers_1.normalizePhone)(p.
|
|
125
|
+
const phones = personPhones.data?.map(p => (0, helpers_1.normalizePhone)(p.number || '')).filter(Boolean) || [];
|
|
119
126
|
return phones.includes(normalizedSearchPhone) ? 1.0 : 0.0;
|
|
120
127
|
}
|
|
121
128
|
catch (error) {
|
|
122
|
-
|
|
129
|
+
this.debugLog('scoring failed to verify phone match', { personId: person.id, error: String(error) });
|
|
123
130
|
return 0.0;
|
|
124
131
|
}
|
|
125
132
|
}
|
|
@@ -127,18 +134,15 @@ class MatchScorer {
|
|
|
127
134
|
* Score name matching - only exact matches
|
|
128
135
|
*/
|
|
129
136
|
scoreNameMatch(person, options) {
|
|
130
|
-
const attrs = person.attributes;
|
|
131
|
-
if (!attrs)
|
|
132
|
-
return 0;
|
|
133
137
|
let score = 0;
|
|
134
138
|
// First name matching - exact match only
|
|
135
|
-
if (options.firstName &&
|
|
136
|
-
const firstNameMatch = options.firstName.toLowerCase() ===
|
|
139
|
+
if (options.firstName && person.first_name) {
|
|
140
|
+
const firstNameMatch = options.firstName.toLowerCase() === person.first_name.toLowerCase();
|
|
137
141
|
score += firstNameMatch ? 0.5 : 0;
|
|
138
142
|
}
|
|
139
143
|
// Last name matching - exact match only
|
|
140
|
-
if (options.lastName &&
|
|
141
|
-
const lastNameMatch = options.lastName.toLowerCase() ===
|
|
144
|
+
if (options.lastName && person.last_name) {
|
|
145
|
+
const lastNameMatch = options.lastName.toLowerCase() === person.last_name.toLowerCase();
|
|
142
146
|
score += lastNameMatch ? 0.5 : 0;
|
|
143
147
|
}
|
|
144
148
|
return score;
|
|
@@ -147,7 +151,7 @@ class MatchScorer {
|
|
|
147
151
|
* Score age matching
|
|
148
152
|
*/
|
|
149
153
|
scoreAgeMatch(person, options) {
|
|
150
|
-
const birthdate = person.
|
|
154
|
+
const birthdate = person.birthdate;
|
|
151
155
|
// If no age criteria specified, return neutral score
|
|
152
156
|
if (!options.agePreference &&
|
|
153
157
|
options.minAge === undefined &&
|
package/dist/modules/campus.d.ts
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type { PaginationOptions, PaginationResult } from '@rachelallyson/planning-center-base-ts';
|
|
6
|
-
import type { CampusResource, CampusAttributes, CampusesList } from '../types';
|
|
2
|
+
import type { CampusResource, CampusAttributes, Meta, TopLevelLinks } from '../types';
|
|
3
|
+
import type { ListWhereClause } from '../types/api-options';
|
|
4
|
+
import type { CampusListOptions, CampusPageOptions } from '../types/api-options';
|
|
7
5
|
/**
|
|
8
6
|
* Campus module for managing campus-related operations
|
|
9
7
|
*/
|
|
10
8
|
export declare class CampusModule extends BaseModule {
|
|
11
|
-
constructor(httpClient: PcoHttpClient, paginationHelper: PaginationHelper, eventEmitter: PcoEventEmitter);
|
|
12
9
|
/**
|
|
13
|
-
* Get all campuses
|
|
10
|
+
* Get all campuses across all pages
|
|
14
11
|
*/
|
|
15
|
-
getAll(params?:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
getAll(params?: CampusListOptions): Promise<import("@rachelallyson/planning-center-base-ts").PaginationResult<CampusResource, import("@rachelallyson/planning-center-base-ts").ResourceObject<string, any, any>, Record<string, never>>>;
|
|
13
|
+
/**
|
|
14
|
+
* Get a single page of campuses with optional filtering and pagination control
|
|
15
|
+
* Use this when you need a specific page or want to limit the number of results
|
|
16
|
+
* @param params - List parameters including where, include, perPage, page, and order
|
|
17
|
+
* @returns A single page of results with meta and links for pagination
|
|
18
|
+
*/
|
|
19
|
+
getPage(params?: CampusPageOptions): Promise<{
|
|
20
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Campus", CampusAttributes, import("../types").CampusRelationships, Record<string, never>>[];
|
|
21
|
+
meta?: Meta;
|
|
22
|
+
links?: TopLevelLinks;
|
|
23
|
+
}>;
|
|
21
24
|
/**
|
|
22
25
|
* Get a specific campus by ID
|
|
23
26
|
*/
|
|
24
|
-
getById(id: string, include?: string[]): Promise<
|
|
27
|
+
getById(id: string, include?: string[]): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Campus", CampusAttributes, import("../types").CampusRelationships>>;
|
|
25
28
|
/**
|
|
26
29
|
* Create a new campus
|
|
27
30
|
*/
|
|
28
|
-
create(data: CampusAttributes): Promise<
|
|
31
|
+
create(data: CampusAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Campus", CampusAttributes, import("../types").CampusRelationships>>;
|
|
29
32
|
/**
|
|
30
33
|
* Update an existing campus
|
|
31
34
|
*/
|
|
32
|
-
update(id: string, data: Partial<CampusAttributes>): Promise<
|
|
35
|
+
update(id: string, data: Partial<CampusAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Campus", CampusAttributes, import("../types").CampusRelationships>>;
|
|
33
36
|
/**
|
|
34
37
|
* Delete a campus
|
|
35
38
|
*/
|
|
@@ -38,34 +41,26 @@ export declare class CampusModule extends BaseModule {
|
|
|
38
41
|
* Get lists for a specific campus
|
|
39
42
|
*/
|
|
40
43
|
getLists(campusId: string, params?: {
|
|
41
|
-
where?:
|
|
44
|
+
where?: ListWhereClause;
|
|
42
45
|
include?: string[];
|
|
43
46
|
per_page?: number;
|
|
44
47
|
page?: number;
|
|
45
|
-
}): Promise<
|
|
48
|
+
}): Promise<{
|
|
49
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"List", import("../types").ListAttributes, {}, Record<string, never>>[];
|
|
50
|
+
meta?: Meta;
|
|
51
|
+
links?: TopLevelLinks;
|
|
52
|
+
}>;
|
|
46
53
|
/**
|
|
47
54
|
* Get service times for a specific campus
|
|
48
55
|
*/
|
|
49
56
|
getServiceTimes(campusId: string, params?: {
|
|
50
|
-
where?:
|
|
57
|
+
where?: never;
|
|
51
58
|
include?: string[];
|
|
52
59
|
per_page?: number;
|
|
53
60
|
page?: number;
|
|
54
|
-
}): Promise<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
where?: Record<string, any>;
|
|
60
|
-
include?: string[];
|
|
61
|
-
per_page?: number;
|
|
62
|
-
}): Promise<CampusResource[]>;
|
|
63
|
-
/**
|
|
64
|
-
* Get all campuses with pagination support
|
|
65
|
-
*/
|
|
66
|
-
getAllPagesPaginated(params?: {
|
|
67
|
-
where?: Record<string, any>;
|
|
68
|
-
include?: string[];
|
|
69
|
-
per_page?: number;
|
|
70
|
-
}, paginationOptions?: PaginationOptions): Promise<PaginationResult<CampusResource>>;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"ServiceTime", import("../types").ServiceTimeAttributes, import("../types").ServiceTimeRelationships, Record<string, never>>[];
|
|
63
|
+
meta?: Meta;
|
|
64
|
+
links?: TopLevelLinks;
|
|
65
|
+
}>;
|
|
71
66
|
}
|
package/dist/modules/campus.js
CHANGED
|
@@ -6,24 +6,38 @@ const planning_center_base_ts_1 = require("@rachelallyson/planning-center-base-t
|
|
|
6
6
|
* Campus module for managing campus-related operations
|
|
7
7
|
*/
|
|
8
8
|
class CampusModule extends planning_center_base_ts_1.BaseModule {
|
|
9
|
-
constructor(httpClient, paginationHelper, eventEmitter) {
|
|
10
|
-
super(httpClient, paginationHelper, eventEmitter);
|
|
11
|
-
}
|
|
12
9
|
/**
|
|
13
|
-
* Get all campuses
|
|
10
|
+
* Get all campuses across all pages
|
|
14
11
|
*/
|
|
15
12
|
async getAll(params) {
|
|
16
|
-
|
|
13
|
+
this.debugLog('campus.getAll', { params });
|
|
14
|
+
return this.getAllPages('/campuses', {
|
|
15
|
+
where: params?.where,
|
|
16
|
+
include: params?.include,
|
|
17
|
+
order: params?.order
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get a single page of campuses 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 params - List parameters including where, include, perPage, page, and order
|
|
24
|
+
* @returns A single page of results with meta and links for pagination
|
|
25
|
+
*/
|
|
26
|
+
async getPage(params) {
|
|
27
|
+
this.debugLog('campus.getPage', { params });
|
|
28
|
+
return this.getList('/campuses', {
|
|
29
|
+
where: params?.where,
|
|
30
|
+
include: params?.include,
|
|
31
|
+
per_page: params?.perPage,
|
|
32
|
+
page: params?.page,
|
|
33
|
+
order: params?.order
|
|
34
|
+
});
|
|
17
35
|
}
|
|
18
36
|
/**
|
|
19
37
|
* Get a specific campus by ID
|
|
20
38
|
*/
|
|
21
39
|
async getById(id, include) {
|
|
22
|
-
|
|
23
|
-
if (include) {
|
|
24
|
-
params.include = include.join(',');
|
|
25
|
-
}
|
|
26
|
-
return this.getSingle(`/campuses/${id}`, params);
|
|
40
|
+
return this.getSingle(`/campuses/${id}`, include);
|
|
27
41
|
}
|
|
28
42
|
/**
|
|
29
43
|
* Create a new campus
|
|
@@ -47,50 +61,23 @@ class CampusModule extends planning_center_base_ts_1.BaseModule {
|
|
|
47
61
|
* Get lists for a specific campus
|
|
48
62
|
*/
|
|
49
63
|
async getLists(campusId, params) {
|
|
50
|
-
|
|
64
|
+
this.debugLog('campus.getLists', { campusId, params });
|
|
65
|
+
return this.getList(`/campuses/${campusId}/lists`, {
|
|
66
|
+
where: params?.where,
|
|
67
|
+
include: params?.include,
|
|
68
|
+
per_page: params?.per_page,
|
|
69
|
+
page: params?.page
|
|
70
|
+
});
|
|
51
71
|
}
|
|
52
72
|
/**
|
|
53
73
|
* Get service times for a specific campus
|
|
54
74
|
*/
|
|
55
75
|
async getServiceTimes(campusId, params) {
|
|
56
|
-
return this.getList(`/campuses/${campusId}/service_times`,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
async getAllCampuses(params) {
|
|
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
|
-
const result = await super.getAllPages('/campuses', queryParams);
|
|
75
|
-
return result.data;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Get all campuses with pagination support
|
|
79
|
-
*/
|
|
80
|
-
async getAllPagesPaginated(params, paginationOptions) {
|
|
81
|
-
const queryParams = {};
|
|
82
|
-
if (params?.where) {
|
|
83
|
-
Object.entries(params.where).forEach(([key, value]) => {
|
|
84
|
-
queryParams[`where[${key}]`] = value;
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
if (params?.include) {
|
|
88
|
-
queryParams.include = params.include.join(',');
|
|
89
|
-
}
|
|
90
|
-
if (params?.per_page) {
|
|
91
|
-
queryParams.per_page = params.per_page;
|
|
92
|
-
}
|
|
93
|
-
return super.getAllPages('/campuses', queryParams, paginationOptions);
|
|
76
|
+
return this.getList(`/campuses/${campusId}/service_times`, {
|
|
77
|
+
include: params?.include,
|
|
78
|
+
per_page: params?.per_page,
|
|
79
|
+
page: params?.page
|
|
80
|
+
});
|
|
94
81
|
}
|
|
95
82
|
}
|
|
96
83
|
exports.CampusModule = CampusModule;
|
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
* v2.0.0 Contacts Module
|
|
3
3
|
*/
|
|
4
4
|
import { BaseModule } from '@rachelallyson/planning-center-base-ts';
|
|
5
|
-
import type {
|
|
5
|
+
import type { EmailAttributes, PhoneNumberAttributes, AddressAttributes, SocialProfileAttributes, Meta, TopLevelLinks } from '../types';
|
|
6
6
|
export declare class ContactsModule extends BaseModule {
|
|
7
7
|
/**
|
|
8
8
|
* Get all emails
|
|
9
9
|
*/
|
|
10
10
|
getAllEmails(): Promise<{
|
|
11
|
-
data:
|
|
12
|
-
meta?:
|
|
13
|
-
links?:
|
|
11
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Email", EmailAttributes, import("../types").EmailRelationships, Record<string, never>>[];
|
|
12
|
+
meta?: Meta;
|
|
13
|
+
links?: TopLevelLinks;
|
|
14
14
|
}>;
|
|
15
15
|
/**
|
|
16
16
|
* Get a single email by ID
|
|
17
17
|
*/
|
|
18
|
-
getEmailById(id: string): Promise<
|
|
18
|
+
getEmailById(id: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Email", EmailAttributes, import("../types").EmailRelationships>>;
|
|
19
19
|
/**
|
|
20
|
-
* Create an email
|
|
20
|
+
* Create an email for a person
|
|
21
|
+
* Note: Emails must be created via person-specific endpoint
|
|
21
22
|
*/
|
|
22
|
-
createEmail(data: EmailAttributes): Promise<
|
|
23
|
+
createEmail(personId: string, data: EmailAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Email", EmailAttributes, import("../types").EmailRelationships>>;
|
|
23
24
|
/**
|
|
24
25
|
* Update an email
|
|
25
26
|
*/
|
|
26
|
-
updateEmail(id: string, data: Partial<EmailAttributes>): Promise<
|
|
27
|
+
updateEmail(id: string, data: Partial<EmailAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Email", EmailAttributes, import("../types").EmailRelationships>>;
|
|
27
28
|
/**
|
|
28
29
|
* Delete an email
|
|
29
30
|
*/
|
|
@@ -32,22 +33,23 @@ export declare class ContactsModule extends BaseModule {
|
|
|
32
33
|
* Get all phone numbers
|
|
33
34
|
*/
|
|
34
35
|
getAllPhoneNumbers(): Promise<{
|
|
35
|
-
data:
|
|
36
|
-
meta?:
|
|
37
|
-
links?:
|
|
36
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"PhoneNumber", PhoneNumberAttributes, import("../types").PhoneNumberRelationships, Record<string, never>>[];
|
|
37
|
+
meta?: Meta;
|
|
38
|
+
links?: TopLevelLinks;
|
|
38
39
|
}>;
|
|
39
40
|
/**
|
|
40
41
|
* Get a single phone number by ID
|
|
41
42
|
*/
|
|
42
|
-
getPhoneNumberById(id: string): Promise<
|
|
43
|
+
getPhoneNumberById(id: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"PhoneNumber", PhoneNumberAttributes, import("../types").PhoneNumberRelationships>>;
|
|
43
44
|
/**
|
|
44
|
-
* Create a phone number
|
|
45
|
+
* Create a phone number for a person
|
|
46
|
+
* Note: Phone numbers must be created via person-specific endpoint
|
|
45
47
|
*/
|
|
46
|
-
createPhoneNumber(data: PhoneNumberAttributes): Promise<
|
|
48
|
+
createPhoneNumber(personId: string, data: PhoneNumberAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"PhoneNumber", PhoneNumberAttributes, import("../types").PhoneNumberRelationships>>;
|
|
47
49
|
/**
|
|
48
50
|
* Update a phone number
|
|
49
51
|
*/
|
|
50
|
-
updatePhoneNumber(id: string, data: Partial<PhoneNumberAttributes>): Promise<
|
|
52
|
+
updatePhoneNumber(id: string, data: Partial<PhoneNumberAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"PhoneNumber", PhoneNumberAttributes, import("../types").PhoneNumberRelationships>>;
|
|
51
53
|
/**
|
|
52
54
|
* Delete a phone number
|
|
53
55
|
*/
|
|
@@ -56,22 +58,23 @@ export declare class ContactsModule extends BaseModule {
|
|
|
56
58
|
* Get all addresses
|
|
57
59
|
*/
|
|
58
60
|
getAllAddresses(): Promise<{
|
|
59
|
-
data:
|
|
60
|
-
meta?:
|
|
61
|
-
links?:
|
|
61
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Address", AddressAttributes, import("../types").AddressRelationships, Record<string, never>>[];
|
|
62
|
+
meta?: Meta;
|
|
63
|
+
links?: TopLevelLinks;
|
|
62
64
|
}>;
|
|
63
65
|
/**
|
|
64
66
|
* Get a single address by ID
|
|
65
67
|
*/
|
|
66
|
-
getAddressById(id: string): Promise<
|
|
68
|
+
getAddressById(id: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Address", AddressAttributes, import("../types").AddressRelationships>>;
|
|
67
69
|
/**
|
|
68
|
-
* Create an address
|
|
70
|
+
* Create an address for a person
|
|
71
|
+
* Note: Addresses must be created via person-specific endpoint
|
|
69
72
|
*/
|
|
70
|
-
createAddress(data: AddressAttributes): Promise<
|
|
73
|
+
createAddress(personId: string, data: AddressAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Address", AddressAttributes, import("../types").AddressRelationships>>;
|
|
71
74
|
/**
|
|
72
75
|
* Update an address
|
|
73
76
|
*/
|
|
74
|
-
updateAddress(id: string, data: Partial<AddressAttributes>): Promise<
|
|
77
|
+
updateAddress(id: string, data: Partial<AddressAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"Address", AddressAttributes, import("../types").AddressRelationships>>;
|
|
75
78
|
/**
|
|
76
79
|
* Delete an address
|
|
77
80
|
*/
|
|
@@ -80,22 +83,23 @@ export declare class ContactsModule extends BaseModule {
|
|
|
80
83
|
* Get all social profiles
|
|
81
84
|
*/
|
|
82
85
|
getAllSocialProfiles(): Promise<{
|
|
83
|
-
data:
|
|
84
|
-
meta?:
|
|
85
|
-
links?:
|
|
86
|
+
data: import("@rachelallyson/planning-center-base-ts").FlattenedResource<"SocialProfile", SocialProfileAttributes, import("../types").SocialProfileRelationships, Record<string, never>>[];
|
|
87
|
+
meta?: Meta;
|
|
88
|
+
links?: TopLevelLinks;
|
|
86
89
|
}>;
|
|
87
90
|
/**
|
|
88
91
|
* Get a single social profile by ID
|
|
89
92
|
*/
|
|
90
|
-
getSocialProfileById(id: string): Promise<
|
|
93
|
+
getSocialProfileById(id: string): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"SocialProfile", SocialProfileAttributes, import("../types").SocialProfileRelationships>>;
|
|
91
94
|
/**
|
|
92
|
-
* Create a social profile
|
|
95
|
+
* Create a social profile for a person
|
|
96
|
+
* Note: Social profiles must be created via person-specific endpoint
|
|
93
97
|
*/
|
|
94
|
-
createSocialProfile(data: SocialProfileAttributes): Promise<
|
|
98
|
+
createSocialProfile(personId: string, data: SocialProfileAttributes): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"SocialProfile", SocialProfileAttributes, import("../types").SocialProfileRelationships>>;
|
|
95
99
|
/**
|
|
96
100
|
* Update a social profile
|
|
97
101
|
*/
|
|
98
|
-
updateSocialProfile(id: string, data: Partial<SocialProfileAttributes>): Promise<
|
|
102
|
+
updateSocialProfile(id: string, data: Partial<SocialProfileAttributes>): Promise<import("@rachelallyson/planning-center-base-ts").FlattenedResource<"SocialProfile", SocialProfileAttributes, import("../types").SocialProfileRelationships>>;
|
|
99
103
|
/**
|
|
100
104
|
* Delete a social profile
|
|
101
105
|
*/
|
package/dist/modules/contacts.js
CHANGED
|
@@ -10,120 +10,144 @@ class ContactsModule extends planning_center_base_ts_1.BaseModule {
|
|
|
10
10
|
* Get all emails
|
|
11
11
|
*/
|
|
12
12
|
async getAllEmails() {
|
|
13
|
+
this.debugLog('contacts.getAllEmails');
|
|
13
14
|
return this.getList('/emails');
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
16
17
|
* Get a single email by ID
|
|
17
18
|
*/
|
|
18
19
|
async getEmailById(id) {
|
|
20
|
+
this.debugLog('contacts.getEmailById', { id });
|
|
19
21
|
return this.getSingle(`/emails/${id}`);
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
|
-
* Create an email
|
|
24
|
+
* Create an email for a person
|
|
25
|
+
* Note: Emails must be created via person-specific endpoint
|
|
23
26
|
*/
|
|
24
|
-
async createEmail(data) {
|
|
25
|
-
|
|
27
|
+
async createEmail(personId, data) {
|
|
28
|
+
this.debugLog('contacts.createEmail', { personId, data });
|
|
29
|
+
return this.createResource(`/people/${personId}/emails`, data);
|
|
26
30
|
}
|
|
27
31
|
/**
|
|
28
32
|
* Update an email
|
|
29
33
|
*/
|
|
30
34
|
async updateEmail(id, data) {
|
|
35
|
+
this.debugLog('contacts.updateEmail', { id, data });
|
|
31
36
|
return this.updateResource(`/emails/${id}`, data);
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* Delete an email
|
|
35
40
|
*/
|
|
36
41
|
async deleteEmail(id) {
|
|
42
|
+
this.debugLog('contacts.deleteEmail', { id });
|
|
37
43
|
return this.deleteResource(`/emails/${id}`);
|
|
38
44
|
}
|
|
39
45
|
/**
|
|
40
46
|
* Get all phone numbers
|
|
41
47
|
*/
|
|
42
48
|
async getAllPhoneNumbers() {
|
|
49
|
+
this.debugLog('contacts.getAllPhoneNumbers');
|
|
43
50
|
return this.getList('/phone_numbers');
|
|
44
51
|
}
|
|
45
52
|
/**
|
|
46
53
|
* Get a single phone number by ID
|
|
47
54
|
*/
|
|
48
55
|
async getPhoneNumberById(id) {
|
|
56
|
+
this.debugLog('contacts.getPhoneNumberById', { id });
|
|
49
57
|
return this.getSingle(`/phone_numbers/${id}`);
|
|
50
58
|
}
|
|
51
59
|
/**
|
|
52
|
-
* Create a phone number
|
|
60
|
+
* Create a phone number for a person
|
|
61
|
+
* Note: Phone numbers must be created via person-specific endpoint
|
|
53
62
|
*/
|
|
54
|
-
async createPhoneNumber(data) {
|
|
55
|
-
|
|
63
|
+
async createPhoneNumber(personId, data) {
|
|
64
|
+
this.debugLog('contacts.createPhoneNumber', { personId, data });
|
|
65
|
+
return this.createResource(`/people/${personId}/phone_numbers`, data);
|
|
56
66
|
}
|
|
57
67
|
/**
|
|
58
68
|
* Update a phone number
|
|
59
69
|
*/
|
|
60
70
|
async updatePhoneNumber(id, data) {
|
|
71
|
+
this.debugLog('contacts.updatePhoneNumber', { id, data });
|
|
61
72
|
return this.updateResource(`/phone_numbers/${id}`, data);
|
|
62
73
|
}
|
|
63
74
|
/**
|
|
64
75
|
* Delete a phone number
|
|
65
76
|
*/
|
|
66
77
|
async deletePhoneNumber(id) {
|
|
78
|
+
this.debugLog('contacts.deletePhoneNumber', { id });
|
|
67
79
|
return this.deleteResource(`/phone_numbers/${id}`);
|
|
68
80
|
}
|
|
69
81
|
/**
|
|
70
82
|
* Get all addresses
|
|
71
83
|
*/
|
|
72
84
|
async getAllAddresses() {
|
|
85
|
+
this.debugLog('contacts.getAllAddresses');
|
|
73
86
|
return this.getList('/addresses');
|
|
74
87
|
}
|
|
75
88
|
/**
|
|
76
89
|
* Get a single address by ID
|
|
77
90
|
*/
|
|
78
91
|
async getAddressById(id) {
|
|
92
|
+
this.debugLog('contacts.getAddressById', { id });
|
|
79
93
|
return this.getSingle(`/addresses/${id}`);
|
|
80
94
|
}
|
|
81
95
|
/**
|
|
82
|
-
* Create an address
|
|
96
|
+
* Create an address for a person
|
|
97
|
+
* Note: Addresses must be created via person-specific endpoint
|
|
83
98
|
*/
|
|
84
|
-
async createAddress(data) {
|
|
85
|
-
|
|
99
|
+
async createAddress(personId, data) {
|
|
100
|
+
this.debugLog('contacts.createAddress', { personId, data });
|
|
101
|
+
return this.createResource(`/people/${personId}/addresses`, data);
|
|
86
102
|
}
|
|
87
103
|
/**
|
|
88
104
|
* Update an address
|
|
89
105
|
*/
|
|
90
106
|
async updateAddress(id, data) {
|
|
107
|
+
this.debugLog('contacts.updateAddress', { id, data });
|
|
91
108
|
return this.updateResource(`/addresses/${id}`, data);
|
|
92
109
|
}
|
|
93
110
|
/**
|
|
94
111
|
* Delete an address
|
|
95
112
|
*/
|
|
96
113
|
async deleteAddress(id) {
|
|
114
|
+
this.debugLog('contacts.deleteAddress', { id });
|
|
97
115
|
return this.deleteResource(`/addresses/${id}`);
|
|
98
116
|
}
|
|
99
117
|
/**
|
|
100
118
|
* Get all social profiles
|
|
101
119
|
*/
|
|
102
120
|
async getAllSocialProfiles() {
|
|
121
|
+
this.debugLog('contacts.getAllSocialProfiles');
|
|
103
122
|
return this.getList('/social_profiles');
|
|
104
123
|
}
|
|
105
124
|
/**
|
|
106
125
|
* Get a single social profile by ID
|
|
107
126
|
*/
|
|
108
127
|
async getSocialProfileById(id) {
|
|
128
|
+
this.debugLog('contacts.getSocialProfileById', { id });
|
|
109
129
|
return this.getSingle(`/social_profiles/${id}`);
|
|
110
130
|
}
|
|
111
131
|
/**
|
|
112
|
-
* Create a social profile
|
|
132
|
+
* Create a social profile for a person
|
|
133
|
+
* Note: Social profiles must be created via person-specific endpoint
|
|
113
134
|
*/
|
|
114
|
-
async createSocialProfile(data) {
|
|
115
|
-
|
|
135
|
+
async createSocialProfile(personId, data) {
|
|
136
|
+
this.debugLog('contacts.createSocialProfile', { personId, data });
|
|
137
|
+
return this.createResource(`/people/${personId}/social_profiles`, data);
|
|
116
138
|
}
|
|
117
139
|
/**
|
|
118
140
|
* Update a social profile
|
|
119
141
|
*/
|
|
120
142
|
async updateSocialProfile(id, data) {
|
|
143
|
+
this.debugLog('contacts.updateSocialProfile', { id, data });
|
|
121
144
|
return this.updateResource(`/social_profiles/${id}`, data);
|
|
122
145
|
}
|
|
123
146
|
/**
|
|
124
147
|
* Delete a social profile
|
|
125
148
|
*/
|
|
126
149
|
async deleteSocialProfile(id) {
|
|
150
|
+
this.debugLog('contacts.deleteSocialProfile', { id });
|
|
127
151
|
return this.deleteResource(`/social_profiles/${id}`);
|
|
128
152
|
}
|
|
129
153
|
}
|