pyrus-api 1.0.2 → 2.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 (173) hide show
  1. package/build/cjs/index.cjs +240 -234
  2. package/build/esm/index.js +223 -231
  3. package/build/types/index.d.ts +1426 -51
  4. package/package.json +3 -2
  5. package/build/types/src/api/announcementsApi.d.ts +0 -14
  6. package/build/types/src/api/baseApi.d.ts +0 -21
  7. package/build/types/src/api/botApi.d.ts +0 -17
  8. package/build/types/src/api/calendarApi.d.ts +0 -8
  9. package/build/types/src/api/callApi.d.ts +0 -11
  10. package/build/types/src/api/catalogsApi.d.ts +0 -22
  11. package/build/types/src/api/contactsApi.d.ts +0 -8
  12. package/build/types/src/api/filesApi.d.ts +0 -8
  13. package/build/types/src/api/formsApi.d.ts +0 -17
  14. package/build/types/src/api/index.d.ts +0 -1
  15. package/build/types/src/api/listsApi.d.ts +0 -20
  16. package/build/types/src/api/logsApi.d.ts +0 -13
  17. package/build/types/src/api/membersApi.d.ts +0 -21
  18. package/build/types/src/api/profileApi.d.ts +0 -8
  19. package/build/types/src/api/pyrusApiClient.d.ts +0 -57
  20. package/build/types/src/api/roleApi.d.ts +0 -15
  21. package/build/types/src/api/tasksApi.d.ts +0 -18
  22. package/build/types/src/entities/TaskWithComments.d.ts +0 -7
  23. package/build/types/src/entities/announcementComment.d.ts +0 -12
  24. package/build/types/src/entities/announcementWithComments.d.ts +0 -13
  25. package/build/types/src/entities/approval.d.ts +0 -7
  26. package/build/types/src/entities/attachedFile.d.ts +0 -9
  27. package/build/types/src/entities/bot.d.ts +0 -15
  28. package/build/types/src/entities/catalogHeader.d.ts +0 -9
  29. package/build/types/src/entities/catalogInfo.d.ts +0 -19
  30. package/build/types/src/entities/catalogItem.d.ts +0 -12
  31. package/build/types/src/entities/channel.d.ts +0 -8
  32. package/build/types/src/entities/channelUser.d.ts +0 -4
  33. package/build/types/src/entities/columnSettings.d.ts +0 -6
  34. package/build/types/src/entities/commentDescription.d.ts +0 -6
  35. package/build/types/src/entities/department.d.ts +0 -7
  36. package/build/types/src/entities/dueFilter.d.ts +0 -3
  37. package/build/types/src/entities/formFieldInfo.d.ts +0 -21
  38. package/build/types/src/entities/formFields/formField.d.ts +0 -26
  39. package/build/types/src/entities/formFields/formFieldAuthor.d.ts +0 -7
  40. package/build/types/src/entities/formFields/formFieldBase.d.ts +0 -12
  41. package/build/types/src/entities/formFields/formFieldCatalog.d.ts +0 -15
  42. package/build/types/src/entities/formFields/formFieldCheckmark.d.ts +0 -7
  43. package/build/types/src/entities/formFields/formFieldCreateDate.d.ts +0 -6
  44. package/build/types/src/entities/formFields/formFieldDate.d.ts +0 -6
  45. package/build/types/src/entities/formFields/formFieldDueDate.d.ts +0 -6
  46. package/build/types/src/entities/formFields/formFieldDueDateTime.d.ts +0 -6
  47. package/build/types/src/entities/formFields/formFieldEmail.d.ts +0 -6
  48. package/build/types/src/entities/formFields/formFieldFile.d.ts +0 -7
  49. package/build/types/src/entities/formFields/formFieldFlag.d.ts +0 -7
  50. package/build/types/src/entities/formFields/formFieldFormLink.d.ts +0 -7
  51. package/build/types/src/entities/formFields/formFieldMoney.d.ts +0 -6
  52. package/build/types/src/entities/formFields/formFieldMultipleChoice.d.ts +0 -14
  53. package/build/types/src/entities/formFields/formFieldNewFile.d.ts +0 -5
  54. package/build/types/src/entities/formFields/formFieldNote.d.ts +0 -6
  55. package/build/types/src/entities/formFields/formFieldNumber.d.ts +0 -6
  56. package/build/types/src/entities/formFields/formFieldPerson.d.ts +0 -7
  57. package/build/types/src/entities/formFields/formFieldPhone.d.ts +0 -6
  58. package/build/types/src/entities/formFields/formFieldProject.d.ts +0 -15
  59. package/build/types/src/entities/formFields/formFieldStatus.d.ts +0 -7
  60. package/build/types/src/entities/formFields/formFieldStep.d.ts +0 -6
  61. package/build/types/src/entities/formFields/formFieldTable.d.ts +0 -14
  62. package/build/types/src/entities/formFields/formFieldText.d.ts +0 -6
  63. package/build/types/src/entities/formFields/formFieldTime.d.ts +0 -6
  64. package/build/types/src/entities/formFields/formFieldTitle.d.ts +0 -13
  65. package/build/types/src/entities/formLink.d.ts +0 -5
  66. package/build/types/src/entities/formMapping.d.ts +0 -16
  67. package/build/types/src/entities/newFile.d.ts +0 -7
  68. package/build/types/src/entities/organization.d.ts +0 -9
  69. package/build/types/src/entities/person.d.ts +0 -19
  70. package/build/types/src/entities/plainTaskList.d.ts +0 -15
  71. package/build/types/src/entities/printForm.d.ts +0 -4
  72. package/build/types/src/entities/role.d.ts +0 -10
  73. package/build/types/src/entities/sessionLifespan.d.ts +0 -4
  74. package/build/types/src/entities/sessionRestriction.d.ts +0 -9
  75. package/build/types/src/entities/settings.d.ts +0 -5
  76. package/build/types/src/entities/smsInfo.d.ts +0 -8
  77. package/build/types/src/entities/step.d.ts +0 -5
  78. package/build/types/src/entities/subscriber.d.ts +0 -6
  79. package/build/types/src/entities/task.d.ts +0 -26
  80. package/build/types/src/entities/taskComment.d.ts +0 -50
  81. package/build/types/src/entities/taskHeader.d.ts +0 -11
  82. package/build/types/src/entities/taskList.d.ts +0 -4
  83. package/build/types/src/enums/activityAction.d.ts +0 -4
  84. package/build/types/src/enums/approvalChoice.d.ts +0 -7
  85. package/build/types/src/enums/callEventType.d.ts +0 -3
  86. package/build/types/src/enums/callStatus.d.ts +0 -7
  87. package/build/types/src/enums/channelType.d.ts +0 -23
  88. package/build/types/src/enums/checkmark.d.ts +0 -4
  89. package/build/types/src/enums/disconnectParty.d.ts +0 -6
  90. package/build/types/src/enums/errorCodeType.d.ts +0 -123
  91. package/build/types/src/enums/filterMask.d.ts +0 -20
  92. package/build/types/src/enums/flag.d.ts +0 -5
  93. package/build/types/src/enums/formFieldType.d.ts +0 -27
  94. package/build/types/src/enums/listType.d.ts +0 -4
  95. package/build/types/src/enums/operatorId.d.ts +0 -9
  96. package/build/types/src/enums/permissionLevel.d.ts +0 -6
  97. package/build/types/src/enums/personRights.d.ts +0 -24
  98. package/build/types/src/enums/personType.d.ts +0 -5
  99. package/build/types/src/enums/sendSmsError.d.ts +0 -11
  100. package/build/types/src/enums/sendSmsStatus.d.ts +0 -6
  101. package/build/types/src/enums/sourceType.d.ts +0 -4
  102. package/build/types/src/enums/status.d.ts +0 -4
  103. package/build/types/src/helpers/constants.d.ts +0 -8
  104. package/build/types/src/helpers/functions.d.ts +0 -13
  105. package/build/types/src/helpers/types.d.ts +0 -4
  106. package/build/types/src/requests/announcementCommentRequest.d.ts +0 -6
  107. package/build/types/src/requests/announcementRequest.d.ts +0 -6
  108. package/build/types/src/requests/attachCallRecordRequest.d.ts +0 -37
  109. package/build/types/src/requests/authRequest.d.ts +0 -11
  110. package/build/types/src/requests/calendarTasksRequest.d.ts +0 -24
  111. package/build/types/src/requests/callRequest.d.ts +0 -27
  112. package/build/types/src/requests/catalogRequestBase.d.ts +0 -15
  113. package/build/types/src/requests/changePermissionsRequest.d.ts +0 -4
  114. package/build/types/src/requests/contactsRequest.d.ts +0 -3
  115. package/build/types/src/requests/createBotRequest.d.ts +0 -5
  116. package/build/types/src/requests/createCallRequest.d.ts +0 -6
  117. package/build/types/src/requests/createCatalogRequest.d.ts +0 -6
  118. package/build/types/src/requests/createDepartmentRequest.d.ts +0 -6
  119. package/build/types/src/requests/createListRequest.d.ts +0 -12
  120. package/build/types/src/requests/createMemberRequest.d.ts +0 -12
  121. package/build/types/src/requests/createRoleRequest.d.ts +0 -5
  122. package/build/types/src/requests/deleteBotRequest.d.ts +0 -4
  123. package/build/types/src/requests/deleteRoleRequest.d.ts +0 -4
  124. package/build/types/src/requests/formFilter.d.ts +0 -6
  125. package/build/types/src/requests/formRegisterRequest.d.ts +0 -26
  126. package/build/types/src/requests/getAllRequest.d.ts +0 -3
  127. package/build/types/src/requests/getMessageRequest.d.ts +0 -10
  128. package/build/types/src/requests/inboxRequest.d.ts +0 -8
  129. package/build/types/src/requests/personIdentity.d.ts +0 -4
  130. package/build/types/src/requests/profileRequest.d.ts +0 -3
  131. package/build/types/src/requests/setAvatarRequest.d.ts +0 -4
  132. package/build/types/src/requests/syncCatalogRequest.d.ts +0 -6
  133. package/build/types/src/requests/taskCommentRequest.d.ts +0 -39
  134. package/build/types/src/requests/taskListRequest.d.ts +0 -10
  135. package/build/types/src/requests/taskRequest.d.ts +0 -24
  136. package/build/types/src/requests/updateBotRequest.d.ts +0 -13
  137. package/build/types/src/requests/updateDepartmentRequest.d.ts +0 -8
  138. package/build/types/src/requests/updateListRequest.d.ts +0 -14
  139. package/build/types/src/requests/updateMemberRequest.d.ts +0 -15
  140. package/build/types/src/requests/updateRoleRequest.d.ts +0 -8
  141. package/build/types/src/responses/announcementResponse.d.ts +0 -5
  142. package/build/types/src/responses/announcementsResponse.d.ts +0 -5
  143. package/build/types/src/responses/authResponse.d.ts +0 -6
  144. package/build/types/src/responses/botResponse.d.ts +0 -3
  145. package/build/types/src/responses/botsResponse.d.ts +0 -5
  146. package/build/types/src/responses/calendarResponse.d.ts +0 -6
  147. package/build/types/src/responses/callResponse.d.ts +0 -4
  148. package/build/types/src/responses/catalogItemResponse.d.ts +0 -4
  149. package/build/types/src/responses/catalogResponse.d.ts +0 -18
  150. package/build/types/src/responses/contactsResponse.d.ts +0 -5
  151. package/build/types/src/responses/departmentResponse.d.ts +0 -3
  152. package/build/types/src/responses/departmentsResponse.d.ts +0 -5
  153. package/build/types/src/responses/formRegisterResponse.d.ts +0 -5
  154. package/build/types/src/responses/formResponse.d.ts +0 -17
  155. package/build/types/src/responses/formsResponse.d.ts +0 -4
  156. package/build/types/src/responses/listsResponse.d.ts +0 -5
  157. package/build/types/src/responses/memberResponse.d.ts +0 -3
  158. package/build/types/src/responses/membersResponse.d.ts +0 -5
  159. package/build/types/src/responses/permissionsDict.d.ts +0 -4
  160. package/build/types/src/responses/permissionsResponse.d.ts +0 -5
  161. package/build/types/src/responses/plainListResponse.d.ts +0 -3
  162. package/build/types/src/responses/profileIdentityResponse.d.ts +0 -5
  163. package/build/types/src/responses/profileResponse.d.ts +0 -12
  164. package/build/types/src/responses/responseBase.d.ts +0 -6
  165. package/build/types/src/responses/roleResponse.d.ts +0 -3
  166. package/build/types/src/responses/rolesResponse.d.ts +0 -5
  167. package/build/types/src/responses/syncCatalogResponse.d.ts +0 -10
  168. package/build/types/src/responses/taskListResponse.d.ts +0 -6
  169. package/build/types/src/responses/taskResponse.d.ts +0 -5
  170. package/build/types/src/responses/uploadResponse.d.ts +0 -5
  171. package/build/types/src/responses//321/201atalogsResponse.d.ts +0 -5
  172. package/build/types/src/settings/defaults.d.ts +0 -2
  173. package/build/types/src/settings/endpoints.d.ts +0 -32
@@ -1,51 +1,1426 @@
1
- export { toDateString, toDateTimeString, toTimeString, } from "./src/helpers/functions";
2
- export { FilterMask } from "./src/enums/filterMask";
3
- export { CallEventType } from "./src/enums/callEventType";
4
- export { SourceType } from "./src/enums/sourceType";
5
- export { OperatorId } from "./src/enums/operatorId";
6
- export { ActivityAction } from "./src/enums/activityAction";
7
- export { ApprovalChoice } from "./src/enums/approvalChoice";
8
- export { PersonRights } from "./src/enums/personRights";
9
- export { ListType } from "./src/enums/listType";
10
- export { ErrorCodeType } from "./src/enums/errorCodeType";
11
- export { Flag } from "./src/enums/flag";
12
- export { FormFieldType } from "./src/enums/formFieldType";
13
- export { PermissionLevel } from "./src/enums/permissionLevel";
14
- export { PersonType } from "./src/enums/personType";
15
- export { SendSmsError } from "./src/enums/sendSmsError";
16
- export { SendSmsStatus } from "./src/enums/sendSmsStatus";
17
- export type { NewFile } from "./src/entities/newFile";
18
- export type { FormMapping } from "./src/entities/formMapping";
19
- export type { CatalogItem } from "./src/entities/catalogItem";
20
- export type { ColumnSettings } from "./src/entities/columnSettings";
21
- export type { DueFilter } from "./src/entities/dueFilter";
22
- export type { FormFilter } from "./src/requests/formFilter";
23
- export type { CommentDescription } from "./src/entities/commentDescription";
24
- export type { Channel } from "./src/entities/channel";
25
- export type { PersonIdentity } from "./src/requests/personIdentity";
26
- export type { FormFieldAuthor } from "./src/entities/formFields/formFieldAuthor";
27
- export type { FormFieldCatalog } from "./src/entities/formFields/formFieldCatalog";
28
- export type { FormFieldCheckmark } from "./src/entities/formFields/formFieldCheckmark";
29
- export type { FormFieldCreateDate } from "./src/entities/formFields/formFieldCreateDate";
30
- export type { FormFieldDate } from "./src/entities/formFields/formFieldDate";
31
- export type { FormFieldDueDate } from "./src/entities/formFields/formFieldDueDate";
32
- export type { FormFieldDueDateTime } from "./src/entities/formFields/formFieldDueDateTime";
33
- export type { FormFieldEmail } from "./src/entities/formFields/formFieldEmail";
34
- export type { FormFieldFile } from "./src/entities/formFields/formFieldFile";
35
- export type { FormFieldFlag } from "./src/entities/formFields/formFieldFlag";
36
- export type { FormFieldFormLink } from "./src/entities/formFields/formFieldFormLink";
37
- export type { FormFieldMoney } from "./src/entities/formFields/formFieldMoney";
38
- export type { FormFieldMultipleChoice } from "./src/entities/formFields/formFieldMultipleChoice";
39
- export type { FormFieldNewFile } from "./src/entities/formFields/formFieldNewFile";
40
- export type { FormFieldNote } from "./src/entities/formFields/formFieldNote";
41
- export type { FormFieldNumber } from "./src/entities/formFields/formFieldNumber";
42
- export type { FormFieldPerson } from "./src/entities/formFields/formFieldPerson";
43
- export type { FormFieldPhone } from "./src/entities/formFields/formFieldPhone";
44
- export type { FormFieldProject } from "./src/entities/formFields/formFieldProject";
45
- export type { FormFieldStatus } from "./src/entities/formFields/formFieldStatus";
46
- export type { FormFieldStep } from "./src/entities/formFields/formFieldStep";
47
- export type { FormFieldTable } from "./src/entities/formFields/formFieldTable";
48
- export type { FormFieldText } from "./src/entities/formFields/formFieldText";
49
- export type { FormFieldTime } from "./src/entities/formFields/formFieldTime";
50
- export type { FormFieldTitle } from "./src/entities/formFields/formFieldTitle";
51
- export { PyrusApiClient } from "./src/api";
1
+ declare module "pyrus-api" {
2
+ export enum OperatorId {
3
+ Equals = 1,
4
+ LessThan = 2,
5
+ GreaterThan = 3,
6
+ IsIn = 4,
7
+ Range = 5,
8
+ MatchPrefix = 6,
9
+ IsEmpty = 7
10
+ }
11
+ export type FormFilter = {
12
+ field_id: number;
13
+ operator_id: OperatorId;
14
+ values: string[];
15
+ };
16
+ export function toDateTimeString(date: Date | string): string;
17
+ export function toDateString(date: Date | string): string;
18
+ export function toTimeString(date: Date | string): string;
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: {
157
+ /**
158
+ * Events whose deadline is indicated in UTC+0
159
+ */
160
+ readonly Due: 1;
161
+ /**
162
+ * Tasks whose deadline is indicated by date
163
+ * (without reference to timezone)
164
+ */
165
+ readonly DueDate: 2;
166
+ /**
167
+ * Tasks whose deadline at the current step is
168
+ * within the selected time period in UTC+0
169
+ */
170
+ readonly DueForCurrentStep: 4;
171
+ /**
172
+ * Tasks with a programmed reminder
173
+ */
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];
199
+ export enum PersonRights {
200
+ None = 0,
201
+ ManageRoles = 1,
202
+ CanSeeAllTasks = 2,
203
+ ManagePersonsInOrganization = 4,
204
+ EditOrganizationProjects = 8,
205
+ EditOrganizationSettings = 16,
206
+ DeleteMyTasksAndProjects = 32,
207
+ CloseDeleteAnnouncements = 64,
208
+ BillsPayment = 128,
209
+ InvitePersonsToOrganization = 256,
210
+ DeleteOtherMembersTasks = 512,
211
+ ManageIntegrationsAndCatalogs = 1024,
212
+ CreateAnnouncement = 2048,
213
+ CanDeleteTaskFlagEquivalent = 544,
214
+ SupervisorRights = 221,
215
+ MaxAdditionalRights = 2047,
216
+ NewOrganizationDefaultRights = 2080,
217
+ UIOrganizationManager = 277,
218
+ UIAccountant = 128,
219
+ UISupervisor = 10,
220
+ UIConfigurationManager = 1600,
221
+ UIAdministrator = 2015
222
+ }
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];
294
+ export type NewFile = {
295
+ guid?: string;
296
+ root_id?: number;
297
+ attachment_id?: number;
298
+ url?: string;
299
+ name?: string;
300
+ };
301
+ /**
302
+ * Data for autofilling form fields
303
+ */
304
+ export type FormMapping = {
305
+ /**
306
+ * Pyrus form field symbol code
307
+ */
308
+ code: string;
309
+ /**
310
+ * Pyrus field value
311
+ *
312
+ * @remarks
313
+ * 300 symbols max
314
+ */
315
+ value: string;
316
+ };
317
+ export type CatalogItem = {
318
+ item_id?: number;
319
+ external_id?: number;
320
+ values: string[];
321
+ deleted?: boolean;
322
+ links?: CatalogItemLink[];
323
+ };
324
+ export type CatalogItemLink = {
325
+ item_id: number;
326
+ catalog_id: number;
327
+ };
328
+ export type ColumnSettings = {
329
+ original_position?: number;
330
+ sort_order?: number;
331
+ visible?: boolean;
332
+ group_by?: boolean;
333
+ };
334
+ export type DueFilter = {
335
+ overdue_steps: number[];
336
+ };
337
+ export type FormFieldInfo = {
338
+ required_step?: number;
339
+ immutable_step?: number;
340
+ options?: ChoiceOption[];
341
+ catalog_id?: number;
342
+ columns?: FormField[];
343
+ fields?: FormField[];
344
+ form_id?: number;
345
+ code?: string;
346
+ decimal_places?: number;
347
+ multiple_choice?: boolean;
348
+ multiline?: boolean;
349
+ };
350
+ export type ChoiceOption = {
351
+ choice_id: number;
352
+ choice_value: string;
353
+ deleted: boolean;
354
+ fields: FormField[];
355
+ };
356
+ export type FormFieldBase = {
357
+ id?: number;
358
+ type?: FormFieldType;
359
+ name?: string;
360
+ info?: FormFieldInfo;
361
+ parent_id?: number;
362
+ row_id?: number;
363
+ code?: string;
364
+ };
365
+ export type Person = {
366
+ id: number;
367
+ first_name: string;
368
+ last_name: string;
369
+ native_first_name?: string;
370
+ native_last_name?: string;
371
+ email: string;
372
+ status?: string;
373
+ type: PersonType;
374
+ department_id?: string;
375
+ department_name?: string;
376
+ banned: boolean;
377
+ fired?: boolean;
378
+ task_receiver?: number;
379
+ position: string;
380
+ skype: string;
381
+ phone: string;
382
+ };
383
+ export type FormFieldAuthor = FormFieldBase & {
384
+ type?: typeof FormFieldType.Author;
385
+ value?: Person;
386
+ };
387
+ export type FormFieldCatalog = FormFieldBase & {
388
+ type?: typeof FormFieldType.Catalog;
389
+ value?: Catalog;
390
+ };
391
+ export type Catalog = {
392
+ item_id: number;
393
+ item_ids?: number[];
394
+ item_names?: string[];
395
+ headers?: string[];
396
+ values?: string[];
397
+ rows?: string[][];
398
+ };
399
+ const Checkmark: {
400
+ readonly Checked: "checked";
401
+ readonly Unchecked: "unchecked";
402
+ };
403
+ export type Checkmark = typeof Checkmark[keyof typeof Checkmark];
404
+ export type FormFieldCheckmark = FormFieldBase & {
405
+ type?: typeof FormFieldType.Checkmark;
406
+ value?: Checkmark;
407
+ };
408
+ export type FormFieldCreateDate = FormFieldBase & {
409
+ type: typeof FormFieldType.CreationDate;
410
+ value?: Date;
411
+ };
412
+ export type FormFieldDate = FormFieldBase & {
413
+ type: typeof FormFieldType.Date;
414
+ value?: Date;
415
+ };
416
+ export type FormFieldDueDate = FormFieldBase & {
417
+ type: typeof FormFieldType.DueDate;
418
+ value?: Date;
419
+ };
420
+ export type FormFieldDueDateTime = FormFieldBase & {
421
+ type: typeof FormFieldType.DueDateTime;
422
+ value?: Date;
423
+ };
424
+ export type FormFieldEmail = FormFieldBase & {
425
+ type?: typeof FormFieldType.Email;
426
+ value?: string;
427
+ };
428
+ export type AttachedFile = {
429
+ id: number;
430
+ name: string;
431
+ size: number;
432
+ md5: string;
433
+ url: string;
434
+ version: number;
435
+ root_id?: number;
436
+ };
437
+ export type FormFieldFile = FormFieldBase & {
438
+ type?: typeof FormFieldType.File;
439
+ value?: AttachedFile[];
440
+ };
441
+ export type FormFieldFlag = FormFieldBase & {
442
+ type?: typeof FormFieldType.Flag;
443
+ value?: Flag;
444
+ };
445
+ export type FormLink = {
446
+ task_id?: number;
447
+ task_ids?: number[];
448
+ subject?: string;
449
+ };
450
+ export type FormFieldFormLink = FormFieldBase & {
451
+ type?: typeof FormFieldType.FormLink;
452
+ value?: FormLink;
453
+ };
454
+ export type FormFieldMoney = FormFieldBase & {
455
+ type?: typeof FormFieldType.Money;
456
+ value?: number;
457
+ };
458
+ export type FormFieldMultipleChoice = FormFieldBase & {
459
+ type?: typeof FormFieldType.MultipleChoice;
460
+ value?: MultipleChoice;
461
+ };
462
+ export type MultipleChoice = {
463
+ choice_id?: number;
464
+ choice_ids?: number[];
465
+ choice_names?: string[];
466
+ fields?: FormField[];
467
+ };
468
+ export type FormFieldNewFile = FormFieldFile & {
469
+ value?: NewFile[];
470
+ };
471
+ export type FormFieldNote = FormFieldBase & {
472
+ type?: typeof FormFieldType.Note;
473
+ value?: string;
474
+ };
475
+ export type FormFieldNumber = FormFieldBase & {
476
+ type?: typeof FormFieldType.Number;
477
+ value?: number;
478
+ };
479
+ export type FormFieldPerson = FormFieldBase & {
480
+ type?: typeof FormFieldType.Person;
481
+ value?: Person;
482
+ };
483
+ export type FormFieldPhone = FormFieldBase & {
484
+ type?: typeof FormFieldType.Phone;
485
+ value?: string;
486
+ };
487
+ export type FormFieldProject = FormFieldBase & {
488
+ type?: typeof FormFieldType.Project;
489
+ value?: ProjectArray;
490
+ };
491
+ export type ProjectArray = {
492
+ projects: Project[];
493
+ };
494
+ export type Project = {
495
+ id: number;
496
+ name?: string;
497
+ parent?: Project;
498
+ };
499
+ const Status: {
500
+ readonly Open: "open";
501
+ readonly Closed: "closed";
502
+ };
503
+ export type Status = typeof Status[keyof typeof Status];
504
+ export type FormFieldStatus = FormFieldBase & {
505
+ type?: typeof FormFieldType.Status;
506
+ value?: Status;
507
+ };
508
+ export type FormFieldStep = FormFieldBase & {
509
+ type?: typeof FormFieldType.Step;
510
+ value?: number;
511
+ };
512
+ export type FormFieldTable = FormFieldBase & {
513
+ type?: typeof FormFieldType.Table;
514
+ value?: TableRow[];
515
+ };
516
+ export type TableRow = {
517
+ row_id: number;
518
+ cells?: FormField[];
519
+ delete?: boolean;
520
+ deleted?: boolean;
521
+ };
522
+ export type FormFieldText = FormFieldBase & {
523
+ type?: typeof FormFieldType.Text;
524
+ value?: string;
525
+ };
526
+ export type FormFieldTime = FormFieldBase & {
527
+ type: typeof FormFieldType.Time;
528
+ value?: Date;
529
+ };
530
+ export type FormFieldTitle = FormFieldBase & {
531
+ type?: typeof FormFieldType.Title;
532
+ value?: Title;
533
+ };
534
+ export type Title = {
535
+ checkmark?: Checkmark;
536
+ fields?: FormField[];
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
+ };
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;
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];
573
+ export type ChannelUser = {
574
+ email?: string;
575
+ name?: string;
576
+ };
577
+ export type Channel = {
578
+ type: ChannelType;
579
+ phone?: string;
580
+ to?: ChannelUser;
581
+ from?: ChannelUser;
582
+ };
583
+ export type PersonIdentity = {
584
+ id: number;
585
+ } | {
586
+ email: string;
587
+ };
588
+ export type TaskCommentRequest = {
589
+ text?: string;
590
+ formatted_text?: string;
591
+ subject?: string;
592
+ approval_choice?: ApprovalChoice;
593
+ reassign_to?: PersonIdentity;
594
+ approval_steps?: number[];
595
+ action?: ActivityAction;
596
+ attachments?: NewFile[];
597
+ field_updates?: FormFieldIdentified[];
598
+ approvals_added?: PersonIdentity[][];
599
+ approvals_removed?: PersonIdentity[][];
600
+ approvals_rerequested?: PersonIdentity[][];
601
+ subscribers_added?: PersonIdentity[];
602
+ subscribers_removed?: PersonIdentity[];
603
+ subscribers_rerequested?: PersonIdentity[];
604
+ participants_added?: PersonIdentity[];
605
+ participants_removed?: PersonIdentity[];
606
+ due_date?: Date;
607
+ due?: Date;
608
+ duration?: number;
609
+ cancel_due?: boolean;
610
+ scheduled_date?: Date;
611
+ scheduled_datetime_utc?: Date;
612
+ cancel_schedule?: boolean;
613
+ added_list_ids?: number[];
614
+ removed_list_ids?: number[];
615
+ channel?: Channel;
616
+ spent_minutes?: number;
617
+ skip_satisfaction?: boolean;
618
+ edit_comment_id?: number;
619
+ skip_notification?: boolean;
620
+ };
621
+ export type CommentDescription = {
622
+ task_id: number;
623
+ previous_note_id: number;
624
+ comment: TaskCommentRequest;
625
+ };
626
+ export type Approval = {
627
+ person: Person;
628
+ approval_choice?: ApprovalChoice;
629
+ step?: number;
630
+ };
631
+ export type Subscriber = {
632
+ person: Person;
633
+ approval_choice?: ApprovalChoice;
634
+ };
635
+ export type TaskHeader = {
636
+ id: number;
637
+ text: string;
638
+ create_date: Date;
639
+ last_modified_date: Date;
640
+ author: Person;
641
+ close_date?: Date;
642
+ responsible?: Person;
643
+ due_date?: Date;
644
+ };
645
+ export type Task = TaskHeader & {
646
+ due_date?: Date;
647
+ due?: Date;
648
+ scheduled_date?: Date;
649
+ scheduled_datetime_utc?: Date;
650
+ cancel_schedule?: boolean;
651
+ duration?: number;
652
+ form_id?: number;
653
+ attachments?: AttachedFile[];
654
+ fields?: FormField[];
655
+ approvals?: Approval[][];
656
+ subscribers?: Subscriber[];
657
+ participants?: Person[];
658
+ list_ids?: number[];
659
+ linked_task_ids?: number[];
660
+ parent_task_id?: number;
661
+ last_note_id?: number;
662
+ subject?: string;
663
+ is_closed: boolean;
664
+ };
665
+ export type Role = {
666
+ id: number;
667
+ name: string;
668
+ external_id?: string;
669
+ avatar_id?: number;
670
+ external_avatar_id?: number;
671
+ banned: boolean;
672
+ fired?: boolean;
673
+ member_ids: number[];
674
+ };
675
+ export type SmsInfo = {
676
+ error_code?: SendSmsError;
677
+ status: SendSmsStatus;
678
+ error_message?: string;
679
+ sent_comment_id: number;
680
+ };
681
+ export type TaskComment = {
682
+ id: number;
683
+ text: string;
684
+ formatted_text?: string;
685
+ mentions?: number[];
686
+ subject?: string;
687
+ create_date: Date;
688
+ author: Person;
689
+ reassigned_to?: Person;
690
+ field_updates?: FormField[];
691
+ approval_choice?: ApprovalChoice;
692
+ reset_to_step?: number;
693
+ reply_note_id?: number;
694
+ approvals_added?: Approval[][];
695
+ approvals_removed?: Approval[][];
696
+ approvals_rerequested?: Approval[][];
697
+ subscribers_added?: Person[];
698
+ subscribers_removed?: Person[];
699
+ participants_added?: Person[];
700
+ participants_removed?: Person[];
701
+ due_date?: Date;
702
+ due?: Date;
703
+ scheduled_date?: Date;
704
+ scheduled_datetime_utc?: Date;
705
+ cancel_schedule?: boolean;
706
+ duration?: number;
707
+ attachments?: AttachedFile[];
708
+ action?: ActivityAction;
709
+ added_list_ids?: number[];
710
+ removed_list_ids?: number[];
711
+ approval_step?: number;
712
+ comment_as_roles?: Role[];
713
+ changed_step?: number;
714
+ channel?: Channel;
715
+ edit_comment_id?: number;
716
+ removed_attachment_ids?: number[];
717
+ delete_comment_id?: number;
718
+ spent_minutes?: number;
719
+ skip_satisfaction?: boolean;
720
+ sms_info?: SmsInfo;
721
+ };
722
+ export type Step = {
723
+ step: number;
724
+ elapsed_time: number;
725
+ name?: string;
726
+ };
727
+ export type TaskWithComments = Task & {
728
+ comments: TaskComment[];
729
+ steps?: Step[];
730
+ };
731
+ export type TaskResponse = {
732
+ task: TaskWithComments;
733
+ };
734
+ export type BotHookRequest = TaskResponse & {
735
+ event: "Comment" | "Close";
736
+ access_token: string;
737
+ user_id: number;
738
+ bot_settings: string;
739
+ task_id: number;
740
+ };
741
+ export type BotHookResponse = TaskCommentRequest | void;
742
+ export type AuthRequest = {
743
+ login: string;
744
+ security_key: string;
745
+ /**
746
+ * Employee ID
747
+ * @remarks
748
+ * if you have more than one account registered to the same email,
749
+ * then to receive a token you need to add the person_id parameter
750
+ */
751
+ person_id?: string;
752
+ };
753
+ export type Settings = {
754
+ apiUrl?: string;
755
+ authUrl: string;
756
+ filesUrl?: string;
757
+ };
758
+ export type AuthResponse = {
759
+ access_token: string;
760
+ api_url?: string;
761
+ files_url?: string;
762
+ };
763
+ export interface BaseApiParams {
764
+ token?: string;
765
+ settings?: Settings;
766
+ authRequest?: Promise<AuthResponse>;
767
+ }
768
+ abstract class BaseApi {
769
+ protected _token: string;
770
+ protected _settings: Settings;
771
+ protected _authRequest: Promise<AuthResponse>;
772
+ protected _moduleSubPath: string;
773
+ protected constructor({ token, authRequest, settings }: BaseApiParams);
774
+ protected loginDone(): Promise<void>;
775
+ protected fetchApi<T>(url: string, method: HTTPMethod, body?: BodyInit, headersOverride?: HeadersInit): Promise<T>;
776
+ protected _checkResponse(resp: Response): Promise<any>;
777
+ protected getModulePath(): Promise<string>;
778
+ protected authorisationHeader(): Promise<Record<string, string>>;
779
+ private defaultHeaders;
780
+ }
781
+ export type CreateRoleRequest = {
782
+ name: string;
783
+ external_id?: string;
784
+ member_add?: number[];
785
+ };
786
+ enum Endpoints {
787
+ Auth = "/auth",
788
+ Roles = "/roles",
789
+ Profile = "/profile",
790
+ Contacts = "/contacts",
791
+ Files = "/files",
792
+ V4 = "/v4",
793
+ Upload = "/upload",
794
+ Download = "/download",
795
+ Lists = "/lists",
796
+ Inbox = "/inbox",
797
+ ListTasks = "/tasks",
798
+ Calendar = "/calendar",
799
+ Announcements = "/announcements",
800
+ AnnouncementComments = "/comments",
801
+ Catalogs = "/catalogs",
802
+ Members = "/members",
803
+ Tasks = "/tasks",
804
+ TasksComments = "/comments",
805
+ Forms = "/forms",
806
+ FormsRegister = "/register",
807
+ FormsPermissions = "/permissions",
808
+ EventHistory = "/eventhistory",
809
+ FileAccessHistory = "/fileaccesshistory",
810
+ TaskAccessHistory = "/taskaccesshistory",
811
+ TaskExportHistory = "/taskexporthistory",
812
+ RegistryDownloadHistory = "/registrydownloadhistory",
813
+ Integrations = "/integrations",
814
+ Call = "/call",
815
+ AttachCallRecord = "/attachcallrecord",
816
+ Bots = "/bots"
817
+ }
818
+ export type RolesResponse = {
819
+ roles: Role[];
820
+ };
821
+ export type UpdateRoleRequest = {
822
+ id: number;
823
+ name?: string;
824
+ external_id?: string;
825
+ banned?: boolean;
826
+ member_add?: number[];
827
+ member_remove?: number[];
828
+ };
829
+ export type GetAllRequest = {
830
+ include_fired: boolean;
831
+ };
832
+ class RoleApi extends BaseApi {
833
+ protected _moduleSubPath: Endpoints;
834
+ create(request: CreateRoleRequest): Promise<Role>;
835
+ get({ id }: ById): Promise<Role>;
836
+ getAll(request?: GetAllRequest): Promise<RolesResponse>;
837
+ update(request: UpdateRoleRequest): Promise<Role>;
838
+ }
839
+ export type Organization = {
840
+ organization_id: number;
841
+ name: string;
842
+ persons: Person[];
843
+ roles: Role[];
844
+ department_catalog_id?: number;
845
+ };
846
+ export type ProfileResponse = {
847
+ person_id: number;
848
+ first_name?: string;
849
+ last_name?: string;
850
+ email: string;
851
+ locale?: string;
852
+ organization_id: number;
853
+ organization: Organization;
854
+ timezone_offset?: number;
855
+ };
856
+ export type ProfileRequest = {
857
+ include_inactive: boolean;
858
+ };
859
+ class ProfileApi extends BaseApi {
860
+ protected _moduleSubPath: Endpoints;
861
+ get(request?: ProfileRequest): Promise<ProfileResponse>;
862
+ }
863
+ export type ContactsRequest = {
864
+ include_inactive?: boolean;
865
+ };
866
+ export type ContactsResponse = {
867
+ organizations: Organization[];
868
+ };
869
+ class ContactsApi extends BaseApi {
870
+ protected _moduleSubPath: Endpoints;
871
+ getAll(request?: ContactsRequest): Promise<ContactsResponse>;
872
+ }
873
+ export type UploadResponse = {
874
+ guid: string;
875
+ md5_hash: string;
876
+ };
877
+ class FilesApi extends BaseApi {
878
+ upload(file: Blob, filename: string): Promise<UploadResponse>;
879
+ download({ id }: ById): Promise<Blob>;
880
+ private _filePath;
881
+ }
882
+ export type PlainTaskList = {
883
+ id: number;
884
+ parent_id?: number;
885
+ name: string;
886
+ color?: string;
887
+ deleted: boolean;
888
+ list_type: ListType;
889
+ has_form?: boolean;
890
+ manager_ids: number[];
891
+ member_ids?: number[];
892
+ version: number;
893
+ external_version?: number;
894
+ external_id?: number;
895
+ };
896
+ export type TaskList = PlainTaskList & {
897
+ children?: TaskList[];
898
+ };
899
+ export type ListsResponse = {
900
+ lists: TaskList[];
901
+ };
902
+ export type TaskListRequest = {
903
+ include_archived?: "y";
904
+ modified_before?: Date;
905
+ modified_after?: Date;
906
+ /**
907
+ * @remarks
908
+ * Default: 200
909
+ */
910
+ item_count?: number;
911
+ };
912
+ export type TaskListResponse = {
913
+ tasks: TaskHeader[];
914
+ has_more: boolean;
915
+ };
916
+ export type InboxRequest = {
917
+ /**
918
+ * The maximum number of tasks in the response
919
+ * @remarks
920
+ * default: 50
921
+ */
922
+ item_count: number;
923
+ };
924
+ export type CreateListRequest = {
925
+ parent_id?: number;
926
+ name: string;
927
+ color?: string;
928
+ list_type?: ListType;
929
+ added_managers?: number[];
930
+ added_members?: number[];
931
+ external_version?: number;
932
+ external_id?: number;
933
+ is_private?: boolean;
934
+ };
935
+ export type UpdateListRequest = {
936
+ id: number;
937
+ name?: string;
938
+ color?: string;
939
+ list_type?: ListType;
940
+ added_managers?: number[];
941
+ removed_managers?: number[];
942
+ added_members?: number[];
943
+ removed_members?: number[];
944
+ external_version?: number;
945
+ external_id?: number;
946
+ is_private?: boolean;
947
+ };
948
+ class ListsApi extends BaseApi {
949
+ protected _moduleSubPath: Endpoints;
950
+ getAll(): Promise<ListsResponse>;
951
+ getTasksInList(listId: number, request?: TaskListRequest): Promise<TaskListResponse>;
952
+ getInbox(request?: InboxRequest): Promise<TaskListResponse>;
953
+ create(request: CreateListRequest): Promise<PlainTaskList>;
954
+ delete(request: ById): Promise<void>;
955
+ update(request: UpdateListRequest): Promise<PlainTaskList>;
956
+ }
957
+ export type CalendarTasksRequest = {
958
+ start_date_utc?: Date;
959
+ end_date_utc: Date;
960
+ /**
961
+ * Maximum number of tasks that will be returned in reply
962
+ * @remarks
963
+ * 50 default, 100 max
964
+ */
965
+ item_count?: number;
966
+ /**
967
+ * @remarks
968
+ * Whether all tasks accessible to user must be returned,
969
+ * including all roles of user and all tasks from forms
970
+ * accessible to user. Otherwise, only tasks where the user
971
+ * is an assignee or approver, that have not yet been approved,
972
+ * will be returned.
973
+ */
974
+ all_accessed_tasks?: boolean;
975
+ /**
976
+ * Bit mask that determines filter combination
977
+ */
978
+ filter_mask?: FilterMask;
979
+ };
980
+ export type CalendarResponse = {
981
+ tasks: TaskWithComments[];
982
+ has_more: boolean;
983
+ };
984
+ class CalendarApi extends BaseApi {
985
+ protected _moduleSubPath: Endpoints;
986
+ getTasks(request: CalendarTasksRequest): Promise<CalendarResponse>;
987
+ }
988
+ export type AnnouncementComment = {
989
+ id: number;
990
+ text?: string;
991
+ formatted_text?: string;
992
+ create_date: Date;
993
+ author: Person;
994
+ attachments?: AttachedFile[];
995
+ comments?: TaskComment[];
996
+ };
997
+ export type AnnouncementWithComments = {
998
+ id: number;
999
+ text: string;
1000
+ formatted_text: string;
1001
+ create_date: Date;
1002
+ last_modified_date: Date;
1003
+ author: Person;
1004
+ attachments?: AttachedFile[];
1005
+ comments?: AnnouncementComment[];
1006
+ };
1007
+ export type AnnouncementsResponse = {
1008
+ announcements: AnnouncementWithComments[];
1009
+ };
1010
+ export type AnnouncementResponse = {
1011
+ announcement: AnnouncementWithComments;
1012
+ };
1013
+ export type AnnouncementRequest = {
1014
+ text: string;
1015
+ formatted_text?: string;
1016
+ attachments?: NewFile[];
1017
+ };
1018
+ export type AnnouncementCommentRequest = {
1019
+ text?: string;
1020
+ formatted_text?: string;
1021
+ attachments?: NewFile[];
1022
+ };
1023
+ class AnnouncementsApi extends BaseApi {
1024
+ protected _moduleSubPath: Endpoints;
1025
+ getAll(): Promise<AnnouncementsResponse>;
1026
+ get({ id }: ById): Promise<AnnouncementResponse>;
1027
+ create(request: AnnouncementRequest): Promise<AnnouncementResponse>;
1028
+ addComment(id: number, request: AnnouncementCommentRequest): Promise<AnnouncementResponse>;
1029
+ }
1030
+ export type CatalogInfo = {
1031
+ catalog_id: number;
1032
+ name: number;
1033
+ source_type: SourceType;
1034
+ external_id?: string;
1035
+ version: number;
1036
+ external_version?: number;
1037
+ deleted: boolean;
1038
+ supervisors?: number[];
1039
+ column_settings?: ColumnSettings[];
1040
+ links?: CatalogLink[];
1041
+ };
1042
+ export type CatalogLink = {
1043
+ catalog_id: number;
1044
+ column_name: string;
1045
+ };
1046
+ export type CatalogsResponse = {
1047
+ catalogs: CatalogInfo[];
1048
+ };
1049
+ export type CatalogHeader = {
1050
+ name: string;
1051
+ type: CatalogHeaderType;
1052
+ };
1053
+ enum CatalogHeaderType {
1054
+ Text = "text",
1055
+ Workflow = "workflow"
1056
+ }
1057
+ export type CatalogItemResponse = CatalogItem & {
1058
+ item_id: number;
1059
+ };
1060
+ export type CatalogResponse = {
1061
+ catalog_id: number;
1062
+ name: string;
1063
+ external_id?: string;
1064
+ version: number;
1065
+ external_version?: number;
1066
+ deleted: boolean;
1067
+ supervisors?: number[];
1068
+ catalog_headers: CatalogHeader[];
1069
+ column_settings?: ColumnSettings[];
1070
+ items?: CatalogItemResponse[];
1071
+ source_type: SourceType;
1072
+ };
1073
+ export type CatalogRequestBase = {
1074
+ id?: number;
1075
+ external_id?: string;
1076
+ name?: string;
1077
+ external_version?: number;
1078
+ catalog_headers: string[];
1079
+ items?: CatalogItem[];
1080
+ add_supervisors?: number[];
1081
+ remove_supervisors?: number[];
1082
+ add_workflow_headers?: string[];
1083
+ delete_workflow_headers?: string[];
1084
+ column_settings?: ColumnSettings[];
1085
+ };
1086
+ export type CreateCatalogRequest = CatalogRequestBase & {
1087
+ name: string;
1088
+ source_type?: SourceType;
1089
+ };
1090
+ export type SyncCatalogRequest = CatalogRequestBase & {
1091
+ id: number;
1092
+ apply: boolean;
1093
+ force_update_first_column?: boolean;
1094
+ };
1095
+ export type SyncCatalogResponse = {
1096
+ apply: boolean;
1097
+ added?: CatalogItemResponse[];
1098
+ deleted?: CatalogItemResponse[];
1099
+ updated?: CatalogItemResponse[];
1100
+ catalog_headers: CatalogHeader[];
1101
+ };
1102
+ class CatalogsApi extends BaseApi {
1103
+ protected _moduleSubPath: Endpoints;
1104
+ getAll(): Promise<CatalogsResponse>;
1105
+ get({ id }: ById): Promise<CatalogResponse>;
1106
+ create(request: CreateCatalogRequest): Promise<CatalogResponse>;
1107
+ /**
1108
+ * This method updates catalog headers and items.
1109
+ * You must define all the values and text columns that need to remain in the catalog.
1110
+ *
1111
+ * All unspecified items and text columns will be deleted
1112
+ * @param request
1113
+ */
1114
+ sync(request: SyncCatalogRequest): Promise<SyncCatalogResponse>;
1115
+ }
1116
+ export type MembersResponse = {
1117
+ members: Person[];
1118
+ };
1119
+ export type CreateMemberRequest = {
1120
+ first_name?: string;
1121
+ last_name?: string;
1122
+ email: string;
1123
+ status?: string;
1124
+ position?: string;
1125
+ department_id?: number;
1126
+ skype?: string;
1127
+ phone?: string;
1128
+ external_id?: string;
1129
+ login_phone?: string;
1130
+ };
1131
+ export type UpdateMemberRequest = {
1132
+ id: number;
1133
+ first_name?: string;
1134
+ last_name?: string;
1135
+ native_first_name?: string;
1136
+ native_last_name?: string;
1137
+ email?: string;
1138
+ status?: string;
1139
+ banned?: boolean;
1140
+ position?: string;
1141
+ department_id?: number;
1142
+ drop_department?: boolean;
1143
+ skype?: string;
1144
+ phone?: string;
1145
+ };
1146
+ class MembersApi extends BaseApi {
1147
+ protected _moduleSubPath: Endpoints;
1148
+ /**
1149
+ *
1150
+ * @param request
1151
+ * "email" and one of "first_name" or "last_name" are required
1152
+ */
1153
+ create(request: CreateMemberRequest): Promise<Person>;
1154
+ get({ id }: ById): Promise<Person>;
1155
+ getAll(request?: GetAllRequest): Promise<MembersResponse>;
1156
+ update(request: UpdateMemberRequest): Promise<Person>;
1157
+ delete({ id }: ById): Promise<Person>;
1158
+ }
1159
+ export type TaskRequest = {
1160
+ text?: string;
1161
+ formatted_text?: string;
1162
+ subject?: string;
1163
+ parent_task_id?: number;
1164
+ due_date?: Date;
1165
+ due?: Date;
1166
+ scheduled_date?: Date;
1167
+ scheduled_datetime_utc?: Date;
1168
+ cancel_schedule?: boolean;
1169
+ duration?: number;
1170
+ form_id?: number;
1171
+ attachments?: NewFile[];
1172
+ responsible?: PersonIdentity;
1173
+ fields?: FormFieldIdentified[];
1174
+ approvals?: PersonIdentity[][];
1175
+ subscribers?: PersonIdentity[];
1176
+ participants?: PersonIdentity[];
1177
+ list_ids?: number[];
1178
+ fill_defaults?: boolean;
1179
+ };
1180
+ class TasksApi extends BaseApi {
1181
+ protected _moduleSubPath: Endpoints;
1182
+ get({ id }: ById): Promise<TaskResponse>;
1183
+ /**
1184
+ *
1185
+ * @param request
1186
+ * If "form_id" specified it will be Form task,
1187
+ * else - Simple task.
1188
+ */
1189
+ create(request: TaskRequest): Promise<TaskResponse>;
1190
+ addComment(id: number, request: TaskCommentRequest): Promise<TaskResponse>;
1191
+ }
1192
+ export type PrintForm = {
1193
+ print_form_id: number;
1194
+ print_form_name?: string;
1195
+ };
1196
+ export type FormResponse = {
1197
+ id: number;
1198
+ name: string;
1199
+ steps?: TaskSteps;
1200
+ fields: FormField[];
1201
+ print_forms?: PrintForm[];
1202
+ deleted_or_closed: boolean;
1203
+ business_owners?: number[];
1204
+ folder?: string[];
1205
+ };
1206
+ export type TaskSteps = {
1207
+ [index: number]: string;
1208
+ };
1209
+ export type FormsResponse = {
1210
+ forms: FormResponse[];
1211
+ };
1212
+ export type FormRegisterRequest = {
1213
+ steps?: number[];
1214
+ include_archived?: "y";
1215
+ modified_before?: Date;
1216
+ modified_after?: Date;
1217
+ created_before?: Date;
1218
+ created_after?: Date;
1219
+ closed_before?: Date;
1220
+ closed_after?: Date;
1221
+ filters?: FormFilter[];
1222
+ format?: "csv";
1223
+ delimiter?: string;
1224
+ simple_format?: boolean;
1225
+ encoding?: string;
1226
+ field_ids?: number[];
1227
+ task_ids?: number[];
1228
+ due_filter?: DueFilter;
1229
+ /**
1230
+ * Max. number of tasks in request
1231
+ * @remarks
1232
+ * More than 0, and less than or equal to 20000
1233
+ */
1234
+ item_count?: number;
1235
+ };
1236
+ export type FormRegisterResponse = {
1237
+ tasks: Task[];
1238
+ };
1239
+ export type PermissionsDict = {
1240
+ [index: string | number]: PermissionLevel;
1241
+ };
1242
+ export type PermissionsResponse = {
1243
+ permissions: PermissionsDict;
1244
+ };
1245
+ export type ChangePermissionsRequest = {
1246
+ permissions: PermissionsDict;
1247
+ };
1248
+ class FormsApi extends BaseApi {
1249
+ protected _moduleSubPath: Endpoints;
1250
+ get({ id }: ById): Promise<FormResponse>;
1251
+ getAll(): Promise<FormsResponse>;
1252
+ getTasks(id: number, request: FormRegisterRequest): Promise<FormRegisterResponse>;
1253
+ getPermissions({ id }: ById): Promise<PermissionsResponse>;
1254
+ setPermissions(id: number, request: ChangePermissionsRequest): Promise<PermissionsResponse>;
1255
+ }
1256
+ export type LogsParameters = {
1257
+ after?: number;
1258
+ count?: number;
1259
+ };
1260
+ class LogsApi extends BaseApi {
1261
+ getEvents(request?: LogsParameters): Promise<Blob>;
1262
+ getFileAccess(request?: LogsParameters): Promise<Blob>;
1263
+ getTaskAccess(request?: LogsParameters): Promise<Blob>;
1264
+ getTaskExport(request?: LogsParameters): Promise<Blob>;
1265
+ getRegistryDownload(request?: LogsParameters): Promise<Blob>;
1266
+ }
1267
+ export type CallRequest = {
1268
+ /**
1269
+ * Unique ID of the extension's account in the external system
1270
+ */
1271
+ account_id: string;
1272
+ /**
1273
+ * Sender phone number
1274
+ */
1275
+ from_number: string;
1276
+ /**
1277
+ * Recipient phone number
1278
+ */
1279
+ to_number: string;
1280
+ /**
1281
+ * Internal operator number
1282
+ */
1283
+ internal_number?: string;
1284
+ /**
1285
+ * Call ID in external system
1286
+ */
1287
+ external_id?: string;
1288
+ /**
1289
+ * Data for autofill form fields
1290
+ */
1291
+ mappings?: FormMapping[];
1292
+ };
1293
+ export type CallResponse = {
1294
+ task_id: number;
1295
+ };
1296
+ /**
1297
+ * Adding information about the call
1298
+ *
1299
+ * @remarks
1300
+ *
1301
+ * To successfully process the request, one of the following parameters
1302
+ * must be indicated: external_id, task_id or from_number and to_number
1303
+ */
1304
+ export type AttachCallRecordRequest = {
1305
+ /**
1306
+ * Unique ID of the file uploaded with a /files/upload request
1307
+ */
1308
+ record_file?: string;
1309
+ /**
1310
+ * Sender phone number
1311
+ */
1312
+ from_number?: string;
1313
+ /**
1314
+ * Recipient phone number
1315
+ */
1316
+ to_number?: string;
1317
+ /**
1318
+ * Call ID in external system
1319
+ */
1320
+ external_id?: string;
1321
+ /**
1322
+ * ID of the created task
1323
+ * @remarks
1324
+ * Returns to integrations/call.
1325
+ */
1326
+ task_id?: number;
1327
+ /**
1328
+ * Data for autofill form fields
1329
+ */
1330
+ mappings?: FormMapping[];
1331
+ };
1332
+ class CallApi extends BaseApi {
1333
+ protected _moduleSubPath: Endpoints;
1334
+ registerCall(request: CallRequest): Promise<CallResponse>;
1335
+ attachCallRecord(request: AttachCallRecordRequest): Promise<void>;
1336
+ }
1337
+ export type CreateBotRequest = {
1338
+ name: string;
1339
+ hook_url?: string;
1340
+ external_id?: string;
1341
+ };
1342
+ export type Bot = {
1343
+ id: number;
1344
+ name: string;
1345
+ external_id?: string;
1346
+ is_enabled: boolean;
1347
+ fired?: boolean;
1348
+ hook_url: string;
1349
+ description: string;
1350
+ bot_settings: string;
1351
+ version: string;
1352
+ login: string;
1353
+ send_only_last_comment: boolean;
1354
+ locale?: string;
1355
+ time_zone_offset?: number;
1356
+ };
1357
+ export type BotsResponse = {
1358
+ bots: Bot[];
1359
+ };
1360
+ export type UpdateBotRequest = {
1361
+ id: number;
1362
+ name?: string;
1363
+ hook_url?: string;
1364
+ is_enabled?: boolean;
1365
+ bot_settings?: string;
1366
+ description?: string;
1367
+ rights?: PersonRights;
1368
+ send_only_last_comment?: boolean;
1369
+ locale?: string;
1370
+ time_zone_offset?: number;
1371
+ };
1372
+ export type DeleteBotRequest = {
1373
+ id: number;
1374
+ task_receiver_id: number;
1375
+ };
1376
+ class BotApi extends BaseApi {
1377
+ protected _moduleSubPath: Endpoints;
1378
+ create(request: CreateBotRequest): Promise<Bot>;
1379
+ getAll(request?: GetAllRequest): Promise<BotsResponse>;
1380
+ update(request: UpdateBotRequest): Promise<Bot>;
1381
+ delete(request: DeleteBotRequest): Promise<Bot>;
1382
+ }
1383
+ export class PyrusApiClient extends BaseApi {
1384
+ private _role;
1385
+ private _profile;
1386
+ private _contacts;
1387
+ private _files;
1388
+ private _lists;
1389
+ private _calendar;
1390
+ private _announcements;
1391
+ private _catalogs;
1392
+ private _members;
1393
+ private _tasks;
1394
+ private _forms;
1395
+ private _logs;
1396
+ private _call;
1397
+ private _bot;
1398
+ /**
1399
+ *
1400
+ * @param auth
1401
+ * can be AuthRequest type or token
1402
+ * @param settings
1403
+ * connection settings
1404
+ */
1405
+ constructor(auth: AuthRequest | string, settings?: Settings);
1406
+ private _authenticateClient;
1407
+ private get initParams();
1408
+ get role(): RoleApi;
1409
+ get profile(): ProfileApi;
1410
+ get contacts(): ContactsApi;
1411
+ get files(): FilesApi;
1412
+ get lists(): ListsApi;
1413
+ get calendar(): CalendarApi;
1414
+ get announcements(): AnnouncementsApi;
1415
+ get catalogs(): CatalogsApi;
1416
+ get members(): MembersApi;
1417
+ get tasks(): TasksApi;
1418
+ get forms(): FormsApi;
1419
+ get logs(): LogsApi;
1420
+ get call(): CallApi;
1421
+ get bot(): BotApi;
1422
+ }
1423
+
1424
+ export {};
1425
+
1426
+ }