useresponse 0.0.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +9 -4
  2. package/dist/Endpoints.d.ts +74 -0
  3. package/dist/Endpoints.js +173 -0
  4. package/dist/UseResponse.d.ts +11 -0
  5. package/dist/UseResponse.js +38 -0
  6. package/dist/api/AdditionalAPI.d.ts +8 -0
  7. package/dist/api/AdditionalAPI.js +33 -0
  8. package/dist/api/AuthAPI.d.ts +7 -0
  9. package/dist/api/AuthAPI.js +26 -0
  10. package/dist/api/CategoriesAPI.d.ts +13 -0
  11. package/dist/api/CategoriesAPI.js +33 -0
  12. package/dist/api/ChangelogAPI.d.ts +8 -0
  13. package/dist/api/ChangelogAPI.js +33 -0
  14. package/dist/api/ChatsAPI.d.ts +13 -0
  15. package/dist/api/ChatsAPI.js +40 -0
  16. package/dist/api/CommentsAPI.d.ts +14 -0
  17. package/dist/api/CommentsAPI.js +75 -0
  18. package/dist/api/CustomFieldsAPI.d.ts +8 -0
  19. package/dist/api/CustomFieldsAPI.js +33 -0
  20. package/dist/api/ModerationAPI.d.ts +10 -0
  21. package/dist/api/ModerationAPI.js +47 -0
  22. package/dist/api/ObjectsAPI.d.ts +19 -0
  23. package/dist/api/ObjectsAPI.js +110 -0
  24. package/dist/api/ReportsAPI.d.ts +8 -0
  25. package/dist/api/ReportsAPI.js +33 -0
  26. package/dist/api/UserNotesAPI.d.ts +10 -0
  27. package/dist/api/UserNotesAPI.js +47 -0
  28. package/dist/api/UsersAPI.d.ts +16 -0
  29. package/dist/api/UsersAPI.js +89 -0
  30. package/dist/api/index.d.ts +12 -0
  31. package/dist/api/index.js +28 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +18 -0
  34. package/dist/interfaces/API.d.ts +15 -0
  35. package/dist/interfaces/API.js +2 -0
  36. package/dist/interfaces/ClientOptions.d.ts +4 -0
  37. package/dist/interfaces/ClientOptions.js +2 -0
  38. package/dist/interfaces/UseResponseInterfaces.d.ts +723 -0
  39. package/dist/interfaces/UseResponseInterfaces.js +2 -0
  40. package/dist/interfaces/index.d.ts +3 -0
  41. package/dist/interfaces/index.js +19 -0
  42. package/package.json +16 -9
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # useresponse [![npm version](https://img.shields.io/npm/v/useresponse.svg)](https://www.npmjs.com/package/useresponse)
2
2
 
3
- A [useresponse](https://useresponse) API client. For a documentation on the API see [https://api.useresponse.com](https://api.useresponse.com).
3
+ A [useresponse](https://www.useresponse.com/) API client. For a documentation on the API see [https://api.useresponse.com](https://api.useresponse.com).
4
4
 
5
5
  ### Installation
6
6
 
@@ -15,16 +15,21 @@ A complete documentation is available at https://ffflorian.github.io/api-clients
15
15
  ```ts
16
16
  import {UseResponse} from 'useresponse';
17
17
 
18
- const useResponse = new UseResponse();
18
+ const useResponse = new UseResponse({apiKey: 'your-api-key'});
19
19
 
20
20
  useResponse
21
- .api.search.searchPackage('useresponse')
21
+ .api.objects.addObject({
22
+ content: 'How do I reset my password?',
23
+ object_type: 'ticket',
24
+ ownership: 'helpdesk',
25
+ title: 'Password reset help',
26
+ })
22
27
  .then(data => {
23
28
  ...
24
29
  });
25
30
 
26
31
  useResponse
27
- .api.search.getSuggestions('useresponse')
32
+ .api.comments.getComments()
28
33
  .then(data => {
29
34
  ...
30
35
  });
@@ -0,0 +1,74 @@
1
+ export declare const Endpoint: {
2
+ Additional: {
3
+ forums(): string;
4
+ statuses(): string;
5
+ };
6
+ Auth: {
7
+ login(): string;
8
+ };
9
+ Categories: {
10
+ categoryById(id: string): string;
11
+ listOfCategories(): string;
12
+ };
13
+ Changelog: {
14
+ objects(id: string): string;
15
+ users(id: string): string;
16
+ };
17
+ Chats: {
18
+ chat(id: string): string;
19
+ chats(): string;
20
+ messages(chatId: string): string;
21
+ };
22
+ Comments: {
23
+ comments(): string;
24
+ editComment(commentId: string): string;
25
+ objectComments(objectId: string): string;
26
+ recoveryComment(commentId: string): string;
27
+ toggleBestComment(commentId: string): string;
28
+ toggleVoteComment(commentId: string): string;
29
+ trashComment(commentId: string): string;
30
+ };
31
+ CustomFields: {
32
+ objectCustomFields(): string;
33
+ userCustomFields(): string;
34
+ };
35
+ Moderation: {
36
+ approveComment(commentId: string): string;
37
+ approveTopic(topicId: string): string;
38
+ declineComment(commentId: string): string;
39
+ declineTopic(topicId: string): string;
40
+ };
41
+ Objects: {
42
+ archive(id: string): string;
43
+ attachFile(id: string): string;
44
+ commentsToggle(id: string): string;
45
+ object(id: string): string;
46
+ objects(): string;
47
+ search(): string;
48
+ subscribe(id: string): string;
49
+ tickets(): string;
50
+ toggleVote(id: string): string;
51
+ trash(id: string): string;
52
+ unsubscribe(id: string): string;
53
+ };
54
+ Reports: {
55
+ reportObjects(reportId: string): string;
56
+ reportsList(): string;
57
+ };
58
+ UserNotes: {
59
+ add(userId: string): string;
60
+ delete(noteId: string): string;
61
+ edit(noteId: string): string;
62
+ notes(userId: string): string;
63
+ };
64
+ Users: {
65
+ activity(userId: string): string;
66
+ banUser(userId: string): string;
67
+ changePassword(userId: string): string;
68
+ me(): string;
69
+ searchUsers(): string;
70
+ updateProfile(): string;
71
+ user(id: string): string;
72
+ users(): string;
73
+ };
74
+ };
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Endpoint = void 0;
4
+ exports.Endpoint = {
5
+ Additional: {
6
+ forums() {
7
+ return '/forums.json';
8
+ },
9
+ statuses() {
10
+ return '/statuses.json';
11
+ },
12
+ },
13
+ Auth: {
14
+ login() {
15
+ return '/auth/login.json';
16
+ },
17
+ },
18
+ Categories: {
19
+ categoryById(id) {
20
+ return `/categories/${id}.json`;
21
+ },
22
+ listOfCategories() {
23
+ return '/categories.json';
24
+ },
25
+ },
26
+ Changelog: {
27
+ objects(id) {
28
+ return `/changelog/object/${id}.json`;
29
+ },
30
+ users(id) {
31
+ return `/changelog/user/${id}.json`;
32
+ },
33
+ },
34
+ Chats: {
35
+ chat(id) {
36
+ return `/chats/${id}.json`;
37
+ },
38
+ chats() {
39
+ return '/chats.json';
40
+ },
41
+ messages(chatId) {
42
+ return `/chats/${chatId}/messages.json`;
43
+ },
44
+ },
45
+ Comments: {
46
+ comments() {
47
+ return '/comments.json';
48
+ },
49
+ editComment(commentId) {
50
+ return `/comments/${commentId}/edit.json`;
51
+ },
52
+ objectComments(objectId) {
53
+ return `/objects/${objectId}/comments.json`;
54
+ },
55
+ recoveryComment(commentId) {
56
+ return `/comments/${commentId}/recovery.json`;
57
+ },
58
+ toggleBestComment(commentId) {
59
+ return `/comments/${commentId}/best/toggle.json`;
60
+ },
61
+ toggleVoteComment(commentId) {
62
+ return `/comments/${commentId}/votes/toggle.json`;
63
+ },
64
+ trashComment(commentId) {
65
+ return `/comments/${commentId}/trash.json`;
66
+ },
67
+ },
68
+ CustomFields: {
69
+ objectCustomFields() {
70
+ return '/objects/custom-fields/list.json';
71
+ },
72
+ userCustomFields() {
73
+ return '/users/custom-fields/list.json';
74
+ },
75
+ },
76
+ Moderation: {
77
+ approveComment(commentId) {
78
+ return `/comment/${commentId}/approve.json`;
79
+ },
80
+ approveTopic(topicId) {
81
+ return `/topic/${topicId}/approve.json`;
82
+ },
83
+ declineComment(commentId) {
84
+ return `/comment/${commentId}/decline.json`;
85
+ },
86
+ declineTopic(topicId) {
87
+ return `/topic/${topicId}/decline.json`;
88
+ },
89
+ },
90
+ Objects: {
91
+ archive(id) {
92
+ return `/objects/${id}/archive.json`;
93
+ },
94
+ attachFile(id) {
95
+ return `/objects/${id}/attach-file.json`;
96
+ },
97
+ commentsToggle(id) {
98
+ return `/objects/${id}/comments/toggle.json`;
99
+ },
100
+ object(id) {
101
+ return `/objects/${id}.json`;
102
+ },
103
+ objects() {
104
+ return '/objects.json';
105
+ },
106
+ search() {
107
+ return '/search.json';
108
+ },
109
+ subscribe(id) {
110
+ return `/objects/${id}/subscribe.json`;
111
+ },
112
+ tickets() {
113
+ return '/tickets.json';
114
+ },
115
+ toggleVote(id) {
116
+ return `/objects/${id}/votes/toggle.json`;
117
+ },
118
+ trash(id) {
119
+ return `/objects/${id}/trash.json`;
120
+ },
121
+ unsubscribe(id) {
122
+ return `/objects/${id}/unsubscribe.json`;
123
+ },
124
+ },
125
+ Reports: {
126
+ reportObjects(reportId) {
127
+ return `/report/${reportId}/objects.json`;
128
+ },
129
+ reportsList() {
130
+ return '/reports/list.json';
131
+ },
132
+ },
133
+ UserNotes: {
134
+ add(userId) {
135
+ return `/users/${userId}/notes/add.json`;
136
+ },
137
+ delete(noteId) {
138
+ return `/users/notes/${noteId}/delete.json`;
139
+ },
140
+ edit(noteId) {
141
+ return `/users/notes/${noteId}/edit.json`;
142
+ },
143
+ notes(userId) {
144
+ return `/users/${userId}/notes.json`;
145
+ },
146
+ },
147
+ Users: {
148
+ activity(userId) {
149
+ return `/users/${userId}/activity.json`;
150
+ },
151
+ banUser(userId) {
152
+ return `/users/${userId}/ban.json`;
153
+ },
154
+ changePassword(userId) {
155
+ return `/users/${userId}/change-password.json`;
156
+ },
157
+ me() {
158
+ return '/me.json';
159
+ },
160
+ searchUsers() {
161
+ return '/users/search.json';
162
+ },
163
+ updateProfile() {
164
+ return '/profile/update.json';
165
+ },
166
+ user(id) {
167
+ return `/users/${id}.json`;
168
+ },
169
+ users() {
170
+ return '/users.json';
171
+ },
172
+ },
173
+ };
@@ -0,0 +1,11 @@
1
+ import type { API, ClientOptions } from './interfaces';
2
+ export declare class UseResponse {
3
+ readonly api: API;
4
+ private readonly apiClient;
5
+ constructor(options: ClientOptions);
6
+ /**
7
+ * Set a new API URL.
8
+ * @param newURL The new API url
9
+ */
10
+ setApiUrl(newURL: string): void;
11
+ }
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UseResponse = void 0;
4
+ const api_client_1 = require("@ffflorian/api-client");
5
+ const api_1 = require("./api");
6
+ class UseResponse {
7
+ constructor(options) {
8
+ this.apiClient = new api_client_1.APIClient(options.apiUrl || 'https://api.useresponse.com/api/7.0');
9
+ this.apiClient.interceptors.request.push(config => {
10
+ if (options.apiKey) {
11
+ config.url.searchParams.set('api_key', options.apiKey);
12
+ }
13
+ return config;
14
+ });
15
+ this.api = {
16
+ additional: new api_1.AdditionalAPI(this.apiClient),
17
+ auth: new api_1.AuthAPI(this.apiClient),
18
+ categories: new api_1.CategoriesAPI(this.apiClient),
19
+ changelog: new api_1.ChangelogAPI(this.apiClient),
20
+ chats: new api_1.ChatsAPI(this.apiClient),
21
+ comments: new api_1.CommentsAPI(this.apiClient),
22
+ customFields: new api_1.CustomFieldsAPI(this.apiClient),
23
+ moderation: new api_1.ModerationAPI(this.apiClient),
24
+ objects: new api_1.ObjectsAPI(this.apiClient),
25
+ reports: new api_1.ReportsAPI(this.apiClient),
26
+ userNotes: new api_1.UserNotesAPI(this.apiClient),
27
+ users: new api_1.UsersAPI(this.apiClient),
28
+ };
29
+ }
30
+ /**
31
+ * Set a new API URL.
32
+ * @param newURL The new API url
33
+ */
34
+ setApiUrl(newURL) {
35
+ this.apiClient.setBaseURL(newURL);
36
+ }
37
+ }
38
+ exports.UseResponse = UseResponse;
@@ -0,0 +1,8 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { Forum, Status } from '../interfaces';
3
+ export declare class AdditionalAPI {
4
+ private readonly apiClient;
5
+ constructor(apiClient: APIClient);
6
+ getForums(): Promise<Forum[]>;
7
+ getStatuses(): Promise<Status[]>;
8
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AdditionalAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ class AdditionalAPI {
15
+ constructor(apiClient) {
16
+ this.apiClient = apiClient;
17
+ }
18
+ getForums() {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const endpoint = Endpoints_1.Endpoint.Additional.forums();
21
+ const { data } = yield this.apiClient.get(endpoint);
22
+ return data;
23
+ });
24
+ }
25
+ getStatuses() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const endpoint = Endpoints_1.Endpoint.Additional.statuses();
28
+ const { data } = yield this.apiClient.get(endpoint);
29
+ return data;
30
+ });
31
+ }
32
+ }
33
+ exports.AdditionalAPI = AdditionalAPI;
@@ -0,0 +1,7 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { LoginData, User } from '../interfaces';
3
+ export declare class AuthAPI {
4
+ private readonly apiClient;
5
+ constructor(apiClient: APIClient);
6
+ login(loginData: LoginData): Promise<User>;
7
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AuthAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ class AuthAPI {
15
+ constructor(apiClient) {
16
+ this.apiClient = apiClient;
17
+ }
18
+ login(loginData) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const endpoint = Endpoints_1.Endpoint.Auth.login();
21
+ const { data } = yield this.apiClient.post(endpoint, loginData);
22
+ return data;
23
+ });
24
+ }
25
+ }
26
+ exports.AuthAPI = AuthAPI;
@@ -0,0 +1,13 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { Category } from '../interfaces';
3
+ interface GetListOptions {
4
+ ownership?: string;
5
+ type?: string;
6
+ }
7
+ export declare class CategoriesAPI {
8
+ private readonly apiClient;
9
+ constructor(apiClient: APIClient);
10
+ getCategory(categoryId: string): Promise<Category>;
11
+ getList(options: GetListOptions): Promise<Category[]>;
12
+ }
13
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CategoriesAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ class CategoriesAPI {
15
+ constructor(apiClient) {
16
+ this.apiClient = apiClient;
17
+ }
18
+ getCategory(categoryId) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const endpoint = Endpoints_1.Endpoint.Categories.categoryById(categoryId);
21
+ const { data } = yield this.apiClient.get(endpoint);
22
+ return data;
23
+ });
24
+ }
25
+ getList(options) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const endpoint = Endpoints_1.Endpoint.Categories.listOfCategories();
28
+ const { data } = yield this.apiClient.get(endpoint, { params: options });
29
+ return data;
30
+ });
31
+ }
32
+ }
33
+ exports.CategoriesAPI = CategoriesAPI;
@@ -0,0 +1,8 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { Changelog } from '../interfaces';
3
+ export declare class ChangelogAPI {
4
+ private readonly apiClient;
5
+ constructor(apiClient: APIClient);
6
+ getObjectsChangelog(objectId: string): Promise<Changelog[]>;
7
+ getUsersChangelog(userId: string): Promise<Changelog[]>;
8
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ChangelogAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ class ChangelogAPI {
15
+ constructor(apiClient) {
16
+ this.apiClient = apiClient;
17
+ }
18
+ getObjectsChangelog(objectId) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const endpoint = Endpoints_1.Endpoint.Changelog.objects(objectId);
21
+ const { data } = yield this.apiClient.get(endpoint);
22
+ return data;
23
+ });
24
+ }
25
+ getUsersChangelog(userId) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const endpoint = Endpoints_1.Endpoint.Changelog.users(userId);
28
+ const { data } = yield this.apiClient.get(endpoint);
29
+ return data;
30
+ });
31
+ }
32
+ }
33
+ exports.ChangelogAPI = ChangelogAPI;
@@ -0,0 +1,13 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import { APIResult, Chat, ChatMessagesPaginator } from '../interfaces';
3
+ export interface GetAllChatOptions {
4
+ authorId?: string;
5
+ page?: number;
6
+ }
7
+ export declare class ChatsAPI {
8
+ private readonly apiClient;
9
+ constructor(apiClient: APIClient);
10
+ getAllChats(options?: GetAllChatOptions): Promise<APIResult<Chat[]>>;
11
+ getChat(chatId: string): Promise<APIResult<Chat>>;
12
+ getMessages(chatId: string): Promise<ChatMessagesPaginator>;
13
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ChatsAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ class ChatsAPI {
15
+ constructor(apiClient) {
16
+ this.apiClient = apiClient;
17
+ }
18
+ getAllChats(options) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const endpoint = Endpoints_1.Endpoint.Chats.chats();
21
+ const { data } = yield this.apiClient.get(endpoint, { params: options });
22
+ return data;
23
+ });
24
+ }
25
+ getChat(chatId) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const endpoint = Endpoints_1.Endpoint.Chats.chat(chatId);
28
+ const { data } = yield this.apiClient.get(endpoint);
29
+ return data;
30
+ });
31
+ }
32
+ getMessages(chatId) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const endpoint = Endpoints_1.Endpoint.Chats.messages(chatId);
35
+ const { data } = yield this.apiClient.get(endpoint);
36
+ return data;
37
+ });
38
+ }
39
+ }
40
+ exports.ChatsAPI = ChatsAPI;
@@ -0,0 +1,14 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { CommentActionResponse, CommentAddParams, CommentEditParams, CommentsListResponse } from '../interfaces';
3
+ export declare class CommentsAPI {
4
+ private readonly apiClient;
5
+ constructor(apiClient: APIClient);
6
+ addComment(comment: CommentAddParams): Promise<CommentActionResponse>;
7
+ editComment(commentId: string, comment: CommentEditParams): Promise<CommentActionResponse>;
8
+ getComments(options?: Record<string, unknown>): Promise<CommentsListResponse>;
9
+ getObjectComments(objectId: string): Promise<CommentsListResponse>;
10
+ recoverComment(commentId: string): Promise<CommentActionResponse>;
11
+ toggleBestComment(commentId: string): Promise<CommentActionResponse>;
12
+ toggleVoteComment(commentId: string): Promise<CommentActionResponse>;
13
+ trashComment(commentId: string): Promise<CommentActionResponse>;
14
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CommentsAPI = void 0;
13
+ const Endpoints_1 = require("../Endpoints");
14
+ class CommentsAPI {
15
+ constructor(apiClient) {
16
+ this.apiClient = apiClient;
17
+ }
18
+ addComment(comment) {
19
+ return __awaiter(this, void 0, void 0, function* () {
20
+ const endpoint = Endpoints_1.Endpoint.Comments.comments();
21
+ const { data } = yield this.apiClient.post(endpoint, comment);
22
+ return data;
23
+ });
24
+ }
25
+ editComment(commentId, comment) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const endpoint = Endpoints_1.Endpoint.Comments.editComment(commentId);
28
+ const { data } = yield this.apiClient.post(endpoint, comment);
29
+ return data;
30
+ });
31
+ }
32
+ getComments(options) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const endpoint = Endpoints_1.Endpoint.Comments.comments();
35
+ const { data } = yield this.apiClient.get(endpoint, { params: options });
36
+ return data;
37
+ });
38
+ }
39
+ getObjectComments(objectId) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const endpoint = Endpoints_1.Endpoint.Comments.objectComments(objectId);
42
+ const { data } = yield this.apiClient.get(endpoint);
43
+ return data;
44
+ });
45
+ }
46
+ recoverComment(commentId) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ const endpoint = Endpoints_1.Endpoint.Comments.recoveryComment(commentId);
49
+ const { data } = yield this.apiClient.post(endpoint);
50
+ return data;
51
+ });
52
+ }
53
+ toggleBestComment(commentId) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const endpoint = Endpoints_1.Endpoint.Comments.toggleBestComment(commentId);
56
+ const { data } = yield this.apiClient.post(endpoint);
57
+ return data;
58
+ });
59
+ }
60
+ toggleVoteComment(commentId) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ const endpoint = Endpoints_1.Endpoint.Comments.toggleVoteComment(commentId);
63
+ const { data } = yield this.apiClient.post(endpoint);
64
+ return data;
65
+ });
66
+ }
67
+ trashComment(commentId) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const endpoint = Endpoints_1.Endpoint.Comments.trashComment(commentId);
70
+ const { data } = yield this.apiClient.post(endpoint);
71
+ return data;
72
+ });
73
+ }
74
+ }
75
+ exports.CommentsAPI = CommentsAPI;
@@ -0,0 +1,8 @@
1
+ import type { APIClient } from '@ffflorian/api-client';
2
+ import type { CustomField } from '../interfaces';
3
+ export declare class CustomFieldsAPI {
4
+ private readonly apiClient;
5
+ constructor(apiClient: APIClient);
6
+ getObjectCustomFields(): Promise<CustomField[]>;
7
+ getUserCustomFields(): Promise<CustomField[]>;
8
+ }