pyrus-api 1.1.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,44 +16,186 @@ declare module "pyrus-api" {
16
16
  export function toDateTimeString(date: Date | string): string;
17
17
  export function toDateString(date: Date | string): string;
18
18
  export function toTimeString(date: Date | string): string;
19
- export enum FilterMask {
19
+ export const ErrorCodeType: {
20
+ readonly ServerError: "server_error";
21
+ readonly AuthorizationError: "authorization_error";
22
+ readonly TokenNotSpecified: "token_not_specified";
23
+ readonly RevokedToken: "revoked_token";
24
+ readonly ExpiredToken: "expired_token";
25
+ readonly InvalidToken: "invalid_token";
26
+ readonly AccountBlocked: "account_blocked";
27
+ readonly InvalidCredentials: "invalid_credentials";
28
+ readonly InvalidApplicationId: "invalid_application_id";
29
+ readonly InvalidFieldId: "invalid_field_id";
30
+ readonly InvalidFieldName: "invalid_field_name";
31
+ readonly InvalidFieldIdName: "invalid_field_id_name";
32
+ readonly NonUniqueName: "non_unique_name";
33
+ readonly FieldIdentityMissing: "field_identity_missing";
34
+ readonly DuplicateField: "duplicate_field";
35
+ readonly InvalidCatalogId: "invalid_catalog_id";
36
+ readonly InvalidCatalogItemName: "invalid_catalog_item_name";
37
+ readonly NonUniqueCatalogItemName: "non_unique_catalog_item_name";
38
+ readonly InvalidCatalogItemId: "invalid_catalog_item_id";
39
+ readonly InvalidCatalogItemIdName: "catalog_item_id_name_mismatch";
40
+ readonly InvalidEmail: "invalid_email";
41
+ readonly NonUniqueEmail: "non_unique_email";
42
+ readonly InvalidPersonIdEmail: "invalid_person_id_email";
43
+ readonly UnrecognizedAttachmentId: "unrecognized_attachment_id";
44
+ readonly RequiredFieldMissing: "required_field_missing";
45
+ readonly FieldTypeIsNotSupported: "type_is_not_supported";
46
+ readonly IncorrectParametersCount: "incorrect_parameters_count";
47
+ readonly FilterTypeIsNotSupported: "filter_type_is_not_supported";
48
+ readonly StepFieldDoesNotExists: "step_field_does_not_exists";
49
+ readonly NoFileInRequest: "no_file_in_request";
50
+ readonly TooLargeRequestLength: "too_large_request_length";
51
+ readonly TaskHasNoForm: "task_has_no_form";
52
+ readonly RequiredParameterMissing: "required_parameter_missing";
53
+ readonly InvalidValueFormat: "invalid_value_format";
54
+ readonly InvalidJson: "invalid_json";
55
+ readonly EmptyBody: "empty_body";
56
+ readonly TextMissing: "text_missing";
57
+ readonly FormIdMissing: "form_id_missing";
58
+ readonly InvalidPersonId: "invalid_person_id";
59
+ readonly DeletedField: "deleted_field";
60
+ readonly PersonIdentityMissing: "person_identity_missing";
61
+ readonly CatalogItemIdMissing: "catalog_identity_missing";
62
+ readonly FormHasNoTask: "form_has_no_task";
63
+ readonly EitherDueDateOrDueCanBeSet: "either_due_date_or_due_can_be_set";
64
+ readonly NegativeDuration: "negative_duration";
65
+ readonly DurationIsTooLong: "duration_is_too_long";
66
+ readonly DueMissing: "due_missing";
67
+ readonly ScheduledDateInPast: "scheduled_date_in_past";
68
+ readonly CannotAddFormProject: "cannot_add_form_project";
69
+ readonly FormTemplateCantBeRemovedFromTask: "form_template_cant_be_removed_from_task";
70
+ readonly TooManyTaskSteps: "too_many_task_steps";
71
+ readonly TooManyComments: "too_many_comments";
72
+ readonly InvalidStepNumber: "invalid_step_number";
73
+ readonly TaskLimitExceeded: "task_limit_exceeded";
74
+ readonly FieldIsInTable: "field_is_in_table";
75
+ readonly RequiredTableFieldMissing: "required_table_field_missing";
76
+ readonly DepartmentCatalogCanNotBeModified: "department_catalog_can_not_be_modified";
77
+ readonly CatalogDuplicateItems: "catalog_duplicate_rows";
78
+ readonly EmptyCatalogHeaders: "empty_catalog_headers";
79
+ readonly CanNotModifyDeletedCatalog: "can_not_modify_deleted_catalog";
80
+ readonly CatalogDuplicateHeaders: "catalog_duplicate_headers";
81
+ readonly CanNotModifyFirstColumn: "can_not_modify_first_column";
82
+ readonly CatalogHeadersItemsMismatch: "catalog_headers_items_mismatch";
83
+ readonly TooManyCatalogItems: "too_many_catalog_items";
84
+ readonly CatalogItemMaxLengthExceeded: "catalog_item_max_length_exceeded";
85
+ readonly SingleValueIsNotSupported: "single_value_is_not_supported";
86
+ readonly ParticipantLimitExceeded: "participant_limit_exceeded";
87
+ readonly TableRowsLimitExceeded: "table_rows_limit_exceeded";
88
+ readonly TextFieldValueLimitExceeded: "text_field_value_limit_exceeded";
89
+ readonly UnableToEditField: "unable_to_edit_field";
90
+ readonly EmptyFile: "empty_file";
91
+ readonly BadMultipartContent: "bad_multipart_content";
92
+ readonly TooManyDecimalPlaces: "too_many_decimal_places";
93
+ readonly ExternalCommentEmptyText: "external_comment_empty_text";
94
+ readonly SenderAddressFieldMissing: "sender_address_field_missing";
95
+ readonly ExternalCommentRecipientNotFound: "external_comment_recipient_not_found";
96
+ readonly DefaultMailboxNotFound: "default_mailbox_not_found";
97
+ readonly CatalogNullValue: "catalog_null_value";
98
+ readonly MaxTextLengthExceeded: "max_text_length_exceeded";
99
+ readonly DueOutsideOfBounds: "due_outside_of_bounds";
100
+ readonly AttachmentsForbidden: "attachments_forbidden";
101
+ readonly UnrecognizedCallGuid: "unrecognized_call_guid";
102
+ readonly UnsupportedAttachmentFormat: "unsupported_attachment_format";
103
+ readonly ValidationError: "validation_error";
104
+ readonly UnrecognizedAccountId: "unrecognized_account_id";
105
+ readonly WebhookIsDisabled: "webhook_is_disabled";
106
+ readonly TooLargeMessageText: "too_large_message_text";
107
+ readonly UnrecognizedMessageType: "unrecognized_message_type";
108
+ readonly InvalidFieldMappingCode: "invalid_field_mapping_code";
109
+ readonly TooManyAttachments: "too_many_attachments";
110
+ readonly UnrecognizedCallId: "unrecognized_call_id";
111
+ readonly UnsupportedRecordFileFormat: "unsupported_record_file_format";
112
+ readonly UnrecognizedIntegrationGuid: "unrecognized_integration_guid";
113
+ readonly LimitExceeded: "limit_exceeded";
114
+ readonly MaxSmsTextLengthExceeded: "max_sms_text_length_exceeded";
115
+ readonly SmsIntegrationNotConfigured: "sms_integration_not_configured";
116
+ readonly AttachmentTooBig: "attachment_too_big";
117
+ readonly UncreatedOrDeletedTableRows: "invalid_table_row";
118
+ readonly PrivateChannelAccessDenied: "private_channel_access_denied";
119
+ readonly PrivateCommentHasForbiddenChanges: "private_comment_has_forbidden_changes";
120
+ readonly ItemsCountOutOfRange: "items_count_out_of_range";
121
+ readonly CannotAddExternalUser: "cannot_add_external_user";
122
+ readonly UnrecognizedTaskId: "unrecognized_task_id";
123
+ readonly TooManyDeletedCatalogItems: "too_many_deleted_catalog_items";
124
+ readonly FieldCannotHaveMultipleValues: "field_cannot_have_multiple_values";
125
+ readonly FieldEditingIsNotAllowed: "field_editing_is_not_allowed";
126
+ readonly NonUniqueCode: "non_unique_code";
127
+ readonly InvalidFieldCode: "invalid_field_code";
128
+ readonly AccessDeniedProject: "access_denied_project";
129
+ readonly AccessDeniedTask: "access_denied_task";
130
+ readonly AccessDeniedCatalog: "access_denied_catalog";
131
+ readonly AccessDeniedForm: "access_denied_form";
132
+ readonly AccessDeniedPerson: "access_denied_person";
133
+ readonly AccessDeniedCloseTask: "access_denied_close_task";
134
+ readonly AccessDeniedReopenTask: "access_denied_reopen_task";
135
+ readonly AccessDeniedFileAccessHistory: "access_denied_file_access_history";
136
+ readonly AccessDeniedFile: "access_denied_file";
137
+ readonly AccessDeniedReport: "access_denied_report";
138
+ readonly AccessDenied: "access_denied";
139
+ readonly FileIsMissing: "file_is_missing";
140
+ readonly TooManyRequests: "too_many_requests";
141
+ };
142
+ export type ErrorCodeType = typeof ErrorCodeType[keyof typeof ErrorCodeType];
143
+ export type ErrorResponse = {
144
+ error: string;
145
+ error_code: ErrorCodeType;
146
+ error_message?: string;
147
+ };
148
+ export class ApiError extends Error {
149
+ name: string;
150
+ readonly errorCode: ErrorCodeType;
151
+ constructor({ code, error }: {
152
+ code: number;
153
+ error: ErrorResponse;
154
+ });
155
+ }
156
+ export const FilterMask: {
20
157
  /**
21
158
  * Events whose deadline is indicated in UTC+0
22
159
  */
23
- Due = 1,
160
+ readonly Due: 1;
24
161
  /**
25
162
  * Tasks whose deadline is indicated by date
26
163
  * (without reference to timezone)
27
164
  */
28
- DueDate = 2,
165
+ readonly DueDate: 2;
29
166
  /**
30
167
  * Tasks whose deadline at the current step is
31
168
  * within the selected time period in UTC+0
32
169
  */
33
- DueForCurrentStep = 4,
170
+ readonly DueForCurrentStep: 4;
34
171
  /**
35
172
  * Tasks with a programmed reminder
36
173
  */
37
- Reminded = 8
38
- }
39
- export enum CallEventType {
40
- Show = "show"
41
- }
42
- export enum SourceType {
43
- Default = "default",
44
- FillTable = "fill_table"
45
- }
46
- export enum ActivityAction {
47
- Finished = "finished",
48
- Reopened = "reopened"
49
- }
50
- export enum ApprovalChoice {
51
- Waiting = "waiting",
52
- Approved = "approved",
53
- Rejected = "rejected",
54
- Revoked = "revoked",
55
- Acknowledged = "acknowledged"
56
- }
174
+ readonly Reminded: 8;
175
+ };
176
+ export type FilterMask = typeof FilterMask[keyof typeof FilterMask];
177
+ export const CallEventType: {
178
+ readonly Show: "show";
179
+ };
180
+ export type CallEventType = typeof CallEventType[keyof typeof CallEventType];
181
+ export const SourceType: {
182
+ readonly Default: "default";
183
+ readonly FillTable: "fill_table";
184
+ };
185
+ export type SourceType = typeof SourceType[keyof typeof SourceType];
186
+ export const ActivityAction: {
187
+ readonly Finished: "finished";
188
+ readonly Reopened: "reopened";
189
+ };
190
+ export type ActivityAction = typeof ActivityAction[keyof typeof ActivityAction];
191
+ export const ApprovalChoice: {
192
+ readonly Waiting: "waiting";
193
+ readonly Approved: "approved";
194
+ readonly Rejected: "rejected";
195
+ readonly Revoked: "revoked";
196
+ readonly Acknowledged: "acknowledged";
197
+ };
198
+ export type ApprovalChoice = typeof ApprovalChoice[keyof typeof ApprovalChoice];
57
199
  export enum PersonRights {
58
200
  None = 0,
59
201
  ManageRoles = 1,
@@ -78,193 +220,77 @@ declare module "pyrus-api" {
78
220
  UIConfigurationManager = 1600,
79
221
  UIAdministrator = 2015
80
222
  }
81
- export enum ListType {
82
- Private = "private",
83
- OrganizationWide = "org_wide"
84
- }
85
- export enum ErrorCodeType {
86
- ServerError = "server_error",
87
- AuthorizationError = "authorization_error",
88
- TokenNotSpecified = "token_not_specified",
89
- RevokedToken = "revoked_token",
90
- ExpiredToken = "expired_token",
91
- InvalidToken = "invalid_token",
92
- AccountBlocked = "account_blocked",
93
- InvalidCredentials = "invalid_credentials",
94
- InvalidApplicationId = "invalid_application_id",
95
- InvalidFieldId = "invalid_field_id",
96
- InvalidFieldName = "invalid_field_name",
97
- InvalidFieldIdName = "invalid_field_id_name",
98
- NonUniqueName = "non_unique_name",
99
- FieldIdentityMissing = "field_identity_missing",
100
- DuplicateField = "duplicate_field",
101
- InvalidCatalogId = "invalid_catalog_id",
102
- InvalidCatalogItemName = "invalid_catalog_item_name",
103
- NonUniqueCatalogItemName = "non_unique_catalog_item_name",
104
- InvalidCatalogItemId = "invalid_catalog_item_id",
105
- InvalidCatalogItemIdName = "catalog_item_id_name_mismatch",
106
- InvalidEmail = "invalid_email",
107
- NonUniqueEmail = "non_unique_email",
108
- InvalidPersonIdEmail = "invalid_person_id_email",
109
- UnrecognizedAttachmentId = "unrecognized_attachment_id",
110
- RequiredFieldMissing = "required_field_missing",
111
- FieldTypeIsNotSupported = "type_is_not_supported",
112
- IncorrectParametersCount = "incorrect_parameters_count",
113
- FilterTypeIsNotSupported = "filter_type_is_not_supported",
114
- StepFieldDoesNotExists = "step_field_does_not_exists",
115
- NoFileInRequest = "no_file_in_request",
116
- TooLargeRequestLength = "too_large_request_length",
117
- TaskHasNoForm = "task_has_no_form",
118
- RequiredParameterMissing = "required_parameter_missing",
119
- InvalidValueFormat = "invalid_value_format",
120
- InvalidJson = "invalid_json",
121
- EmptyBody = "empty_body",
122
- TextMissing = "text_missing",
123
- FormIdMissing = "form_id_missing",
124
- InvalidPersonId = "invalid_person_id",
125
- DeletedField = "deleted_field",
126
- PersonIdentityMissing = "person_identity_missing",
127
- CatalogItemIdMissing = "catalog_identity_missing",
128
- FormHasNoTask = "form_has_no_task",
129
- EitherDueDateOrDueCanBeSet = "either_due_date_or_due_can_be_set",
130
- NegativeDuration = "negative_duration",
131
- DurationIsTooLong = "duration_is_too_long",
132
- DueMissing = "due_missing",
133
- ScheduledDateInPast = "scheduled_date_in_past",
134
- CannotAddFormProject = "cannot_add_form_project",
135
- FormTemplateCantBeRemovedFromTask = "form_template_cant_be_removed_from_task",
136
- TooManyTaskSteps = "too_many_task_steps",
137
- TooManyComments = "too_many_comments",
138
- InvalidStepNumber = "invalid_step_number",
139
- TaskLimitExceeded = "task_limit_exceeded",
140
- FieldIsInTable = "field_is_in_table",
141
- RequiredTableFieldMissing = "required_table_field_missing",
142
- DepartmentCatalogCanNotBeModified = "department_catalog_can_not_be_modified",
143
- CatalogDuplicateItems = "catalog_duplicate_rows",
144
- EmptyCatalogHeaders = "empty_catalog_headers",
145
- CanNotModifyDeletedCatalog = "can_not_modify_deleted_catalog",
146
- CatalogDuplicateHeaders = "catalog_duplicate_headers",
147
- CanNotModifyFirstColumn = "can_not_modify_first_column",
148
- CatalogHeadersItemsMismatch = "catalog_headers_items_mismatch",
149
- TooManyCatalogItems = "too_many_catalog_items",
150
- CatalogItemMaxLengthExceeded = "catalog_item_max_length_exceeded",
151
- SingleValueIsNotSupported = "single_value_is_not_supported",
152
- ParticipantLimitExceeded = "participant_limit_exceeded",
153
- TableRowsLimitExceeded = "table_rows_limit_exceeded",
154
- TextFieldValueLimitExceeded = "text_field_value_limit_exceeded",
155
- UnableToEditField = "unable_to_edit_field",
156
- EmptyFile = "empty_file",
157
- BadMultipartContent = "bad_multipart_content",
158
- TooManyDecimalPlaces = "too_many_decimal_places",
159
- ExternalCommentEmptyText = "external_comment_empty_text",
160
- SenderAddressFieldMissing = "sender_address_field_missing",
161
- ExternalCommentRecipientNotFound = "external_comment_recipient_not_found",
162
- DefaultMailboxNotFound = "default_mailbox_not_found",
163
- CatalogNullValue = "catalog_null_value",
164
- MaxTextLengthExceeded = "max_text_length_exceeded",
165
- DueOutsideOfBounds = "due_outside_of_bounds",
166
- AttachmentsForbidden = "attachments_forbidden",
167
- UnrecognizedCallGuid = "unrecognized_call_guid",
168
- UnsupportedAttachmentFormat = "unsupported_attachment_format",
169
- ValidationError = "validation_error",
170
- UnrecognizedAccountId = "unrecognized_account_id",
171
- WebhookIsDisabled = "webhook_is_disabled",
172
- TooLargeMessageText = "too_large_message_text",
173
- UnrecognizedMessageType = "unrecognized_message_type",
174
- InvalidFieldMappingCode = "invalid_field_mapping_code",
175
- TooManyAttachments = "too_many_attachments",
176
- UnrecognizedCallId = "unrecognized_call_id",
177
- UnsupportedRecordFileFormat = "unsupported_record_file_format",
178
- UnrecognizedIntegrationGuid = "unrecognized_integration_guid",
179
- LimitExceeded = "limit_exceeded",
180
- MaxSmsTextLengthExceeded = "max_sms_text_length_exceeded",
181
- SmsIntegrationNotConfigured = "sms_integration_not_configured",
182
- AttachmentTooBig = "attachment_too_big",
183
- UncreatedOrDeletedTableRows = "invalid_table_row",
184
- PrivateChannelAccessDenied = "private_channel_access_denied",
185
- PrivateCommentHasForbiddenChanges = "private_comment_has_forbidden_changes",
186
- ItemsCountOutOfRange = "items_count_out_of_range",
187
- CannotAddExternalUser = "cannot_add_external_user",
188
- UnrecognizedTaskId = "unrecognized_task_id",
189
- TooManyDeletedCatalogItems = "too_many_deleted_catalog_items",
190
- FieldCannotHaveMultipleValues = "field_cannot_have_multiple_values",
191
- FieldEditingIsNotAllowed = "field_editing_is_not_allowed",
192
- NonUniqueCode = "non_unique_code",
193
- InvalidFieldCode = "invalid_field_code",
194
- AccessDeniedProject = "access_denied_project",
195
- AccessDeniedTask = "access_denied_task",
196
- AccessDeniedCatalog = "access_denied_catalog",
197
- AccessDeniedForm = "access_denied_form",
198
- AccessDeniedPerson = "access_denied_person",
199
- AccessDeniedCloseTask = "access_denied_close_task",
200
- AccessDeniedReopenTask = "access_denied_reopen_task",
201
- AccessDeniedFileAccessHistory = "access_denied_file_access_history",
202
- AccessDeniedFile = "access_denied_file",
203
- AccessDeniedReport = "access_denied_report",
204
- AccessDenied = "access_denied",
205
- FileIsMissing = "file_is_missing",
206
- TooManyRequests = "too_many_requests"
207
- }
208
- export enum Flag {
209
- None = "none",
210
- Checked = "checked",
211
- Unchecked = "unchecked"
212
- }
213
- export enum FormFieldType {
214
- Unknown = "unknown",
215
- Text = "text",
216
- Money = "money",
217
- Number = "number",
218
- Date = "date",
219
- Time = "time",
220
- Checkmark = "checkmark",
221
- MultipleChoice = "multiple_choice",
222
- DueDate = "due_date",
223
- Email = "email",
224
- Phone = "phone",
225
- Flag = "flag",
226
- Step = "step",
227
- Status = "status",
228
- CreationDate = "creation_date",
229
- Note = "note",
230
- Catalog = "catalog",
231
- File = "file",
232
- Person = "person",
233
- Author = "author",
234
- Table = "table",
235
- Title = "title",
236
- Project = "project",
237
- FormLink = "form_link",
238
- DueDateTime = "due_date_time"
239
- }
240
- export enum PermissionLevel {
241
- None = "none",
242
- Manager = "manager",
243
- Member = "member",
244
- Administrator = "administrator"
245
- }
246
- export enum PersonType {
247
- User = "user",
248
- Bot = "bot",
249
- Role = "role"
250
- }
251
- export enum SendSmsError {
252
- None = "none",
253
- Unknown = "unknown",
254
- Expired = "expired",
255
- Forbidden = "forbidden",
256
- Unreachable = "unreachable",
257
- UnknownStatus = "unknown_status",
258
- UnableToDeliver = "unable_to_deliver",
259
- InvalidPhoneNumber = "invalid_phone_number",
260
- Rejected = "rejected"
261
- }
262
- export enum SendSmsStatus {
263
- Sent = "sent",
264
- Delivered = "delivered",
265
- DeliveryFailed = "delivery_failed",
266
- SendFailed = "send_failed"
267
- }
223
+ export const ListType: {
224
+ readonly Private: "private";
225
+ readonly OrganizationWide: "org_wide";
226
+ };
227
+ export type ListType = typeof ListType[keyof typeof ListType];
228
+ export const Flag: {
229
+ readonly None: "none";
230
+ readonly Checked: "checked";
231
+ readonly Unchecked: "unchecked";
232
+ };
233
+ export type Flag = typeof Flag[keyof typeof Flag];
234
+ export const FormFieldType: {
235
+ readonly Unknown: "unknown";
236
+ readonly Text: "text";
237
+ readonly Money: "money";
238
+ readonly Number: "number";
239
+ readonly Date: "date";
240
+ readonly Time: "time";
241
+ readonly Checkmark: "checkmark";
242
+ readonly MultipleChoice: "multiple_choice";
243
+ readonly DueDate: "due_date";
244
+ readonly Email: "email";
245
+ readonly Phone: "phone";
246
+ readonly Flag: "flag";
247
+ readonly Step: "step";
248
+ readonly Status: "status";
249
+ readonly CreationDate: "creation_date";
250
+ readonly Note: "note";
251
+ readonly Catalog: "catalog";
252
+ readonly File: "file";
253
+ readonly Person: "person";
254
+ readonly Author: "author";
255
+ readonly Table: "table";
256
+ readonly Title: "title";
257
+ readonly Project: "project";
258
+ readonly FormLink: "form_link";
259
+ readonly DueDateTime: "due_date_time";
260
+ };
261
+ export type FormFieldType = typeof FormFieldType[keyof typeof FormFieldType];
262
+ export const PermissionLevel: {
263
+ readonly None: "none";
264
+ readonly Manager: "manager";
265
+ readonly Member: "member";
266
+ readonly Administrator: "administrator";
267
+ };
268
+ export type PermissionLevel = typeof PermissionLevel[keyof typeof PermissionLevel];
269
+ export const PersonType: {
270
+ readonly User: "user";
271
+ readonly Bot: "bot";
272
+ readonly Role: "role";
273
+ };
274
+ export type PersonType = typeof PersonType[keyof typeof PersonType];
275
+ export const SendSmsError: {
276
+ readonly None: "none";
277
+ readonly Unknown: "unknown";
278
+ readonly Expired: "expired";
279
+ readonly Forbidden: "forbidden";
280
+ readonly Unreachable: "unreachable";
281
+ readonly UnknownStatus: "unknown_status";
282
+ readonly UnableToDeliver: "unable_to_deliver";
283
+ readonly InvalidPhoneNumber: "invalid_phone_number";
284
+ readonly Rejected: "rejected";
285
+ };
286
+ export type SendSmsError = typeof SendSmsError[keyof typeof SendSmsError];
287
+ export const SendSmsStatus: {
288
+ readonly Sent: "sent";
289
+ readonly Delivered: "delivered";
290
+ readonly DeliveryFailed: "delivery_failed";
291
+ readonly SendFailed: "send_failed";
292
+ };
293
+ export type SendSmsStatus = typeof SendSmsStatus[keyof typeof SendSmsStatus];
268
294
  export type NewFile = {
269
295
  guid?: string;
270
296
  root_id?: number;
@@ -328,14 +354,13 @@ declare module "pyrus-api" {
328
354
  fields: FormField[];
329
355
  };
330
356
  export type FormFieldBase = {
331
- id: number;
332
- type: FormFieldType;
357
+ id?: number;
358
+ type?: FormFieldType;
333
359
  name?: string;
334
360
  info?: FormFieldInfo;
335
361
  parent_id?: number;
336
362
  row_id?: number;
337
363
  code?: string;
338
- value?: any;
339
364
  };
340
365
  export type Person = {
341
366
  id: number;
@@ -356,11 +381,11 @@ declare module "pyrus-api" {
356
381
  phone: string;
357
382
  };
358
383
  export type FormFieldAuthor = FormFieldBase & {
359
- type?: FormFieldType.Author;
384
+ type?: typeof FormFieldType.Author;
360
385
  value?: Person;
361
386
  };
362
387
  export type FormFieldCatalog = FormFieldBase & {
363
- type?: FormFieldType.Catalog;
388
+ type?: typeof FormFieldType.Catalog;
364
389
  value?: Catalog;
365
390
  };
366
391
  export type Catalog = {
@@ -371,32 +396,33 @@ declare module "pyrus-api" {
371
396
  values?: string[];
372
397
  rows?: string[][];
373
398
  };
374
- enum Checkmark {
375
- Checked = "checked",
376
- Unchecked = "unchecked"
377
- }
399
+ const Checkmark: {
400
+ readonly Checked: "checked";
401
+ readonly Unchecked: "unchecked";
402
+ };
403
+ export type Checkmark = typeof Checkmark[keyof typeof Checkmark];
378
404
  export type FormFieldCheckmark = FormFieldBase & {
379
- type?: FormFieldType.Checkmark;
405
+ type?: typeof FormFieldType.Checkmark;
380
406
  value?: Checkmark;
381
407
  };
382
408
  export type FormFieldCreateDate = FormFieldBase & {
383
- type?: FormFieldType.CreationDate;
409
+ type: typeof FormFieldType.CreationDate;
384
410
  value?: Date;
385
411
  };
386
412
  export type FormFieldDate = FormFieldBase & {
387
- type?: FormFieldType.Date;
413
+ type: typeof FormFieldType.Date;
388
414
  value?: Date;
389
415
  };
390
416
  export type FormFieldDueDate = FormFieldBase & {
391
- type?: FormFieldType.DueDate;
417
+ type: typeof FormFieldType.DueDate;
392
418
  value?: Date;
393
419
  };
394
420
  export type FormFieldDueDateTime = FormFieldBase & {
395
- type?: FormFieldType.DueDateTime;
421
+ type: typeof FormFieldType.DueDateTime;
396
422
  value?: Date;
397
423
  };
398
424
  export type FormFieldEmail = FormFieldBase & {
399
- type?: FormFieldType.Email;
425
+ type?: typeof FormFieldType.Email;
400
426
  value?: string;
401
427
  };
402
428
  export type AttachedFile = {
@@ -409,11 +435,11 @@ declare module "pyrus-api" {
409
435
  root_id?: number;
410
436
  };
411
437
  export type FormFieldFile = FormFieldBase & {
412
- type?: FormFieldType.File;
438
+ type?: typeof FormFieldType.File;
413
439
  value?: AttachedFile[];
414
440
  };
415
441
  export type FormFieldFlag = FormFieldBase & {
416
- type?: FormFieldType.Flag;
442
+ type?: typeof FormFieldType.Flag;
417
443
  value?: Flag;
418
444
  };
419
445
  export type FormLink = {
@@ -422,15 +448,15 @@ declare module "pyrus-api" {
422
448
  subject?: string;
423
449
  };
424
450
  export type FormFieldFormLink = FormFieldBase & {
425
- type?: FormFieldType.FormLink;
451
+ type?: typeof FormFieldType.FormLink;
426
452
  value?: FormLink;
427
453
  };
428
454
  export type FormFieldMoney = FormFieldBase & {
429
- type?: FormFieldType.Money;
455
+ type?: typeof FormFieldType.Money;
430
456
  value?: number;
431
457
  };
432
458
  export type FormFieldMultipleChoice = FormFieldBase & {
433
- type?: FormFieldType.MultipleChoice;
459
+ type?: typeof FormFieldType.MultipleChoice;
434
460
  value?: MultipleChoice;
435
461
  };
436
462
  export type MultipleChoice = {
@@ -443,23 +469,23 @@ declare module "pyrus-api" {
443
469
  value?: NewFile[];
444
470
  };
445
471
  export type FormFieldNote = FormFieldBase & {
446
- type?: FormFieldType.Note;
472
+ type?: typeof FormFieldType.Note;
447
473
  value?: string;
448
474
  };
449
475
  export type FormFieldNumber = FormFieldBase & {
450
- type?: FormFieldType.Number;
476
+ type?: typeof FormFieldType.Number;
451
477
  value?: number;
452
478
  };
453
479
  export type FormFieldPerson = FormFieldBase & {
454
- type?: FormFieldType.Person;
480
+ type?: typeof FormFieldType.Person;
455
481
  value?: Person;
456
482
  };
457
483
  export type FormFieldPhone = FormFieldBase & {
458
- type?: FormFieldType.Phone;
484
+ type?: typeof FormFieldType.Phone;
459
485
  value?: string;
460
486
  };
461
487
  export type FormFieldProject = FormFieldBase & {
462
- type?: FormFieldType.Project;
488
+ type?: typeof FormFieldType.Project;
463
489
  value?: ProjectArray;
464
490
  };
465
491
  export type ProjectArray = {
@@ -470,20 +496,21 @@ declare module "pyrus-api" {
470
496
  name?: string;
471
497
  parent?: Project;
472
498
  };
473
- enum Status {
474
- Open = "open",
475
- Closed = "closed"
476
- }
499
+ const Status: {
500
+ readonly Open: "open";
501
+ readonly Closed: "closed";
502
+ };
503
+ export type Status = typeof Status[keyof typeof Status];
477
504
  export type FormFieldStatus = FormFieldBase & {
478
- type?: FormFieldType.Status;
505
+ type?: typeof FormFieldType.Status;
479
506
  value?: Status;
480
507
  };
481
508
  export type FormFieldStep = FormFieldBase & {
482
- type?: FormFieldType.Step;
509
+ type?: typeof FormFieldType.Step;
483
510
  value?: number;
484
511
  };
485
512
  export type FormFieldTable = FormFieldBase & {
486
- type?: FormFieldType.Table;
513
+ type?: typeof FormFieldType.Table;
487
514
  value?: TableRow[];
488
515
  };
489
516
  export type TableRow = {
@@ -493,45 +520,56 @@ declare module "pyrus-api" {
493
520
  deleted?: boolean;
494
521
  };
495
522
  export type FormFieldText = FormFieldBase & {
496
- type?: FormFieldType.Text;
523
+ type?: typeof FormFieldType.Text;
497
524
  value?: string;
498
525
  };
499
526
  export type FormFieldTime = FormFieldBase & {
500
- type?: FormFieldType.Time;
527
+ type: typeof FormFieldType.Time;
501
528
  value?: Date;
502
529
  };
503
530
  export type FormFieldTitle = FormFieldBase & {
504
- type?: FormFieldType.Title;
531
+ type?: typeof FormFieldType.Title;
505
532
  value?: Title;
506
533
  };
507
534
  export type Title = {
508
535
  checkmark?: Checkmark;
509
536
  fields?: FormField[];
510
537
  };
538
+ export type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE";
539
+ export type ById = {
540
+ id: number;
541
+ };
542
+ export type IdOrCodeRequired = {
543
+ id: number;
544
+ } | {
545
+ code: string;
546
+ };
511
547
  export type FormField = FormFieldAuthor | FormFieldCatalog | FormFieldCheckmark | FormFieldCreateDate | FormFieldDate | FormFieldDueDate | FormFieldDueDateTime | FormFieldEmail | FormFieldFile | FormFieldFlag | FormFieldFormLink | FormFieldMoney | FormFieldMultipleChoice | FormFieldNewFile | FormFieldNote | FormFieldNumber | FormFieldPerson | FormFieldPhone | FormFieldProject | FormFieldStatus | FormFieldStep | FormFieldTable | FormFieldText | FormFieldTime | FormFieldTitle;
512
- enum ChannelType {
513
- Email = "email",
514
- Telegram = "telegram",
515
- Web = "web",
516
- Facebook = "facebook",
517
- Vk = "vk",
518
- Viber = "viber",
519
- MobileApp = "mobile_app",
520
- WebWidget = "web_widget",
521
- MoySklad = "moy_sklad",
522
- Zadarma = "zadarma",
523
- AmoCrm = "amo_crm",
524
- Instagram = "instagram",
525
- PrivateChannel = "private_channel",
526
- Jira = "jira",
527
- Beeline = "beeline",
528
- ApiTelephony = "api_telephony",
529
- Zoom = "zoom",
530
- WebForm = "web_form",
531
- WhatsApp = "whats_app",
532
- Custom = "custom",
533
- Sms = "sms"
534
- }
548
+ export type FormFieldIdentified = FormField & IdOrCodeRequired;
549
+ const ChannelType: {
550
+ readonly Email: "email";
551
+ readonly Telegram: "telegram";
552
+ readonly Web: "web";
553
+ readonly Facebook: "facebook";
554
+ readonly Vk: "vk";
555
+ readonly Viber: "viber";
556
+ readonly MobileApp: "mobile_app";
557
+ readonly WebWidget: "web_widget";
558
+ readonly MoySklad: "moy_sklad";
559
+ readonly Zadarma: "zadarma";
560
+ readonly AmoCrm: "amo_crm";
561
+ readonly Instagram: "instagram";
562
+ readonly PrivateChannel: "private_channel";
563
+ readonly Jira: "jira";
564
+ readonly Beeline: "beeline";
565
+ readonly ApiTelephony: "api_telephony";
566
+ readonly Zoom: "zoom";
567
+ readonly WebForm: "web_form";
568
+ readonly WhatsApp: "whats_app";
569
+ readonly Custom: "custom";
570
+ readonly Sms: "sms";
571
+ };
572
+ export type ChannelType = typeof ChannelType[keyof typeof ChannelType];
535
573
  export type ChannelUser = {
536
574
  email?: string;
537
575
  name?: string;
@@ -556,7 +594,7 @@ declare module "pyrus-api" {
556
594
  approval_steps?: number[];
557
595
  action?: ActivityAction;
558
596
  attachments?: NewFile[];
559
- field_updates?: FormField[];
597
+ field_updates?: FormFieldIdentified[];
560
598
  approvals_added?: PersonIdentity[][];
561
599
  approvals_removed?: PersonIdentity[][];
562
600
  approvals_rerequested?: PersonIdentity[][];
@@ -585,11 +623,6 @@ declare module "pyrus-api" {
585
623
  previous_note_id: number;
586
624
  comment: TaskCommentRequest;
587
625
  };
588
- export type ResponseBase = {
589
- error?: string;
590
- error_code?: ErrorCodeType;
591
- error_message?: string;
592
- };
593
626
  export type Approval = {
594
627
  person: Person;
595
628
  approval_choice?: ApprovalChoice;
@@ -695,16 +728,15 @@ declare module "pyrus-api" {
695
728
  comments: TaskComment[];
696
729
  steps?: Step[];
697
730
  };
698
- export type TaskResponse = ResponseBase & {
731
+ export type TaskResponse = {
699
732
  task: TaskWithComments;
700
733
  };
701
- export type BotHookRequest = {
734
+ export type BotHookRequest = TaskResponse & {
702
735
  event: "Comment" | "Close";
703
736
  access_token: string;
704
737
  user_id: number;
705
738
  bot_settings: string;
706
739
  task_id: number;
707
- task: TaskResponse;
708
740
  };
709
741
  export type BotHookResponse = TaskCommentRequest | void;
710
742
  export type AuthRequest = {
@@ -723,15 +755,11 @@ declare module "pyrus-api" {
723
755
  authUrl: string;
724
756
  filesUrl?: string;
725
757
  };
726
- export type AuthResponse = ResponseBase & {
758
+ export type AuthResponse = {
727
759
  access_token: string;
728
760
  api_url?: string;
729
761
  files_url?: string;
730
762
  };
731
- export type HTTPMethod = "GET" | "POST" | "PUT" | "DELETE";
732
- export type ById = {
733
- id: number;
734
- };
735
763
  export interface BaseApiParams {
736
764
  token?: string;
737
765
  settings?: Settings;
@@ -787,8 +815,7 @@ declare module "pyrus-api" {
787
815
  AttachCallRecord = "/attachcallrecord",
788
816
  Bots = "/bots"
789
817
  }
790
- export type RoleResponse = ResponseBase & Role;
791
- export type RolesResponse = ResponseBase & {
818
+ export type RolesResponse = {
792
819
  roles: Role[];
793
820
  };
794
821
  export type UpdateRoleRequest = {
@@ -804,10 +831,10 @@ declare module "pyrus-api" {
804
831
  };
805
832
  class RoleApi extends BaseApi {
806
833
  protected _moduleSubPath: Endpoints;
807
- create(request: CreateRoleRequest): Promise<RoleResponse>;
808
- get({ id }: ById): Promise<RoleResponse>;
834
+ create(request: CreateRoleRequest): Promise<Role>;
835
+ get({ id }: ById): Promise<Role>;
809
836
  getAll(request?: GetAllRequest): Promise<RolesResponse>;
810
- update(request: UpdateRoleRequest): Promise<RoleResponse>;
837
+ update(request: UpdateRoleRequest): Promise<Role>;
811
838
  }
812
839
  export type Organization = {
813
840
  organization_id: number;
@@ -816,7 +843,7 @@ declare module "pyrus-api" {
816
843
  roles: Role[];
817
844
  department_catalog_id?: number;
818
845
  };
819
- export type ProfileResponse = ResponseBase & {
846
+ export type ProfileResponse = {
820
847
  person_id: number;
821
848
  first_name?: string;
822
849
  last_name?: string;
@@ -836,14 +863,14 @@ declare module "pyrus-api" {
836
863
  export type ContactsRequest = {
837
864
  include_inactive?: boolean;
838
865
  };
839
- export type ContactsResponse = ResponseBase & {
866
+ export type ContactsResponse = {
840
867
  organizations: Organization[];
841
868
  };
842
869
  class ContactsApi extends BaseApi {
843
870
  protected _moduleSubPath: Endpoints;
844
871
  getAll(request?: ContactsRequest): Promise<ContactsResponse>;
845
872
  }
846
- export type UploadResponse = ResponseBase & {
873
+ export type UploadResponse = {
847
874
  guid: string;
848
875
  md5_hash: string;
849
876
  };
@@ -869,7 +896,7 @@ declare module "pyrus-api" {
869
896
  export type TaskList = PlainTaskList & {
870
897
  children?: TaskList[];
871
898
  };
872
- export type ListsResponse = ResponseBase & {
899
+ export type ListsResponse = {
873
900
  lists: TaskList[];
874
901
  };
875
902
  export type TaskListRequest = {
@@ -882,7 +909,7 @@ declare module "pyrus-api" {
882
909
  */
883
910
  item_count?: number;
884
911
  };
885
- export type TaskListResponse = ResponseBase & {
912
+ export type TaskListResponse = {
886
913
  tasks: TaskHeader[];
887
914
  has_more: boolean;
888
915
  };
@@ -905,7 +932,6 @@ declare module "pyrus-api" {
905
932
  external_id?: number;
906
933
  is_private?: boolean;
907
934
  };
908
- export type PlainListResponse = ResponseBase & PlainTaskList;
909
935
  export type UpdateListRequest = {
910
936
  id: number;
911
937
  name?: string;
@@ -924,9 +950,10 @@ declare module "pyrus-api" {
924
950
  getAll(): Promise<ListsResponse>;
925
951
  getTasksInList(listId: number, request?: TaskListRequest): Promise<TaskListResponse>;
926
952
  getInbox(request?: InboxRequest): Promise<TaskListResponse>;
927
- create(request: CreateListRequest): Promise<PlainListResponse>;
928
- delete(request: ById): Promise<ResponseBase>;
929
- update(request: UpdateListRequest): Promise<PlainListResponse>;
953
+ create(request: CreateListRequest): Promise<PlainTaskList>;
954
+ get(request: ById): Promise<TaskList>;
955
+ delete(request: ById): Promise<void>;
956
+ update(request: UpdateListRequest): Promise<PlainTaskList>;
930
957
  }
931
958
  export type CalendarTasksRequest = {
932
959
  start_date_utc?: Date;
@@ -951,7 +978,7 @@ declare module "pyrus-api" {
951
978
  */
952
979
  filter_mask?: FilterMask;
953
980
  };
954
- export type CalendarResponse = ResponseBase & {
981
+ export type CalendarResponse = {
955
982
  tasks: TaskWithComments[];
956
983
  has_more: boolean;
957
984
  };
@@ -978,10 +1005,10 @@ declare module "pyrus-api" {
978
1005
  attachments?: AttachedFile[];
979
1006
  comments?: AnnouncementComment[];
980
1007
  };
981
- export type AnnouncementsResponse = ResponseBase & {
1008
+ export type AnnouncementsResponse = {
982
1009
  announcements: AnnouncementWithComments[];
983
1010
  };
984
- export type AnnouncementResponse = ResponseBase & {
1011
+ export type AnnouncementResponse = {
985
1012
  announcement: AnnouncementWithComments;
986
1013
  };
987
1014
  export type AnnouncementRequest = {
@@ -1017,7 +1044,7 @@ declare module "pyrus-api" {
1017
1044
  catalog_id: number;
1018
1045
  column_name: string;
1019
1046
  };
1020
- export type CatalogsResponse = ResponseBase & {
1047
+ export type CatalogsResponse = {
1021
1048
  catalogs: CatalogInfo[];
1022
1049
  };
1023
1050
  export type CatalogHeader = {
@@ -1031,7 +1058,7 @@ declare module "pyrus-api" {
1031
1058
  export type CatalogItemResponse = CatalogItem & {
1032
1059
  item_id: number;
1033
1060
  };
1034
- export type CatalogResponse = ResponseBase & {
1061
+ export type CatalogResponse = {
1035
1062
  catalog_id: number;
1036
1063
  name: string;
1037
1064
  external_id?: string;
@@ -1066,7 +1093,7 @@ declare module "pyrus-api" {
1066
1093
  apply: boolean;
1067
1094
  force_update_first_column?: boolean;
1068
1095
  };
1069
- export type SyncCatalogResponse = ResponseBase & {
1096
+ export type SyncCatalogResponse = {
1070
1097
  apply: boolean;
1071
1098
  added?: CatalogItemResponse[];
1072
1099
  deleted?: CatalogItemResponse[];
@@ -1087,10 +1114,9 @@ declare module "pyrus-api" {
1087
1114
  */
1088
1115
  sync(request: SyncCatalogRequest): Promise<SyncCatalogResponse>;
1089
1116
  }
1090
- export type MembersResponse = ResponseBase & {
1117
+ export type MembersResponse = {
1091
1118
  members: Person[];
1092
1119
  };
1093
- export type MemberResponse = ResponseBase & Person;
1094
1120
  export type CreateMemberRequest = {
1095
1121
  first_name?: string;
1096
1122
  last_name?: string;
@@ -1125,11 +1151,11 @@ declare module "pyrus-api" {
1125
1151
  * @param request
1126
1152
  * "email" and one of "first_name" or "last_name" are required
1127
1153
  */
1128
- create(request: CreateMemberRequest): Promise<MemberResponse>;
1129
- get({ id }: ById): Promise<MemberResponse>;
1154
+ create(request: CreateMemberRequest): Promise<Person>;
1155
+ get({ id }: ById): Promise<Person>;
1130
1156
  getAll(request?: GetAllRequest): Promise<MembersResponse>;
1131
- update(request: UpdateMemberRequest): Promise<MemberResponse>;
1132
- delete({ id }: ById): Promise<MemberResponse>;
1157
+ update(request: UpdateMemberRequest): Promise<Person>;
1158
+ delete({ id }: ById): Promise<Person>;
1133
1159
  }
1134
1160
  export type TaskRequest = {
1135
1161
  text?: string;
@@ -1145,7 +1171,7 @@ declare module "pyrus-api" {
1145
1171
  form_id?: number;
1146
1172
  attachments?: NewFile[];
1147
1173
  responsible?: PersonIdentity;
1148
- fields?: FormField[];
1174
+ fields?: FormFieldIdentified[];
1149
1175
  approvals?: PersonIdentity[][];
1150
1176
  subscribers?: PersonIdentity[];
1151
1177
  participants?: PersonIdentity[];
@@ -1168,7 +1194,7 @@ declare module "pyrus-api" {
1168
1194
  print_form_id: number;
1169
1195
  print_form_name?: string;
1170
1196
  };
1171
- export type FormResponse = ResponseBase & {
1197
+ export type FormResponse = {
1172
1198
  id: number;
1173
1199
  name: string;
1174
1200
  steps?: TaskSteps;
@@ -1208,13 +1234,13 @@ declare module "pyrus-api" {
1208
1234
  */
1209
1235
  item_count?: number;
1210
1236
  };
1211
- export type FormRegisterResponse = ResponseBase & {
1237
+ export type FormRegisterResponse = {
1212
1238
  tasks: Task[];
1213
1239
  };
1214
1240
  export type PermissionsDict = {
1215
1241
  [index: string | number]: PermissionLevel;
1216
1242
  };
1217
- export type PermissionsResponse = ResponseBase & {
1243
+ export type PermissionsResponse = {
1218
1244
  permissions: PermissionsDict;
1219
1245
  };
1220
1246
  export type ChangePermissionsRequest = {
@@ -1265,7 +1291,7 @@ declare module "pyrus-api" {
1265
1291
  */
1266
1292
  mappings?: FormMapping[];
1267
1293
  };
1268
- export type CallResponse = ResponseBase & {
1294
+ export type CallResponse = {
1269
1295
  task_id: number;
1270
1296
  };
1271
1297
  /**
@@ -1307,7 +1333,7 @@ declare module "pyrus-api" {
1307
1333
  class CallApi extends BaseApi {
1308
1334
  protected _moduleSubPath: Endpoints;
1309
1335
  registerCall(request: CallRequest): Promise<CallResponse>;
1310
- attachCallRecord(request: AttachCallRecordRequest): Promise<ResponseBase>;
1336
+ attachCallRecord(request: AttachCallRecordRequest): Promise<void>;
1311
1337
  }
1312
1338
  export type CreateBotRequest = {
1313
1339
  name: string;
@@ -1329,8 +1355,7 @@ declare module "pyrus-api" {
1329
1355
  locale?: string;
1330
1356
  time_zone_offset?: number;
1331
1357
  };
1332
- export type BotResponse = ResponseBase & Bot;
1333
- export type BotsResponse = ResponseBase & {
1358
+ export type BotsResponse = {
1334
1359
  bots: Bot[];
1335
1360
  };
1336
1361
  export type UpdateBotRequest = {
@@ -1351,11 +1376,10 @@ declare module "pyrus-api" {
1351
1376
  };
1352
1377
  class BotApi extends BaseApi {
1353
1378
  protected _moduleSubPath: Endpoints;
1354
- create(request: CreateBotRequest): Promise<BotResponse>;
1355
- get({ id }: ById): Promise<BotResponse>;
1379
+ create(request: CreateBotRequest): Promise<Bot>;
1356
1380
  getAll(request?: GetAllRequest): Promise<BotsResponse>;
1357
- update(request: UpdateBotRequest): Promise<BotResponse>;
1358
- delete(request: DeleteBotRequest): Promise<BotResponse>;
1381
+ update(request: UpdateBotRequest): Promise<Bot>;
1382
+ delete(request: DeleteBotRequest): Promise<Bot>;
1359
1383
  }
1360
1384
  export class PyrusApiClient extends BaseApi {
1361
1385
  private _role;