intercom-client 3.0.0-2 → 3.1.1
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/README.md +317 -3
- package/dist/admin/admin.types.d.ts +4 -2
- package/dist/admin/admin.types.d.ts.map +1 -1
- package/dist/admin/admin.types.js.map +1 -1
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js.map +1 -1
- package/dist/article/article.types.d.ts +87 -0
- package/dist/article/article.types.d.ts.map +1 -0
- package/dist/article/article.types.js +45 -0
- package/dist/article/article.types.js.map +1 -0
- package/dist/article.d.ts +34 -0
- package/dist/article.d.ts.map +1 -0
- package/dist/article.js +69 -0
- package/dist/article.js.map +1 -0
- package/dist/client.d.ts +12 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -3
- package/dist/client.js.map +1 -1
- package/dist/common/common.types.d.ts +19 -41
- package/dist/common/common.types.d.ts.map +1 -1
- package/dist/common/common.types.js.map +1 -1
- package/dist/company/company.types.d.ts.map +1 -1
- package/dist/company/company.types.js.map +1 -1
- package/dist/company.d.ts +2 -6
- package/dist/company.d.ts.map +1 -1
- package/dist/company.js.map +1 -1
- package/dist/contact/contact.types.d.ts.map +1 -1
- package/dist/contact/contact.types.js.map +1 -1
- package/dist/contact.d.ts +4 -8
- package/dist/contact.d.ts.map +1 -1
- package/dist/contact.js.map +1 -1
- package/dist/conversation/conversation.types.d.ts.map +1 -1
- package/dist/conversation/conversation.types.js.map +1 -1
- package/dist/conversation.d.ts +6 -4
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js.map +1 -1
- package/dist/count/count.types.d.ts +89 -0
- package/dist/count/count.types.d.ts.map +1 -0
- package/dist/count/count.types.js +17 -0
- package/dist/count/count.types.js.map +1 -0
- package/dist/count.d.ts +18 -0
- package/dist/count.d.ts.map +1 -0
- package/dist/count.js +72 -0
- package/dist/count.js.map +1 -0
- package/dist/dataAttribute/dataAttribute.types.d.ts.map +1 -1
- package/dist/dataAttribute/dataAttribute.types.js.map +1 -1
- package/dist/dataAttribute.d.ts.map +1 -1
- package/dist/dataAttribute.js.map +1 -1
- package/dist/errors/badResponse.error.d.ts.map +1 -1
- package/dist/errors/badResponse.error.js.map +1 -1
- package/dist/event/event.types.d.ts.map +1 -1
- package/dist/event/event.types.js.map +1 -1
- package/dist/event.d.ts.map +1 -1
- package/dist/event.js.map +1 -1
- package/dist/helpCenter/helpCenter.types.d.ts +23 -0
- package/dist/helpCenter/helpCenter.types.d.ts.map +1 -0
- package/dist/helpCenter/helpCenter.types.js +3 -0
- package/dist/helpCenter/helpCenter.types.js.map +1 -0
- package/dist/helpCenter.d.ts +58 -0
- package/dist/helpCenter.d.ts.map +1 -0
- package/dist/helpCenter.js +121 -0
- package/dist/helpCenter.js.map +1 -0
- package/dist/index.d.ts +22 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -3
- package/dist/index.js.map +1 -1
- package/dist/message/message.types.d.ts.map +1 -1
- package/dist/message/message.types.js.map +1 -1
- package/dist/message.d.ts.map +1 -1
- package/dist/message.js.map +1 -1
- package/dist/note/note.types.d.ts +13 -0
- package/dist/note/note.types.d.ts.map +1 -0
- package/dist/note/note.types.js +3 -0
- package/dist/note/note.types.js.map +1 -0
- package/dist/note.d.ts +24 -0
- package/dist/note.d.ts.map +1 -0
- package/dist/note.js +40 -0
- package/dist/note.js.map +1 -0
- package/dist/package.json +59 -0
- package/dist/scroll.d.ts.map +1 -1
- package/dist/scroll.js.map +1 -1
- package/dist/segment/segment.types.d.ts.map +1 -1
- package/dist/segment/segment.types.js.map +1 -1
- package/dist/segment.d.ts.map +1 -1
- package/dist/segment.js.map +1 -1
- package/dist/subscription/subscription.types.d.ts.map +1 -1
- package/dist/subscription/subscription.types.js.map +1 -1
- package/dist/tag/tag.types.d.ts.map +1 -1
- package/dist/tag/tag.types.js.map +1 -1
- package/dist/tag.d.ts.map +1 -1
- package/dist/tag.js.map +1 -1
- package/dist/team/team.types.d.ts.map +1 -1
- package/dist/team/team.types.js.map +1 -1
- package/dist/team.d.ts.map +1 -1
- package/dist/team.js.map +1 -1
- package/dist/util/time.d.ts.map +1 -1
- package/dist/util/time.js.map +1 -1
- package/dist/util/url.d.ts.map +1 -1
- package/dist/util/url.js.map +1 -1
- package/dist/visitor/visitor.types.d.ts +20 -0
- package/dist/visitor/visitor.types.d.ts.map +1 -0
- package/dist/visitor/visitor.types.js +3 -0
- package/dist/visitor/visitor.types.js.map +1 -0
- package/dist/visitor.d.ts +50 -0
- package/dist/visitor.d.ts.map +1 -0
- package/dist/visitor.js +60 -0
- package/dist/visitor.js.map +1 -0
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
## Project Updates
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Breaking changes
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
The Node SDK has been updated to support latest API version (2.4). The update also contains requested features, such like Typescript support. You can find more information on how-to migrate and what has changed in the [migration guide](https://github.com/intercom/intercom-node/wiki/Migration-guide).
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ Current repository is a new WIP version of Node SDK, that supports latest API ve
|
|
|
19
19
|
yarn add intercom-client
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
**This client is intended for server side use only. Please use the [Intercom Javascript SDK](https://developers.intercom.com/
|
|
22
|
+
**This client is intended for server side use only. Please use the [Intercom Javascript SDK](https://developers.intercom.com/installing-intercom/docs/intercom-for-web) for client-side operations.**
|
|
23
23
|
|
|
24
24
|
## Testing
|
|
25
25
|
|
|
@@ -110,6 +110,76 @@ await client.admins.listAllActivityLogs({
|
|
|
110
110
|
const admins = await client.admins.list();
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
### Articles
|
|
114
|
+
|
|
115
|
+
#### [Create an article](https://developers.intercom.com/intercom-api-reference/reference/create-an-article)
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const article = await client.articles.create({
|
|
119
|
+
title: 'Thanks for everything',
|
|
120
|
+
description: 'English description',
|
|
121
|
+
body: '<p>This is the body in html</p>',
|
|
122
|
+
authorId: 1,
|
|
123
|
+
state: 'published',
|
|
124
|
+
parentId: 1,
|
|
125
|
+
parentType: 'collection',
|
|
126
|
+
translatedContent: {
|
|
127
|
+
fr: {
|
|
128
|
+
title: 'Allez les verts',
|
|
129
|
+
description: 'French description',
|
|
130
|
+
body: '<p>French body in html</p>',
|
|
131
|
+
author_id: 1,
|
|
132
|
+
state: 'published',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### [Retrieve an article](https://developers.intercom.com/intercom-api-reference/reference/retrieve-an-article)
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
const response = await client.articles.find({ id: '123' });
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### [Update an article](https://developers.intercom.com/intercom-api-reference/reference/update-an-article)
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
const article = await client.articles.update({
|
|
148
|
+
id: '123',
|
|
149
|
+
title: 'Thanks for everything',
|
|
150
|
+
description: 'English description',
|
|
151
|
+
body: '<p>This is the body in html</p>',
|
|
152
|
+
authorId: 1,
|
|
153
|
+
state: 'published',
|
|
154
|
+
parentId: 1,
|
|
155
|
+
parentType: 'collection',
|
|
156
|
+
translatedContent: {
|
|
157
|
+
fr: {
|
|
158
|
+
title: 'Allez les verts',
|
|
159
|
+
description: 'French description',
|
|
160
|
+
body: '<p>French body in html</p>',
|
|
161
|
+
author_id: 1,
|
|
162
|
+
state: 'published',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### [Delete an article](https://developers.intercom.com/intercom-api-reference/reference/delete-an-article)
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
await client.articles.delete({ id: '123' });
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### [List all articles](https://developers.intercom.com/intercom-api-reference/reference/list-all-articles)
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
const response = await client.articles.list({
|
|
178
|
+
page: 3,
|
|
179
|
+
perPage: 12,
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
113
183
|
### Companies
|
|
114
184
|
|
|
115
185
|
#### [Create a company](https://developers.intercom.com/intercom-api-reference/reference/create-or-update-company)
|
|
@@ -676,6 +746,62 @@ const response = await client.conversations.redactConversationPart({
|
|
|
676
746
|
});
|
|
677
747
|
```
|
|
678
748
|
|
|
749
|
+
### Counts
|
|
750
|
+
|
|
751
|
+
#### [App Total Count](https://developers.intercom.com/intercom-api-reference/reference/company-user-counts)
|
|
752
|
+
|
|
753
|
+
```typescript
|
|
754
|
+
const response = await client.counts.forApp();
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
#### [Conversation Count Model](https://developers.intercom.com/intercom-api-reference/reference/conversation-counts)
|
|
758
|
+
|
|
759
|
+
```typescript
|
|
760
|
+
const response = await client.counts.countConversation();
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
#### [Admin Conversation Count Model](https://developers.intercom.com/intercom-api-reference/reference/admin-conversations)
|
|
764
|
+
|
|
765
|
+
```typescript
|
|
766
|
+
const response = await client.counts.countAdminConversation();
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
#### [User Segment/Tag Count Model](https://developers.intercom.com/intercom-api-reference/reference/user-tag-counts)
|
|
770
|
+
|
|
771
|
+
##### Count User Segment
|
|
772
|
+
|
|
773
|
+
```typescript
|
|
774
|
+
const response = await client.counts.countUserSegment();
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
##### Count User Tag
|
|
778
|
+
|
|
779
|
+
```typescript
|
|
780
|
+
const response = await client.counts.countUserTag();
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
#### [Company User/Segment/Tag Count Model](https://developers.intercom.com/intercom-api-reference/reference/company-tag-counts)
|
|
784
|
+
|
|
785
|
+
##### Count Company Segment
|
|
786
|
+
|
|
787
|
+
```typescript
|
|
788
|
+
const response = await client.counts.countCompanySegment();
|
|
789
|
+
const response = await client.counts.countCompanyTag();
|
|
790
|
+
const response = await client.counts.countCompanyUser();
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
##### Count Company Tag
|
|
794
|
+
|
|
795
|
+
```typescript
|
|
796
|
+
const response = await client.counts.countCompanyTag();
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
##### Count Company User
|
|
800
|
+
|
|
801
|
+
```typescript
|
|
802
|
+
const response = await client.counts.countCompanyUser();
|
|
803
|
+
```
|
|
804
|
+
|
|
679
805
|
### Data Attributes
|
|
680
806
|
|
|
681
807
|
#### [Create Data Attribute](https://developers.intercom.com/intercom-api-reference/reference/create-data-attributes)
|
|
@@ -745,6 +871,118 @@ const response = await client.events.listBy({
|
|
|
745
871
|
});
|
|
746
872
|
```
|
|
747
873
|
|
|
874
|
+
### Help Center - Collections
|
|
875
|
+
|
|
876
|
+
#### [Create a collection](https://developers.intercom.com/intercom-api-reference/reference/create-a-collection)
|
|
877
|
+
|
|
878
|
+
```typescript
|
|
879
|
+
const collection = await client.helpCenter.collections.create({
|
|
880
|
+
name: 'Thanks for everything',
|
|
881
|
+
description: 'English description',
|
|
882
|
+
translatedContent: {
|
|
883
|
+
fr: {
|
|
884
|
+
name: 'Allez les verts',
|
|
885
|
+
description: 'French description',
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
});
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
#### [Retrieve a collection](https://developers.intercom.com/intercom-api-reference/reference/retrieve-a-collection)
|
|
892
|
+
|
|
893
|
+
```typescript
|
|
894
|
+
const response = await client.helpCenter.collections.find({ id: '123' });
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
#### [Update a collection](https://developers.intercom.com/intercom-api-reference/reference/update-a-collection)
|
|
898
|
+
|
|
899
|
+
```typescript
|
|
900
|
+
const article = await client.helpCenter.collections.update({
|
|
901
|
+
id: '123',
|
|
902
|
+
name: 'Thanks for everything',
|
|
903
|
+
description: 'English description',
|
|
904
|
+
translatedContent: {
|
|
905
|
+
fr: {
|
|
906
|
+
name: 'Allez les verts',
|
|
907
|
+
description: 'French description',
|
|
908
|
+
},
|
|
909
|
+
},
|
|
910
|
+
});
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
#### [Delete a collection](https://developers.intercom.com/intercom-api-reference/reference/delete-a-collection)
|
|
914
|
+
|
|
915
|
+
```typescript
|
|
916
|
+
await client.helpCenter.collections.delete({
|
|
917
|
+
id: '123',
|
|
918
|
+
});
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
#### [List all collections](https://developers.intercom.com/intercom-api-reference/reference/list-all-collections)
|
|
922
|
+
|
|
923
|
+
```typescript
|
|
924
|
+
const response = client.helpCenter.collections.list({
|
|
925
|
+
page: 3,
|
|
926
|
+
perPage: 12,
|
|
927
|
+
});
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
## Help Center - Sections
|
|
931
|
+
|
|
932
|
+
#### [Create a section](https://developers.intercom.com/intercom-api-reference/reference/create-a-section)
|
|
933
|
+
|
|
934
|
+
```typescript
|
|
935
|
+
const collection = await client.helpCenter.sections.create({
|
|
936
|
+
name: 'Thanks for everything',
|
|
937
|
+
parentId: '1234',
|
|
938
|
+
translatedContent: {
|
|
939
|
+
fr: {
|
|
940
|
+
name: 'Allez les verts',
|
|
941
|
+
description: 'French description',
|
|
942
|
+
},
|
|
943
|
+
},
|
|
944
|
+
});
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
#### [Retrieve a section](https://developers.intercom.com/intercom-api-reference/reference/retrieve-a-section)
|
|
948
|
+
|
|
949
|
+
```typescript
|
|
950
|
+
const response = await client.helpCenter.sections.find({ id: '123' });
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
#### [Update a section](https://developers.intercom.com/intercom-api-reference/reference/update-a-section)
|
|
954
|
+
|
|
955
|
+
```typescript
|
|
956
|
+
const article = await client.helpCenter.sections.update({
|
|
957
|
+
id: '123',
|
|
958
|
+
name: 'Thanks for everything',
|
|
959
|
+
parentId: '456',
|
|
960
|
+
translatedContent: {
|
|
961
|
+
fr: {
|
|
962
|
+
name: 'Allez les verts',
|
|
963
|
+
description: 'French description',
|
|
964
|
+
},
|
|
965
|
+
},
|
|
966
|
+
});
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
#### [Delete a section](https://developers.intercom.com/intercom-api-reference/reference/delete-a-section)
|
|
970
|
+
|
|
971
|
+
```typescript
|
|
972
|
+
await client.helpCenter.sections.delete({
|
|
973
|
+
id: '123',
|
|
974
|
+
});
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
#### [List all sections](https://developers.intercom.com/intercom-api-reference/reference/list-all-sections)
|
|
978
|
+
|
|
979
|
+
```typescript
|
|
980
|
+
const response = client.helpCenter.sections.list({
|
|
981
|
+
page: 3,
|
|
982
|
+
perPage: 12,
|
|
983
|
+
});
|
|
984
|
+
```
|
|
985
|
+
|
|
748
986
|
### Messages
|
|
749
987
|
|
|
750
988
|
#### [Create a message](https://developers.intercom.com/intercom-api-reference/reference/admin-initiated-conversation)
|
|
@@ -766,6 +1004,34 @@ const response = await client.messages.create({
|
|
|
766
1004
|
});
|
|
767
1005
|
```
|
|
768
1006
|
|
|
1007
|
+
### Notes
|
|
1008
|
+
|
|
1009
|
+
#### [Create a note](https://developers.intercom.com/intercom-api-reference/reference/create-note-for-contact)
|
|
1010
|
+
|
|
1011
|
+
```typescript
|
|
1012
|
+
const response = await client.notes.create({
|
|
1013
|
+
adminId: '12345',
|
|
1014
|
+
body: 'Shiny',
|
|
1015
|
+
contactId: '5678',
|
|
1016
|
+
});
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
#### [Retrieve a note](https://developers.intercom.com/intercom-api-reference/reference/view-a-note)
|
|
1020
|
+
|
|
1021
|
+
```typescript
|
|
1022
|
+
const response = await client.notes.find({ id: '123' });
|
|
1023
|
+
```
|
|
1024
|
+
|
|
1025
|
+
#### [List all notes](https://developers.intercom.com/intercom-api-reference/reference/list-notes-of-contact)
|
|
1026
|
+
|
|
1027
|
+
```typescript
|
|
1028
|
+
const response = await client.notes.list({
|
|
1029
|
+
contactId: '123',
|
|
1030
|
+
page: 2,
|
|
1031
|
+
perPage: 3,
|
|
1032
|
+
});
|
|
1033
|
+
```
|
|
1034
|
+
|
|
769
1035
|
### Segments
|
|
770
1036
|
|
|
771
1037
|
#### [Retrieve a segment](https://developers.intercom.com/intercom-api-reference/reference/view-a-segment)
|
|
@@ -885,6 +1151,54 @@ const response = await client.teams.find({
|
|
|
885
1151
|
const response = await client.teams.list();
|
|
886
1152
|
```
|
|
887
1153
|
|
|
1154
|
+
### Visitors
|
|
1155
|
+
|
|
1156
|
+
#### [Retrieve a Visitor](https://developers.intercom.com/intercom-api-reference/reference/view-a-visitor)
|
|
1157
|
+
|
|
1158
|
+
```typescript
|
|
1159
|
+
const response = await client.visitors.find({ id: '123' });
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
OR
|
|
1163
|
+
|
|
1164
|
+
```typescript
|
|
1165
|
+
const response = await client.visitors.find({ userId: '123' });
|
|
1166
|
+
```
|
|
1167
|
+
|
|
1168
|
+
#### [Update a Visitor](https://developers.intercom.com/intercom-api-reference/reference/update-a-visitor)
|
|
1169
|
+
|
|
1170
|
+
```typescript
|
|
1171
|
+
const response = await client.visitors.update({
|
|
1172
|
+
userId: '123',
|
|
1173
|
+
name: 'anonymous bruh',
|
|
1174
|
+
customAttributes: {
|
|
1175
|
+
paid_subscriber: true,
|
|
1176
|
+
},
|
|
1177
|
+
});
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1180
|
+
#### [Delete a Visitor](https://developers.intercom.com/intercom-api-reference/reference/delete-a-visitor)
|
|
1181
|
+
|
|
1182
|
+
```typescript
|
|
1183
|
+
const response = await client.visitors.delete({
|
|
1184
|
+
id,
|
|
1185
|
+
});
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
#### [Convert a Visitor](https://developers.intercom.com/intercom-api-reference/reference/convert-a-visitor-to-a-user)
|
|
1189
|
+
|
|
1190
|
+
```typescript
|
|
1191
|
+
const response = await client.visitors.mergeToContact({
|
|
1192
|
+
visitor: {
|
|
1193
|
+
id: '123',
|
|
1194
|
+
},
|
|
1195
|
+
user: {
|
|
1196
|
+
userId: '123',
|
|
1197
|
+
},
|
|
1198
|
+
type: Role.USER,
|
|
1199
|
+
});
|
|
1200
|
+
```
|
|
1201
|
+
|
|
888
1202
|
### Identity verification
|
|
889
1203
|
|
|
890
1204
|
`intercom-node` provides a helper for using [identity verification](https://docs.intercom.com/configure-intercom-for-your-product-or-site/staying-secure/enable-identity-verification-on-your-web-product):
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface AdminObject {
|
|
2
|
-
type:
|
|
2
|
+
type: 'admin';
|
|
3
3
|
id: string;
|
|
4
4
|
name: string;
|
|
5
5
|
email: string;
|
|
@@ -8,6 +8,8 @@ export interface AdminObject {
|
|
|
8
8
|
away_mode_reassign: boolean;
|
|
9
9
|
has_inbox_seat: boolean;
|
|
10
10
|
team_ids: Array<number>;
|
|
11
|
-
avatar: string
|
|
11
|
+
avatar: string | {
|
|
12
|
+
image_url: string;
|
|
13
|
+
};
|
|
12
14
|
}
|
|
13
15
|
//# sourceMappingURL=admin.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.types.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"admin.types.d.ts","sourceRoot":"","sources":["../../../lib/admin/admin.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,OAAO,CAAC;IAC5B,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"admin.types.js","sourceRoot":"","sources":["../../../lib/admin/admin.types.ts"],"names":[],"mappings":""}
|
package/dist/admin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../../lib/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,MAAM,CAAC,OAAO,OAAO,KAAK;IAGV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,SAAgB,OAAO,YAAY;gBAEN,MAAM,EAAE,MAAM;IAI3C,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,gBAAgB;IAG7B,IAAI,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,gBAAgB;IAWtE,mBAAmB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,uBAAuB;IAW9D,IAAI;CAGP;AAED,UAAU,gBAAgB;IACtB,EAAE,EAAE,MAAM,CAAC;CACd;AAED,UAAU,gBAAgB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,OAAO,CAAC;IACxB,kBAAkB,EAAE,OAAO,CAAC;CAC/B;AAED,UAAU,uBAAuB;IAC7B,KAAK,EAAE,IAAI,CAAC;IACZ,MAAM,CAAC,EAAE,IAAI,CAAC;CACjB;AAED,UAAU,2BAA2B;IACjC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,YAAY,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,UAAU,cAAc;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;IACnD,YAAY,EAAE,WAAW,CAAC;CAC7B;AAED,UAAU,KAAK;IACX,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,eAAe;IACrB,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,WAAW,EAAE,CAAC;CACzB"}
|
package/dist/admin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../../lib/admin.ts"],"names":[],"mappings":";;AAEA,oCAAkD;AAElD;IAGI,eAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;QAF3B,YAAO,GAAG,QAAQ,CAAC;QAG/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;IAED,oBAAI,GAAJ,UAAK,EAAwB;YAAtB,EAAE,QAAA;QACL,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAc,EAAE,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,cAAI,EAAE,CAAE,EAAE,CAAC,CAAC;IAC3E,CAAC;IACD,oBAAI,GAAJ,UAAK,EAAiE;YAA/D,OAAO,aAAA,EAAE,cAAc,oBAAA,EAAE,kBAAkB,wBAAA;QAC9C,IAAM,IAAI,GAAG;YACT,iBAAiB,EAAE,cAAc;YACjC,kBAAkB,EAAE,kBAAkB;SACzC,CAAC;QAEF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAc;YAChC,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,cAAI,OAAO,UAAO;YACvC,IAAI,MAAA;SACP,CAAC,CAAC;IACP,CAAC;IACD,mCAAmB,GAAnB,UAAoB,EAA0C;YAAxC,MAAM,YAAA,EAAE,KAAK,WAAA;QAC/B,IAAM,MAAM,GAAG;YACX,gBAAgB,EAAE,IAAA,0BAAmB,EAAC,KAAK,CAAC;YAC5C,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC,IAAA,0BAAmB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS;SACtE,CAAC;QAEF,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAA8B;YAChD,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,mBAAgB;YACrC,MAAM,QAAA;SACT,CAAC,CAAC;IACP,CAAC;IACD,oBAAI,GAAJ;QACI,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,EAAE,GAAG,EAAE,WAAI,IAAI,CAAC,OAAO,CAAE,EAAE,CAAC,CAAC;IACzE,CAAC;IACL,YAAC;AAAD,CAAC,AAnCD,IAmCC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Timestamp } from '../common/common.types';
|
|
2
|
+
export declare type ArticleObject = {
|
|
3
|
+
type: 'article';
|
|
4
|
+
id: string;
|
|
5
|
+
workspace_id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
body: string;
|
|
9
|
+
author_id: string;
|
|
10
|
+
state: string;
|
|
11
|
+
created_at: Timestamp;
|
|
12
|
+
updated_at: Timestamp;
|
|
13
|
+
url: string;
|
|
14
|
+
parent_id: string;
|
|
15
|
+
parent_type: string;
|
|
16
|
+
default_locale: string;
|
|
17
|
+
translated_content: TranslatedContentObject;
|
|
18
|
+
statistics: StatisticsObject;
|
|
19
|
+
};
|
|
20
|
+
export declare enum Locales {
|
|
21
|
+
ARABIC = "ar",
|
|
22
|
+
BULGARIAN = "bg",
|
|
23
|
+
BOSNIAN = "bs",
|
|
24
|
+
CATALAN = "ca",
|
|
25
|
+
CZECH = "cs",
|
|
26
|
+
DANISH = "da",
|
|
27
|
+
GERMAN = "de",
|
|
28
|
+
DE_FORM = "de-form",
|
|
29
|
+
GREEK = "el",
|
|
30
|
+
ENGLISH = "en",
|
|
31
|
+
SPANISH = "es",
|
|
32
|
+
ESTONIAN = "et",
|
|
33
|
+
FINNISH = "fi",
|
|
34
|
+
FRENCH = "fr",
|
|
35
|
+
HEBREW = "he",
|
|
36
|
+
CROATIAN = "hr",
|
|
37
|
+
HUNGARIAN = "hu",
|
|
38
|
+
INDONESIAN = "id",
|
|
39
|
+
ITALIAN = "it",
|
|
40
|
+
JAPANESE = "ja",
|
|
41
|
+
KOREAN = "ko",
|
|
42
|
+
LITHUANIAN = "lt",
|
|
43
|
+
LATVIAN = "lv",
|
|
44
|
+
MONGOLIAN = "mn",
|
|
45
|
+
NORWEGIAN = "nb",
|
|
46
|
+
DUTCH = "nl",
|
|
47
|
+
POLISH = "pl",
|
|
48
|
+
PORTUGUESE_BRAZIL = "pt-BR",
|
|
49
|
+
PORTUGUESE = "pt",
|
|
50
|
+
ROMANIAN = "ro",
|
|
51
|
+
RUSSIAN = "ru",
|
|
52
|
+
SLOVENIAN = "sl",
|
|
53
|
+
SERBIAN = "sr",
|
|
54
|
+
SWEDISH = "sv",
|
|
55
|
+
TURKISH = "tr",
|
|
56
|
+
VIETNAMESE = "vi",
|
|
57
|
+
CHINESE_S = "zh-CN",
|
|
58
|
+
CHINESE_T = "zh-TW"
|
|
59
|
+
}
|
|
60
|
+
export interface ContentObject {
|
|
61
|
+
type?: 'article_content';
|
|
62
|
+
title: string;
|
|
63
|
+
description: string;
|
|
64
|
+
body: string;
|
|
65
|
+
author?: string;
|
|
66
|
+
author_id?: number;
|
|
67
|
+
state: string;
|
|
68
|
+
created_at?: Timestamp;
|
|
69
|
+
updated_at?: Timestamp;
|
|
70
|
+
url?: string;
|
|
71
|
+
}
|
|
72
|
+
export declare type ArticleLocalesMapping = {
|
|
73
|
+
[key in Locales]: ContentObject;
|
|
74
|
+
};
|
|
75
|
+
export declare type TranslatedContentObject = {
|
|
76
|
+
type: 'article_translated_content';
|
|
77
|
+
} & Partial<ArticleLocalesMapping>;
|
|
78
|
+
export declare type StatisticsObject = {
|
|
79
|
+
type: 'article_statistics';
|
|
80
|
+
views: number;
|
|
81
|
+
conversations: number;
|
|
82
|
+
reactions: number;
|
|
83
|
+
happy_reaction_percentage: number;
|
|
84
|
+
neutral_reaction_percentage: number;
|
|
85
|
+
sad_reaction_percentage: number;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=article.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article.types.d.ts","sourceRoot":"","sources":["../../../lib/article/article.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,oBAAY,aAAa,GAAG;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,SAAS,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;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CAClC,CAAC;AAEF,oBAAY,uBAAuB,GAAG;IAClC,IAAI,EAAE,4BAA4B,CAAC;CACtC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAEnC,oBAAY,gBAAgB,GAAG;IAC3B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,yBAAyB,EAAE,MAAM,CAAC;IAClC,2BAA2B,EAAE,MAAM,CAAC;IACpC,uBAAuB,EAAE,MAAM,CAAC;CACnC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Locales = void 0;
|
|
4
|
+
var Locales;
|
|
5
|
+
(function (Locales) {
|
|
6
|
+
Locales["ARABIC"] = "ar";
|
|
7
|
+
Locales["BULGARIAN"] = "bg";
|
|
8
|
+
Locales["BOSNIAN"] = "bs";
|
|
9
|
+
Locales["CATALAN"] = "ca";
|
|
10
|
+
Locales["CZECH"] = "cs";
|
|
11
|
+
Locales["DANISH"] = "da";
|
|
12
|
+
Locales["GERMAN"] = "de";
|
|
13
|
+
Locales["DE_FORM"] = "de-form";
|
|
14
|
+
Locales["GREEK"] = "el";
|
|
15
|
+
Locales["ENGLISH"] = "en";
|
|
16
|
+
Locales["SPANISH"] = "es";
|
|
17
|
+
Locales["ESTONIAN"] = "et";
|
|
18
|
+
Locales["FINNISH"] = "fi";
|
|
19
|
+
Locales["FRENCH"] = "fr";
|
|
20
|
+
Locales["HEBREW"] = "he";
|
|
21
|
+
Locales["CROATIAN"] = "hr";
|
|
22
|
+
Locales["HUNGARIAN"] = "hu";
|
|
23
|
+
Locales["INDONESIAN"] = "id";
|
|
24
|
+
Locales["ITALIAN"] = "it";
|
|
25
|
+
Locales["JAPANESE"] = "ja";
|
|
26
|
+
Locales["KOREAN"] = "ko";
|
|
27
|
+
Locales["LITHUANIAN"] = "lt";
|
|
28
|
+
Locales["LATVIAN"] = "lv";
|
|
29
|
+
Locales["MONGOLIAN"] = "mn";
|
|
30
|
+
Locales["NORWEGIAN"] = "nb";
|
|
31
|
+
Locales["DUTCH"] = "nl";
|
|
32
|
+
Locales["POLISH"] = "pl";
|
|
33
|
+
Locales["PORTUGUESE_BRAZIL"] = "pt-BR";
|
|
34
|
+
Locales["PORTUGUESE"] = "pt";
|
|
35
|
+
Locales["ROMANIAN"] = "ro";
|
|
36
|
+
Locales["RUSSIAN"] = "ru";
|
|
37
|
+
Locales["SLOVENIAN"] = "sl";
|
|
38
|
+
Locales["SERBIAN"] = "sr";
|
|
39
|
+
Locales["SWEDISH"] = "sv";
|
|
40
|
+
Locales["TURKISH"] = "tr";
|
|
41
|
+
Locales["VIETNAMESE"] = "vi";
|
|
42
|
+
Locales["CHINESE_S"] = "zh-CN";
|
|
43
|
+
Locales["CHINESE_T"] = "zh-TW";
|
|
44
|
+
})(Locales = exports.Locales || (exports.Locales = {}));
|
|
45
|
+
//# sourceMappingURL=article.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article.types.js","sourceRoot":"","sources":["../../../lib/article/article.types.ts"],"names":[],"mappings":";;;AAqBA,IAAY,OAuCX;AAvCD,WAAY,OAAO;IACf,wBAAa,CAAA;IACb,2BAAgB,CAAA;IAChB,yBAAc,CAAA;IACd,yBAAc,CAAA;IACd,uBAAY,CAAA;IACZ,wBAAa,CAAA;IACb,wBAAa,CAAA;IACb,8BAAmB,CAAA;IACnB,uBAAY,CAAA;IACZ,yBAAc,CAAA;IACd,yBAAc,CAAA;IACd,0BAAe,CAAA;IACf,yBAAc,CAAA;IACd,wBAAa,CAAA;IACb,wBAAa,CAAA;IACb,0BAAe,CAAA;IACf,2BAAgB,CAAA;IAChB,4BAAiB,CAAA;IACjB,yBAAc,CAAA;IACd,0BAAe,CAAA;IACf,wBAAa,CAAA;IACb,4BAAiB,CAAA;IACjB,yBAAc,CAAA;IACd,2BAAgB,CAAA;IAChB,2BAAgB,CAAA;IAChB,uBAAY,CAAA;IACZ,wBAAa,CAAA;IACb,sCAA2B,CAAA;IAC3B,4BAAiB,CAAA;IACjB,0BAAe,CAAA;IACf,yBAAc,CAAA;IACd,2BAAgB,CAAA;IAChB,yBAAc,CAAA;IACd,yBAAc,CAAA;IACd,yBAAc,CAAA;IACd,4BAAiB,CAAA;IACjB,8BAAmB,CAAA;IACnB,8BAAmB,CAAA;AACvB,CAAC,EAvCW,OAAO,GAAP,eAAO,KAAP,eAAO,QAuClB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Client } from '.';
|
|
2
|
+
import { ArticleObject, TranslatedContentObject } from './article/article.types';
|
|
3
|
+
import { GenericDeletedResponse, OperationById, Paginated } from './common/common.types';
|
|
4
|
+
export default class Article {
|
|
5
|
+
private readonly client;
|
|
6
|
+
readonly baseUrl = "articles";
|
|
7
|
+
constructor(client: Client);
|
|
8
|
+
create({ title, description, body, authorId, state, parentId, parentType, translatedContent, }: CreateArticleData): Promise<ArticleObject>;
|
|
9
|
+
find({ id }: ArticleFindByIdData): Promise<ArticleObject>;
|
|
10
|
+
update({ id, title, description, body, authorId, state, parentId, parentType, translatedContent, }: UpdateArticleData): Promise<ArticleObject>;
|
|
11
|
+
delete({ id }: ArticleDeleteByIdData): Promise<ArticleDeleteByIdResponse>;
|
|
12
|
+
list({ page, perPage: per_page }: ArticleListData): Promise<ArticleListResponse>;
|
|
13
|
+
}
|
|
14
|
+
interface CreateArticleData {
|
|
15
|
+
title: string;
|
|
16
|
+
authorId: number;
|
|
17
|
+
description?: string;
|
|
18
|
+
body?: string;
|
|
19
|
+
state?: string;
|
|
20
|
+
parentId?: number;
|
|
21
|
+
parentType?: string;
|
|
22
|
+
translatedContent?: Omit<TranslatedContentObject, 'type'>;
|
|
23
|
+
}
|
|
24
|
+
declare type ArticleFindByIdData = OperationById;
|
|
25
|
+
declare type UpdateArticleData = Partial<CreateArticleData> & OperationById;
|
|
26
|
+
declare type ArticleDeleteByIdData = OperationById;
|
|
27
|
+
declare type ArticleDeleteByIdResponse = GenericDeletedResponse<'article'>;
|
|
28
|
+
declare type ArticleListData = {
|
|
29
|
+
page?: number;
|
|
30
|
+
perPage?: number;
|
|
31
|
+
};
|
|
32
|
+
declare type ArticleListResponse = Paginated<ArticleObject>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=article.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"article.d.ts","sourceRoot":"","sources":["../../lib/article.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AAC3B,OAAO,EACH,aAAa,EACb,uBAAuB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,sBAAsB,EACtB,aAAa,EACb,SAAS,EACZ,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,OAAO,OAAO,OAAO;IAGZ,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,SAAgB,OAAO,cAAc;gBAER,MAAM,EAAE,MAAM;IAI3C,MAAM,CAAC,EACH,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,iBAAiB,GACpB,EAAE,iBAAiB;IAiBpB,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,mBAAmB;IAKhC,MAAM,CAAC,EACH,EAAE,EACF,KAAK,EACL,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,iBAAiB,GACpB,EAAE,iBAAiB;IAiBpB,MAAM,CAAC,EAAE,EAAE,EAAE,EAAE,qBAAqB;IAKpC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,eAAe;CAWpD;AAED,UAAU,iBAAiB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;CAC7D;AAED,aAAK,mBAAmB,GAAG,aAAa,CAAC;AAEzC,aAAK,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC,GAAG,aAAa,CAAC;AAEpE,aAAK,qBAAqB,GAAG,aAAa,CAAC;AAE3C,aAAK,yBAAyB,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;AAEnE,aAAK,eAAe,GAAG;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,aAAK,mBAAmB,GAAG,SAAS,CAAC,aAAa,CAAC,CAAC"}
|
package/dist/article.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var Article = /** @class */ (function () {
|
|
4
|
+
function Article(client) {
|
|
5
|
+
this.client = client;
|
|
6
|
+
this.baseUrl = 'articles';
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
Article.prototype.create = function (_a) {
|
|
10
|
+
var title = _a.title, description = _a.description, body = _a.body, authorId = _a.authorId, state = _a.state, parentId = _a.parentId, parentType = _a.parentType, translatedContent = _a.translatedContent;
|
|
11
|
+
var data = {
|
|
12
|
+
title: title,
|
|
13
|
+
description: description,
|
|
14
|
+
body: body,
|
|
15
|
+
author_id: authorId,
|
|
16
|
+
state: state,
|
|
17
|
+
parent_id: parentId,
|
|
18
|
+
parent_type: parentType,
|
|
19
|
+
translated_content: translatedContent,
|
|
20
|
+
};
|
|
21
|
+
return this.client.post({
|
|
22
|
+
url: "/".concat(this.baseUrl),
|
|
23
|
+
data: data,
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
Article.prototype.find = function (_a) {
|
|
27
|
+
var id = _a.id;
|
|
28
|
+
return this.client.get({
|
|
29
|
+
url: "/".concat(this.baseUrl, "/").concat(id),
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
Article.prototype.update = function (_a) {
|
|
33
|
+
var id = _a.id, title = _a.title, description = _a.description, body = _a.body, authorId = _a.authorId, state = _a.state, parentId = _a.parentId, parentType = _a.parentType, translatedContent = _a.translatedContent;
|
|
34
|
+
var data = {
|
|
35
|
+
title: title,
|
|
36
|
+
description: description,
|
|
37
|
+
body: body,
|
|
38
|
+
author_id: authorId,
|
|
39
|
+
state: state,
|
|
40
|
+
parent_id: parentId,
|
|
41
|
+
parent_type: parentType,
|
|
42
|
+
translated_content: translatedContent,
|
|
43
|
+
};
|
|
44
|
+
return this.client.put({
|
|
45
|
+
url: "/".concat(this.baseUrl, "/").concat(id),
|
|
46
|
+
data: data,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
Article.prototype.delete = function (_a) {
|
|
50
|
+
var id = _a.id;
|
|
51
|
+
return this.client.delete({
|
|
52
|
+
url: "/".concat(this.baseUrl, "/").concat(id),
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
Article.prototype.list = function (_a) {
|
|
56
|
+
var page = _a.page, per_page = _a.perPage;
|
|
57
|
+
var params = {
|
|
58
|
+
page: page,
|
|
59
|
+
per_page: per_page,
|
|
60
|
+
};
|
|
61
|
+
return this.client.get({
|
|
62
|
+
url: "/".concat(this.baseUrl),
|
|
63
|
+
params: params,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return Article;
|
|
67
|
+
}());
|
|
68
|
+
exports.default = Article;
|
|
69
|
+
//# sourceMappingURL=article.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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