nextmail 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +183 -0
- data/lib/nextmail/api_paths.rb +447 -0
- data/lib/nextmail/client.rb +81 -0
- data/lib/nextmail/constants.rb +1621 -0
- data/lib/nextmail/credentials.rb +53 -0
- data/lib/nextmail/decode.rb +34 -0
- data/lib/nextmail/defaults.rb +114 -0
- data/lib/nextmail/endpoint.rb +144 -0
- data/lib/nextmail/errors.rb +121 -0
- data/lib/nextmail/http.rb +172 -0
- data/lib/nextmail/image_crop.rb +38 -0
- data/lib/nextmail/languages.rb +42 -0
- data/lib/nextmail/pagination.rb +63 -0
- data/lib/nextmail/protocol.rb +221 -0
- data/lib/nextmail/raw_body.rb +83 -0
- data/lib/nextmail/request_path.rb +50 -0
- data/lib/nextmail/resource.rb +109 -0
- data/lib/nextmail/resources/account.rb +155 -0
- data/lib/nextmail/resources/addresses.rb +38 -0
- data/lib/nextmail/resources/analytics.rb +19 -0
- data/lib/nextmail/resources/app_host.rb +23 -0
- data/lib/nextmail/resources/audiences.rb +95 -0
- data/lib/nextmail/resources/automations.rb +125 -0
- data/lib/nextmail/resources/billing.rb +76 -0
- data/lib/nextmail/resources/bookings.rb +100 -0
- data/lib/nextmail/resources/branding.rb +24 -0
- data/lib/nextmail/resources/broadcasts.rb +102 -0
- data/lib/nextmail/resources/calendar.rb +153 -0
- data/lib/nextmail/resources/chats.rb +62 -0
- data/lib/nextmail/resources/connected_mailboxes.rb +35 -0
- data/lib/nextmail/resources/connectors.rb +75 -0
- data/lib/nextmail/resources/contacts.rb +197 -0
- data/lib/nextmail/resources/dns_connections.rb +23 -0
- data/lib/nextmail/resources/domains.rb +264 -0
- data/lib/nextmail/resources/drafts.rb +36 -0
- data/lib/nextmail/resources/emails.rb +120 -0
- data/lib/nextmail/resources/encryption.rb +19 -0
- data/lib/nextmail/resources/events.rb +22 -0
- data/lib/nextmail/resources/exports.rb +27 -0
- data/lib/nextmail/resources/files.rb +82 -0
- data/lib/nextmail/resources/follow_ups.rb +21 -0
- data/lib/nextmail/resources/forms.rb +112 -0
- data/lib/nextmail/resources/imports.rb +106 -0
- data/lib/nextmail/resources/keys.rb +126 -0
- data/lib/nextmail/resources/knowledge.rb +137 -0
- data/lib/nextmail/resources/labels.rb +43 -0
- data/lib/nextmail/resources/languages.rb +11 -0
- data/lib/nextmail/resources/me.rb +57 -0
- data/lib/nextmail/resources/members.rb +100 -0
- data/lib/nextmail/resources/out_of_office.rb +28 -0
- data/lib/nextmail/resources/provider_imports.rb +48 -0
- data/lib/nextmail/resources/roles.rb +39 -0
- data/lib/nextmail/resources/rules.rb +73 -0
- data/lib/nextmail/resources/security.rb +39 -0
- data/lib/nextmail/resources/segments.rb +31 -0
- data/lib/nextmail/resources/senders.rb +19 -0
- data/lib/nextmail/resources/sending.rb +23 -0
- data/lib/nextmail/resources/settings.rb +16 -0
- data/lib/nextmail/resources/signatures.rb +41 -0
- data/lib/nextmail/resources/subscriptions.rb +55 -0
- data/lib/nextmail/resources/support.rb +11 -0
- data/lib/nextmail/resources/suppressions.rb +43 -0
- data/lib/nextmail/resources/tasks.rb +95 -0
- data/lib/nextmail/resources/temp_mail.rb +67 -0
- data/lib/nextmail/resources/templates.rb +153 -0
- data/lib/nextmail/resources/threads.rb +218 -0
- data/lib/nextmail/resources/tools.rb +35 -0
- data/lib/nextmail/resources/tracking.rb +72 -0
- data/lib/nextmail/resources/webhooks.rb +170 -0
- data/lib/nextmail/resources/workspaces.rb +40 -0
- data/lib/nextmail/results.rb +33 -0
- data/lib/nextmail/transport.rb +272 -0
- data/lib/nextmail/update_notice.rb +69 -0
- data/lib/nextmail/version.rb +5 -0
- data/lib/nextmail/webhook.rb +82 -0
- data/lib/nextmail/wire.rb +102 -0
- data/lib/nextmail.rb +126 -0
- metadata +122 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Members < Resource
|
|
6
|
+
def list(q: nil, limit: nil, cursor: nil, api_key: nil)
|
|
7
|
+
fetch_page(ApiPaths::MEMBERS, query_params(q:), limit:, cursor:, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_all(q: nil, limit: nil, cursor: nil, api_key: nil)
|
|
11
|
+
collect_all(ApiPaths::MEMBERS, query_params(q:), limit:, cursor:, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def iterate(q: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
15
|
+
iterate_pages(ApiPaths::MEMBERS, query_params(q:), limit:, cursor:, api_key:, &)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(user_id, api_key: nil)
|
|
19
|
+
request(fill(ApiPaths::MEMBER, userId: user_id), api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def add(body = nil, api_key: nil, **fields)
|
|
23
|
+
request(ApiPaths::MEMBERS, method: :post, body: payload(body, fields), api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update(user_id, patch = nil, api_key: nil, **fields)
|
|
27
|
+
request(fill(ApiPaths::MEMBER, userId: user_id), method: :patch, body: payload(patch, fields),
|
|
28
|
+
repeatable: true, api_key:)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def remove(user_id, api_key: nil)
|
|
32
|
+
request(fill(ApiPaths::MEMBER, userId: user_id), method: :delete, api_key:)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def grant_address(user_id, body = nil, api_key: nil, **fields)
|
|
36
|
+
request(fill(ApiPaths::MEMBER_ADDRESSES, userId: user_id), method: :post, body: payload(body, fields),
|
|
37
|
+
repeatable: true, api_key:)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def revoke_address(user_id, address_id, api_key: nil)
|
|
41
|
+
request(fill(ApiPaths::MEMBER_ADDRESS, userId: user_id, addressId: address_id), method: :delete, api_key:)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def grant_domain(user_id, body = nil, api_key: nil, **fields)
|
|
45
|
+
request(fill(ApiPaths::MEMBER_DOMAINS, userId: user_id), method: :post, body: payload(body, fields),
|
|
46
|
+
repeatable: true, api_key:)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def revoke_domain(user_id, domain_id, api_key: nil)
|
|
50
|
+
request(fill(ApiPaths::MEMBER_DOMAIN, userId: user_id, domainId: domain_id), method: :delete, api_key:)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def list_invitations(limit: nil, cursor: nil, api_key: nil)
|
|
54
|
+
fetch_page(ApiPaths::MEMBER_INVITATIONS, limit:, cursor:, api_key:)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def list_all_invitations(limit: nil, cursor: nil, api_key: nil)
|
|
58
|
+
collect_all(ApiPaths::MEMBER_INVITATIONS, limit:, cursor:, api_key:)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def iterate_invitations(limit: nil, cursor: nil, api_key: nil, &)
|
|
62
|
+
iterate_pages(ApiPaths::MEMBER_INVITATIONS, limit:, cursor:, api_key:, &)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def revoke_invitation(invitation_id, api_key: nil)
|
|
66
|
+
request(fill(ApiPaths::MEMBER_INVITATION, invitationId: invitation_id), method: :delete, api_key:)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def resend_invitation(invitation_id, api_key: nil)
|
|
70
|
+
request(fill(ApiPaths::MEMBER_INVITATION_RESEND, invitationId: invitation_id), method: :post, api_key:)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def get_directory_sync(api_key: nil)
|
|
74
|
+
request(ApiPaths::DIRECTORY_SYNC, api_key:)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def connect_directory_sync(api_key: nil)
|
|
78
|
+
request(ApiPaths::DIRECTORY_SYNC, method: :post, api_key:)
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def disconnect_directory_sync(api_key: nil)
|
|
82
|
+
request(ApiPaths::DIRECTORY_SYNC, method: :delete, api_key:)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def list_directory_people(start_index: nil, count: nil, api_key: nil)
|
|
86
|
+
request(ApiPaths::DIRECTORY_SYNC_PEOPLE, query: query_params(start_index:, count:), api_key:)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def set_directory_default_role(role_id, api_key: nil)
|
|
90
|
+
request(ApiPaths::DIRECTORY_SYNC_DEFAULT_ROLE, method: :put, body: {"roleId" => role_id}, repeatable: true,
|
|
91
|
+
api_key:)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def set_directory_group_role(group_id, role_id, api_key: nil)
|
|
95
|
+
request(fill(ApiPaths::DIRECTORY_SYNC_GROUP_ROLE, groupId: group_id), method: :put, body: {"roleId" => role_id},
|
|
96
|
+
repeatable: true, api_key:)
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class OutOfOffice < Resource
|
|
6
|
+
def list(address: nil, api_key: nil)
|
|
7
|
+
fetch_list(ApiPaths::OUT_OF_OFFICE, query_params(address:), api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def set(address, body = nil, api_key: nil, **fields)
|
|
11
|
+
request(ApiPaths::OUT_OF_OFFICE, method: :put, query: query_params(address:),
|
|
12
|
+
body: reply_wire(payload(body, fields)), repeatable: true, api_key:)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def clear(address, api_key: nil)
|
|
16
|
+
request(ApiPaths::OUT_OF_OFFICE, method: :delete, query: query_params(address:), repeatable: true, api_key:)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def reply_wire(wire)
|
|
22
|
+
wire["startsAt"] = instant(wire["startsAt"]) if wire.key?("startsAt")
|
|
23
|
+
wire["endsAt"] = instant(wire["endsAt"]) if wire.key?("endsAt")
|
|
24
|
+
wire
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class ProviderImports < Resource
|
|
6
|
+
NOT_GIVEN = Object.new.freeze
|
|
7
|
+
private_constant :NOT_GIVEN
|
|
8
|
+
|
|
9
|
+
def inspect(provider_key = NOT_GIVEN, provider: nil, api_key: nil)
|
|
10
|
+
return super() if provider_key.equal?(NOT_GIVEN)
|
|
11
|
+
|
|
12
|
+
body = {"apiKey" => provider_key}
|
|
13
|
+
body["provider"] = provider unless provider.nil?
|
|
14
|
+
request(ApiPaths::PROVIDER_IMPORTS_INSPECT, method: :post, body:, api_key:)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def create(body = nil, api_key: nil, **fields)
|
|
18
|
+
request(ApiPaths::PROVIDER_IMPORTS, method: :post, body: payload(body, fields), api_key:)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def list(source: nil, status: nil, search: nil, limit: nil, cursor: nil, api_key: nil)
|
|
22
|
+
fetch_page(ApiPaths::PROVIDER_IMPORTS, list_query(source, status, search), limit:, cursor:, api_key:)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def list_all(source: nil, status: nil, search: nil, limit: nil, cursor: nil, api_key: nil)
|
|
26
|
+
collect_all(ApiPaths::PROVIDER_IMPORTS, list_query(source, status, search), limit:, cursor:, api_key:)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def iterate(source: nil, status: nil, search: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
30
|
+
iterate_pages(ApiPaths::PROVIDER_IMPORTS, list_query(source, status, search), limit:, cursor:, api_key:, &)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def get(id, api_key: nil)
|
|
34
|
+
request(fill(ApiPaths::PROVIDER_IMPORT, id:), api_key:)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def cancel(id, api_key: nil)
|
|
38
|
+
request(fill(ApiPaths::PROVIDER_IMPORT_CANCEL, id:), method: :post, api_key:)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
def list_query(source, status, search)
|
|
44
|
+
query_params(source:, status:, search:)
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Roles < Resource
|
|
6
|
+
def list(limit: nil, cursor: nil, api_key: nil)
|
|
7
|
+
fetch_page(ApiPaths::ROLES, limit:, cursor:, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_all(limit: nil, cursor: nil, api_key: nil)
|
|
11
|
+
collect_all(ApiPaths::ROLES, limit:, cursor:, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def iterate(limit: nil, cursor: nil, api_key: nil, &)
|
|
15
|
+
iterate_pages(ApiPaths::ROLES, limit:, cursor:, api_key:, &)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id, api_key: nil)
|
|
19
|
+
request(fill(ApiPaths::ROLE, id:), api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(body = nil, api_key: nil, **fields)
|
|
23
|
+
request(ApiPaths::ROLES, method: :post, body: payload(body, fields), api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update(id, patch = nil, api_key: nil, **fields)
|
|
27
|
+
request(fill(ApiPaths::ROLE, id:), method: :patch, body: payload(patch, fields), repeatable: true, api_key:)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def delete(id, reassign_to: nil, api_key: nil)
|
|
31
|
+
request(fill(ApiPaths::ROLE, id:), method: :delete, query: query_params(reassign_to:), api_key:)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def list_permissions(api_key: nil)
|
|
35
|
+
fetch_list(ApiPaths::ROLE_PERMISSIONS, api_key:)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Rules < Resource
|
|
6
|
+
def list(enabled: nil, q: nil, limit: nil, cursor: nil, api_key: nil)
|
|
7
|
+
fetch_page(ApiPaths::RULES, list_query(enabled, q), limit:, cursor:, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_all(enabled: nil, q: nil, limit: nil, cursor: nil, api_key: nil)
|
|
11
|
+
collect_all(ApiPaths::RULES, list_query(enabled, q), limit:, cursor:, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def iterate(enabled: nil, q: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
15
|
+
iterate_pages(ApiPaths::RULES, list_query(enabled, q), limit:, cursor:, api_key:, &)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id, api_key: nil)
|
|
19
|
+
request(fill(ApiPaths::RULE, id:), api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(body = nil, api_key: nil, **fields)
|
|
23
|
+
request(ApiPaths::RULES, method: :post, body: payload(body, fields), api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update(id, patch = nil, api_key: nil, **fields)
|
|
27
|
+
request(fill(ApiPaths::RULE, id:), method: :patch, body: payload(patch, fields), api_key:)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def delete(id, api_key: nil)
|
|
31
|
+
request(fill(ApiPaths::RULE, id:), method: :delete, api_key:)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def reorder(rule_ids, api_key: nil)
|
|
35
|
+
envelope = request(ApiPaths::RULES_REORDER, method: :post, body: {"ruleIds" => rule_ids}, repeatable: true,
|
|
36
|
+
api_key:)
|
|
37
|
+
Pagination.items_of(envelope.is_a?(Hash) ? envelope : {})
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test(id, body = nil, api_key: nil, **fields)
|
|
41
|
+
request(fill(ApiPaths::RULE_TEST, id:), method: :post, body: payload(body, fields), repeatable: true, api_key:)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def list_runs(rule_id: nil, rule_ids: nil, thread_id: nil, limit: nil, cursor: nil, api_key: nil)
|
|
45
|
+
fetch_page(ApiPaths::RULE_RUNS, run_query(rule_id, rule_ids, thread_id), limit:, cursor:, api_key:)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def list_all_runs(rule_id: nil, rule_ids: nil, thread_id: nil, limit: nil, cursor: nil, api_key: nil)
|
|
49
|
+
collect_all(ApiPaths::RULE_RUNS, run_query(rule_id, rule_ids, thread_id), limit:, cursor:, api_key:)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def iterate_runs(rule_id: nil, rule_ids: nil, thread_id: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
53
|
+
iterate_pages(ApiPaths::RULE_RUNS, run_query(rule_id, rule_ids, thread_id), limit:, cursor:, api_key:, &)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def stats(rule_ids: nil, since: nil, until: nil, grain: nil, offset_minutes: nil, api_key: nil)
|
|
57
|
+
query = log_window_query(since, binding.local_variable_get(:until))
|
|
58
|
+
.merge(query_params(rule_ids: joined(rule_ids), grain:, offset_minutes:))
|
|
59
|
+
request(ApiPaths::RULES_STATS, query:, api_key:)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
private
|
|
63
|
+
|
|
64
|
+
def list_query(enabled, q)
|
|
65
|
+
query_params(enabled: flag(enabled), q:)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def run_query(rule_id, rule_ids, thread_id)
|
|
69
|
+
query_params(rule_id:, rule_ids: joined(rule_ids), thread_id:)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Security < Resource
|
|
6
|
+
def list_events(limit: nil, cursor: nil, api_key: nil)
|
|
7
|
+
fetch_page(ApiPaths::SECURITY_EVENTS, limit:, cursor:, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_all_events(limit: nil, cursor: nil, api_key: nil)
|
|
11
|
+
collect_all(ApiPaths::SECURITY_EVENTS, limit:, cursor:, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def iterate_events(limit: nil, cursor: nil, api_key: nil, &)
|
|
15
|
+
iterate_pages(ApiPaths::SECURITY_EVENTS, limit:, cursor:, api_key:, &)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def step_up_status(api_key: nil)
|
|
19
|
+
request(ApiPaths::SECURITY_STEP_UP, api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def begin_step_up(body = nil, api_key: nil, **fields)
|
|
23
|
+
request(ApiPaths::SECURITY_STEP_UP, method: :post, body: payload(body, fields), api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def verify_step_up(body = nil, api_key: nil, **fields)
|
|
27
|
+
request(ApiPaths::SECURITY_STEP_UP_VERIFY, method: :post, body: payload(body, fields), api_key:)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def get_policy(api_key: nil)
|
|
31
|
+
request(ApiPaths::SECURITY_POLICY, api_key:)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def update_policy(patch = nil, api_key: nil, **fields)
|
|
35
|
+
request(ApiPaths::SECURITY_POLICY, method: :patch, body: payload(patch, fields), repeatable: true, api_key:)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Segments < Resource
|
|
6
|
+
def list(api_key: nil)
|
|
7
|
+
fetch_list(ApiPaths::SEGMENTS, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get(id, api_key: nil)
|
|
11
|
+
request(fill(ApiPaths::SEGMENT, id:), api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def create(body = nil, api_key: nil, **fields)
|
|
15
|
+
request(ApiPaths::SEGMENTS, method: :post, body: payload(body, fields), api_key:)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def update(id, patch = nil, api_key: nil, **fields)
|
|
19
|
+
request(fill(ApiPaths::SEGMENT, id:), method: :patch, body: payload(patch, fields), repeatable: true, api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def delete(id, api_key: nil)
|
|
23
|
+
request(fill(ApiPaths::SEGMENT, id:), method: :delete, api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def preview(body = nil, api_key: nil, **fields)
|
|
27
|
+
request(ApiPaths::SEGMENTS_PREVIEW, method: :post, body: payload(body, fields), repeatable: true, api_key:)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Senders < Resource
|
|
6
|
+
def get(email, api_key: nil)
|
|
7
|
+
request(fill(ApiPaths::SENDER, email:), api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get_avatar(email, api_key: nil)
|
|
11
|
+
request(fill(ApiPaths::SENDER_AVATAR, email:), binary: true, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def research(email, api_key: nil)
|
|
15
|
+
request(fill(ApiPaths::SENDER_RESEARCH, email:), method: :post, repeatable: true, api_key:)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Sending < Resource
|
|
6
|
+
def list_streams(api_key: nil)
|
|
7
|
+
request(ApiPaths::SENDING_STREAMS, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def resume_stream(stream, api_key: nil)
|
|
11
|
+
request(fill(ApiPaths::SENDING_STREAM_RESUME, stream:), method: :post, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def list_dedicated_ips(api_key: nil)
|
|
15
|
+
request(ApiPaths::SENDING_DEDICATED_IPS, api_key:)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get_dedicated_ip(ip, api_key: nil)
|
|
19
|
+
request(fill(ApiPaths::SENDING_DEDICATED_IP, ip:), api_key:)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Settings < Resource
|
|
6
|
+
def get(address: nil, api_key: nil)
|
|
7
|
+
request(ApiPaths::SETTINGS, query: query_params(address:), api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def update(patch = nil, address: nil, api_key: nil, **fields)
|
|
11
|
+
request(ApiPaths::SETTINGS, method: :patch, query: query_params(address:), body: payload(patch, fields),
|
|
12
|
+
repeatable: true, api_key:)
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Signatures < Resource
|
|
6
|
+
def list(address: nil, from: nil, limit: nil, cursor: nil, api_key: nil)
|
|
7
|
+
fetch_page(ApiPaths::SIGNATURES, query_params(address:, from:), limit:, cursor:, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_all(address: nil, from: nil, limit: nil, cursor: nil, api_key: nil)
|
|
11
|
+
collect_all(ApiPaths::SIGNATURES, query_params(address:, from:), limit:, cursor:, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def iterate(address: nil, from: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
15
|
+
iterate_pages(ApiPaths::SIGNATURES, query_params(address:, from:), limit:, cursor:, api_key:, &)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id, api_key: nil)
|
|
19
|
+
request(fill(ApiPaths::SIGNATURE, id:), api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(body = nil, api_key: nil, **fields)
|
|
23
|
+
request(ApiPaths::SIGNATURES, method: :post, body: payload(body, fields), api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update(id, patch = nil, api_key: nil, **fields)
|
|
27
|
+
request(fill(ApiPaths::SIGNATURE, id:), method: :patch, body: payload(patch, fields), repeatable: true, api_key:)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def delete(id, api_key: nil)
|
|
31
|
+
request(fill(ApiPaths::SIGNATURE, id:), method: :delete, api_key:)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def copy(id, body = nil, api_key: nil, **fields)
|
|
35
|
+
envelope = request(fill(ApiPaths::SIGNATURE_COPY, id:), method: :post, body: payload(body, fields),
|
|
36
|
+
repeatable: true, api_key:)
|
|
37
|
+
Pagination.items_of(envelope.is_a?(Hash) ? envelope : {})
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Subscriptions < Resource
|
|
6
|
+
def list(status: nil, q: nil, sort: nil, suggested: nil, limit: nil, offset: nil, address: nil, api_key: nil)
|
|
7
|
+
request(ApiPaths::SUBSCRIPTIONS, query: list_query(status, q, sort, suggested, limit, offset, address), api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_domains(status: nil, q: nil, sort: nil, suggested: nil, limit: nil, offset: nil, address: nil,
|
|
11
|
+
api_key: nil)
|
|
12
|
+
request(ApiPaths::SUBSCRIPTION_DOMAINS, query: list_query(status, q, sort, suggested, limit, offset, address),
|
|
13
|
+
api_key:)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def unsubscribe(id, body = nil, api_key: nil, **fields)
|
|
17
|
+
request(fill(ApiPaths::SUBSCRIPTION_UNSUBSCRIBE, id:), method: :post, body: payload(body, fields), api_key:)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def unsubscribe_domain(domain, body = nil, api_key: nil, **fields)
|
|
21
|
+
request(fill(ApiPaths::SUBSCRIPTION_DOMAIN_UNSUBSCRIBE, domain:), method: :post, body: payload(body, fields),
|
|
22
|
+
api_key:)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def move(id, body = nil, api_key: nil, **fields)
|
|
26
|
+
request(fill(ApiPaths::SUBSCRIPTION_MOVE, id:), method: :post, body: payload(body, fields), repeatable: true,
|
|
27
|
+
api_key:)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def keep(ids, body = nil, api_key: nil, **fields)
|
|
31
|
+
request(ApiPaths::SUBSCRIPTIONS_BATCH_KEEP, method: :post, body: batch(ids, body, fields), repeatable: true,
|
|
32
|
+
api_key:)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def unsubscribe_many(ids, body = nil, api_key: nil, **fields)
|
|
36
|
+
request(ApiPaths::SUBSCRIPTIONS_BATCH_UNSUBSCRIBE, method: :post, body: batch(ids, body, fields), api_key:)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def move_many(ids, body = nil, api_key: nil, **fields)
|
|
40
|
+
request(ApiPaths::SUBSCRIPTIONS_BATCH_MOVE, method: :post, body: batch(ids, body, fields), repeatable: true,
|
|
41
|
+
api_key:)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def list_query(status, q, sort, suggested, limit, offset, address)
|
|
47
|
+
query_params(status:, q:, sort:, suggested: flag(suggested), limit:, offset:, address:)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def batch(ids, body, fields)
|
|
51
|
+
{"ids" => ids}.merge(payload(body, fields))
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Suppressions < Resource
|
|
6
|
+
def list(q: nil, reason: nil, limit: nil, cursor: nil, api_key: nil)
|
|
7
|
+
fetch_page(ApiPaths::SUPPRESSIONS, query_params(q:, reason:), limit:, cursor:, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_all(q: nil, reason: nil, limit: nil, cursor: nil, api_key: nil)
|
|
11
|
+
collect_all(ApiPaths::SUPPRESSIONS, query_params(q:, reason:), limit:, cursor:, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def iterate(q: nil, reason: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
15
|
+
iterate_pages(ApiPaths::SUPPRESSIONS, query_params(q:, reason:), limit:, cursor:, api_key:, &)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id, api_key: nil)
|
|
19
|
+
request(fill(ApiPaths::SUPPRESSION, id:), api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def add(body = nil, api_key: nil, **fields)
|
|
23
|
+
request(ApiPaths::SUPPRESSIONS, method: :post, body: payload(body, fields), repeatable: true, api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def remove(id, api_key: nil)
|
|
27
|
+
request(fill(ApiPaths::SUPPRESSION, id:), method: :delete, api_key:)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def list_unsubscribes(q: nil, source: nil, limit: nil, cursor: nil, api_key: nil)
|
|
31
|
+
fetch_page(ApiPaths::SUPPRESSION_UNSUBSCRIBES, query_params(q:, source:), limit:, cursor:, api_key:)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def add_unsubscribe(body = nil, api_key: nil, **fields)
|
|
35
|
+
request(ApiPaths::SUPPRESSION_UNSUBSCRIBES, method: :post, body: payload(body, fields), repeatable: true, api_key:)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def remove_unsubscribe(email, api_key: nil)
|
|
39
|
+
request(fill(ApiPaths::SUPPRESSION_UNSUBSCRIBE, email:), method: :delete, api_key:)
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Nextmail
|
|
4
|
+
module Resources
|
|
5
|
+
class Tasks < Resource
|
|
6
|
+
def list(status: nil, limit: nil, cursor: nil, api_key: nil)
|
|
7
|
+
fetch_page(ApiPaths::TASKS, query_params(status:), limit:, cursor:, api_key:)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def list_all(status: nil, limit: nil, cursor: nil, api_key: nil)
|
|
11
|
+
collect_all(ApiPaths::TASKS, query_params(status:), limit:, cursor:, api_key:)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def iterate(status: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
15
|
+
iterate_pages(ApiPaths::TASKS, query_params(status:), limit:, cursor:, api_key:, &)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def get(id, api_key: nil)
|
|
19
|
+
request(fill(ApiPaths::TASK, id:), api_key:)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def create(body = nil, api_key: nil, **fields)
|
|
23
|
+
request(ApiPaths::TASKS, method: :post, body: payload(body, fields), api_key:)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def update(id, patch = nil, api_key: nil, **fields)
|
|
27
|
+
request(fill(ApiPaths::TASK, id:), method: :patch, body: payload(patch, fields), repeatable: true, api_key:)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def delete(id, api_key: nil)
|
|
31
|
+
request(fill(ApiPaths::TASK, id:), method: :delete, api_key:)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def pause(id, api_key: nil)
|
|
35
|
+
request(fill(ApiPaths::TASK_PAUSE, id:), method: :post, repeatable: true, api_key:)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def resume(id, api_key: nil)
|
|
39
|
+
request(fill(ApiPaths::TASK_RESUME, id:), method: :post, repeatable: true, api_key:)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def run(id, api_key: nil)
|
|
43
|
+
request(fill(ApiPaths::TASK_RUN_NOW, id:), method: :post, api_key:)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def list_runs(task_id: nil, status: nil, limit: nil, cursor: nil, api_key: nil)
|
|
47
|
+
fetch_page(ApiPaths::TASK_RUNS, query_params(task_id:, status:), limit:, cursor:, api_key:)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def list_all_runs(task_id: nil, status: nil, limit: nil, cursor: nil, api_key: nil)
|
|
51
|
+
collect_all(ApiPaths::TASK_RUNS, query_params(task_id:, status:), limit:, cursor:, api_key:)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def iterate_runs(task_id: nil, status: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
55
|
+
iterate_pages(ApiPaths::TASK_RUNS, query_params(task_id:, status:), limit:, cursor:, api_key:, &)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def get_run(id, api_key: nil)
|
|
59
|
+
request(fill(ApiPaths::TASK_RUN, id:), api_key:)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def start_run(body = nil, api_key: nil, **fields)
|
|
63
|
+
request(ApiPaths::TASK_RUNS, method: :post, body: payload(body, fields), api_key:)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def cancel_run(id, api_key: nil)
|
|
67
|
+
request(fill(ApiPaths::TASK_RUN_CANCEL, id:), method: :post, api_key:)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def list_approvals(status: nil, run_id: nil, task_id: nil, limit: nil, cursor: nil, api_key: nil)
|
|
71
|
+
fetch_page(ApiPaths::TASK_APPROVALS, query_params(status:, run_id:, task_id:), limit:, cursor:, api_key:)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def list_all_approvals(status: nil, run_id: nil, task_id: nil, limit: nil, cursor: nil, api_key: nil)
|
|
75
|
+
collect_all(ApiPaths::TASK_APPROVALS, query_params(status:, run_id:, task_id:), limit:, cursor:, api_key:)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def iterate_approvals(status: nil, run_id: nil, task_id: nil, limit: nil, cursor: nil, api_key: nil, &)
|
|
79
|
+
iterate_pages(ApiPaths::TASK_APPROVALS, query_params(status:, run_id:, task_id:), limit:, cursor:, api_key:, &)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def get_approval(id, api_key: nil)
|
|
83
|
+
request(fill(ApiPaths::TASK_APPROVAL, id:), api_key:)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def approve(id, body = nil, api_key: nil, **fields)
|
|
87
|
+
request(fill(ApiPaths::TASK_APPROVAL_APPROVE, id:), method: :post, body: payload(body, fields), api_key:)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def deny(id, api_key: nil)
|
|
91
|
+
request(fill(ApiPaths::TASK_APPROVAL_DENY, id:), method: :post, api_key:)
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|