nylas 6.0.0.beta.1 → 6.0.0.beta.3
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 +4 -4
- data/lib/nylas/client.rb +68 -9
- data/lib/nylas/errors.rb +33 -11
- data/lib/nylas/handler/api_operations.rb +7 -5
- data/lib/nylas/handler/http_client.rb +98 -34
- data/lib/nylas/resources/applications.rb +1 -1
- data/lib/nylas/resources/attachments.rb +65 -0
- data/lib/nylas/resources/auth.rb +15 -14
- data/lib/nylas/resources/calendars.rb +83 -13
- data/lib/nylas/resources/connectors.rb +80 -0
- data/lib/nylas/resources/contacts.rb +89 -0
- data/lib/nylas/resources/credentials.rb +75 -0
- data/lib/nylas/resources/drafts.rb +102 -0
- data/lib/nylas/resources/events.rb +89 -11
- data/lib/nylas/resources/folders.rb +73 -0
- data/lib/nylas/resources/grants.rb +47 -9
- data/lib/nylas/resources/messages.rb +126 -0
- data/lib/nylas/resources/redirect_uris.rb +59 -11
- data/lib/nylas/resources/resource.rb +2 -2
- data/lib/nylas/resources/smart_compose.rb +36 -0
- data/lib/nylas/resources/threads.rb +62 -0
- data/lib/nylas/resources/webhooks.rb +62 -11
- data/lib/nylas/utils/file_utils.rb +54 -0
- data/lib/nylas/version.rb +1 -1
- data/lib/nylas.rb +12 -1
- metadata +32 -4
- data/lib/nylas/handler/admin_api_operations.rb +0 -95
- data/lib/nylas/handler/grants_api_operations.rb +0 -99
@@ -1,31 +1,101 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "resource"
|
4
|
-
require_relative "../handler/
|
4
|
+
require_relative "../handler/api_operations"
|
5
5
|
|
6
6
|
module Nylas
|
7
|
-
#
|
7
|
+
# Nylas Calendar API
|
8
8
|
class Calendars < Resource
|
9
|
-
include
|
10
|
-
include
|
11
|
-
include
|
12
|
-
include
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
|
17
|
-
|
9
|
+
include ApiOperations::Get
|
10
|
+
include ApiOperations::Post
|
11
|
+
include ApiOperations::Put
|
12
|
+
include ApiOperations::Delete
|
13
|
+
|
14
|
+
# Return all calendars.
|
15
|
+
#
|
16
|
+
# @param identifier [String] Grant ID or email account to query.
|
17
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
18
|
+
# @return [Array(Array(Hash), String)] The list of calendars and API Request ID.
|
19
|
+
def list(identifier:, query_params: nil)
|
20
|
+
get(
|
21
|
+
path: "#{api_uri}/v3/grants/#{identifier}/calendars",
|
22
|
+
query_params: query_params
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return a calendar.
|
27
|
+
#
|
28
|
+
# @param identifier [String] Grant ID or email account to query.
|
29
|
+
# @param calendar_id [String] The id of the calendar to return.
|
30
|
+
# Use "primary" to refer to the primary calendar associated with grant.
|
31
|
+
# @return [Array(Hash, String)] The calendar and API request ID.
|
32
|
+
def find(identifier:, calendar_id:)
|
33
|
+
get(
|
34
|
+
path: "#{api_uri}/v3/grants/#{identifier}/calendars/#{calendar_id}"
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create a calendar.
|
39
|
+
#
|
40
|
+
# @param identifier [String] Grant ID or email account in which to create the object.
|
41
|
+
# @param request_body [Hash] The values to create the calendar with.
|
42
|
+
# @return [Array(Hash, String)] The created calendar and API Request ID.
|
43
|
+
def create(identifier:, request_body:)
|
44
|
+
post(
|
45
|
+
path: "#{api_uri}/v3/grants/#{identifier}/calendars",
|
46
|
+
request_body: request_body
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Update a calendar.
|
51
|
+
#
|
52
|
+
# @param identifier [String] Grant ID or email account in which to update an object.
|
53
|
+
# @param calendar_id [String] The id of the calendar to update.
|
54
|
+
# Use "primary" to refer to the primary calendar associated with grant.
|
55
|
+
# @param request_body [Hash] The values to update the calendar with
|
56
|
+
# @return [Array(Hash, String)] The updated calendar and API Request ID.
|
57
|
+
def update(identifier:, calendar_id:, request_body:)
|
58
|
+
put(
|
59
|
+
path: "#{api_uri}/v3/grants/#{identifier}/calendars/#{calendar_id}",
|
60
|
+
request_body: request_body
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Delete a calendar.
|
65
|
+
#
|
66
|
+
# @param identifier [String] Grant ID or email account from which to delete an object.
|
67
|
+
# @param calendar_id [String] The id of the calendar to delete.
|
68
|
+
# Use "primary" to refer to the primary calendar associated with grant.
|
69
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
70
|
+
def destroy(identifier:, calendar_id:)
|
71
|
+
_, request_id = delete(
|
72
|
+
path: "#{api_uri}/v3/grants/#{identifier}/calendars/#{calendar_id}"
|
73
|
+
)
|
74
|
+
|
75
|
+
[true, request_id]
|
18
76
|
end
|
19
77
|
|
20
78
|
# Checks multiple calendars to find available time slots for a single meeting.
|
21
79
|
#
|
22
|
-
# @param request_body [Hash
|
80
|
+
# @param request_body [Hash] Request body to pass to the request.
|
23
81
|
# @return [Array(Hash, String)] Availability object and API request ID.
|
24
|
-
def get_availability(request_body:
|
82
|
+
def get_availability(request_body:)
|
25
83
|
post(
|
26
84
|
path: "#{api_uri}/v3/calendars/availability",
|
27
85
|
request_body: request_body
|
28
86
|
)
|
29
87
|
end
|
88
|
+
|
89
|
+
# Get the free/busy schedule for a list of email addresses.
|
90
|
+
#
|
91
|
+
# @param identifier [str] The identifier of the grant to act upon.
|
92
|
+
# @param request_body [Hash] Request body to pass to the request.
|
93
|
+
# @return [Array(Array(Hash), String)] The free/busy response.
|
94
|
+
def get_free_busy(identifier:, request_body:)
|
95
|
+
post(
|
96
|
+
path: "#{api_uri}/v3/grants/#{identifier}/calendars/free-busy",
|
97
|
+
request_body: request_body
|
98
|
+
)
|
99
|
+
end
|
30
100
|
end
|
31
101
|
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "resource"
|
4
|
+
require_relative "../handler/api_operations"
|
5
|
+
|
6
|
+
module Nylas
|
7
|
+
# Nylas Connectors API
|
8
|
+
class Connectors < Resource
|
9
|
+
include ApiOperations::Get
|
10
|
+
include ApiOperations::Post
|
11
|
+
include ApiOperations::Put
|
12
|
+
include ApiOperations::Delete
|
13
|
+
|
14
|
+
# Access the Credentials API
|
15
|
+
attr_reader :credentials
|
16
|
+
|
17
|
+
# Initializes Connectors.
|
18
|
+
def initialize(sdk_instance)
|
19
|
+
super(sdk_instance)
|
20
|
+
|
21
|
+
@credentials = Credentials.new(sdk_instance)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Return all connectors.
|
25
|
+
#
|
26
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
27
|
+
# @return [Array(Array(Hash), String)] The list of connectors and API Request ID.
|
28
|
+
def list(query_params: nil)
|
29
|
+
get(
|
30
|
+
path: "#{api_uri}/v3/connectors",
|
31
|
+
query_params: query_params
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Return a connector.
|
36
|
+
#
|
37
|
+
# @param provider [String] The provider associated to the connector to retrieve.
|
38
|
+
# @return [Array(Hash, String)] The connector and API request ID.
|
39
|
+
def find(provider:)
|
40
|
+
get(
|
41
|
+
path: "#{api_uri}/v3/connectors/#{provider}"
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Create a connector.
|
46
|
+
#
|
47
|
+
# @param request_body [Hash] The values to create the connector with.
|
48
|
+
# @return [Array(Hash, String)] The created connector and API Request ID.
|
49
|
+
def create(request_body:)
|
50
|
+
post(
|
51
|
+
path: "#{api_uri}/v3/connectors",
|
52
|
+
request_body: request_body
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Update a connector.
|
57
|
+
#
|
58
|
+
# @param provider [String] The provider associated to the connector to update.
|
59
|
+
# @param request_body [Hash] The values to update the connector with
|
60
|
+
# @return [Array(Hash, String)] The updated connector and API Request ID.
|
61
|
+
def update(provider:, request_body:)
|
62
|
+
put(
|
63
|
+
path: "#{api_uri}/v3/connectors/#{provider}",
|
64
|
+
request_body: request_body
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Delete a connector.
|
69
|
+
#
|
70
|
+
# @param provider [String] The provider associated to the connector to delete.
|
71
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
72
|
+
def destroy(provider:)
|
73
|
+
_, request_id = delete(
|
74
|
+
path: "#{api_uri}/v3/connectors/#{provider}"
|
75
|
+
)
|
76
|
+
|
77
|
+
[true, request_id]
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "resource"
|
4
|
+
require_relative "../handler/api_operations"
|
5
|
+
|
6
|
+
module Nylas
|
7
|
+
# Nylas Contact API
|
8
|
+
class Contacts < Resource
|
9
|
+
include ApiOperations::Get
|
10
|
+
include ApiOperations::Post
|
11
|
+
include ApiOperations::Put
|
12
|
+
include ApiOperations::Delete
|
13
|
+
|
14
|
+
# Return all contacts.
|
15
|
+
#
|
16
|
+
# @param identifier [String] Grant ID or email account to query.
|
17
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
18
|
+
# @return [Array(Array(Hash), String)] The list of contacts and API Request ID.
|
19
|
+
def list(identifier:, query_params: nil)
|
20
|
+
get(
|
21
|
+
path: "#{api_uri}/v3/grants/#{identifier}/contacts",
|
22
|
+
query_params: query_params
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return a contact.
|
27
|
+
#
|
28
|
+
# @param identifier [String] Grant ID or email account to query.
|
29
|
+
# @param contact_id [String] The id of the contact to return.
|
30
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
31
|
+
# @return [Array(Hash, String)] The contact and API request ID.
|
32
|
+
def find(identifier:, contact_id:, query_params: nil)
|
33
|
+
get(
|
34
|
+
path: "#{api_uri}/v3/grants/#{identifier}/contacts/#{contact_id}",
|
35
|
+
query_params: query_params
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Create a contact.
|
40
|
+
#
|
41
|
+
# @param identifier [String] Grant ID or email account in which to create the object.
|
42
|
+
# @param request_body [Hash] The values to create the contact with.
|
43
|
+
# @return [Array(Hash, String)] The created contact and API Request ID.
|
44
|
+
def create(identifier:, request_body:)
|
45
|
+
post(
|
46
|
+
path: "#{api_uri}/v3/grants/#{identifier}/contacts",
|
47
|
+
request_body: request_body
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Update a contact.
|
52
|
+
#
|
53
|
+
# @param identifier [String] Grant ID or email account in which to update an object.
|
54
|
+
# @param contact_id [String] The id of the contact to update.
|
55
|
+
# @param request_body [Hash] The values to update the contact with
|
56
|
+
# @return [Array(Hash, String)] The updated contact and API Request ID.
|
57
|
+
def update(identifier:, contact_id:, request_body:)
|
58
|
+
put(
|
59
|
+
path: "#{api_uri}/v3/grants/#{identifier}/contacts/#{contact_id}",
|
60
|
+
request_body: request_body
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Delete a contact.
|
65
|
+
#
|
66
|
+
# @param identifier [String] Grant ID or email account from which to delete an object.
|
67
|
+
# @param contact_id [String] The id of the contact to delete.
|
68
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
69
|
+
def destroy(identifier:, contact_id:)
|
70
|
+
_, request_id = delete(
|
71
|
+
path: "#{api_uri}/v3/grants/#{identifier}/contacts/#{contact_id}"
|
72
|
+
)
|
73
|
+
|
74
|
+
[true, request_id]
|
75
|
+
end
|
76
|
+
|
77
|
+
# Return all contact groups.
|
78
|
+
#
|
79
|
+
# @param identifier [String] Grant ID or email account to query.
|
80
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
81
|
+
# @return [Array(Array(Hash), String)] The list of contact groups and API Request ID.
|
82
|
+
def contact_groups(identifier:, query_params: nil)
|
83
|
+
get(
|
84
|
+
path: "#{api_uri}/v3/grants/#{identifier}/contacts/groups",
|
85
|
+
query_params: query_params
|
86
|
+
)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "resource"
|
4
|
+
require_relative "../handler/api_operations"
|
5
|
+
|
6
|
+
module Nylas
|
7
|
+
# Nylas Connectors API
|
8
|
+
class Credentials < Resource
|
9
|
+
include ApiOperations::Get
|
10
|
+
include ApiOperations::Post
|
11
|
+
include ApiOperations::Put
|
12
|
+
include ApiOperations::Delete
|
13
|
+
|
14
|
+
# Return all credentials.
|
15
|
+
#
|
16
|
+
# @param provider [String] The provider associated to the credential to list from
|
17
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
18
|
+
# @return [Array(Array(Hash), String)] The list of credentials and API Request ID.
|
19
|
+
def list(provider:, query_params: nil)
|
20
|
+
get(
|
21
|
+
path: "#{api_uri}/v3/connectors/#{provider}/creds",
|
22
|
+
query_params: query_params
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return a connector.
|
27
|
+
#
|
28
|
+
# @param provider [String] The provider associated to the connector to retrieve.
|
29
|
+
# @param credential_id [String] The id of the credentials to retrieve.
|
30
|
+
# @return [Array(Hash, String)] The connector and API request ID.
|
31
|
+
def find(provider:, credential_id:)
|
32
|
+
get(
|
33
|
+
path: "#{api_uri}/v3/connectors/#{provider}/creds/#{credential_id}"
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Create a connector.
|
38
|
+
#
|
39
|
+
# @param provider [String] The provider associated to the credential being created
|
40
|
+
# @param request_body [Hash] The values to create the connector with.
|
41
|
+
# @return [Array(Hash, String)] The created connector and API Request ID.
|
42
|
+
def create(provider:, request_body:)
|
43
|
+
post(
|
44
|
+
path: "#{api_uri}/v3/connectors/#{provider}/creds",
|
45
|
+
request_body: request_body
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Update a connector.
|
50
|
+
#
|
51
|
+
# @param provider [String] The provider associated to the connector to update from.
|
52
|
+
# @param credential_id [String] The id of the credentials to update.
|
53
|
+
# @param request_body [Hash] The values to update the connector with
|
54
|
+
# @return [Array(Hash, String)] The updated connector and API Request ID.
|
55
|
+
def update(provider:, credential_id:, request_body:)
|
56
|
+
put(
|
57
|
+
path: "#{api_uri}/v3/connectors/#{provider}/creds/#{credential_id}",
|
58
|
+
request_body: request_body
|
59
|
+
)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Delete a connector.
|
63
|
+
#
|
64
|
+
# @param provider [String] The provider associated to the connector to delete.
|
65
|
+
# @param credential_id [String] The id of the credentials to delete.
|
66
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
67
|
+
def destroy(provider:, credential_id:)
|
68
|
+
_, request_id = delete(
|
69
|
+
path: "#{api_uri}/v3/connectors/#{provider}/creds/#{credential_id}"
|
70
|
+
)
|
71
|
+
|
72
|
+
[true, request_id]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "resource"
|
4
|
+
require_relative "../handler/api_operations"
|
5
|
+
require_relative "../utils/file_utils"
|
6
|
+
|
7
|
+
module Nylas
|
8
|
+
# Nylas Drafts API
|
9
|
+
class Drafts < Resource
|
10
|
+
include ApiOperations::Get
|
11
|
+
include ApiOperations::Post
|
12
|
+
include ApiOperations::Put
|
13
|
+
include ApiOperations::Delete
|
14
|
+
|
15
|
+
# Return all drafts.
|
16
|
+
#
|
17
|
+
# @param identifier [String] Grant ID or email account to query.
|
18
|
+
# @param query_params [Hash, nil] Query params to pass to the request.
|
19
|
+
# @return [Array(Array(Hash), String)] The list of drafts and API Request ID.
|
20
|
+
def list(identifier:, query_params: nil)
|
21
|
+
get(
|
22
|
+
path: "#{api_uri}/v3/grants/#{identifier}/drafts",
|
23
|
+
query_params: query_params
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Return an draft.
|
28
|
+
#
|
29
|
+
# @param identifier [String] Grant ID or email account to query.
|
30
|
+
# @param draft_id [String] The id of the draft to return.
|
31
|
+
# @return [Array(Hash, String)] The draft and API request ID.
|
32
|
+
def find(identifier:, draft_id:)
|
33
|
+
get(
|
34
|
+
path: "#{api_uri}/v3/grants/#{identifier}/drafts/#{draft_id}"
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create an draft.
|
39
|
+
#
|
40
|
+
# @param identifier [String] Grant ID or email account in which to create the draft.
|
41
|
+
# @param request_body [Hash] The values to create the message with.
|
42
|
+
# If you're attaching files, you must pass an array of [File] objects, or
|
43
|
+
# you can use {FileUtils::attach_file_request_builder} to build each object attach.
|
44
|
+
# @return [Array(Hash, String)] The created draft and API Request ID.
|
45
|
+
def create(identifier:, request_body:)
|
46
|
+
form_body, opened_files = FileUtils.build_form_request(request_body)
|
47
|
+
response = post(
|
48
|
+
path: "#{api_uri}/v3/grants/#{identifier}/drafts",
|
49
|
+
request_body: form_body
|
50
|
+
)
|
51
|
+
|
52
|
+
opened_files.each(&:close)
|
53
|
+
|
54
|
+
response
|
55
|
+
end
|
56
|
+
|
57
|
+
# Update an draft.
|
58
|
+
#
|
59
|
+
# @param identifier [String] Grant ID or email account in which to update the draft.
|
60
|
+
# @param draft_id [String] The id of the draft to update.
|
61
|
+
# @param request_body [Hash] The values to create the message with.
|
62
|
+
# If you're attaching files, you must pass an array of [File] objects, or
|
63
|
+
# you can use {FileUtils::attach_file_request_builder} to build each object attach.
|
64
|
+
# @return [Array(Hash, String)] The updated draft and API Request ID.
|
65
|
+
def update(identifier:, draft_id:, request_body:)
|
66
|
+
form_body, opened_files = FileUtils.build_form_request(request_body)
|
67
|
+
|
68
|
+
response = put(
|
69
|
+
path: "#{api_uri}/v3/grants/#{identifier}/drafts/#{draft_id}",
|
70
|
+
request_body: form_body
|
71
|
+
)
|
72
|
+
|
73
|
+
opened_files.each(&:close)
|
74
|
+
|
75
|
+
response
|
76
|
+
end
|
77
|
+
|
78
|
+
# Delete an draft.
|
79
|
+
#
|
80
|
+
# @param identifier [String] Grant ID or email account from which to delete an object.
|
81
|
+
# @param draft_id [String] The id of the draft to delete.
|
82
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
83
|
+
def destroy(identifier:, draft_id:)
|
84
|
+
_, request_id = delete(
|
85
|
+
path: "#{api_uri}/v3/grants/#{identifier}/drafts/#{draft_id}"
|
86
|
+
)
|
87
|
+
|
88
|
+
[true, request_id]
|
89
|
+
end
|
90
|
+
|
91
|
+
# Send an draft.
|
92
|
+
#
|
93
|
+
# @param identifier [String] Grant ID or email account from which to send the draft.
|
94
|
+
# @param draft_id [String] The id of the draft to send.
|
95
|
+
# @return [Array(Hash, String)] The sent message draft and the API Request ID.
|
96
|
+
def send(identifier:, draft_id:)
|
97
|
+
post(
|
98
|
+
path: "#{api_uri}/v3/grants/#{identifier}/drafts/#{draft_id}"
|
99
|
+
)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -1,20 +1,98 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "resource"
|
4
|
-
require_relative "../handler/
|
4
|
+
require_relative "../handler/api_operations"
|
5
5
|
|
6
6
|
module Nylas
|
7
|
-
# Events
|
7
|
+
# Nylas Events API
|
8
8
|
class Events < Resource
|
9
|
-
include
|
10
|
-
include
|
11
|
-
include
|
12
|
-
include
|
13
|
-
|
14
|
-
|
15
|
-
#
|
16
|
-
|
17
|
-
|
9
|
+
include ApiOperations::Get
|
10
|
+
include ApiOperations::Post
|
11
|
+
include ApiOperations::Put
|
12
|
+
include ApiOperations::Delete
|
13
|
+
|
14
|
+
# Return all events.
|
15
|
+
#
|
16
|
+
# @param identifier [String] Grant ID or email account to query.
|
17
|
+
# @param query_params [Hash] Query params to pass to the request.
|
18
|
+
# @return [Array(Array(Hash), String)] The list of events and API Request ID.
|
19
|
+
def list(identifier:, query_params:)
|
20
|
+
get(
|
21
|
+
path: "#{api_uri}/v3/grants/#{identifier}/events",
|
22
|
+
query_params: query_params
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Return an event.
|
27
|
+
#
|
28
|
+
# @param identifier [String] Grant ID or email account to query.
|
29
|
+
# @param event_id [String] The id of the event to return.
|
30
|
+
# @param query_params [Hash] The query parameters to include in the request
|
31
|
+
# @return [Array(Hash, String)] The event and API request ID.
|
32
|
+
def find(identifier:, event_id:, query_params:)
|
33
|
+
get(
|
34
|
+
path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}",
|
35
|
+
query_params: query_params
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Create an event.
|
40
|
+
#
|
41
|
+
# @param identifier [String] Grant ID or email account in which to create the object.
|
42
|
+
# @param request_body [Hash] The values to create the event with.
|
43
|
+
# @param query_params [Hash] The query parameters to include in the request.
|
44
|
+
# @return [Array(Hash, String)] The created event and API Request ID.
|
45
|
+
def create(identifier:, request_body:, query_params:)
|
46
|
+
post(
|
47
|
+
path: "#{api_uri}/v3/grants/#{identifier}/events",
|
48
|
+
query_params: query_params,
|
49
|
+
request_body: request_body
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Update an event.
|
54
|
+
#
|
55
|
+
# @param identifier [String] Grant ID or email account in which to update an object.
|
56
|
+
# @param event_id [String] The id of the event to update.
|
57
|
+
# @param request_body [Hash] The values to update the event with
|
58
|
+
# @param query_params [Hash] The query parameters to include in the request
|
59
|
+
# @return [Array(Hash, String)] The updated event and API Request ID.
|
60
|
+
def update(identifier:, event_id:, request_body:, query_params:)
|
61
|
+
put(
|
62
|
+
path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}",
|
63
|
+
query_params: query_params,
|
64
|
+
request_body: request_body
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
# Delete an event.
|
69
|
+
#
|
70
|
+
# @param identifier [String] Grant ID or email account from which to delete an object.
|
71
|
+
# @param event_id [String] The id of the event to delete.
|
72
|
+
# @param query_params [Hash] The query parameters to include in the request
|
73
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
74
|
+
def destroy(identifier:, event_id:, query_params:)
|
75
|
+
_, request_id = delete(
|
76
|
+
path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}",
|
77
|
+
query_params: query_params
|
78
|
+
)
|
79
|
+
|
80
|
+
[true, request_id]
|
81
|
+
end
|
82
|
+
|
83
|
+
# Send RSVP. Allows users to respond to events they have been added to as an attendee.
|
84
|
+
#
|
85
|
+
# @param identifier [String] Grant ID or email account from which to send RSVP with.
|
86
|
+
# @param event_id [String] The id of the event to respond to.
|
87
|
+
# @param request_body [Hash] The status values to send the RSVP with.
|
88
|
+
# @param query_params [Hash] The query parameters to include in the request
|
89
|
+
# @return [Hash] Response object with the API Request ID.
|
90
|
+
def send_rsvp(identifier:, event_id:, request_body:, query_params:)
|
91
|
+
post(
|
92
|
+
path: "#{api_uri}/v3/grants/#{identifier}/events/#{event_id}/send-rsvp",
|
93
|
+
query_params: query_params,
|
94
|
+
request_body: request_body
|
95
|
+
)
|
18
96
|
end
|
19
97
|
end
|
20
98
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "resource"
|
4
|
+
require_relative "../handler/api_operations"
|
5
|
+
|
6
|
+
module Nylas
|
7
|
+
# Nylas Folder API
|
8
|
+
class Folders < Resource
|
9
|
+
include ApiOperations::Get
|
10
|
+
include ApiOperations::Post
|
11
|
+
include ApiOperations::Put
|
12
|
+
include ApiOperations::Delete
|
13
|
+
|
14
|
+
# Return all folders.
|
15
|
+
#
|
16
|
+
# @param identifier [String] Grant ID or email account to query.
|
17
|
+
# @return [Array(Array(Hash), String)] The list of folders and API Request ID.
|
18
|
+
def list(identifier:)
|
19
|
+
get(
|
20
|
+
path: "#{api_uri}/v3/grants/#{identifier}/folders"
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Return a folder.
|
25
|
+
#
|
26
|
+
# @param identifier [String] Grant ID or email account to query.
|
27
|
+
# @param folder_id [String] The id of the folder to return.
|
28
|
+
# @return [Array(Hash, String)] The folder and API request ID.
|
29
|
+
def find(identifier:, folder_id:)
|
30
|
+
get(
|
31
|
+
path: "#{api_uri}/v3/grants/#{identifier}/folders/#{folder_id}"
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Create a folder.
|
36
|
+
#
|
37
|
+
# @param identifier [String] Grant ID or email account in which to create the object.
|
38
|
+
# @param request_body [Hash] The values to create the folder with.
|
39
|
+
# @return [Array(Hash, String)] The created folder and API Request ID.
|
40
|
+
def create(identifier:, request_body:)
|
41
|
+
post(
|
42
|
+
path: "#{api_uri}/v3/grants/#{identifier}/folders",
|
43
|
+
request_body: request_body
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Update a folder.
|
48
|
+
#
|
49
|
+
# @param identifier [String] Grant ID or email account in which to update an object.
|
50
|
+
# @param folder_id [String] The id of the folder to update.
|
51
|
+
# @param request_body [Hash] The values to update the folder with
|
52
|
+
# @return [Array(Hash, String)] The updated folder and API Request ID.
|
53
|
+
def update(identifier:, folder_id:, request_body:)
|
54
|
+
put(
|
55
|
+
path: "#{api_uri}/v3/grants/#{identifier}/folders/#{folder_id}",
|
56
|
+
request_body: request_body
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Delete a folder.
|
61
|
+
#
|
62
|
+
# @param identifier [String] Grant ID or email account from which to delete an object.
|
63
|
+
# @param folder_id [String] The id of the folder to delete.
|
64
|
+
# @return [Array(TrueClass, String)] True and the API Request ID for the delete operation.
|
65
|
+
def destroy(identifier:, folder_id:)
|
66
|
+
_, request_id = delete(
|
67
|
+
path: "#{api_uri}/v3/grants/#{identifier}/folders/#{folder_id}"
|
68
|
+
)
|
69
|
+
|
70
|
+
[true, request_id]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|