@activepieces/piece-ghostcms 0.1.4 → 0.1.6
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/package.json +7 -24
- package/src/index.js +56 -72
- package/README.md +0 -7
- package/src/index.d.ts +0 -8
- package/src/index.js.map +0 -1
- package/src/lib/actions/create-member.d.ts +0 -15
- package/src/lib/actions/create-member.js +0 -60
- package/src/lib/actions/create-member.js.map +0 -1
- package/src/lib/actions/create-post.d.ts +0 -20
- package/src/lib/actions/create-post.js +0 -84
- package/src/lib/actions/create-post.js.map +0 -1
- package/src/lib/actions/find-member.d.ts +0 -6
- package/src/lib/actions/find-member.js +0 -36
- package/src/lib/actions/find-member.js.map +0 -1
- package/src/lib/actions/find-user.d.ts +0 -6
- package/src/lib/actions/find-user.js +0 -36
- package/src/lib/actions/find-user.js.map +0 -1
- package/src/lib/actions/update-member.d.ts +0 -22
- package/src/lib/actions/update-member.js +0 -63
- package/src/lib/actions/update-member.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -33
- package/src/lib/common/index.js +0 -203
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/triggers/member-added.d.ts +0 -14
- package/src/lib/triggers/member-added.js +0 -101
- package/src/lib/triggers/member-added.js.map +0 -1
- package/src/lib/triggers/member-deleted.d.ts +0 -14
- package/src/lib/triggers/member-deleted.js +0 -101
- package/src/lib/triggers/member-deleted.js.map +0 -1
- package/src/lib/triggers/member-edited.d.ts +0 -14
- package/src/lib/triggers/member-edited.js +0 -106
- package/src/lib/triggers/member-edited.js.map +0 -1
- package/src/lib/triggers/page-published.d.ts +0 -14
- package/src/lib/triggers/page-published.js +0 -208
- package/src/lib/triggers/page-published.js.map +0 -1
- package/src/lib/triggers/post-published.d.ts +0 -14
- package/src/lib/triggers/post-published.js +0 -209
- package/src/lib/triggers/post-published.js.map +0 -1
- package/src/lib/triggers/post-scheduled.d.ts +0 -14
- package/src/lib/triggers/post-scheduled.js +0 -209
- package/src/lib/triggers/post-scheduled.js.map +0 -1
package/README.md
DELETED
package/src/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare const ghostAuth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>;
|
|
5
|
-
export declare const ghostcms: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>>;
|
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/ghostcms/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AAExC,+DAAwE;AACxE,iDAAqD;AACrD,+DAA2D;AAC3D,2DAAuD;AACvD,2DAAuD;AACvD,uDAAmD;AACnD,+DAA2D;AAC3D,yCAAsC;AACtC,8DAA0D;AAC1D,kEAA8D;AAC9D,gEAA4D;AAC5D,kEAA8D;AAC9D,kEAA8D;AAC9D,kEAA8D;AAE9D,MAAM,YAAY,GAAG;;;;;;CAMpB,CAAC;AAEW,QAAA,SAAS,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC5C,WAAW,EAAE,YAAY;IACzB,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE;QACL,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,WAAW,EACT,qEAAqE;YACvE,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,MAAM,EAAE,4BAAS,CAAC,UAAU,CAAC;YAC3B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,wCAAwC;YACrD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;CACF,CAAC,CAAC;AAEU,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAClC,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,+CAA+C;IAE5D,IAAI,EAAE,iBAAS;IACf,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE,CAAC,sBAAa,CAAC,SAAS,CAAC;IACrC,OAAO,EAAE,CAAC,YAAY,EAAC,WAAW,EAAC,UAAU,CAAC;IAC9C,OAAO,EAAE;QACP,4BAAY;QACZ,4BAAY;QACZ,wBAAU;QACV,wBAAU;QACV,oBAAQ;QACR,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,CAAA,IAAI,CAAC,CAAC;gBACtB,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,EAAE;YAC9C,IAAI,EAAE,iBAAS;YACf,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,SAAS,eAAM,CAAC,aAAa,CAC1C,IAAI,CAAC,KAAK,CAAC,MAAM,CAClB,EAAE;iBACJ,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE;QACR,0BAAW;QACX,4BAAY;QACZ,8BAAa;QACb,8BAAa;QACb,8BAAa;QACb,8BAAa;KACd;CACF,CAAC,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const createMember: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
note: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
-
newsletters: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>>;
|
|
15
|
-
}>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMember = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.createMember = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'create_member',
|
|
11
|
-
displayName: 'Create Member',
|
|
12
|
-
description: 'Create a new member',
|
|
13
|
-
auth: __1.ghostAuth,
|
|
14
|
-
props: {
|
|
15
|
-
email: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Email',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
name: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'Full Name',
|
|
21
|
-
required: false,
|
|
22
|
-
}),
|
|
23
|
-
note: pieces_framework_1.Property.ShortText({
|
|
24
|
-
displayName: 'Note',
|
|
25
|
-
required: false,
|
|
26
|
-
}),
|
|
27
|
-
newsletters: common_1.common.properties.newsletters(false),
|
|
28
|
-
},
|
|
29
|
-
run(context) {
|
|
30
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const newsletters = [];
|
|
32
|
-
if (context.propsValue.newsletters) {
|
|
33
|
-
context.propsValue.newsletters.forEach((newsletter) => {
|
|
34
|
-
newsletters.push({
|
|
35
|
-
id: newsletter,
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
40
|
-
url: `${context.auth.props.baseUrl}/ghost/api/admin/members`,
|
|
41
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
42
|
-
headers: {
|
|
43
|
-
Authorization: `Ghost ${common_1.common.jwtFromApiKey(context.auth.props.apiKey)}`,
|
|
44
|
-
},
|
|
45
|
-
body: {
|
|
46
|
-
members: [
|
|
47
|
-
{
|
|
48
|
-
email: context.propsValue.email,
|
|
49
|
-
name: context.propsValue.name,
|
|
50
|
-
note: context.propsValue.note,
|
|
51
|
-
newsletters: newsletters,
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
return response.body;
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
});
|
|
60
|
-
//# sourceMappingURL=create-member.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-member.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/ghostcms/src/lib/actions/create-member.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,qBAAqB;IAClC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB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CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export declare const createPost: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
slug: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
-
status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
8
|
-
publishedAt: import("@activepieces/pieces-framework").DateTimeProperty<false>;
|
|
9
|
-
html: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
10
|
-
customExcerpt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
-
author: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>>;
|
|
15
|
-
featured: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
16
|
-
tags: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
17
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
18
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
-
}>>;
|
|
20
|
-
}>;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPost = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.createPost = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'create_post',
|
|
11
|
-
displayName: 'Create Post',
|
|
12
|
-
description: 'Create a new post',
|
|
13
|
-
auth: __1.ghostAuth,
|
|
14
|
-
props: {
|
|
15
|
-
title: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Title',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
slug: pieces_framework_1.Property.ShortText({
|
|
20
|
-
displayName: 'Slug',
|
|
21
|
-
required: false,
|
|
22
|
-
}),
|
|
23
|
-
status: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
-
displayName: 'Status',
|
|
25
|
-
required: true,
|
|
26
|
-
options: {
|
|
27
|
-
options: [
|
|
28
|
-
{ label: 'Draft', value: 'draft' },
|
|
29
|
-
{ label: 'Published', value: 'published' },
|
|
30
|
-
{ label: 'Scheduled', value: 'scheduled' },
|
|
31
|
-
],
|
|
32
|
-
},
|
|
33
|
-
}),
|
|
34
|
-
publishedAt: pieces_framework_1.Property.DateTime({
|
|
35
|
-
displayName: 'Published At',
|
|
36
|
-
required: false,
|
|
37
|
-
}),
|
|
38
|
-
html: pieces_framework_1.Property.LongText({
|
|
39
|
-
displayName: 'Content (HTML)',
|
|
40
|
-
required: true,
|
|
41
|
-
}),
|
|
42
|
-
customExcerpt: pieces_framework_1.Property.ShortText({
|
|
43
|
-
displayName: 'Custom Excerpt',
|
|
44
|
-
required: false,
|
|
45
|
-
}),
|
|
46
|
-
author: common_1.common.properties.author,
|
|
47
|
-
featured: pieces_framework_1.Property.Checkbox({
|
|
48
|
-
displayName: 'Featured',
|
|
49
|
-
required: false,
|
|
50
|
-
}),
|
|
51
|
-
tags: common_1.common.properties.tags,
|
|
52
|
-
},
|
|
53
|
-
run(context) {
|
|
54
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
55
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
56
|
-
url: `${context.auth.props.baseUrl}/ghost/api/admin/posts`,
|
|
57
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
58
|
-
headers: {
|
|
59
|
-
Authorization: `Ghost ${common_1.common.jwtFromApiKey(context.auth.props.apiKey)}`,
|
|
60
|
-
},
|
|
61
|
-
body: {
|
|
62
|
-
posts: [
|
|
63
|
-
{
|
|
64
|
-
title: context.propsValue.title,
|
|
65
|
-
slug: context.propsValue.slug,
|
|
66
|
-
status: context.propsValue.status,
|
|
67
|
-
html: context.propsValue.html,
|
|
68
|
-
published_at: context.propsValue.publishedAt,
|
|
69
|
-
authors: [context.propsValue.author],
|
|
70
|
-
featured: context.propsValue.featured,
|
|
71
|
-
custom_excerpt: context.propsValue.customExcerpt,
|
|
72
|
-
tags: context.propsValue.tags,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
queryParams: {
|
|
77
|
-
source: 'html',
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
return response.body;
|
|
81
|
-
});
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
//# sourceMappingURL=create-post.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-post.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/ghostcms/src/lib/actions/create-post.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,IAAI,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OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;iBAC1E;gBACD,IAAI,EAAE;oBACJ,KAAK,EAAE;wBACL;4BACE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;4BAC/B,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;4BAC7B,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;4BACjC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;4BAC7B,YAAY,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;4BAC5C,OAAO,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;4BACpC,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,QAAQ;4BACrC,cAAc,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;4BAChD,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,IAAI;yBAC9B;qBACF;iBACF;gBACD,WAAW,EAAE;oBACX,MAAM,EAAE,MAAM;iBACf;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const findMember: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
}>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findMember = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.findMember = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'find_member',
|
|
11
|
-
displayName: 'Find Member',
|
|
12
|
-
description: 'Find a member by email',
|
|
13
|
-
auth: __1.ghostAuth,
|
|
14
|
-
props: {
|
|
15
|
-
email: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Email',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
run(context) {
|
|
21
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
23
|
-
url: `${context.auth.props.baseUrl}/ghost/api/admin/members`,
|
|
24
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
25
|
-
headers: {
|
|
26
|
-
Authorization: `Ghost ${common_1.common.jwtFromApiKey(context.auth.props.apiKey)}`,
|
|
27
|
-
},
|
|
28
|
-
queryParams: {
|
|
29
|
-
filter: `email:${context.propsValue.email}`,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
return response.body;
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=find-member.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-member.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/ghostcms/src/lib/actions/find-member.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,UAAU,GAAG,IAAA,+BAAY,EAAC;IACrC,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,wBAAwB;IACrC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG,CAAC,OAAO;;YACf,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,0BAA0B;gBAC5D,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;iBAC1E;gBACD,WAAW,EAAE;oBACX,MAAM,EAAE,SAAS,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE;iBAC5C;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const findUser: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
6
|
-
}>;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findUser = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.findUser = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'find_user',
|
|
11
|
-
displayName: 'Find User',
|
|
12
|
-
description: 'Find a staff user by email',
|
|
13
|
-
auth: __1.ghostAuth,
|
|
14
|
-
props: {
|
|
15
|
-
email: pieces_framework_1.Property.ShortText({
|
|
16
|
-
displayName: 'Email',
|
|
17
|
-
required: true,
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
run(context) {
|
|
21
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
22
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
23
|
-
url: `${context.auth.props.baseUrl}/ghost/api/admin/users`,
|
|
24
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
25
|
-
headers: {
|
|
26
|
-
Authorization: `Ghost ${common_1.common.jwtFromApiKey(context.auth.props.apiKey)}`,
|
|
27
|
-
},
|
|
28
|
-
queryParams: {
|
|
29
|
-
filter: `email:${context.propsValue.email}`,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
return response.body;
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=find-user.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-user.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/ghostcms/src/lib/actions/find-user.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,QAAQ,GAAG,IAAA,+BAAY,EAAC;IACnC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,4BAA4B;IACzC,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IAEK,GAAG,CAAC,OAAO;;YACf,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC5C,GAAG,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,wBAAwB;gBAC1D,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;iBAC1E;gBACD,WAAW,EAAE;oBACX,MAAM,EAAE,SAAS,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE;iBAC5C;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const updateMember: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
4
|
-
}>, {
|
|
5
|
-
member: import("@activepieces/pieces-framework").DropdownProperty<any, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
8
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<any, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
9
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>>;
|
|
12
|
-
email: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
-
note: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
15
|
-
newsletters: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
16
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
17
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
18
|
-
}>> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
19
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
20
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
21
|
-
}>>;
|
|
22
|
-
}>;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateMember = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
const common_1 = require("../common");
|
|
9
|
-
exports.updateMember = (0, pieces_framework_1.createAction)({
|
|
10
|
-
name: 'update_member',
|
|
11
|
-
displayName: 'Update Member',
|
|
12
|
-
description: 'Update a member',
|
|
13
|
-
auth: __1.ghostAuth,
|
|
14
|
-
props: {
|
|
15
|
-
member: common_1.common.properties.member(),
|
|
16
|
-
email: pieces_framework_1.Property.ShortText({
|
|
17
|
-
displayName: 'Email',
|
|
18
|
-
required: false,
|
|
19
|
-
}),
|
|
20
|
-
name: pieces_framework_1.Property.ShortText({
|
|
21
|
-
displayName: 'Full Name',
|
|
22
|
-
required: false,
|
|
23
|
-
}),
|
|
24
|
-
note: pieces_framework_1.Property.ShortText({
|
|
25
|
-
displayName: 'Note',
|
|
26
|
-
required: false,
|
|
27
|
-
}),
|
|
28
|
-
newsletters: common_1.common.properties.newsletters(false),
|
|
29
|
-
},
|
|
30
|
-
run(context) {
|
|
31
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const newsletters = [];
|
|
33
|
-
if (context.propsValue.newsletters) {
|
|
34
|
-
context.propsValue.newsletters.forEach((newsletter) => {
|
|
35
|
-
newsletters.push({
|
|
36
|
-
id: newsletter,
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
const data = {};
|
|
41
|
-
if (context.propsValue.email)
|
|
42
|
-
data.email = context.propsValue.email;
|
|
43
|
-
if (context.propsValue.name)
|
|
44
|
-
data.name = context.propsValue.name;
|
|
45
|
-
if (context.propsValue.note)
|
|
46
|
-
data.note = context.propsValue.note;
|
|
47
|
-
if (context.propsValue.newsletters)
|
|
48
|
-
data.newsletters = context.propsValue.newsletters;
|
|
49
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
50
|
-
url: `${context.auth.props.baseUrl}/ghost/api/admin/members/${context.propsValue.member}`,
|
|
51
|
-
method: pieces_common_1.HttpMethod.PUT,
|
|
52
|
-
headers: {
|
|
53
|
-
Authorization: `Ghost ${common_1.common.jwtFromApiKey(context.auth.props.apiKey)}`,
|
|
54
|
-
},
|
|
55
|
-
body: {
|
|
56
|
-
members: [data],
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
return response.body;
|
|
60
|
-
});
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
//# sourceMappingURL=update-member.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-member.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/ghostcms/src/lib/actions/update-member.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAqE;AAErE,6BAAkC;AAClC,sCAAmC;AAEtB,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,iBAAiB;IAC9B,IAAI,EAAE,aAAS;IACf,KAAK,EAAE;QACL,MAAM,EAAE,eAAM,CAAC,UAAU,CAAC,MAAM,EAAE;QAClC,KAAK,EAAE,2B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CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,4BAA4B,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;gBACzF,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,eAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;iBAC1E;gBACD,IAAI,EAAE;oBACJ,OAAO,EAAE,CAAC,IAAI,CAAC;iBAChB;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;QACvB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare const common: {
|
|
2
|
-
properties: {
|
|
3
|
-
newsletters: (required?: boolean) => import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
4
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<any, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
-
}>>;
|
|
10
|
-
member: (required?: boolean) => import("@activepieces/pieces-framework").DropdownProperty<any, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
-
}>> | import("@activepieces/pieces-framework").DropdownProperty<any, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
14
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
16
|
-
}>>;
|
|
17
|
-
author: import("@activepieces/pieces-framework").DropdownProperty<unknown, true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
18
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
19
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
20
|
-
}>>;
|
|
21
|
-
tags: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<unknown, false, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
22
|
-
baseUrl: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
23
|
-
apiKey: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
24
|
-
}>>;
|
|
25
|
-
};
|
|
26
|
-
jwtFromApiKey: (apiKey: string) => string;
|
|
27
|
-
subscribeWebhook(auth: any, webhookType: string, webhookUrl: string): Promise<any>;
|
|
28
|
-
unsubscribeWebhook(auth: any, webhookId: string): Promise<any>;
|
|
29
|
-
getNewsletters(auth: any): Promise<any>;
|
|
30
|
-
getMembers(auth: any): Promise<any>;
|
|
31
|
-
getUsers(auth: any): Promise<any>;
|
|
32
|
-
getTags(auth: any): Promise<any>;
|
|
33
|
-
};
|
package/src/lib/common/index.js
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.common = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
6
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
-
const jsonwebtoken_1 = tslib_1.__importDefault(require("jsonwebtoken"));
|
|
8
|
-
const __1 = require("../..");
|
|
9
|
-
exports.common = {
|
|
10
|
-
properties: {
|
|
11
|
-
newsletters: (required = true) => {
|
|
12
|
-
return pieces_framework_1.Property.MultiSelectDropdown({
|
|
13
|
-
auth: __1.ghostAuth,
|
|
14
|
-
displayName: 'Newsletters',
|
|
15
|
-
required: required,
|
|
16
|
-
refreshers: [],
|
|
17
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
18
|
-
if (!auth) {
|
|
19
|
-
return {
|
|
20
|
-
disabled: true,
|
|
21
|
-
placeholder: 'Connect your account',
|
|
22
|
-
options: [],
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const newsletters = (yield exports.common.getNewsletters(auth)).newsletters.map((newsletter) => {
|
|
26
|
-
return {
|
|
27
|
-
label: newsletter.name,
|
|
28
|
-
value: newsletter.id,
|
|
29
|
-
};
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
options: newsletters,
|
|
33
|
-
};
|
|
34
|
-
}),
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
member: (required = true) => {
|
|
38
|
-
return pieces_framework_1.Property.Dropdown({
|
|
39
|
-
auth: __1.ghostAuth,
|
|
40
|
-
displayName: 'Member',
|
|
41
|
-
required: required,
|
|
42
|
-
refreshers: [],
|
|
43
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
44
|
-
if (!auth) {
|
|
45
|
-
return {
|
|
46
|
-
disabled: true,
|
|
47
|
-
placeholder: 'Connect your account',
|
|
48
|
-
options: [],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const members = (yield exports.common.getMembers(auth)).members.map((member) => {
|
|
52
|
-
var _a;
|
|
53
|
-
return {
|
|
54
|
-
label: (_a = member.name) !== null && _a !== void 0 ? _a : member.email,
|
|
55
|
-
value: member.id,
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
options: members,
|
|
60
|
-
};
|
|
61
|
-
}),
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
author: pieces_framework_1.Property.Dropdown({
|
|
65
|
-
auth: __1.ghostAuth,
|
|
66
|
-
displayName: 'Author',
|
|
67
|
-
required: true,
|
|
68
|
-
refreshers: [],
|
|
69
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
70
|
-
if (!auth) {
|
|
71
|
-
return {
|
|
72
|
-
disabled: true,
|
|
73
|
-
placeholder: 'Connect your account',
|
|
74
|
-
options: [],
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
const authors = (yield exports.common.getUsers(auth)).users.map((user) => {
|
|
78
|
-
var _a;
|
|
79
|
-
return {
|
|
80
|
-
label: (_a = user.name) !== null && _a !== void 0 ? _a : user.email,
|
|
81
|
-
value: user.email,
|
|
82
|
-
};
|
|
83
|
-
});
|
|
84
|
-
return {
|
|
85
|
-
options: authors,
|
|
86
|
-
};
|
|
87
|
-
}),
|
|
88
|
-
}),
|
|
89
|
-
tags: pieces_framework_1.Property.MultiSelectDropdown({
|
|
90
|
-
auth: __1.ghostAuth,
|
|
91
|
-
displayName: 'Tags',
|
|
92
|
-
required: false,
|
|
93
|
-
refreshers: [],
|
|
94
|
-
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
95
|
-
if (!auth) {
|
|
96
|
-
return {
|
|
97
|
-
disabled: true,
|
|
98
|
-
placeholder: 'Connect your account',
|
|
99
|
-
options: [],
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const tags = (yield exports.common.getTags(auth)).tags.map((tag) => {
|
|
103
|
-
return {
|
|
104
|
-
label: tag.name,
|
|
105
|
-
value: tag.name,
|
|
106
|
-
};
|
|
107
|
-
});
|
|
108
|
-
return {
|
|
109
|
-
options: tags,
|
|
110
|
-
};
|
|
111
|
-
}),
|
|
112
|
-
}),
|
|
113
|
-
},
|
|
114
|
-
jwtFromApiKey: (apiKey) => {
|
|
115
|
-
const [id, secret] = apiKey.split(':');
|
|
116
|
-
return jsonwebtoken_1.default.sign({}, Buffer.from(secret, 'hex'), {
|
|
117
|
-
keyid: id,
|
|
118
|
-
expiresIn: '5m',
|
|
119
|
-
audience: '/admin/',
|
|
120
|
-
});
|
|
121
|
-
},
|
|
122
|
-
subscribeWebhook(auth, webhookType, webhookUrl) {
|
|
123
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
125
|
-
url: `${auth.baseUrl}/ghost/api/admin/webhooks`,
|
|
126
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
127
|
-
headers: {
|
|
128
|
-
Authorization: `Ghost ${exports.common.jwtFromApiKey(auth.apiKey)}`,
|
|
129
|
-
},
|
|
130
|
-
body: {
|
|
131
|
-
webhooks: [
|
|
132
|
-
{
|
|
133
|
-
target_url: webhookUrl,
|
|
134
|
-
event: webhookType,
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
return response.body;
|
|
140
|
-
});
|
|
141
|
-
},
|
|
142
|
-
unsubscribeWebhook(auth, webhookId) {
|
|
143
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
145
|
-
url: `${auth.baseUrl}/ghost/api/admin/webhooks/${webhookId}`,
|
|
146
|
-
method: pieces_common_1.HttpMethod.DELETE,
|
|
147
|
-
headers: {
|
|
148
|
-
Authorization: `Ghost ${exports.common.jwtFromApiKey(auth.apiKey)}`,
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
return response.body;
|
|
152
|
-
});
|
|
153
|
-
},
|
|
154
|
-
getNewsletters(auth) {
|
|
155
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
157
|
-
url: `${auth.baseUrl}/ghost/api/admin/newsletters`,
|
|
158
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
159
|
-
headers: {
|
|
160
|
-
Authorization: `Ghost ${exports.common.jwtFromApiKey(auth.apiKey)}`,
|
|
161
|
-
},
|
|
162
|
-
});
|
|
163
|
-
return response.body;
|
|
164
|
-
});
|
|
165
|
-
},
|
|
166
|
-
getMembers(auth) {
|
|
167
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
169
|
-
url: `${auth.baseUrl}/ghost/api/admin/members`,
|
|
170
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
171
|
-
headers: {
|
|
172
|
-
Authorization: `Ghost ${exports.common.jwtFromApiKey(auth.apiKey)}`,
|
|
173
|
-
},
|
|
174
|
-
});
|
|
175
|
-
return response.body;
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
getUsers(auth) {
|
|
179
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
180
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
181
|
-
url: `${auth.baseUrl}/ghost/api/admin/users`,
|
|
182
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
183
|
-
headers: {
|
|
184
|
-
Authorization: `Ghost ${exports.common.jwtFromApiKey(auth.apiKey)}`,
|
|
185
|
-
},
|
|
186
|
-
});
|
|
187
|
-
return response.body;
|
|
188
|
-
});
|
|
189
|
-
},
|
|
190
|
-
getTags(auth) {
|
|
191
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
192
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
193
|
-
url: `${auth.baseUrl}/ghost/api/admin/tags`,
|
|
194
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
195
|
-
headers: {
|
|
196
|
-
Authorization: `Ghost ${exports.common.jwtFromApiKey(auth.apiKey)}`,
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
return response.body;
|
|
200
|
-
});
|
|
201
|
-
},
|
|
202
|
-
};
|
|
203
|
-
//# sourceMappingURL=index.js.map
|