zm-ruby-client 3.0.1 → 3.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.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -0
  3. data/README.md +128 -27
  4. data/VERSION +1 -1
  5. data/lib/zm/client/account/account.rb +12 -19
  6. data/lib/zm/client/account/account_aliases_collection.rb +6 -4
  7. data/lib/zm/client/account/account_dls_membership_collection.rb +4 -3
  8. data/lib/zm/client/account/account_dls_owner_collection.rb +3 -2
  9. data/lib/zm/client/account/account_jsns_builder.rb +10 -10
  10. data/lib/zm/client/account/accounts_collection.rb +27 -16
  11. data/lib/zm/client/ace/ace.rb +3 -6
  12. data/lib/zm/client/ace/ace_jsns_builder.rb +6 -6
  13. data/lib/zm/client/appointment/appointment.rb +32 -14
  14. data/lib/zm/client/appointment/appointment_jsns_builder.rb +5 -5
  15. data/lib/zm/client/appointment/appointment_jsns_initializer.rb +6 -1
  16. data/lib/zm/client/appointment/appointments_collection.rb +12 -9
  17. data/lib/zm/client/backup/backup.rb +5 -2
  18. data/lib/zm/client/backup/backups_collection.rb +3 -2
  19. data/lib/zm/client/base/account_objects_collection.rb +1 -0
  20. data/lib/zm/client/base/account_search_objects_collection.rb +6 -6
  21. data/lib/zm/client/base/admin_objects_collection.rb +60 -7
  22. data/lib/zm/client/base/base_account_jsns_builder.rb +89 -87
  23. data/lib/zm/client/base/base_jsns_builder.rb +3 -3
  24. data/lib/zm/client/base/base_jsns_initializer.rb +20 -15
  25. data/lib/zm/client/base/mailbox_infos_collection.rb +92 -90
  26. data/lib/zm/client/base/mailbox_object.rb +49 -160
  27. data/lib/zm/client/base/mailbox_prefs_collection.rb +54 -52
  28. data/lib/zm/client/base/object.rb +19 -2
  29. data/lib/zm/client/base/objects_collection.rb +10 -10
  30. data/lib/zm/client/base/zimbra_attribute.rb +28 -42
  31. data/lib/zm/client/base/zimbra_attributes_collection.rb +38 -24
  32. data/lib/zm/client/{cluster/batch_request.rb → batch_request.rb} +1 -1
  33. data/lib/zm/client/cluster/cluster.rb +24 -61
  34. data/lib/zm/client/cluster/cluster_config.rb +35 -15
  35. data/lib/zm/client/contact/contact.rb +15 -13
  36. data/lib/zm/client/contact/contact_jsns_builder.rb +9 -6
  37. data/lib/zm/client/contact/contact_jsns_initializer.rb +2 -2
  38. data/lib/zm/client/contact/contact_member.rb +3 -3
  39. data/lib/zm/client/contact/contact_members_collection.rb +3 -3
  40. data/lib/zm/client/contact/contacts_builder.rb +1 -1
  41. data/lib/zm/client/contact/contacts_collection.rb +2 -2
  42. data/lib/zm/client/contact/group_contact_jsns_builder.rb +18 -14
  43. data/lib/zm/client/contact/mod_group_contact.rb +12 -8
  44. data/lib/zm/client/cos/cos.rb +15 -31
  45. data/lib/zm/client/cos/cos_jsns_builder.rb +21 -21
  46. data/lib/zm/client/cos/coses_collection.rb +11 -6
  47. data/lib/zm/client/datasource/datasource.rb +3 -9
  48. data/lib/zm/client/datasource/datasource_jsns_builder.rb +4 -4
  49. data/lib/zm/client/datasource/datasources_builder.rb +1 -1
  50. data/lib/zm/client/datasource/datasources_collection.rb +2 -2
  51. data/lib/zm/client/deprecated_constants.rb +36 -0
  52. data/lib/zm/client/distributionlist/distributionlist.rb +15 -47
  53. data/lib/zm/client/distributionlist/distributionlist_aces_collection.rb +4 -4
  54. data/lib/zm/client/distributionlist/distributionlist_aliases_collection.rb +7 -5
  55. data/lib/zm/client/distributionlist/distributionlist_jsns_builder.rb +29 -41
  56. data/lib/zm/client/distributionlist/distributionlist_jsns_initializer.rb +14 -3
  57. data/lib/zm/client/distributionlist/distributionlist_members_collection.rb +14 -10
  58. data/lib/zm/client/distributionlist/distributionlist_owners_collection.rb +13 -13
  59. data/lib/zm/client/distributionlist/distributionlists_collection.rb +15 -7
  60. data/lib/zm/client/distributionlist/dls_membership_collection.rb +8 -6
  61. data/lib/zm/client/document/document.rb +5 -11
  62. data/lib/zm/client/document/document_jsns_builder.rb +2 -2
  63. data/lib/zm/client/document/documents_collection.rb +4 -4
  64. data/lib/zm/client/domain/domain.rb +8 -25
  65. data/lib/zm/client/domain/domain_jsns_builder.rb +13 -13
  66. data/lib/zm/client/domain/domains_collection.rb +13 -6
  67. data/lib/zm/client/filter_rules/filter_rules_collection.rb +1 -1
  68. data/lib/zm/client/filter_rules/outgoing_filter_rules_collection.rb +1 -1
  69. data/lib/zm/client/folder/folder.rb +34 -21
  70. data/lib/zm/client/folder/folder_default.rb +39 -0
  71. data/lib/zm/client/folder/folder_grant_jsns_builder.rb +3 -3
  72. data/lib/zm/client/folder/folder_grants_collection.rb +1 -1
  73. data/lib/zm/client/folder/folder_jsns_builder.rb +12 -12
  74. data/lib/zm/client/folder/folder_jsns_initializer.rb +1 -1
  75. data/lib/zm/client/folder/folder_retention_policies_collection.rb +6 -2
  76. data/lib/zm/client/folder/folder_view.rb +15 -0
  77. data/lib/zm/client/folder/folders_jsns_builder.rb +1 -1
  78. data/lib/zm/client/folder/mod_document_folder.rb +16 -12
  79. data/lib/zm/client/identity/identities_collection.rb +1 -1
  80. data/lib/zm/client/identity/identity.rb +3 -9
  81. data/lib/zm/client/identity/identity_jsns_builder.rb +8 -8
  82. data/lib/zm/client/{base/ldap_filter.rb → ldap_filter.rb} +1 -1
  83. data/lib/zm/client/license/licenses_collection.rb +1 -1
  84. data/lib/zm/client/mailbox/mailbox_item_concern.rb +0 -2
  85. data/lib/zm/client/message/message.rb +14 -19
  86. data/lib/zm/client/message/message_attachments_collection.rb +39 -0
  87. data/lib/zm/client/message/message_flags_collection.rb +130 -0
  88. data/lib/zm/client/message/message_jsns_builder.rb +4 -8
  89. data/lib/zm/client/message/message_jsns_initializer.rb +4 -4
  90. data/lib/zm/client/message/message_recipients.rb +19 -43
  91. data/lib/zm/client/message/messages_collection.rb +20 -4
  92. data/lib/zm/client/mountpoint/{mountpoint.rb → mount_point.rb} +4 -10
  93. data/lib/zm/client/mountpoint/{mountpoint_jsns_builder.rb → mount_point_jsns_builder.rb} +3 -3
  94. data/lib/zm/client/mountpoint/{mountpoint_jsns_initializer.rb → mount_point_jsns_initializer.rb} +1 -1
  95. data/lib/zm/client/mountpoint/{mountpoints_builder.rb → mount_points_builder.rb} +1 -1
  96. data/lib/zm/client/mta_queue/mta_queue.rb +4 -16
  97. data/lib/zm/client/mta_queue/mta_queue_action.rb +12 -0
  98. data/lib/zm/client/mta_queue/mta_queue_jsns_builder.rb +7 -7
  99. data/lib/zm/client/mta_queue/mta_queue_name.rb +14 -0
  100. data/lib/zm/client/mta_queue/mta_queues_collection.rb +4 -3
  101. data/lib/zm/client/mta_queue_item/mta_queue_items_collection.rb +1 -0
  102. data/lib/zm/client/recipient.rb +21 -0
  103. data/lib/zm/client/{common/recipients.rb → recipients.rb} +0 -16
  104. data/lib/zm/client/resource/resource.rb +3 -7
  105. data/lib/zm/client/resource/resource_jsns_builder.rb +13 -13
  106. data/lib/zm/client/resource/resources_collection.rb +20 -7
  107. data/lib/zm/client/search_folder/search_folder.rb +4 -11
  108. data/lib/zm/client/search_folder/search_folder_jsns_builder.rb +6 -6
  109. data/lib/zm/client/search_folder/search_folders_collection.rb +1 -1
  110. data/lib/zm/client/server/server.rb +16 -22
  111. data/lib/zm/client/server/server_services.rb +26 -0
  112. data/lib/zm/client/server/servers_collection.rb +6 -6
  113. data/lib/zm/client/share/share.rb +2 -5
  114. data/lib/zm/client/share/shares_builder.rb +1 -1
  115. data/lib/zm/client/share/shares_collection.rb +5 -4
  116. data/lib/zm/client/signature/signature.rb +7 -13
  117. data/lib/zm/client/signature/signature_jsns_builder.rb +13 -13
  118. data/lib/zm/client/signature/signature_jsns_initializer.rb +2 -2
  119. data/lib/zm/client/signature/signatures_collection.rb +1 -1
  120. data/lib/zm/client/tag/account_object_tags_collection.rb +45 -47
  121. data/lib/zm/client/tag/tag.rb +3 -9
  122. data/lib/zm/client/tag/tag_jsns_builder.rb +3 -3
  123. data/lib/zm/client/tag/tags_builder.rb +1 -1
  124. data/lib/zm/client/tag/tags_collection.rb +2 -2
  125. data/lib/zm/client/task/task.rb +2 -2
  126. data/lib/zm/client/task/tasks_collection.rb +2 -2
  127. data/lib/zm/client/token.rb +4 -1
  128. data/lib/zm/client/upload.rb +179 -1
  129. data/lib/zm/client/{common/utils.rb → utils.rb} +6 -3
  130. data/lib/zm/client/zm_logger.rb +1 -1
  131. data/lib/zm/client.rb +227 -10
  132. data/lib/zm/connector/network_error_handler.rb +18 -0
  133. data/lib/zm/{client/connector → connector}/rest_connector.rb +46 -40
  134. data/lib/zm/{client/connector/soap_account.rb → connector/soap_account_connector.rb} +15 -17
  135. data/lib/zm/{client/connector/soap_admin.rb → connector/soap_admin_connector.rb} +3 -5
  136. data/lib/zm/connector/soap_base_connector.rb +115 -0
  137. data/lib/zm/connector.rb +13 -0
  138. data/lib/zm/error/auth_error.rb +8 -0
  139. data/lib/zm/error/connection_error.rb +8 -0
  140. data/lib/zm/error/rest_error.rb +8 -0
  141. data/lib/zm/{client/connector → error}/soap_error.rb +1 -10
  142. data/lib/zm/error/zm_error.rb +8 -0
  143. data/lib/zm/error.rb +11 -0
  144. data/lib/zm/relationship/has_many.rb +22 -0
  145. data/lib/zm/relationship/jsns_builder.rb +21 -0
  146. data/lib/zm/relationship/relationship.rb +113 -0
  147. data/lib/zm/relationship/schema.rb +32 -0
  148. data/lib/zm/relationship.rb +5 -0
  149. data/lib/zm/{client/soap_request → soap_request}/request_methods_admin.rb +11 -5
  150. data/lib/zm/{client/soap_request → soap_request}/request_methods_mailbox.rb +1 -1
  151. data/lib/zm/{client/soap_request/account_soap_constants.rb → soap_request/soap_account_constants.rb} +1 -1
  152. data/lib/zm/{client/soap_request/admin_soap_constants.rb → soap_request/soap_admin_constants.rb} +1 -1
  153. data/lib/zm/{client/soap_request → soap_request}/soap_constants.rb +1 -1
  154. data/lib/zm/{client/soap_request → soap_request}/soap_context.rb +13 -5
  155. data/lib/zm/{client/soap_request → soap_request}/soap_element.rb +1 -1
  156. data/lib/zm/{client/soap_request/mail_soap_constants.rb → soap_request/soap_mail_constants.rb} +1 -1
  157. data/lib/zm/soap_request.rb +14 -0
  158. data/lib/zm/support/cache/entry.rb +3 -3
  159. data/lib/zm/support/cache/file_store.rb +4 -6
  160. data/lib/zm/support/cache/null_store.rb +2 -4
  161. data/lib/zm/support/cache/store.rb +17 -9
  162. data/lib/zm/support/cache.rb +13 -8
  163. data/lib/zm/support.rb +7 -0
  164. data/lib/zm/{modules → utils}/belongs_to_folder.rb +1 -1
  165. data/lib/zm/{modules → utils}/belongs_to_tag.rb +2 -2
  166. data/lib/zm/utils/content_part.rb +9 -0
  167. data/lib/zm/utils/content_type.rb +11 -0
  168. data/lib/zm/{modules → utils}/has_soap_admin_connector.rb +1 -1
  169. data/lib/zm/utils/inspector.rb +26 -0
  170. data/lib/zm/utils/log_filter.rb +30 -0
  171. data/lib/zm/utils/missing_method_static_collection.rb +17 -0
  172. data/lib/zm/utils/regex.rb +11 -0
  173. data/lib/zm/utils/search_utils.rb +13 -0
  174. data/lib/zm/utils.rb +16 -0
  175. data/lib/zm-ruby-client.rb +12 -0
  176. data/sig/zm/client/admin_objects.rbs +261 -0
  177. data/sig/zm/client/base.rbs +191 -0
  178. data/sig/zm/client/cluster.rbs +152 -0
  179. data/sig/zm/client/mailbox.rbs +766 -0
  180. data/sig/zm/error.rbs +23 -0
  181. metadata +99 -91
  182. data/.gitignore +0 -59
  183. data/.rubocop.yml +0 -6
  184. data/.ruby-version +0 -1
  185. data/Gemfile +0 -11
  186. data/SECURITY.md +0 -21
  187. data/bin/console +0 -11
  188. data/lib/zm/client/account.rb +0 -9
  189. data/lib/zm/client/ace.rb +0 -7
  190. data/lib/zm/client/appointment.rb +0 -7
  191. data/lib/zm/client/backup.rb +0 -6
  192. data/lib/zm/client/base.rb +0 -21
  193. data/lib/zm/client/cluster.rb +0 -4
  194. data/lib/zm/client/common/message.rb +0 -10
  195. data/lib/zm/client/common.rb +0 -5
  196. data/lib/zm/client/connector/soap_base.rb +0 -104
  197. data/lib/zm/client/constant.rb +0 -229
  198. data/lib/zm/client/contact.rb +0 -11
  199. data/lib/zm/client/cos.rb +0 -10
  200. data/lib/zm/client/datasource.rb +0 -7
  201. data/lib/zm/client/distributionlist.rb +0 -8
  202. data/lib/zm/client/document.rb +0 -7
  203. data/lib/zm/client/domain.rb +0 -10
  204. data/lib/zm/client/filter_rule.rb +0 -7
  205. data/lib/zm/client/folder.rb +0 -14
  206. data/lib/zm/client/identity.rb +0 -7
  207. data/lib/zm/client/license.rb +0 -5
  208. data/lib/zm/client/message/attachments_collection.rb +0 -55
  209. data/lib/zm/client/message/message_flags.rb +0 -115
  210. data/lib/zm/client/message.rb +0 -10
  211. data/lib/zm/client/mountpoint.rb +0 -7
  212. data/lib/zm/client/mta_queue.rb +0 -7
  213. data/lib/zm/client/mta_queue_item.rb +0 -6
  214. data/lib/zm/client/resource.rb +0 -7
  215. data/lib/zm/client/search_folder.rb +0 -7
  216. data/lib/zm/client/server.rb +0 -7
  217. data/lib/zm/client/share.rb +0 -7
  218. data/lib/zm/client/signature.rb +0 -7
  219. data/lib/zm/client/soap_request.rb +0 -11
  220. data/lib/zm/client/tag.rb +0 -8
  221. data/lib/zm/client/task.rb +0 -6
  222. data/lib/zm/client/upload/upload.rb +0 -160
  223. data/lib/zm/modules/base.rb +0 -9
  224. data/lib/zm/modules/common/zimbra-attrs.json +0 -58
  225. data/lib/zm/modules/inspector.rb +0 -24
  226. data/lib/zm/modules/missing_method_static_collection.rb +0 -13
  227. data/lib/zm/modules/zm_model.rb +0 -43
  228. data/zm-ruby-client.gemspec +0 -27
  229. /data/lib/zm/client/mountpoint/{mountpoints_collection.rb → mount_points_collection.rb} +0 -0
@@ -0,0 +1,261 @@
1
+ module Zm
2
+ module SoapRequest
3
+ class SoapElement
4
+ end
5
+
6
+ module RequestMethodsAdmin
7
+ def delete!: () -> nil
8
+ def modify!: () -> true
9
+ def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, **untyped attrs) -> bool
10
+ def rename!: (String new_name) -> String
11
+
12
+ def build_create: () -> SoapElement
13
+ def build_modify: () -> SoapElement
14
+ def build_delete: () -> SoapElement
15
+ def build_rename: (String new_name) -> SoapElement
16
+ end
17
+ end
18
+
19
+ module Client
20
+ class Account < Base::MailboxObject
21
+ include SoapRequest::RequestMethodsAdmin
22
+
23
+ def cos: () -> Cos?
24
+ def create!: () -> String
25
+ def created_at: () -> Time?
26
+ def flush_cache!: () -> true
27
+ def attrs_write: () -> Array[String]
28
+ def batch: () -> BatchRequest
29
+ def empty_dumpster!: () -> untyped
30
+ end
31
+
32
+ class AccountsCollection < Base::AdminObjectsCollection[Account]
33
+ def quotas: (?domain_name: String?, ?target_server_id: String?) -> Array[untyped]?
34
+ end
35
+
36
+ class AccountAliasesCollection
37
+ def initialize: (Account parent) -> void
38
+
39
+ def all: () -> Array[String]
40
+ def add!: (String email) -> bool
41
+ def remove!: (String email) -> bool
42
+ end
43
+
44
+ class Resource < Base::MailboxObject
45
+ include SoapRequest::RequestMethodsAdmin
46
+
47
+ LOCATION: String
48
+ EQUIPMENT: String
49
+ TYPES: Array[String]
50
+
51
+ def create!: () -> String
52
+ def attrs_write: () -> Array[String]
53
+ def location?: () -> bool
54
+ def equipment?: () -> bool
55
+ end
56
+
57
+ class ResourcesCollection < Base::AdminObjectsCollection[Resource]
58
+ end
59
+
60
+ class Domain < Base::Object
61
+ include SoapRequest::RequestMethodsAdmin
62
+
63
+ def create!: () -> String
64
+ def cos: () -> Cos?
65
+ def attrs_write: () -> Array[String]
66
+ def DKIMPublicTxt: () -> String?
67
+
68
+ def accounts: () -> DomainAccountsCollection
69
+ def resources: () -> DomainResourcesCollection
70
+ def distribution_lists: () -> DomainDistributionListsCollection
71
+ alias distributionlists distribution_lists
72
+ end
73
+
74
+ class DomainsCollection < Base::AdminObjectsCollection[Domain]
75
+ end
76
+
77
+ class DomainAccountsCollection < AccountsCollection
78
+ end
79
+
80
+ class DomainResourcesCollection < ResourcesCollection
81
+ end
82
+
83
+ class DomainDistributionListsCollection < DistributionListsCollection
84
+ end
85
+
86
+ class Cos < Base::Object
87
+ def create!: () -> String
88
+ def modify!: () -> true
89
+ def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, **untyped attrs) -> bool
90
+ def delete!: () -> nil
91
+ def clone!: (String new_name) -> String
92
+ def attrs_write: () -> Array[String]
93
+
94
+ def servers: () -> CosServersCollection
95
+ def domains: () -> CosDomainsCollection
96
+ def accounts: () -> CosAccountsCollection
97
+ end
98
+
99
+ class CosServersCollection
100
+ def initialize: (Cos parent) -> void
101
+
102
+ def all: () -> Array[Server]
103
+ alias all! all
104
+ def add!: (*(Server | Array[Server]) servers) -> bool
105
+ def remove!: (*(Server | Array[Server]) servers) -> bool
106
+ end
107
+
108
+ class CosDomainsCollection < DomainsCollection
109
+ end
110
+
111
+ class CosAccountsCollection < AccountsCollection
112
+ end
113
+
114
+ class CosesCollection < Base::AdminObjectsCollection[Cos]
115
+ def clone!: (String new_name) ?{ (Cos) -> void } -> String
116
+ end
117
+
118
+ class Server < Base::Object
119
+ def update!: (?Hash[Symbol, untyped]? hash, ?update_attributes: bool, **untyped attrs) -> bool
120
+ def mailboxes: () -> Array[Hash[Symbol, untyped]]?
121
+
122
+ def mta_queues: () -> MtaQueuesCollection
123
+ def backups: () -> BackupsCollection
124
+ def accounts: () -> ServerAccountsCollection
125
+ end
126
+
127
+ class MtaQueue < Base::Object
128
+ attr_accessor n: Integer?
129
+ alias nb_items n
130
+
131
+ def server: () -> Server
132
+ def hold!: (Array[String] ids) -> untyped
133
+ def release!: (Array[String] ids) -> untyped
134
+ def delete!: (Array[String] ids) -> untyped
135
+ def requeue!: (Array[String] ids) -> untyped
136
+ end
137
+
138
+ class MtaQueuesCollection < Base::ObjectsCollection[MtaQueue]
139
+ # The known queues without querying the server.
140
+ def defaults: () -> Array[MtaQueue]
141
+ def defaults!: () -> Array[MtaQueue]
142
+ # Raises Zm::Error::ZmError on an unknown queue name.
143
+ def find: (String queue_name) -> MtaQueue?
144
+ end
145
+
146
+ class Backup < Base::Object
147
+ attr_accessor label: String?
148
+ attr_accessor type: String?
149
+ attr_accessor aborted: bool?
150
+ attr_accessor start: Integer?
151
+ attr_accessor end: Integer?
152
+ attr_accessor minRedoSeq: Integer?
153
+ attr_accessor maxRedoSeq: Integer?
154
+ attr_accessor live: bool?
155
+ attr_accessor accounts: untyped
156
+ alias name label
157
+
158
+ def server: () -> Server
159
+ def start_at: () -> Time?
160
+ def end_at: () -> Time?
161
+ def full?: () -> bool
162
+ def incremental?: () -> bool
163
+ end
164
+
165
+ class BackupsCollection < Base::ObjectsCollection[Backup]
166
+ end
167
+
168
+ class ServerAccountsCollection < AccountsCollection
169
+ end
170
+
171
+ class ServersCollection < Base::AdminObjectsCollection[Server]
172
+ # Filters servers by enabled service (mailbox, mta, proxy...).
173
+ def where: (String service) -> self
174
+ end
175
+
176
+ class DistributionList < Base::Object
177
+ include SoapRequest::RequestMethodsAdmin
178
+
179
+ def create!: () -> String
180
+ def local_transport: () -> String
181
+ def local_transport!: () -> bool
182
+ def local_transport?: () -> bool
183
+ def external_transport?: () -> bool
184
+ def hide_in_gal?: () -> bool
185
+ def group?: () -> bool
186
+ def mailing_list?: () -> bool
187
+ def attrs_write: () -> Array[String]
188
+
189
+ def aliases: () -> DistributionListAliasesCollection
190
+ def members: () -> DistributionListMembersCollection
191
+ def owners: () -> DistributionListOwnersCollection
192
+ def memberships: () -> DlsMembershipCollection
193
+ def aces: () -> DistributionListAcesCollection
194
+ end
195
+
196
+ class DistributionListsCollection < Base::AdminObjectsCollection[DistributionList]
197
+ end
198
+
199
+ class DistributionListAliasesCollection
200
+ def initialize: (DistributionList parent) -> void
201
+
202
+ def all: () -> Array[String]
203
+ def add!: (String email) -> bool
204
+ def remove!: (String email) -> bool
205
+ end
206
+
207
+ class DistributionListMembersCollection
208
+ attr_accessor all: Array[String]
209
+
210
+ def initialize: (DistributionList parent) -> void
211
+
212
+ # Raises ArgumentError on nil, non-String or blank email.
213
+ def add!: (String | Array[String] emails) -> bool
214
+ def remove!: (String | Array[String] emails) -> bool
215
+ end
216
+
217
+ class DistributionListOwnersCollection
218
+ attr_accessor all: Array[String]
219
+
220
+ def initialize: (DistributionList parent) -> void
221
+
222
+ def add!: (*(String | Array[String]) emails) -> bool
223
+ def remove!: (*(String | Array[String]) emails) -> bool
224
+ end
225
+
226
+ class DlMembership < Data
227
+ attr_reader name: String
228
+ attr_reader id: String
229
+ attr_reader via: String?
230
+ end
231
+
232
+ class DlsMembershipCollection < Base::ObjectsCollection[DlMembership]
233
+ end
234
+
235
+ class DistributionListAcesCollection
236
+ class DistributionListAce < Data
237
+ attr_reader zimbra_id: String
238
+ attr_reader type: String
239
+ attr_reader right: String?
240
+ end
241
+
242
+ def initialize: (DistributionList parent) -> void
243
+
244
+ def all: () -> Array[DistributionListAce]
245
+ end
246
+
247
+ class Upload
248
+ def initialize: (String base_url, String token, ?is_token_admin: bool, **untyped rest_options) ?{ (Upload) -> void } -> void
249
+
250
+ def download_file: (String dest_file_path, String file_id, String? type, ?fmt: String?) -> nil
251
+ def read_file: (String file_id, String? type, ?fmt: String?) -> String
252
+ def download_files: (String dest_file_path, Array[String] file_ids, String? type, ?fmt: String?) -> nil
253
+ def download_attachment: (String dest_file_path, String message_id, String part) -> nil
254
+ def download_folder: (String dest_file_path, String folder_id, ?fmt: String?) -> nil
255
+ def send_file: (String src_file_path, String folder_id, ?fmt: String?, ?type: String?, ?resolve: String?) -> String
256
+ def upload_attachment: (String src_file_path) -> String
257
+ def download_file_with_url: (String url, String dest_file_path) -> nil
258
+ def same_origin?: (String url) -> bool
259
+ end
260
+ end
261
+ end
@@ -0,0 +1,191 @@
1
+ module Zm
2
+ module Client
3
+ module Base
4
+ class Object
5
+ attr_accessor parent: untyped
6
+ attr_accessor token: untyped
7
+ attr_accessor name: String?
8
+ attr_accessor id: String?
9
+ attr_accessor updated: bool
10
+
11
+ def initialize: (untyped parent) ?{ (self) -> void } -> void
12
+
13
+ def recorded?: () -> bool
14
+ def updated?: () -> bool
15
+ def save!: () -> untyped
16
+ def clone: () ?{ (self) -> void } -> self
17
+ def logger: () -> ::Logger
18
+ def update_attribute: (Symbol | String key, untyped value) -> void
19
+ def to_h: () -> Hash[Symbol, untyped]
20
+ end
21
+
22
+ # Collections are generic in signatures only: T is the type of the objects they build.
23
+ class ObjectsCollection[T]
24
+ attr_reader parent: untyped
25
+
26
+ def new: () ?{ (T) -> void } -> T
27
+ def find: (String id) -> T
28
+ def first: () -> T?
29
+ def all: () -> Array[T]
30
+ alias all! all
31
+
32
+ def per_page: (Integer? limit) -> self
33
+ alias limit per_page
34
+ def page: (Integer? offset) -> self
35
+ alias offset page
36
+ def order: (untyped sort_by, ?Integer sort_ascending) -> self
37
+
38
+ # Delegated to all through method_missing.
39
+ def each: () { (T) -> void } -> Array[T]
40
+ def map: [U] () { (T) -> U } -> Array[U]
41
+ def select: () { (T) -> boolish } -> Array[T]
42
+ def length: () -> Integer
43
+
44
+ def logger: () -> ::Logger
45
+ end
46
+
47
+ class AdminObjectsCollection[T] < ObjectsCollection[T]
48
+ ONERRORS: Array[String]
49
+
50
+ type onerror = "continue" | "stop"
51
+
52
+ def initialize: (untyped parent) -> void
53
+
54
+ def find_by: (Hash[Symbol, String] hash) -> T
55
+ def find_by!: (Hash[Symbol, String] hash) -> T
56
+ def find_by_or_nil: (Hash[Symbol, String] hash, ?singleton(StandardError) error_handler) -> T?
57
+
58
+ def ldap: () -> self
59
+ def where: (String ldap_query) -> self
60
+ def attrs: (*(String | Symbol | Array[String | Symbol]) attributes) -> self
61
+ def count: () -> Integer
62
+ def clear: () -> self
63
+
64
+ def find_each: (?offset: Integer, ?limit: Integer) { (T) -> void } -> void
65
+
66
+ def update_all!: (?Hash[Symbol, untyped]? hash, ?onerror: onerror, ?update_attributes: bool, **untyped attrs)
67
+ -> Array[T]
68
+ def mass_update!: (Array[T | String] items, ?Hash[Symbol, untyped]? hash, ?onerror: onerror,
69
+ ?update_attributes: bool, **untyped attrs) -> Array[T]
70
+ def delete_all!: (?onerror: onerror) -> Array[T]
71
+ def mass_delete!: (Array[T | String] items, ?onerror: onerror) -> Array[T]
72
+ end
73
+
74
+ class AccountObjectsCollection[T] < ObjectsCollection[T]
75
+ def initialize: (untyped parent) -> void
76
+ end
77
+
78
+ class AccountSearchObjectsCollection[T] < AccountObjectsCollection[T]
79
+ attr_accessor more: bool
80
+
81
+ def find: (String id) -> T
82
+ def start_at: (Time | Date start_at) -> self
83
+ def end_at: (Time | Date end_at) -> self
84
+ def folders: (*(Folder | Array[Folder]) folders) -> self
85
+ def folder_ids: (*(String | Array[String]) folder_ids) -> self
86
+ def where: (String query) -> self
87
+ def order: (String sort_by) -> self
88
+ def ids: () -> Array[String]
89
+ def reset: () -> void
90
+ def delete_all: (Array[String] ids) -> untyped
91
+ end
92
+
93
+ class ZimbraAttribute
94
+ attr_reader name: String
95
+ attr_reader type: String?
96
+ attr_reader objects_scope: Array[String]
97
+
98
+ def immutable?: () -> bool
99
+ end
100
+
101
+ class ZimbraAttributesCollection
102
+ attr_reader path: String
103
+ attr_reader all: Array[ZimbraAttribute]
104
+
105
+ def self.shared: (Cluster parent) -> ZimbraAttributesCollection
106
+
107
+ def initialize: (Cluster parent) -> void
108
+
109
+ def all_account_attrs: () -> Array[ZimbraAttribute]
110
+ def all_account_attrs_writable_names: () -> Array[String]
111
+ def all_cos_attrs: () -> Array[ZimbraAttribute]
112
+ def all_cos_attrs_writable_names: () -> Array[String]
113
+ def all_domain_attrs: () -> Array[ZimbraAttribute]
114
+ def all_domain_attrs_writable_names: () -> Array[String]
115
+ def all_server_attrs: () -> Array[ZimbraAttribute]
116
+ def all_server_attrs_writable_names: () -> Array[String]
117
+ def all_distributionlist_attrs: () -> Array[ZimbraAttribute]
118
+ def all_distributionlist_attrs_writable_names: () -> Array[String]
119
+ def all_resource_attrs: () -> Array[ZimbraAttribute]
120
+ def all_resource_attrs_writable_names: () -> Array[String]
121
+ end
122
+
123
+ class MailboxObject < Object
124
+ attr_accessor home_url: String?
125
+ attr_accessor public_url: String?
126
+ attr_accessor password: String?
127
+ attr_writer used: Integer
128
+ attr_writer domain_key: String?
129
+
130
+ def soap_account_connector: () -> Connector::SoapAccountConnector
131
+ def soap_connector: () -> Connector::SoapBaseConnector
132
+ def soap_admin_connector: () -> Connector::SoapAdminConnector
133
+ alias sac soap_admin_connector
134
+
135
+ def domain_name: () -> String
136
+ def used: () -> Integer?
137
+ def used!: () -> Integer?
138
+ def mbxid: () -> Integer?
139
+ def mbxid!: () -> Integer?
140
+
141
+ def token: () -> Token?
142
+ def token=: (String value) -> void
143
+ def logged?: () -> bool
144
+ def alive?: () -> bool
145
+ def logged_and_alive?: () -> bool
146
+ def domain_key: () -> String?
147
+
148
+ # Delegate auth when the cluster is logged, else password or preauth.
149
+ def login: () -> void
150
+ def account_login: () -> void
151
+ def account_login_preauth: (?Integer expires) -> void
152
+ def account_login_password: () -> void
153
+ def admin_login: () -> void
154
+
155
+ def password!: (?String? new_password) -> (String | false)
156
+ def local_transport: () -> String
157
+ def local_transport!: () -> untyped
158
+ def is_local_transport?: () -> bool
159
+ def is_external_transport?: () -> bool
160
+ def last_logon: () -> Time?
161
+
162
+ def build_uploader: () -> Upload
163
+ def rest_url: () -> String
164
+
165
+ def aliases: () -> AccountAliasesCollection
166
+ def infos: () -> MailboxInfosCollection
167
+ def prefs: () -> MailboxPrefsCollection
168
+ def messages: () -> MessagesCollection
169
+ def folders: () -> FoldersCollection
170
+ def mount_points: () -> MountPointsCollection
171
+ alias mountpoints mount_points
172
+ def search_folders: () -> SearchFoldersCollection
173
+ def identities: () -> IdentitiesCollection
174
+ def shares: () -> SharesCollection
175
+ def contacts: () -> ContactsCollection
176
+ def appointments: () -> AppointmentsCollection
177
+ def tags: () -> TagsCollection
178
+ def tasks: () -> TasksCollection
179
+ def aces: () -> AcesCollection
180
+ alias rights aces
181
+ def signatures: () -> SignaturesCollection
182
+ def documents: () -> DocumentsCollection
183
+ def memberships: () -> AccountDlsMembershipCollection
184
+ def dls_owner: () -> AccountDlsOwnerCollection
185
+ def filter_rules: () -> FilterRulesCollection
186
+ def outgoing_filter_rules: () -> OutgoingFilterRulesCollection
187
+ def data_sources: () -> DataSourcesCollection
188
+ end
189
+ end
190
+ end
191
+ end
@@ -0,0 +1,152 @@
1
+ module Zm
2
+ module Client
3
+ type cache_store = [Symbol] | [Symbol, Hash[Symbol, untyped]]
4
+
5
+ # Anything Logger can write to: a file path, $stdout, a StringIO...
6
+ interface _LogDevice
7
+ def write: (*untyped) -> untyped
8
+ def close: () -> untyped
9
+ end
10
+ type count_object_type = :userAccount | :account | :alias | :dl | :domain | :cos | :server | :calresource
11
+ | :internalUserAccount
12
+
13
+ class ClusterConfig
14
+ BASE_URL_REGEX: Regexp
15
+
16
+ attr_reader zimbra_admin_url: String?
17
+ attr_reader zimbra_public_url: String?
18
+ attr_writer logger: ::Logger
19
+ attr_writer colorize_logging: bool
20
+ attr_accessor zimbra_admin_login: String?
21
+ attr_accessor zimbra_admin_password: String?
22
+ attr_accessor domains: Array[ClusterConfigDomain]
23
+ attr_accessor zimbra_version: String
24
+ attr_accessor log_path: String | _LogDevice
25
+ attr_accessor timeout: Integer
26
+ attr_accessor ssl_verify: bool
27
+ attr_accessor ssl_ca_file: String?
28
+ attr_accessor ssl_ca_path: String?
29
+
30
+ def initialize: (?(String | Hash[Symbol, untyped])? parameters) ?{ (ClusterConfig) -> void } -> void
31
+
32
+ def cache: () -> Support::Cache::Store
33
+ def cache_store: () -> cache_store
34
+ def cache_store=: (cache_store options) -> void
35
+ def ssl_options: () -> Hash[Symbol, untyped]
36
+
37
+ def zimbra_admin_url=: (String url) -> void
38
+ def zimbra_public_url=: (String url) -> void
39
+
40
+ def find_domain: (String domain_name) -> ClusterConfigDomain?
41
+ def domain_key: (String domain_name) -> String?
42
+ def has_admin_credentials?: () -> bool
43
+
44
+ def zimbra_attributes_path: () -> String
45
+ def zimbra_attributes_path=: (String path) -> void
46
+
47
+ def logger: () -> ::Logger
48
+ def log_level=: (Integer level) -> void
49
+ end
50
+
51
+ class ClusterConfigDomain < Data
52
+ attr_reader name: String
53
+ attr_reader key: String?
54
+
55
+ def self.new: (String name, String? key) -> instance
56
+ | (name: String, key: String?) -> instance
57
+ end
58
+
59
+ class ClusterConfigError < StandardError
60
+ end
61
+
62
+ class Cluster
63
+ attr_reader soap_admin_connector: Connector::SoapAdminConnector
64
+ attr_reader config: ClusterConfig
65
+ attr_reader zimbra_attributes: Base::ZimbraAttributesCollection
66
+ attr_reader type: String?
67
+ attr_reader version: String?
68
+ attr_reader release: String?
69
+ attr_reader buildDate: String?
70
+ attr_reader host: String?
71
+ attr_reader majorversion: String?
72
+ attr_reader minorversion: String?
73
+ attr_reader microversion: String?
74
+
75
+ def initialize: (ClusterConfig config) -> void
76
+
77
+ def has_admin_credentials?: () -> bool
78
+ def token: () -> Token?
79
+ def token=: (String value) -> void
80
+
81
+ # Raises ClusterConfigError without admin credentials, Zm::Error::AuthError on bad credentials.
82
+ def login: () -> void
83
+ def logged?: () -> bool
84
+ def alive?: () -> bool
85
+ def logged_and_alive?: () -> bool
86
+
87
+ def license: () -> License?
88
+
89
+ def domains: () -> DomainsCollection
90
+ def accounts: () -> AccountsCollection
91
+ def resources: () -> ResourcesCollection
92
+ def servers: () -> ServersCollection
93
+ def coses: () -> CosesCollection
94
+ def distribution_lists: () -> DistributionListsCollection
95
+ alias distributionlists distribution_lists
96
+
97
+ def domain_key: (String domain_name) -> String?
98
+ def count_object: (count_object_type | String type) -> Integer
99
+ def email_exist?: (String email) -> bool
100
+ def infos!: () -> void
101
+ def logger: () -> ::Logger
102
+ def batch: () -> BatchRequest
103
+ end
104
+
105
+ class Token
106
+ def initialize: (String str) -> void
107
+
108
+ def to_s: () -> String
109
+ def decoded: () -> String
110
+ def metadatas: () -> Hash[String, String?]
111
+ def zimbra_id: () -> String?
112
+ def admin?: () -> bool
113
+ def server_version: () -> String?
114
+ def expire_at: () -> Time
115
+ def expired?: () -> bool
116
+ end
117
+
118
+ class License < Base::Object
119
+ end
120
+
121
+ class BatchRequest
122
+ ONERRORS: Array[String]
123
+
124
+ attr_reader requests: Array[untyped]
125
+
126
+ def initialize: (Connector::SoapBaseConnector connector) -> void
127
+ def invoke: (?onerror: "continue" | "stop") -> Array[untyped]
128
+ end
129
+ end
130
+
131
+ module Connector
132
+ class SoapBaseConnector
133
+ end
134
+
135
+ class SoapAdminConnector < SoapBaseConnector
136
+ end
137
+
138
+ class SoapAccountConnector < SoapBaseConnector
139
+ end
140
+ end
141
+
142
+ module Support
143
+ module Cache
144
+ class Store
145
+ end
146
+
147
+ def self.registered_storage: () -> Hash[Symbol, Symbol | singleton(Store)]
148
+ def self.register_storage: (Symbol key, Symbol | singleton(Store) klass) -> void
149
+ def self.storage: (Symbol key) -> singleton(Store)?
150
+ end
151
+ end
152
+ end