files.com 1.1.768 → 1.1.770
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/Gemfile.lock +1 -1
- data/README.md +47 -7
- data/_VERSION +1 -1
- data/docs/file.md +37 -0
- data/lib/files.com/api.rb +9 -4
- data/lib/files.com/api_client.rb +181 -55
- data/lib/files.com/list.rb +98 -66
- data/lib/files.com/models/action_log.rb +7 -2
- data/lib/files.com/models/action_notification_export.rb +13 -3
- data/lib/files.com/models/action_notification_export_result.rb +7 -2
- data/lib/files.com/models/ai_assistant_personality.rb +34 -8
- data/lib/files.com/models/ai_task.rb +39 -8
- data/lib/files.com/models/api_key.rb +49 -10
- data/lib/files.com/models/api_request_log.rb +7 -2
- data/lib/files.com/models/app.rb +7 -2
- data/lib/files.com/models/as2_incoming_message.rb +7 -2
- data/lib/files.com/models/as2_outgoing_message.rb +7 -2
- data/lib/files.com/models/as2_partner.rb +34 -8
- data/lib/files.com/models/as2_station.rb +34 -8
- data/lib/files.com/models/automation.rb +50 -10
- data/lib/files.com/models/automation_log.rb +7 -2
- data/lib/files.com/models/automation_run.rb +31 -6
- data/lib/files.com/models/bandwidth_snapshot.rb +7 -2
- data/lib/files.com/models/behavior.rb +46 -10
- data/lib/files.com/models/bundle.rb +39 -8
- data/lib/files.com/models/bundle_action.rb +7 -2
- data/lib/files.com/models/bundle_download.rb +7 -2
- data/lib/files.com/models/bundle_notification.rb +34 -8
- data/lib/files.com/models/bundle_recipient.rb +14 -4
- data/lib/files.com/models/bundle_registration.rb +7 -2
- data/lib/files.com/models/chat_session.rb +13 -3
- data/lib/files.com/models/child_site_management_policy.rb +34 -8
- data/lib/files.com/models/clickwrap.rb +34 -8
- data/lib/files.com/models/custom_domain.rb +40 -9
- data/lib/files.com/models/desktop_configuration_profile.rb +34 -8
- data/lib/files.com/models/dns_record.rb +7 -2
- data/lib/files.com/models/email_incoming_message.rb +7 -2
- data/lib/files.com/models/email_log.rb +7 -2
- data/lib/files.com/models/event_channel.rb +34 -8
- data/lib/files.com/models/event_delivery_attempt.rb +13 -3
- data/lib/files.com/models/event_record.rb +13 -3
- data/lib/files.com/models/event_subscription.rb +34 -8
- data/lib/files.com/models/event_target.rb +34 -8
- data/lib/files.com/models/exavault_api_request_log.rb +7 -2
- data/lib/files.com/models/expectation.rb +40 -9
- data/lib/files.com/models/expectation_evaluation.rb +13 -3
- data/lib/files.com/models/expectation_incident.rb +31 -6
- data/lib/files.com/models/external_event.rb +20 -5
- data/lib/files.com/models/file.rb +93 -15
- data/lib/files.com/models/file_comment.rb +28 -7
- data/lib/files.com/models/file_comment_reaction.rb +11 -2
- data/lib/files.com/models/file_migration.rb +6 -1
- data/lib/files.com/models/file_migration_log.rb +7 -2
- data/lib/files.com/models/folder.rb +13 -3
- data/lib/files.com/models/form_field_set.rb +34 -8
- data/lib/files.com/models/ftp_action_log.rb +7 -2
- data/lib/files.com/models/gpg_key.rb +34 -8
- data/lib/files.com/models/group.rb +34 -8
- data/lib/files.com/models/group_user.rb +29 -7
- data/lib/files.com/models/history.rb +35 -10
- data/lib/files.com/models/history_export.rb +13 -3
- data/lib/files.com/models/history_export_result.rb +7 -2
- data/lib/files.com/models/holiday_calendar.rb +34 -8
- data/lib/files.com/models/holiday_region.rb +7 -2
- data/lib/files.com/models/inbound_s3_log.rb +7 -2
- data/lib/files.com/models/inbox_recipient.rb +14 -4
- data/lib/files.com/models/inbox_registration.rb +7 -2
- data/lib/files.com/models/inbox_upload.rb +7 -2
- data/lib/files.com/models/integration_centric_profile.rb +34 -8
- data/lib/files.com/models/invoice.rb +13 -3
- data/lib/files.com/models/ip_address.rb +28 -8
- data/lib/files.com/models/key_lifecycle_rule.rb +34 -8
- data/lib/files.com/models/lock.rb +18 -3
- data/lib/files.com/models/metadata_category.rb +41 -10
- data/lib/files.com/models/notification.rb +34 -8
- data/lib/files.com/models/outbound_connection_log.rb +7 -2
- data/lib/files.com/models/partner.rb +34 -8
- data/lib/files.com/models/partner_channel.rb +34 -8
- data/lib/files.com/models/partner_channel_template.rb +34 -8
- data/lib/files.com/models/partner_site.rb +4 -0
- data/lib/files.com/models/partner_site_request.rb +33 -4
- data/lib/files.com/models/payment.rb +13 -3
- data/lib/files.com/models/pending_work_event.rb +13 -3
- data/lib/files.com/models/permission.rb +18 -4
- data/lib/files.com/models/public_hosting_request_log.rb +7 -2
- data/lib/files.com/models/public_key.rb +34 -8
- data/lib/files.com/models/remote_bandwidth_snapshot.rb +7 -2
- data/lib/files.com/models/remote_mount_backend.rb +39 -8
- data/lib/files.com/models/remote_server.rb +52 -11
- data/lib/files.com/models/remote_server_credential.rb +34 -8
- data/lib/files.com/models/request.rb +25 -6
- data/lib/files.com/models/restore.rb +14 -4
- data/lib/files.com/models/schedule.rb +34 -8
- data/lib/files.com/models/scheduled_export.rb +34 -8
- data/lib/files.com/models/scim_log.rb +13 -3
- data/lib/files.com/models/secret.rb +34 -8
- data/lib/files.com/models/session.rb +11 -2
- data/lib/files.com/models/settings_change.rb +7 -2
- data/lib/files.com/models/sftp_action_log.rb +7 -2
- data/lib/files.com/models/sftp_host_key.rb +34 -8
- data/lib/files.com/models/share_group.rb +34 -8
- data/lib/files.com/models/siem_http_destination.rb +39 -8
- data/lib/files.com/models/siem_http_destination_event.rb +13 -3
- data/lib/files.com/models/site.rb +16 -3
- data/lib/files.com/models/site_subdomain_redirect.rb +17 -3
- data/lib/files.com/models/snapshot.rb +39 -8
- data/lib/files.com/models/sso_event.rb +13 -3
- data/lib/files.com/models/sso_strategy.rb +18 -3
- data/lib/files.com/models/style.rb +20 -5
- data/lib/files.com/models/sync.rb +44 -8
- data/lib/files.com/models/sync_log.rb +7 -2
- data/lib/files.com/models/sync_run.rb +13 -3
- data/lib/files.com/models/usage_daily_snapshot.rb +7 -2
- data/lib/files.com/models/usage_snapshot.rb +7 -2
- data/lib/files.com/models/user.rb +50 -8
- data/lib/files.com/models/user_additional_email_recipient.rb +34 -8
- data/lib/files.com/models/user_cipher_use.rb +7 -2
- data/lib/files.com/models/user_lifecycle_rule.rb +34 -8
- data/lib/files.com/models/user_request.rb +24 -5
- data/lib/files.com/models/user_security_event.rb +13 -3
- data/lib/files.com/models/user_sftp_client_use.rb +7 -2
- data/lib/files.com/models/web_dav_action_log.rb +7 -2
- data/lib/files.com/models/webhook_test.rb +7 -2
- data/lib/files.com/models/workspace.rb +34 -8
- data/lib/files.com/response.rb +24 -0
- data/lib/files.com/sizable_io.rb +65 -4
- data/lib/files.com/version.rb +1 -1
- data/lib/files.com.rb +23 -1
- data/spec/language_spec.rb +20 -10
- data/spec/lib/api_client_spec.rb +173 -18
- data/spec/list_spec.rb +203 -187
- data/spec/models/file_transfer_spec.rb +346 -0
- data/spec/models/persistence_spec.rb +167 -0
- data/spec/spec_helper.rb +122 -6
- data/spec/support/stubbed_api.rb +14 -0
- data/spec/support/transfer_server.rb +60 -0
- metadata +6 -2
data/lib/files.com/list.rb
CHANGED
|
@@ -1,97 +1,129 @@
|
|
|
1
|
+
require "set"
|
|
2
|
+
|
|
1
3
|
module Files
|
|
4
|
+
# A page of results from a list operation, such as Files::User.list.
|
|
5
|
+
#
|
|
6
|
+
# +each+, and every other Enumerable method, covers the records on this page.
|
|
7
|
+
# +auto_paging_each+ continues through the pages that follow, requesting each
|
|
8
|
+
# one only when iteration reaches it. To move through a list one page at a
|
|
9
|
+
# time, use +has_next_page?+ and +next_page+:
|
|
10
|
+
#
|
|
11
|
+
# page = Files::User.list(per_page: 100)
|
|
12
|
+
# loop do
|
|
13
|
+
# page.each { |user| puts user.username }
|
|
14
|
+
# break unless page.has_next_page?
|
|
15
|
+
#
|
|
16
|
+
# page = page.next_page
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# A list operation returns its first page without requesting it yet. A page
|
|
20
|
+
# is requested when first used, and enumerating it again reuses its records.
|
|
21
|
+
#
|
|
22
|
+
# The two ways of paging keep separate places. All pages of one list share
|
|
23
|
+
# the place +next_page+ continues from, so calling it on an older page still
|
|
24
|
+
# returns the page after the newest one. +auto_paging_each+ always starts at
|
|
25
|
+
# the page it is called on, follows the cursors from there, and leaves
|
|
26
|
+
# +next_page+ where it was.
|
|
2
27
|
class List
|
|
3
28
|
include Enumerable
|
|
4
29
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@current_response = current_response
|
|
9
|
-
@current_options = current_options
|
|
10
|
-
@request_page = request_page
|
|
11
|
-
params[:per_page] ||= 1_000
|
|
12
|
-
end
|
|
30
|
+
# A requested page: its records, the cursor that requested it, and the
|
|
31
|
+
# cursor the API returned for the page after it, if any.
|
|
32
|
+
Page = Struct.new(:records, :cursor, :next_cursor)
|
|
13
33
|
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# Note that this method will make as many API calls as necessary to fetch
|
|
18
|
-
# all resources. For more granular control, please see +each+ and
|
|
19
|
-
# +next_page+.
|
|
20
|
-
def auto_paging_each(&block)
|
|
21
|
-
return enum_for(:auto_paging_each).lazy unless block_given?
|
|
34
|
+
# Where next_page continues from, shared by all pages of one list.
|
|
35
|
+
Progress = Struct.new(:next_cursor, :requested_cursors)
|
|
36
|
+
private_constant :Page, :Progress
|
|
22
37
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
38
|
+
# The block requests one page. It receives that page's parameters, which
|
|
39
|
+
# are +params+ plus its cursor, and a check to pass on to Api.send_request,
|
|
40
|
+
# so a rejected page leaves the caller's options as they were. +params+
|
|
41
|
+
# itself is copied, not changed.
|
|
42
|
+
def initialize(resource_wrapper, params, &request)
|
|
43
|
+
@resource_wrapper = resource_wrapper
|
|
44
|
+
@params = params.dup
|
|
45
|
+
@params[:per_page] ||= 1_000
|
|
46
|
+
@request = request
|
|
47
|
+
@progress = Progress.new(nil, Set.new)
|
|
48
|
+
end
|
|
26
49
|
|
|
27
|
-
|
|
50
|
+
# Yields each record on this page and returns the block's results. Without
|
|
51
|
+
# a block, returns an Enumerator.
|
|
52
|
+
def each(&block)
|
|
53
|
+
return enum_for(:each) unless block
|
|
28
54
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
end
|
|
55
|
+
page.records.map(&block)
|
|
56
|
+
end
|
|
32
57
|
|
|
33
|
-
|
|
58
|
+
# Yields each record on this page and then on each page after it, requesting
|
|
59
|
+
# those pages as iteration reaches them. Without a block, returns a lazy
|
|
60
|
+
# Enumerator, so methods such as +first+ request only the pages they need.
|
|
61
|
+
# This does not change where +next_page+ continues.
|
|
62
|
+
def auto_paging_each(&block)
|
|
63
|
+
return enum_for(:auto_paging_each).lazy unless block
|
|
64
|
+
|
|
65
|
+
requested_cursors = Set[page.cursor]
|
|
66
|
+
list = self
|
|
67
|
+
list.page.records.each(&block)
|
|
68
|
+
while (cursor = list.page.next_cursor)
|
|
69
|
+
list = request_list(cursor, requested_cursors)
|
|
70
|
+
list.page.records.each(&block)
|
|
34
71
|
end
|
|
35
72
|
end
|
|
36
73
|
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return [] unless page.valid_response?
|
|
44
|
-
|
|
45
|
-
page.set_cursor
|
|
46
|
-
page.wrap_data { |data| block.call data }
|
|
74
|
+
# Whether +next_page+ has another page to return, as reported by the page
|
|
75
|
+
# +next_page+ returned last (the first page, before any call). When stepping
|
|
76
|
+
# with <tt>page = page.next_page</tt>, that is this page.
|
|
77
|
+
def has_next_page?
|
|
78
|
+
page
|
|
79
|
+
!@progress.next_cursor.nil?
|
|
47
80
|
end
|
|
48
81
|
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
# was given, the default per_page will be used.
|
|
82
|
+
# Requests the page after the last one +next_page+ returned, starting after
|
|
83
|
+
# the first page, so repeated calls on any page of this list walk forward.
|
|
84
|
+
# Once there are no more pages, returns an empty page without a request.
|
|
53
85
|
def next_page
|
|
54
|
-
|
|
86
|
+
page
|
|
87
|
+
return with_page(Page.new([], nil, nil)) unless @progress.next_cursor
|
|
88
|
+
|
|
89
|
+
list = request_list(@progress.next_cursor, @progress.requested_cursors)
|
|
90
|
+
@progress.next_cursor = list.page.next_cursor
|
|
91
|
+
list
|
|
55
92
|
end
|
|
56
93
|
|
|
57
94
|
protected
|
|
58
95
|
|
|
59
|
-
|
|
60
|
-
:params,
|
|
61
|
-
:request_page
|
|
62
|
-
|
|
63
|
-
def current_page
|
|
64
|
-
@current_page ||= if @current_response and @current_options
|
|
65
|
-
self
|
|
66
|
-
else
|
|
67
|
-
next_page
|
|
68
|
-
end
|
|
69
|
-
end
|
|
96
|
+
attr_writer :page
|
|
70
97
|
|
|
71
|
-
def
|
|
72
|
-
@
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
def wrap_data
|
|
76
|
-
data.map do |object|
|
|
77
|
-
yield resource_wrapper.new(object, @current_options)
|
|
98
|
+
def page
|
|
99
|
+
@page ||= request_page(@params[:cursor]).tap do |first_page|
|
|
100
|
+
@progress.requested_cursors << first_page.cursor
|
|
101
|
+
@progress.next_cursor = first_page.next_cursor
|
|
78
102
|
end
|
|
79
103
|
end
|
|
80
104
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
105
|
+
private
|
|
106
|
+
|
|
107
|
+
# A cursor this list has already requested would repeat pages, possibly
|
|
108
|
+
# forever, so it ends the list with an error instead. A request that fails
|
|
109
|
+
# can be tried again.
|
|
110
|
+
def request_list(cursor, requested_cursors)
|
|
111
|
+
raise APIConnectionError, "The Files.com API repeated a list cursor, so the SDK stopped requesting pages." if requested_cursors.include?(cursor)
|
|
84
112
|
|
|
85
|
-
|
|
86
|
-
|
|
113
|
+
list = with_page(request_page(cursor))
|
|
114
|
+
requested_cursors << cursor
|
|
115
|
+
list
|
|
87
116
|
end
|
|
88
117
|
|
|
89
|
-
def
|
|
90
|
-
@
|
|
118
|
+
def request_page(cursor)
|
|
119
|
+
response, options = @request.call(cursor ? @params.merge(cursor: cursor) : @params) { |reply| reply.require_list(@resource_wrapper) }
|
|
120
|
+
records = response.data.map { |attributes| @resource_wrapper.new(attributes, options) }
|
|
121
|
+
next_cursor = response.http_headers["x-files-cursor"]
|
|
122
|
+
Page.new(records, cursor, (next_cursor unless next_cursor.to_s.strip.empty?))
|
|
91
123
|
end
|
|
92
124
|
|
|
93
|
-
def
|
|
94
|
-
|
|
125
|
+
def with_page(page)
|
|
126
|
+
dup.tap { |list| list.page = page }
|
|
95
127
|
end
|
|
96
128
|
end
|
|
97
129
|
end
|
|
@@ -88,6 +88,11 @@ module Files
|
|
|
88
88
|
# filter_prefix - object - If set, return records where the specified field is prefixed by the supplied value. Valid fields are `folder`, `path`, `src`, `destination` or `username`. Valid field combinations are `[ folder ]`, `[ path ]`, `[ src ]`, `[ destination ]`, `[ created_at ]`, `[ user_id ]`, `[ username ]`, `[ folder, path ]`, `[ folder, src ]`, `[ folder, destination ]`, `[ folder, created_at ]`, `[ folder, user_id ]`, `[ folder, username ]`, `[ path, src ]`, `[ path, destination ]`, `[ path, created_at ]`, `[ path, user_id ]`, `[ path, username ]`, `[ src, destination ]`, `[ src, created_at ]`, `[ src, user_id ]`, `[ src, username ]`, `[ destination, created_at ]`, `[ destination, user_id ]`, `[ destination, username ]`, `[ created_at, user_id ]`, `[ created_at, username ]`, `[ user_id, username ]`, `[ folder, path, src ]`, `[ folder, path, destination ]`, `[ folder, path, created_at ]`, `[ folder, path, user_id ]`, `[ folder, path, username ]`, `[ folder, src, destination ]`, `[ folder, src, created_at ]`, `[ folder, src, user_id ]`, `[ folder, src, username ]`, `[ folder, destination, created_at ]`, `[ folder, destination, user_id ]`, `[ folder, destination, username ]`, `[ folder, created_at, user_id ]`, `[ folder, created_at, username ]`, `[ folder, user_id, username ]`, `[ path, src, destination ]`, `[ path, src, created_at ]`, `[ path, src, user_id ]`, `[ path, src, username ]`, `[ path, destination, created_at ]`, `[ path, destination, user_id ]`, `[ path, destination, username ]`, `[ path, created_at, user_id ]`, `[ path, created_at, username ]`, `[ path, user_id, username ]`, `[ src, destination, created_at ]`, `[ src, destination, user_id ]`, `[ src, destination, username ]`, `[ src, created_at, user_id ]`, `[ src, created_at, username ]`, `[ src, user_id, username ]`, `[ destination, created_at, user_id ]`, `[ destination, created_at, username ]`, `[ destination, user_id, username ]`, `[ created_at, user_id, username ]`, `[ folder, path, src, destination ]`, `[ folder, path, src, created_at ]`, `[ folder, path, src, user_id ]`, `[ folder, path, src, username ]`, `[ folder, path, destination, created_at ]`, `[ folder, path, destination, user_id ]`, `[ folder, path, destination, username ]`, `[ folder, path, created_at, user_id ]`, `[ folder, path, created_at, username ]`, `[ folder, path, user_id, username ]`, `[ folder, src, destination, created_at ]`, `[ folder, src, destination, user_id ]`, `[ folder, src, destination, username ]`, `[ folder, src, created_at, user_id ]`, `[ folder, src, created_at, username ]`, `[ folder, src, user_id, username ]`, `[ folder, destination, created_at, user_id ]`, `[ folder, destination, created_at, username ]`, `[ folder, destination, user_id, username ]`, `[ folder, created_at, user_id, username ]`, `[ path, src, destination, created_at ]`, `[ path, src, destination, user_id ]`, `[ path, src, destination, username ]`, `[ path, src, created_at, user_id ]`, `[ path, src, created_at, username ]`, `[ path, src, user_id, username ]`, `[ path, destination, created_at, user_id ]`, `[ path, destination, created_at, username ]`, `[ path, destination, user_id, username ]`, `[ path, created_at, user_id, username ]`, `[ src, destination, created_at, user_id ]`, `[ src, destination, created_at, username ]`, `[ src, destination, user_id, username ]`, `[ src, created_at, user_id, username ]`, `[ destination, created_at, user_id, username ]`, `[ folder, path, src, destination, created_at ]`, `[ folder, path, src, destination, user_id ]`, `[ folder, path, src, destination, username ]`, `[ folder, path, src, created_at, user_id ]`, `[ folder, path, src, created_at, username ]`, `[ folder, path, src, user_id, username ]`, `[ folder, path, destination, created_at, user_id ]`, `[ folder, path, destination, created_at, username ]`, `[ folder, path, destination, user_id, username ]`, `[ folder, path, created_at, user_id, username ]`, `[ folder, src, destination, created_at, user_id ]`, `[ folder, src, destination, created_at, username ]`, `[ folder, src, destination, user_id, username ]`, `[ folder, src, created_at, user_id, username ]`, `[ folder, destination, created_at, user_id, username ]`, `[ path, src, destination, created_at, user_id ]`, `[ path, src, destination, created_at, username ]`, `[ path, src, destination, user_id, username ]`, `[ path, src, created_at, user_id, username ]`, `[ path, destination, created_at, user_id, username ]`, `[ src, destination, created_at, user_id, username ]`, `[ folder, path, src, destination, created_at, user_id ]`, `[ folder, path, src, destination, created_at, username ]`, `[ folder, path, src, destination, user_id, username ]`, `[ folder, path, src, created_at, user_id, username ]`, `[ folder, path, destination, created_at, user_id, username ]`, `[ folder, src, destination, created_at, user_id, username ]`, `[ path, src, destination, created_at, user_id, username ]` or `[ folder, path, src, destination, created_at, user_id, username ]`.
|
|
89
89
|
# filter_lt - object - If set, return records where the specified field is less than the supplied value. Valid fields are `created_at`. Valid field combinations are `[ folder ]`, `[ path ]`, `[ src ]`, `[ destination ]`, `[ created_at ]`, `[ user_id ]`, `[ username ]`, `[ folder, path ]`, `[ folder, src ]`, `[ folder, destination ]`, `[ folder, created_at ]`, `[ folder, user_id ]`, `[ folder, username ]`, `[ path, src ]`, `[ path, destination ]`, `[ path, created_at ]`, `[ path, user_id ]`, `[ path, username ]`, `[ src, destination ]`, `[ src, created_at ]`, `[ src, user_id ]`, `[ src, username ]`, `[ destination, created_at ]`, `[ destination, user_id ]`, `[ destination, username ]`, `[ created_at, user_id ]`, `[ created_at, username ]`, `[ user_id, username ]`, `[ folder, path, src ]`, `[ folder, path, destination ]`, `[ folder, path, created_at ]`, `[ folder, path, user_id ]`, `[ folder, path, username ]`, `[ folder, src, destination ]`, `[ folder, src, created_at ]`, `[ folder, src, user_id ]`, `[ folder, src, username ]`, `[ folder, destination, created_at ]`, `[ folder, destination, user_id ]`, `[ folder, destination, username ]`, `[ folder, created_at, user_id ]`, `[ folder, created_at, username ]`, `[ folder, user_id, username ]`, `[ path, src, destination ]`, `[ path, src, created_at ]`, `[ path, src, user_id ]`, `[ path, src, username ]`, `[ path, destination, created_at ]`, `[ path, destination, user_id ]`, `[ path, destination, username ]`, `[ path, created_at, user_id ]`, `[ path, created_at, username ]`, `[ path, user_id, username ]`, `[ src, destination, created_at ]`, `[ src, destination, user_id ]`, `[ src, destination, username ]`, `[ src, created_at, user_id ]`, `[ src, created_at, username ]`, `[ src, user_id, username ]`, `[ destination, created_at, user_id ]`, `[ destination, created_at, username ]`, `[ destination, user_id, username ]`, `[ created_at, user_id, username ]`, `[ folder, path, src, destination ]`, `[ folder, path, src, created_at ]`, `[ folder, path, src, user_id ]`, `[ folder, path, src, username ]`, `[ folder, path, destination, created_at ]`, `[ folder, path, destination, user_id ]`, `[ folder, path, destination, username ]`, `[ folder, path, created_at, user_id ]`, `[ folder, path, created_at, username ]`, `[ folder, path, user_id, username ]`, `[ folder, src, destination, created_at ]`, `[ folder, src, destination, user_id ]`, `[ folder, src, destination, username ]`, `[ folder, src, created_at, user_id ]`, `[ folder, src, created_at, username ]`, `[ folder, src, user_id, username ]`, `[ folder, destination, created_at, user_id ]`, `[ folder, destination, created_at, username ]`, `[ folder, destination, user_id, username ]`, `[ folder, created_at, user_id, username ]`, `[ path, src, destination, created_at ]`, `[ path, src, destination, user_id ]`, `[ path, src, destination, username ]`, `[ path, src, created_at, user_id ]`, `[ path, src, created_at, username ]`, `[ path, src, user_id, username ]`, `[ path, destination, created_at, user_id ]`, `[ path, destination, created_at, username ]`, `[ path, destination, user_id, username ]`, `[ path, created_at, user_id, username ]`, `[ src, destination, created_at, user_id ]`, `[ src, destination, created_at, username ]`, `[ src, destination, user_id, username ]`, `[ src, created_at, user_id, username ]`, `[ destination, created_at, user_id, username ]`, `[ folder, path, src, destination, created_at ]`, `[ folder, path, src, destination, user_id ]`, `[ folder, path, src, destination, username ]`, `[ folder, path, src, created_at, user_id ]`, `[ folder, path, src, created_at, username ]`, `[ folder, path, src, user_id, username ]`, `[ folder, path, destination, created_at, user_id ]`, `[ folder, path, destination, created_at, username ]`, `[ folder, path, destination, user_id, username ]`, `[ folder, path, created_at, user_id, username ]`, `[ folder, src, destination, created_at, user_id ]`, `[ folder, src, destination, created_at, username ]`, `[ folder, src, destination, user_id, username ]`, `[ folder, src, created_at, user_id, username ]`, `[ folder, destination, created_at, user_id, username ]`, `[ path, src, destination, created_at, user_id ]`, `[ path, src, destination, created_at, username ]`, `[ path, src, destination, user_id, username ]`, `[ path, src, created_at, user_id, username ]`, `[ path, destination, created_at, user_id, username ]`, `[ src, destination, created_at, user_id, username ]`, `[ folder, path, src, destination, created_at, user_id ]`, `[ folder, path, src, destination, created_at, username ]`, `[ folder, path, src, destination, user_id, username ]`, `[ folder, path, src, created_at, user_id, username ]`, `[ folder, path, destination, created_at, user_id, username ]`, `[ folder, src, destination, created_at, user_id, username ]`, `[ path, src, destination, created_at, user_id, username ]` or `[ folder, path, src, destination, created_at, user_id, username ]`.
|
|
90
90
|
# filter_lteq - object - If set, return records where the specified field is less than or equal the supplied value. Valid fields are `created_at`. Valid field combinations are `[ folder ]`, `[ path ]`, `[ src ]`, `[ destination ]`, `[ created_at ]`, `[ user_id ]`, `[ username ]`, `[ folder, path ]`, `[ folder, src ]`, `[ folder, destination ]`, `[ folder, created_at ]`, `[ folder, user_id ]`, `[ folder, username ]`, `[ path, src ]`, `[ path, destination ]`, `[ path, created_at ]`, `[ path, user_id ]`, `[ path, username ]`, `[ src, destination ]`, `[ src, created_at ]`, `[ src, user_id ]`, `[ src, username ]`, `[ destination, created_at ]`, `[ destination, user_id ]`, `[ destination, username ]`, `[ created_at, user_id ]`, `[ created_at, username ]`, `[ user_id, username ]`, `[ folder, path, src ]`, `[ folder, path, destination ]`, `[ folder, path, created_at ]`, `[ folder, path, user_id ]`, `[ folder, path, username ]`, `[ folder, src, destination ]`, `[ folder, src, created_at ]`, `[ folder, src, user_id ]`, `[ folder, src, username ]`, `[ folder, destination, created_at ]`, `[ folder, destination, user_id ]`, `[ folder, destination, username ]`, `[ folder, created_at, user_id ]`, `[ folder, created_at, username ]`, `[ folder, user_id, username ]`, `[ path, src, destination ]`, `[ path, src, created_at ]`, `[ path, src, user_id ]`, `[ path, src, username ]`, `[ path, destination, created_at ]`, `[ path, destination, user_id ]`, `[ path, destination, username ]`, `[ path, created_at, user_id ]`, `[ path, created_at, username ]`, `[ path, user_id, username ]`, `[ src, destination, created_at ]`, `[ src, destination, user_id ]`, `[ src, destination, username ]`, `[ src, created_at, user_id ]`, `[ src, created_at, username ]`, `[ src, user_id, username ]`, `[ destination, created_at, user_id ]`, `[ destination, created_at, username ]`, `[ destination, user_id, username ]`, `[ created_at, user_id, username ]`, `[ folder, path, src, destination ]`, `[ folder, path, src, created_at ]`, `[ folder, path, src, user_id ]`, `[ folder, path, src, username ]`, `[ folder, path, destination, created_at ]`, `[ folder, path, destination, user_id ]`, `[ folder, path, destination, username ]`, `[ folder, path, created_at, user_id ]`, `[ folder, path, created_at, username ]`, `[ folder, path, user_id, username ]`, `[ folder, src, destination, created_at ]`, `[ folder, src, destination, user_id ]`, `[ folder, src, destination, username ]`, `[ folder, src, created_at, user_id ]`, `[ folder, src, created_at, username ]`, `[ folder, src, user_id, username ]`, `[ folder, destination, created_at, user_id ]`, `[ folder, destination, created_at, username ]`, `[ folder, destination, user_id, username ]`, `[ folder, created_at, user_id, username ]`, `[ path, src, destination, created_at ]`, `[ path, src, destination, user_id ]`, `[ path, src, destination, username ]`, `[ path, src, created_at, user_id ]`, `[ path, src, created_at, username ]`, `[ path, src, user_id, username ]`, `[ path, destination, created_at, user_id ]`, `[ path, destination, created_at, username ]`, `[ path, destination, user_id, username ]`, `[ path, created_at, user_id, username ]`, `[ src, destination, created_at, user_id ]`, `[ src, destination, created_at, username ]`, `[ src, destination, user_id, username ]`, `[ src, created_at, user_id, username ]`, `[ destination, created_at, user_id, username ]`, `[ folder, path, src, destination, created_at ]`, `[ folder, path, src, destination, user_id ]`, `[ folder, path, src, destination, username ]`, `[ folder, path, src, created_at, user_id ]`, `[ folder, path, src, created_at, username ]`, `[ folder, path, src, user_id, username ]`, `[ folder, path, destination, created_at, user_id ]`, `[ folder, path, destination, created_at, username ]`, `[ folder, path, destination, user_id, username ]`, `[ folder, path, created_at, user_id, username ]`, `[ folder, src, destination, created_at, user_id ]`, `[ folder, src, destination, created_at, username ]`, `[ folder, src, destination, user_id, username ]`, `[ folder, src, created_at, user_id, username ]`, `[ folder, destination, created_at, user_id, username ]`, `[ path, src, destination, created_at, user_id ]`, `[ path, src, destination, created_at, username ]`, `[ path, src, destination, user_id, username ]`, `[ path, src, created_at, user_id, username ]`, `[ path, destination, created_at, user_id, username ]`, `[ src, destination, created_at, user_id, username ]`, `[ folder, path, src, destination, created_at, user_id ]`, `[ folder, path, src, destination, created_at, username ]`, `[ folder, path, src, destination, user_id, username ]`, `[ folder, path, src, created_at, user_id, username ]`, `[ folder, path, destination, created_at, user_id, username ]`, `[ folder, src, destination, created_at, user_id, username ]`, `[ path, src, destination, created_at, user_id, username ]` or `[ folder, path, src, destination, created_at, user_id, username ]`.
|
|
91
|
+
#
|
|
92
|
+
# params:: Hash of API operation parameter values.
|
|
93
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
94
|
+
#
|
|
95
|
+
# Returns a Files::List of Files::ActionLog objects.
|
|
91
96
|
def self.list(params = {}, options = {})
|
|
92
97
|
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
|
|
93
98
|
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
|
|
@@ -98,8 +103,8 @@ module Files
|
|
|
98
103
|
raise InvalidParameterError.new("Bad parameter: filter_lt must be an Hash") if params[:filter_lt] and !params[:filter_lt].is_a?(Hash)
|
|
99
104
|
raise InvalidParameterError.new("Bad parameter: filter_lteq must be an Hash") if params[:filter_lteq] and !params[:filter_lteq].is_a?(Hash)
|
|
100
105
|
|
|
101
|
-
List.new(ActionLog, params) do
|
|
102
|
-
Api.send_request("/action_logs", :get,
|
|
106
|
+
List.new(ActionLog, params) do |page_params, &check_page|
|
|
107
|
+
Api.send_request("/action_logs", :get, page_params, options, &check_page)
|
|
103
108
|
end
|
|
104
109
|
end
|
|
105
110
|
|
|
@@ -149,21 +149,26 @@ module Files
|
|
|
149
149
|
raise NotImplementedError.new("The ActionNotificationExport object doesn't support updates.")
|
|
150
150
|
else
|
|
151
151
|
new_obj = ActionNotificationExport.create(@attributes, @options)
|
|
152
|
+
@attributes = new_obj.attributes
|
|
152
153
|
end
|
|
153
154
|
|
|
154
|
-
@attributes = new_obj.attributes
|
|
155
155
|
true
|
|
156
156
|
end
|
|
157
157
|
|
|
158
158
|
# Parameters:
|
|
159
159
|
# id (required) - int64 - Action Notification Export ID.
|
|
160
|
+
#
|
|
161
|
+
# params:: Hash of API operation parameter values.
|
|
162
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
163
|
+
#
|
|
164
|
+
# Returns a Files::ActionNotificationExport.
|
|
160
165
|
def self.find(id, params = {}, options = {})
|
|
161
166
|
params ||= {}
|
|
162
167
|
params[:id] = id
|
|
163
168
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
|
|
164
169
|
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
|
|
165
170
|
|
|
166
|
-
response, options = Api.send_request("/action_notification_exports/#{params[:id]}", :get, params, options)
|
|
171
|
+
response, options = Api.send_request("/action_notification_exports/#{params[:id]}", :get, params, options) { |reply| reply.require_object("ActionNotificationExport") }
|
|
167
172
|
ActionNotificationExport.new(response.data, options)
|
|
168
173
|
end
|
|
169
174
|
|
|
@@ -183,6 +188,11 @@ module Files
|
|
|
183
188
|
# query_success - boolean - true if the webhook request succeeded (i.e. returned a 200 or 204 response status). false otherwise.
|
|
184
189
|
# query_path - string - Return notifications that were triggered by actions on this specific path.
|
|
185
190
|
# query_folder - string - Return notifications that were triggered by actions in this folder.
|
|
191
|
+
#
|
|
192
|
+
# params:: Hash of API operation parameter values.
|
|
193
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
194
|
+
#
|
|
195
|
+
# Returns a Files::ActionNotificationExport.
|
|
186
196
|
def self.create(params = {}, options = {})
|
|
187
197
|
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
|
|
188
198
|
raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
|
|
@@ -195,7 +205,7 @@ module Files
|
|
|
195
205
|
raise InvalidParameterError.new("Bad parameter: query_path must be an String") if params[:query_path] and !params[:query_path].is_a?(String)
|
|
196
206
|
raise InvalidParameterError.new("Bad parameter: query_folder must be an String") if params[:query_folder] and !params[:query_folder].is_a?(String)
|
|
197
207
|
|
|
198
|
-
response, options = Api.send_request("/action_notification_exports", :post, params, options)
|
|
208
|
+
response, options = Api.send_request("/action_notification_exports", :post, params, options) { |reply| reply.require_object("ActionNotificationExport") }
|
|
199
209
|
ActionNotificationExport.new(response.data, options)
|
|
200
210
|
end
|
|
201
211
|
end
|
|
@@ -64,6 +64,11 @@ module Files
|
|
|
64
64
|
# cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
|
|
65
65
|
# per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
|
|
66
66
|
# action_notification_export_id (required) - int64 - ID of the associated action notification export.
|
|
67
|
+
#
|
|
68
|
+
# params:: Hash of API operation parameter values.
|
|
69
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
70
|
+
#
|
|
71
|
+
# Returns a Files::List of Files::ActionNotificationExportResult objects.
|
|
67
72
|
def self.list(params = {}, options = {})
|
|
68
73
|
raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer)
|
|
69
74
|
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
|
|
@@ -71,8 +76,8 @@ module Files
|
|
|
71
76
|
raise InvalidParameterError.new("Bad parameter: action_notification_export_id must be an Integer") if params[:action_notification_export_id] and !params[:action_notification_export_id].is_a?(Integer)
|
|
72
77
|
raise MissingParameterError.new("Parameter missing: action_notification_export_id") unless params[:action_notification_export_id]
|
|
73
78
|
|
|
74
|
-
List.new(ActionNotificationExportResult, params) do
|
|
75
|
-
Api.send_request("/action_notification_export_results", :get,
|
|
79
|
+
List.new(ActionNotificationExportResult, params) do |page_params, &check_page|
|
|
80
|
+
Api.send_request("/action_notification_export_results", :get, page_params, options, &check_page)
|
|
76
81
|
end
|
|
77
82
|
end
|
|
78
83
|
|
|
@@ -89,7 +89,9 @@ module Files
|
|
|
89
89
|
raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
|
|
90
90
|
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
|
|
91
91
|
|
|
92
|
-
Api.send_request("/ai_assistant_personalities/#{@attributes[:id]}", :patch, params, @options)
|
|
92
|
+
response, options = Api.send_request("/ai_assistant_personalities/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("AiAssistantPersonality") }
|
|
93
|
+
@attributes = response.data
|
|
94
|
+
[ response, options ]
|
|
93
95
|
end
|
|
94
96
|
|
|
95
97
|
def delete(params = {})
|
|
@@ -109,12 +111,12 @@ module Files
|
|
|
109
111
|
|
|
110
112
|
def save
|
|
111
113
|
if @attributes[:id]
|
|
112
|
-
|
|
114
|
+
update(@attributes)
|
|
113
115
|
else
|
|
114
116
|
new_obj = AiAssistantPersonality.create(@attributes, @options)
|
|
117
|
+
@attributes = new_obj.attributes
|
|
115
118
|
end
|
|
116
119
|
|
|
117
|
-
@attributes = new_obj.attributes
|
|
118
120
|
true
|
|
119
121
|
end
|
|
120
122
|
|
|
@@ -123,14 +125,19 @@ module Files
|
|
|
123
125
|
# per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
|
|
124
126
|
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id` and `id`.
|
|
125
127
|
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `workspace_id`.
|
|
128
|
+
#
|
|
129
|
+
# params:: Hash of API operation parameter values.
|
|
130
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
131
|
+
#
|
|
132
|
+
# Returns a Files::List of Files::AiAssistantPersonality objects.
|
|
126
133
|
def self.list(params = {}, options = {})
|
|
127
134
|
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
|
|
128
135
|
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
|
|
129
136
|
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
|
|
130
137
|
raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
|
|
131
138
|
|
|
132
|
-
List.new(AiAssistantPersonality, params) do
|
|
133
|
-
Api.send_request("/ai_assistant_personalities", :get,
|
|
139
|
+
List.new(AiAssistantPersonality, params) do |page_params, &check_page|
|
|
140
|
+
Api.send_request("/ai_assistant_personalities", :get, page_params, options, &check_page)
|
|
134
141
|
end
|
|
135
142
|
end
|
|
136
143
|
|
|
@@ -140,13 +147,18 @@ module Files
|
|
|
140
147
|
|
|
141
148
|
# Parameters:
|
|
142
149
|
# id (required) - int64 - Ai Assistant Personality ID.
|
|
150
|
+
#
|
|
151
|
+
# params:: Hash of API operation parameter values.
|
|
152
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
153
|
+
#
|
|
154
|
+
# Returns a Files::AiAssistantPersonality.
|
|
143
155
|
def self.find(id, params = {}, options = {})
|
|
144
156
|
params ||= {}
|
|
145
157
|
params[:id] = id
|
|
146
158
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
|
|
147
159
|
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
|
|
148
160
|
|
|
149
|
-
response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :get, params, options)
|
|
161
|
+
response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :get, params, options) { |reply| reply.require_object("AiAssistantPersonality") }
|
|
150
162
|
AiAssistantPersonality.new(response.data, options)
|
|
151
163
|
end
|
|
152
164
|
|
|
@@ -160,6 +172,11 @@ module Files
|
|
|
160
172
|
# system_prompt (required) - string - System prompt injected into the in-app AI Assistant.
|
|
161
173
|
# use_by_default - boolean - Whether this personality is the default personality for the Workspace.
|
|
162
174
|
# workspace_id - int64 - Workspace ID. `0` means the default workspace.
|
|
175
|
+
#
|
|
176
|
+
# params:: Hash of API operation parameter values.
|
|
177
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
178
|
+
#
|
|
179
|
+
# Returns a Files::AiAssistantPersonality.
|
|
163
180
|
def self.create(params = {}, options = {})
|
|
164
181
|
raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
|
|
165
182
|
raise InvalidParameterError.new("Bad parameter: system_prompt must be an String") if params[:system_prompt] and !params[:system_prompt].is_a?(String)
|
|
@@ -167,7 +184,7 @@ module Files
|
|
|
167
184
|
raise MissingParameterError.new("Parameter missing: name") unless params[:name]
|
|
168
185
|
raise MissingParameterError.new("Parameter missing: system_prompt") unless params[:system_prompt]
|
|
169
186
|
|
|
170
|
-
response, options = Api.send_request("/ai_assistant_personalities", :post, params, options)
|
|
187
|
+
response, options = Api.send_request("/ai_assistant_personalities", :post, params, options) { |reply| reply.require_object("AiAssistantPersonality") }
|
|
171
188
|
AiAssistantPersonality.new(response.data, options)
|
|
172
189
|
end
|
|
173
190
|
|
|
@@ -177,6 +194,11 @@ module Files
|
|
|
177
194
|
# system_prompt - string - System prompt injected into the in-app AI Assistant.
|
|
178
195
|
# use_by_default - boolean - Whether this personality is the default personality for the Workspace.
|
|
179
196
|
# workspace_id - int64 - Workspace ID. `0` means the default workspace.
|
|
197
|
+
#
|
|
198
|
+
# params:: Hash of API operation parameter values.
|
|
199
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
200
|
+
#
|
|
201
|
+
# Returns a Files::AiAssistantPersonality.
|
|
180
202
|
def self.update(id, params = {}, options = {})
|
|
181
203
|
params ||= {}
|
|
182
204
|
params[:id] = id
|
|
@@ -186,10 +208,14 @@ module Files
|
|
|
186
208
|
raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
|
|
187
209
|
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
|
|
188
210
|
|
|
189
|
-
response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :patch, params, options)
|
|
211
|
+
response, options = Api.send_request("/ai_assistant_personalities/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("AiAssistantPersonality") }
|
|
190
212
|
AiAssistantPersonality.new(response.data, options)
|
|
191
213
|
end
|
|
192
214
|
|
|
215
|
+
# params:: Hash of API operation parameter values.
|
|
216
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
217
|
+
#
|
|
218
|
+
# Returns nil.
|
|
193
219
|
def self.delete(id, params = {}, options = {})
|
|
194
220
|
params ||= {}
|
|
195
221
|
params[:id] = id
|
|
@@ -271,7 +271,9 @@ module Files
|
|
|
271
271
|
raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
|
|
272
272
|
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
|
|
273
273
|
|
|
274
|
-
Api.send_request("/ai_tasks/#{@attributes[:id]}", :patch, params, @options)
|
|
274
|
+
response, options = Api.send_request("/ai_tasks/#{@attributes[:id]}", :patch, params, @options) { |reply| reply.require_object("AiTask") }
|
|
275
|
+
@attributes = response.data
|
|
276
|
+
[ response, options ]
|
|
275
277
|
end
|
|
276
278
|
|
|
277
279
|
def delete(params = {})
|
|
@@ -291,12 +293,12 @@ module Files
|
|
|
291
293
|
|
|
292
294
|
def save
|
|
293
295
|
if @attributes[:id]
|
|
294
|
-
|
|
296
|
+
update(@attributes)
|
|
295
297
|
else
|
|
296
298
|
new_obj = AiTask.create(@attributes, @options)
|
|
299
|
+
@attributes = new_obj.attributes
|
|
297
300
|
end
|
|
298
301
|
|
|
299
|
-
@attributes = new_obj.attributes
|
|
300
302
|
true
|
|
301
303
|
end
|
|
302
304
|
|
|
@@ -305,14 +307,19 @@ module Files
|
|
|
305
307
|
# per_page - int64 - Number of records to show per page. (Max: 10000, 1,000 or less is recommended).
|
|
306
308
|
# sort_by - object - If set, sort records by the specified field in either `asc` or `desc` direction. Valid fields are `workspace_id`, `name`, `disabled` or `updated_at`.
|
|
307
309
|
# filter - object - If set, return records where the specified field is equal to the supplied value. Valid fields are `disabled`, `trigger` or `workspace_id`. Valid field combinations are `[ workspace_id, disabled ]`.
|
|
310
|
+
#
|
|
311
|
+
# params:: Hash of API operation parameter values.
|
|
312
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
313
|
+
#
|
|
314
|
+
# Returns a Files::List of Files::AiTask objects.
|
|
308
315
|
def self.list(params = {}, options = {})
|
|
309
316
|
raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String)
|
|
310
317
|
raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer)
|
|
311
318
|
raise InvalidParameterError.new("Bad parameter: sort_by must be an Hash") if params[:sort_by] and !params[:sort_by].is_a?(Hash)
|
|
312
319
|
raise InvalidParameterError.new("Bad parameter: filter must be an Hash") if params[:filter] and !params[:filter].is_a?(Hash)
|
|
313
320
|
|
|
314
|
-
List.new(AiTask, params) do
|
|
315
|
-
Api.send_request("/ai_tasks", :get,
|
|
321
|
+
List.new(AiTask, params) do |page_params, &check_page|
|
|
322
|
+
Api.send_request("/ai_tasks", :get, page_params, options, &check_page)
|
|
316
323
|
end
|
|
317
324
|
end
|
|
318
325
|
|
|
@@ -322,13 +329,18 @@ module Files
|
|
|
322
329
|
|
|
323
330
|
# Parameters:
|
|
324
331
|
# id (required) - int64 - Ai Task ID.
|
|
332
|
+
#
|
|
333
|
+
# params:: Hash of API operation parameter values.
|
|
334
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
335
|
+
#
|
|
336
|
+
# Returns a Files::AiTask.
|
|
325
337
|
def self.find(id, params = {}, options = {})
|
|
326
338
|
params ||= {}
|
|
327
339
|
params[:id] = id
|
|
328
340
|
raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer)
|
|
329
341
|
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
|
|
330
342
|
|
|
331
|
-
response, options = Api.send_request("/ai_tasks/#{params[:id]}", :get, params, options)
|
|
343
|
+
response, options = Api.send_request("/ai_tasks/#{params[:id]}", :get, params, options) { |reply| reply.require_object("AiTask") }
|
|
332
344
|
AiTask.new(response.data, options)
|
|
333
345
|
end
|
|
334
346
|
|
|
@@ -355,6 +367,11 @@ module Files
|
|
|
355
367
|
# trigger - string - How this AI Task is triggered.
|
|
356
368
|
# trigger_actions - array(string) - If trigger is `action`, the file action types that invoke this AI Task. Valid actions are create, copy, move, archived_delete, update, read, destroy.
|
|
357
369
|
# workspace_id - int64 - Workspace ID. `0` means the default workspace.
|
|
370
|
+
#
|
|
371
|
+
# params:: Hash of API operation parameter values.
|
|
372
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
373
|
+
#
|
|
374
|
+
# Returns a Files::AiTask.
|
|
358
375
|
def self.create(params = {}, options = {})
|
|
359
376
|
raise InvalidParameterError.new("Bad parameter: description must be an String") if params[:description] and !params[:description].is_a?(String)
|
|
360
377
|
raise InvalidParameterError.new("Bad parameter: holiday_region must be an String") if params[:holiday_region] and !params[:holiday_region].is_a?(String)
|
|
@@ -376,11 +393,16 @@ module Files
|
|
|
376
393
|
raise MissingParameterError.new("Parameter missing: name") unless params[:name]
|
|
377
394
|
raise MissingParameterError.new("Parameter missing: prompt") unless params[:prompt]
|
|
378
395
|
|
|
379
|
-
response, options = Api.send_request("/ai_tasks", :post, params, options)
|
|
396
|
+
response, options = Api.send_request("/ai_tasks", :post, params, options) { |reply| reply.require_object("AiTask") }
|
|
380
397
|
AiTask.new(response.data, options)
|
|
381
398
|
end
|
|
382
399
|
|
|
383
400
|
# Manually Run AI Task
|
|
401
|
+
#
|
|
402
|
+
# params:: Hash of API operation parameter values.
|
|
403
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
404
|
+
#
|
|
405
|
+
# Returns nil.
|
|
384
406
|
def self.manual_run(id, params = {}, options = {})
|
|
385
407
|
params ||= {}
|
|
386
408
|
params[:id] = id
|
|
@@ -410,6 +432,11 @@ module Files
|
|
|
410
432
|
# trigger - string - How this AI Task is triggered.
|
|
411
433
|
# trigger_actions - array(string) - If trigger is `action`, the file action types that invoke this AI Task. Valid actions are create, copy, move, archived_delete, update, read, destroy.
|
|
412
434
|
# workspace_id - int64 - Workspace ID. `0` means the default workspace.
|
|
435
|
+
#
|
|
436
|
+
# params:: Hash of API operation parameter values.
|
|
437
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
438
|
+
#
|
|
439
|
+
# Returns a Files::AiTask.
|
|
413
440
|
def self.update(id, params = {}, options = {})
|
|
414
441
|
params ||= {}
|
|
415
442
|
params[:id] = id
|
|
@@ -433,10 +460,14 @@ module Files
|
|
|
433
460
|
raise InvalidParameterError.new("Bad parameter: workspace_id must be an Integer") if params[:workspace_id] and !params[:workspace_id].is_a?(Integer)
|
|
434
461
|
raise MissingParameterError.new("Parameter missing: id") unless params[:id]
|
|
435
462
|
|
|
436
|
-
response, options = Api.send_request("/ai_tasks/#{params[:id]}", :patch, params, options)
|
|
463
|
+
response, options = Api.send_request("/ai_tasks/#{params[:id]}", :patch, params, options) { |reply| reply.require_object("AiTask") }
|
|
437
464
|
AiTask.new(response.data, options)
|
|
438
465
|
end
|
|
439
466
|
|
|
467
|
+
# params:: Hash of API operation parameter values.
|
|
468
|
+
# options:: Hash of optional request configuration passed to Files::Api.send_request.
|
|
469
|
+
#
|
|
470
|
+
# Returns nil.
|
|
440
471
|
def self.delete(id, params = {}, options = {})
|
|
441
472
|
params ||= {}
|
|
442
473
|
params[:id] = id
|