seam 2.131.0 → 2.133.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/seam/http_multi_workspace.rb +2 -2
  4. data/lib/seam/http_single_workspace.rb +2 -2
  5. data/lib/seam/resources/access_code.rb +67 -0
  6. data/lib/seam/resources/access_grant.rb +51 -0
  7. data/lib/seam/resources/access_method.rb +46 -0
  8. data/lib/seam/resources/acs_access_group.rb +45 -0
  9. data/lib/seam/resources/acs_credential.rb +73 -0
  10. data/lib/seam/resources/acs_encoder.rb +37 -0
  11. data/lib/seam/resources/acs_entrance.rb +61 -0
  12. data/lib/seam/resources/acs_system.rb +54 -0
  13. data/lib/seam/resources/acs_user.rb +63 -0
  14. data/lib/seam/resources/action_attempt.rb +18 -0
  15. data/lib/seam/resources/batch.rb +134 -0
  16. data/lib/seam/resources/client_session.rb +44 -0
  17. data/lib/seam/resources/connect_webview.rb +59 -0
  18. data/lib/seam/resources/connected_account.rb +46 -0
  19. data/lib/seam/resources/customer_portal.rb +25 -0
  20. data/lib/seam/resources/device.rb +83 -0
  21. data/lib/seam/resources/device_provider.rb +56 -0
  22. data/lib/seam/resources/event.rb +193 -0
  23. data/lib/seam/{routes/resources → resources}/index.rb +3 -0
  24. data/lib/seam/resources/instant_key.rb +31 -0
  25. data/lib/seam/resources/noise_threshold.rb +23 -0
  26. data/lib/seam/resources/pagination.rb +15 -0
  27. data/lib/seam/resources/phone.rb +29 -0
  28. data/lib/seam/resources/space.rb +32 -0
  29. data/lib/seam/resources/thermostat_daily_program.rb +22 -0
  30. data/lib/seam/resources/thermostat_schedule.rb +34 -0
  31. data/lib/seam/resources/unmanaged_access_code.rb +53 -0
  32. data/lib/seam/resources/unmanaged_access_grant.rb +43 -0
  33. data/lib/seam/resources/unmanaged_access_method.rb +40 -0
  34. data/lib/seam/resources/unmanaged_device.rb +73 -0
  35. data/lib/seam/resources/unmanaged_user_identity.rb +29 -0
  36. data/lib/seam/resources/user_identity.rb +31 -0
  37. data/lib/seam/resources/webhook.rb +17 -0
  38. data/lib/seam/resources/workspace.rb +28 -0
  39. data/lib/seam/routes/access_codes.rb +227 -0
  40. data/lib/seam/routes/access_codes_simulate.rb +23 -0
  41. data/lib/seam/routes/access_codes_unmanaged.rb +76 -0
  42. data/lib/seam/routes/access_grants.rb +117 -0
  43. data/lib/seam/routes/access_grants_unmanaged.rb +50 -0
  44. data/lib/seam/routes/access_methods.rb +101 -0
  45. data/lib/seam/routes/access_methods_unmanaged.rb +33 -0
  46. data/lib/seam/routes/acs_access_groups.rb +82 -0
  47. data/lib/seam/routes/acs_credentials.rb +109 -0
  48. data/lib/seam/routes/{clients/acs_encoders.rb → acs_encoders.rb} +25 -0
  49. data/lib/seam/routes/acs_encoders_simulate.rb +55 -0
  50. data/lib/seam/routes/acs_entrances.rb +76 -0
  51. data/lib/seam/routes/acs_systems.rb +56 -0
  52. data/lib/seam/routes/acs_users.rb +150 -0
  53. data/lib/seam/routes/{clients/action_attempts.rb → action_attempts.rb} +9 -0
  54. data/lib/seam/routes/client_sessions.rb +102 -0
  55. data/lib/seam/routes/connect_webviews.rb +72 -0
  56. data/lib/seam/routes/connected_accounts.rb +77 -0
  57. data/lib/seam/routes/{clients/connected_accounts_simulate.rb → connected_accounts_simulate.rb} +3 -0
  58. data/lib/seam/routes/customers.rb +87 -0
  59. data/lib/seam/routes/devices.rb +95 -0
  60. data/lib/seam/routes/devices_simulate.rb +76 -0
  61. data/lib/seam/routes/devices_unmanaged.rb +66 -0
  62. data/lib/seam/routes/events.rb +59 -0
  63. data/lib/seam/routes/{clients/instant_keys.rb → instant_keys.rb} +10 -0
  64. data/lib/seam/routes/locks.rb +89 -0
  65. data/lib/seam/routes/{clients/locks_simulate.rb → locks_simulate.rb} +7 -0
  66. data/lib/seam/routes/noise_sensors.rb +45 -0
  67. data/lib/seam/routes/noise_sensors_noise_thresholds.rb +69 -0
  68. data/lib/seam/routes/noise_sensors_simulate.rb +21 -0
  69. data/lib/seam/routes/phones.rb +44 -0
  70. data/lib/seam/routes/phones_simulate.rb +24 -0
  71. data/lib/seam/routes/spaces.rb +145 -0
  72. data/lib/seam/routes/thermostats.rb +238 -0
  73. data/lib/seam/routes/{clients/thermostats_daily_programs.rb → thermostats_daily_programs.rb} +13 -0
  74. data/lib/seam/routes/thermostats_schedules.rb +70 -0
  75. data/lib/seam/routes/thermostats_simulate.rb +37 -0
  76. data/lib/seam/routes/user_identities.rb +167 -0
  77. data/lib/seam/routes/user_identities_unmanaged.rb +46 -0
  78. data/lib/seam/routes/{clients/webhooks.rb → webhooks.rb} +16 -0
  79. data/lib/seam/routes/workspaces.rb +77 -0
  80. data/lib/seam/version.rb +1 -1
  81. data/lib/seam/webhook.rb +1 -1
  82. metadata +83 -80
  83. data/lib/seam/routes/clients/access_codes.rb +0 -80
  84. data/lib/seam/routes/clients/access_codes_simulate.rb +0 -18
  85. data/lib/seam/routes/clients/access_codes_unmanaged.rb +0 -42
  86. data/lib/seam/routes/clients/access_grants.rb +0 -58
  87. data/lib/seam/routes/clients/access_grants_unmanaged.rb +0 -30
  88. data/lib/seam/routes/clients/access_methods.rb +0 -66
  89. data/lib/seam/routes/clients/access_methods_unmanaged.rb +0 -24
  90. data/lib/seam/routes/clients/acs_access_groups.rb +0 -54
  91. data/lib/seam/routes/clients/acs_credentials.rb +0 -60
  92. data/lib/seam/routes/clients/acs_encoders_simulate.rb +0 -36
  93. data/lib/seam/routes/clients/acs_entrances.rb +0 -46
  94. data/lib/seam/routes/clients/acs_systems.rb +0 -36
  95. data/lib/seam/routes/clients/acs_users.rb +0 -78
  96. data/lib/seam/routes/clients/client_sessions.rb +0 -54
  97. data/lib/seam/routes/clients/connect_webviews.rb +0 -36
  98. data/lib/seam/routes/clients/connected_accounts.rb +0 -46
  99. data/lib/seam/routes/clients/customers.rb +0 -30
  100. data/lib/seam/routes/clients/devices.rb +0 -50
  101. data/lib/seam/routes/clients/devices_simulate.rb +0 -48
  102. data/lib/seam/routes/clients/devices_unmanaged.rb +0 -30
  103. data/lib/seam/routes/clients/events.rb +0 -24
  104. data/lib/seam/routes/clients/locks.rb +0 -54
  105. data/lib/seam/routes/clients/noise_sensors.rb +0 -26
  106. data/lib/seam/routes/clients/noise_sensors_noise_thresholds.rb +0 -42
  107. data/lib/seam/routes/clients/noise_sensors_simulate.rb +0 -18
  108. data/lib/seam/routes/clients/phones.rb +0 -34
  109. data/lib/seam/routes/clients/phones_simulate.rb +0 -18
  110. data/lib/seam/routes/clients/spaces.rb +0 -84
  111. data/lib/seam/routes/clients/thermostats.rb +0 -126
  112. data/lib/seam/routes/clients/thermostats_schedules.rb +0 -42
  113. data/lib/seam/routes/clients/thermostats_simulate.rb +0 -24
  114. data/lib/seam/routes/clients/user_identities.rb +0 -100
  115. data/lib/seam/routes/clients/user_identities_unmanaged.rb +0 -30
  116. data/lib/seam/routes/clients/workspaces.rb +0 -46
  117. data/lib/seam/routes/resources/access_code.rb +0 -14
  118. data/lib/seam/routes/resources/access_grant.rb +0 -14
  119. data/lib/seam/routes/resources/access_method.rb +0 -14
  120. data/lib/seam/routes/resources/acs_access_group.rb +0 -14
  121. data/lib/seam/routes/resources/acs_credential.rb +0 -14
  122. data/lib/seam/routes/resources/acs_encoder.rb +0 -13
  123. data/lib/seam/routes/resources/acs_entrance.rb +0 -14
  124. data/lib/seam/routes/resources/acs_system.rb +0 -14
  125. data/lib/seam/routes/resources/acs_user.rb +0 -14
  126. data/lib/seam/routes/resources/action_attempt.rb +0 -9
  127. data/lib/seam/routes/resources/batch.rb +0 -9
  128. data/lib/seam/routes/resources/client_session.rb +0 -11
  129. data/lib/seam/routes/resources/connect_webview.rb +0 -11
  130. data/lib/seam/routes/resources/connected_account.rb +0 -14
  131. data/lib/seam/routes/resources/customer_portal.rb +0 -11
  132. data/lib/seam/routes/resources/device.rb +0 -14
  133. data/lib/seam/routes/resources/device_provider.rb +0 -9
  134. data/lib/seam/routes/resources/event.rb +0 -11
  135. data/lib/seam/routes/resources/instant_key.rb +0 -11
  136. data/lib/seam/routes/resources/noise_threshold.rb +0 -9
  137. data/lib/seam/routes/resources/pagination.rb +0 -9
  138. data/lib/seam/routes/resources/phone.rb +0 -14
  139. data/lib/seam/routes/resources/space.rb +0 -11
  140. data/lib/seam/routes/resources/thermostat_daily_program.rb +0 -11
  141. data/lib/seam/routes/resources/thermostat_schedule.rb +0 -13
  142. data/lib/seam/routes/resources/unmanaged_access_code.rb +0 -14
  143. data/lib/seam/routes/resources/unmanaged_device.rb +0 -14
  144. data/lib/seam/routes/resources/user_identity.rb +0 -14
  145. data/lib/seam/routes/resources/webhook.rb +0 -9
  146. data/lib/seam/routes/resources/workspace.rb +0 -9
  147. /data/lib/seam/{routes/resources → resources}/resource_error.rb +0 -0
  148. /data/lib/seam/{routes/resources → resources}/resource_errors_support.rb +0 -0
  149. /data/lib/seam/{routes/resources → resources}/resource_warning.rb +0 -0
  150. /data/lib/seam/{routes/resources → resources}/resource_warnings_support.rb +0 -0
  151. /data/lib/seam/routes/{clients/acs.rb → acs.rb} +0 -0
  152. /data/lib/seam/routes/{clients/index.rb → index.rb} +0 -0
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ # Represents a [user identity](https://docs.seam.co/capability-guides/mobile-access/managing-mobile-app-user-accounts-with-user-identities#what-is-a-user-identity) associated with an application user account.
6
+ class UserIdentity < BaseResource
7
+ # Array of access system user IDs associated with the user identity.
8
+ attr_accessor :acs_user_ids
9
+ # Display name for the user identity.
10
+ attr_accessor :display_name
11
+ # Unique email address for the user identity.
12
+ attr_accessor :email_address
13
+ # Full name of the user associated with the user identity.
14
+ attr_accessor :full_name
15
+ # Unique phone number for the user identity in [E.164 format](https://www.itu.int/rec/T-REC-E.164/en) (for example, +15555550100).
16
+ attr_accessor :phone_number
17
+ # ID of the user identity.
18
+ attr_accessor :user_identity_id
19
+ # Unique key for the user identity.
20
+ attr_accessor :user_identity_key
21
+ # ID of the workspace that contains the user identity.
22
+ attr_accessor :workspace_id
23
+
24
+ # Date and time at which the user identity was created.
25
+ date_accessor :created_at
26
+
27
+ include Seam::Resources::ResourceErrorsSupport
28
+ include Seam::Resources::ResourceWarningsSupport
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ # Represents a [webhook](https://docs.seam.co/developer-tools/webhooks) that enables you to receive notifications of events. When you create a webhook, specify the endpoint URL at which you want to receive events and the set of event types that you want to receive.
6
+ class Webhook < BaseResource
7
+ # Types of events that the [webhook](https://docs.seam.co/developer-tools/webhooks) should receive.
8
+ attr_accessor :event_types
9
+ # Secret associated with the [webhook](https://docs.seam.co/developer-tools/webhooks).
10
+ attr_accessor :secret
11
+ # URL for the [webhook](https://docs.seam.co/developer-tools/webhooks).
12
+ attr_accessor :url
13
+ # ID of the webhook.
14
+ attr_accessor :webhook_id
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Resources
5
+ # Represents a Seam [workspace](https://docs.seam.co/core-concepts/workspaces). A workspace is a top-level entity that encompasses all other resources below it, such as devices, connected accounts, and Connect Webviews. Seam provides two types of workspaces. A [sandbox workspace](https://docs.seam.co/core-concepts/workspaces#sandbox-workspaces) is a special type of workspace designed for testing code. Sandbox workspaces offer test device accounts and virtual devices that you can connect and control. This ability to work with virtual devices is quite handy because it removes the need to own physical devices from multiple brands. To connect real devices and systems to Seam, use a [production workspace](https://docs.seam.co/core-concepts/workspaces#production-workspaces).
6
+ class Workspace < BaseResource
7
+ # Company name associated with the [workspace](https://docs.seam.co/core-concepts/workspaces).
8
+ attr_accessor :company_name
9
+ # @deprecated Use `company_name` instead.
10
+ attr_accessor :connect_partner_name
11
+ attr_accessor :connect_webview_customization
12
+ # Indicates whether publishable key authentication is enabled for this workspace.
13
+ attr_accessor :is_publishable_key_auth_enabled
14
+ # Indicates whether the workspace is a [sandbox workspace](https://docs.seam.co/core-concepts/workspaces#sandbox-workspaces).
15
+ attr_accessor :is_sandbox
16
+ # Indicates whether the [sandbox workspace](https://docs.seam.co/core-concepts/workspaces#sandbox-workspaces) is suspended. Seam suspends sandbox workspaces that have not been accessed in 14 days.
17
+ attr_accessor :is_suspended
18
+ # Name of the [workspace](https://docs.seam.co/core-concepts/workspaces).
19
+ attr_accessor :name
20
+ # ID of the organization to which the workspace belongs, or `null` if the workspace is not assigned to an organization.
21
+ attr_accessor :organization_id
22
+ # Publishable key for the [workspace](https://docs.seam.co/core-concepts/workspaces). This key is used to identify the workspace in client-side applications.
23
+ attr_accessor :publishable_key
24
+ # ID of the workspace.
25
+ attr_accessor :workspace_id
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,227 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Clients
5
+ class AccessCodes
6
+ def initialize(client:, defaults:)
7
+ @client = client
8
+ @defaults = defaults
9
+ end
10
+
11
+ def simulate
12
+ @simulate ||= Seam::Clients::AccessCodesSimulate.new(client: @client, defaults: @defaults)
13
+ end
14
+
15
+ def unmanaged
16
+ @unmanaged ||= Seam::Clients::AccessCodesUnmanaged.new(client: @client, defaults: @defaults)
17
+ end
18
+
19
+ # Creates a new [access code](https://docs.seam.co/low-level-apis/access-codes). For granting access, we recommend [Access Grants](https://docs.seam.co/use-cases/granting-access) instead: they work across both standalone smart locks and access control systems and manage the underlying codes for you. Use this low-level endpoint only when you need direct control over a code on a single device, such as setting a custom PIN value.
20
+ # @param device_id ID of the device for which you want to create the new access code.
21
+ # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
22
+ # @param attempt_for_offline_device
23
+ # @param code Code to be used for access.
24
+ # @param common_code_key Key to identify access codes that should have the same code. Any two access codes with the same `common_code_key` are guaranteed to have the same `code`. See also [Creating and Updating Multiple Linked Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/creating-and-updating-multiple-linked-access-codes).
25
+ # @param ends_at Date and time at which the validity of the new access code ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
26
+ # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
27
+ # @param is_offline_access_code Indicates whether the access code is an [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes).
28
+ # @param is_one_time_use Indicates whether the [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) is a single-use access code.
29
+ # @param max_time_rounding Maximum rounding adjustment. To create a daily-bound [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) for devices that support this feature, set this parameter to `1d`.
30
+ # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
31
+ #
32
+ # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
33
+ #
34
+ # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
35
+ #
36
+ # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
37
+ # @param prefer_native_scheduling Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
38
+ # @param preferred_code_length Preferred code length. Only applicable if you do not specify a `code`. If the affected device does not support the preferred code length, Seam reverts to using the shortest supported code length.
39
+ # @param starts_at Date and time at which the validity of the new access code starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
40
+ # @param use_backup_access_code_pool Indicates whether to use a [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) provided by Seam. If `true`, you can use [`/access_codes/pull_backup_access_code`](https://docs.seam.co/api/access_codes/pull_backup_access_code).
41
+ # @param use_offline_access_code
42
+ # @deprecated use_offline_access_code: Use `is_offline_access_code` instead.
43
+ # @return [Seam::Resources::AccessCode] OK
44
+ def create(device_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, common_code_key: nil, ends_at: nil, is_external_modification_allowed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
45
+ res = @client.post("/access_codes/create", {device_id: device_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, common_code_key: common_code_key, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact)
46
+
47
+ Seam::Resources::AccessCode.load_from_response(res.body["access_code"])
48
+ end
49
+
50
+ # Creates new [access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes) that share a common code across multiple devices.
51
+ #
52
+ # Users with more than one door lock in a property may want to create groups of linked access codes, all of which have the same code (PIN). For example, a short-term rental host may want to provide guests the same PIN for both a front door lock and a back door lock.
53
+ #
54
+ # If you specify a custom code, Seam assigns this custom code to each of the resulting access codes. However, in this case, Seam does not link these access codes together with a `common_code_key`. That is, `common_code_key` remains null for these access codes.
55
+ #
56
+ # If you want to change these access codes that are not linked by a `common_code_key`, you cannot use `/access_codes/update_multiple`. However, you can update each of these access codes individually, using `/access_codes/update`.
57
+ #
58
+ # See also [Creating and Updating Multiple Linked Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/creating-and-updating-multiple-linked-access-codes).
59
+ #
60
+ # For granting a person access to a space, [Access Grants](https://docs.seam.co/use-cases/granting-access) are the default and recommended approach and work across both standalone smart locks and access systems. Use the lower-level Access Codes API directly only when you specifically need to manage individual PIN codes.
61
+ # @param device_ids IDs of the devices for which you want to create the new access codes.
62
+ # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
63
+ # @param attempt_for_offline_device
64
+ # @param behavior_when_code_cannot_be_shared Desired behavior if any device cannot share a code. If `throw` (default), no access codes will be created if any device cannot share a code. If `create_random_code`, a random code will be created on devices that cannot share a code.
65
+ # @param code Code to be used for access.
66
+ # @param ends_at Date and time at which the validity of the new access code ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
67
+ # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
68
+ # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
69
+ #
70
+ # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
71
+ #
72
+ # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
73
+ #
74
+ # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
75
+ # @param prefer_native_scheduling Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
76
+ # @param preferred_code_length Preferred code length. If the affected devices do not support the preferred code length, Seam reverts to using the shortest supported code length.
77
+ # @param starts_at Date and time at which the validity of the new access code starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
78
+ # @param use_backup_access_code_pool Indicates whether to use a [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) provided by Seam. If `true`, you can use [`/access_codes/pull_backup_access_code`](https://docs.seam.co/api/access_codes/pull_backup_access_code).
79
+ # @return [Seam::Resources::AccessCode] OK
80
+ def create_multiple(device_ids:, allow_external_modification: nil, attempt_for_offline_device: nil, behavior_when_code_cannot_be_shared: nil, code: nil, ends_at: nil, is_external_modification_allowed: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, use_backup_access_code_pool: nil)
81
+ res = @client.post("/access_codes/create_multiple", {device_ids: device_ids, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, behavior_when_code_cannot_be_shared: behavior_when_code_cannot_be_shared, code: code, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, use_backup_access_code_pool: use_backup_access_code_pool}.compact)
82
+
83
+ Seam::Resources::AccessCode.load_from_response(res.body["access_codes"])
84
+ end
85
+
86
+ # Deletes an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
87
+ # @param access_code_id ID of the access code that you want to delete.
88
+ # @param device_id ID of the device for which you want to delete the access code.
89
+ # @return [nil] OK
90
+ def delete(access_code_id:, device_id: nil)
91
+ @client.post("/access_codes/delete", {access_code_id: access_code_id, device_id: device_id}.compact)
92
+
93
+ nil
94
+ end
95
+
96
+ # Generates a code for an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes), given a device ID.
97
+ # @param device_id ID of the device for which you want to generate a code.
98
+ # @return [Seam::Resources::AccessCode] OK
99
+ def generate_code(device_id:)
100
+ res = @client.post("/access_codes/generate_code", {device_id: device_id}.compact)
101
+
102
+ Seam::Resources::AccessCode.load_from_response(res.body["generated_code"])
103
+ end
104
+
105
+ # Returns a specified [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
106
+ #
107
+ # You must specify either `access_code_id` or both `device_id` and `code`.
108
+ # @param access_code_id ID of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
109
+ # @param code Code of the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
110
+ # @param device_id ID of the device containing the access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
111
+ # @return [Seam::Resources::AccessCode] OK
112
+ def get(access_code_id: nil, code: nil, device_id: nil)
113
+ res = @client.post("/access_codes/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
114
+
115
+ Seam::Resources::AccessCode.load_from_response(res.body["access_code"])
116
+ end
117
+
118
+ # Returns a list of all [access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
119
+ #
120
+ # Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
121
+ # @param access_code_ids IDs of the access codes that you want to retrieve. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
122
+ # @param access_grant_id ID of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
123
+ # @param access_grant_key Key of the access grant for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
124
+ # @param access_method_id ID of the access method for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
125
+ # @param customer_key Customer key for which you want to list access codes.
126
+ # @param device_id ID of the device for which you want to list access codes. Specify `device_id`, `access_code_ids`, `access_method_id`, `access_grant_id`, or `access_grant_key`.
127
+ # @param limit Numerical limit on the number of access codes to return.
128
+ # @param page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
129
+ # @param search String for which to search. Filters returned access codes to include all records that satisfy a partial match using `name`, `code` or `access_code_id`.
130
+ # @param user_identifier_key Your user ID for the user by which to filter access codes.
131
+ # @return [Seam::Resources::AccessCode] OK
132
+ def list(access_code_ids: nil, access_grant_id: nil, access_grant_key: nil, access_method_id: nil, customer_key: nil, device_id: nil, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil)
133
+ res = @client.post("/access_codes/list", {access_code_ids: access_code_ids, access_grant_id: access_grant_id, access_grant_key: access_grant_key, access_method_id: access_method_id, customer_key: customer_key, device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact)
134
+
135
+ Seam::Resources::AccessCode.load_from_response(res.body["access_codes"])
136
+ end
137
+
138
+ # Retrieves a backup access code for an [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes). See also [Managing Backup Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes).
139
+ #
140
+ # A backup access code pool is a collection of pre-programmed access codes stored on a device, ready for use. These codes are programmed in addition to the regular access codes on Seam, serving as a safety net for any issues with the primary codes. If there's ever a complication with a primary access code—be it due to intermittent connectivity, manual removal from a device, or provider outages—a backup code can be retrieved. Its end time can then be adjusted to align with the original code, facilitating seamless and uninterrupted access.
141
+ #
142
+ # You can pull a backup access code from the pool at any time. These backup codes are guaranteed to work immediately and automatically programmed to be removed from the device after the access code ends.
143
+ #
144
+ # You can only pull backup access codes for time-bound access codes.
145
+ #
146
+ # Before pulling a backup access code, make sure that the device's `properties.supports_backup_access_code_pool` is `true`. Then, to activate the backup pool, set `use_backup_access_code_pool` to `true` when creating an access code.
147
+ # @param access_code_id ID of the access code for which you want to pull a backup access code.
148
+ # @return [Seam::Resources::AccessCode] OK
149
+ def pull_backup_access_code(access_code_id:)
150
+ res = @client.post("/access_codes/pull_backup_access_code", {access_code_id: access_code_id}.compact)
151
+
152
+ Seam::Resources::AccessCode.load_from_response(res.body["access_code"])
153
+ end
154
+
155
+ # Enables you to report access code-related constraints for a device. Currently, supports reporting supported code length constraints for SmartThings devices.
156
+ #
157
+ # Specify either `supported_code_lengths` or `min_code_length`/`max_code_length`.
158
+ # @param device_id ID of the device for which you want to report constraints.
159
+ # @param max_code_length Maximum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`.
160
+ # @param min_code_length Minimum supported code length as an integer between 4 and 20, inclusive. You can specify either `min_code_length`/`max_code_length` or `supported_code_lengths`.
161
+ # @param supported_code_lengths Array of supported code lengths as integers between 4 and 20, inclusive. You can specify either `supported_code_lengths` or `min_code_length`/`max_code_length`.
162
+ # @return [nil] OK
163
+ def report_device_constraints(device_id:, max_code_length: nil, min_code_length: nil, supported_code_lengths: nil)
164
+ @client.post("/access_codes/report_device_constraints", {device_id: device_id, max_code_length: max_code_length, min_code_length: min_code_length, supported_code_lengths: supported_code_lengths}.compact)
165
+
166
+ nil
167
+ end
168
+
169
+ # Updates a specified active or upcoming [access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
170
+ #
171
+ # See also [Modifying Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes).
172
+ # @param access_code_id ID of the access code that you want to update.
173
+ # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
174
+ # @param attempt_for_offline_device
175
+ # @param code Code to be used for access.
176
+ # @param device_id ID of the device containing the access code that you want to update.
177
+ # @param ends_at Date and time at which the validity of the new access code ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
178
+ # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed. Default: `false`.
179
+ # @param is_managed Indicates whether the access code is managed through Seam. Note that to convert an unmanaged access code into a managed access code, use `/access_codes/unmanaged/convert_to_managed`.
180
+ # @param is_offline_access_code Indicates whether the access code is an [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes).
181
+ # @param is_one_time_use Indicates whether the [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) is a single-use access code.
182
+ # @param max_time_rounding Maximum rounding adjustment. To create a daily-bound [offline access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/offline-access-codes) for devices that support this feature, set this parameter to `1d`.
183
+ # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
184
+ #
185
+ # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
186
+ #
187
+ # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
188
+ #
189
+ # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
190
+ # @param prefer_native_scheduling Indicates whether [native scheduling](https://docs.seam.co/low-level-apis/smart-locks/access-codes#native-scheduling) should be used for time-bound codes when supported by the provider. Default: `true`.
191
+ # @param preferred_code_length Preferred code length. Only applicable if you do not specify a `code`. If the affected device does not support the preferred code length, Seam reverts to using the shortest supported code length.
192
+ # @param starts_at Date and time at which the validity of the new access code starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
193
+ # @param type Type to which you want to convert the access code. To convert a time-bound access code to an ongoing access code, set `type` to `ongoing`. See also [Changing a time-bound access code to permanent access](https://docs.seam.co/low-level-apis/smart-locks/access-codes/modifying-access-codes#special-case-2-changing-a-time-bound-access-code-to-permanent-access).
194
+ # @param use_backup_access_code_pool Indicates whether to use a [backup access code pool](https://docs.seam.co/low-level-apis/smart-locks/access-codes/backup-access-codes) provided by Seam. If `true`, you can use [`/access_codes/pull_backup_access_code`](https://docs.seam.co/api/access_codes/pull_backup_access_code).
195
+ # @param use_offline_access_code
196
+ # @deprecated use_offline_access_code: Use `is_offline_access_code` instead.
197
+ # @return [nil] OK
198
+ def update(access_code_id:, allow_external_modification: nil, attempt_for_offline_device: nil, code: nil, device_id: nil, ends_at: nil, is_external_modification_allowed: nil, is_managed: nil, is_offline_access_code: nil, is_one_time_use: nil, max_time_rounding: nil, name: nil, prefer_native_scheduling: nil, preferred_code_length: nil, starts_at: nil, type: nil, use_backup_access_code_pool: nil, use_offline_access_code: nil)
199
+ @client.post("/access_codes/update", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, attempt_for_offline_device: attempt_for_offline_device, code: code, device_id: device_id, ends_at: ends_at, is_external_modification_allowed: is_external_modification_allowed, is_managed: is_managed, is_offline_access_code: is_offline_access_code, is_one_time_use: is_one_time_use, max_time_rounding: max_time_rounding, name: name, prefer_native_scheduling: prefer_native_scheduling, preferred_code_length: preferred_code_length, starts_at: starts_at, type: type, use_backup_access_code_pool: use_backup_access_code_pool, use_offline_access_code: use_offline_access_code}.compact)
200
+
201
+ nil
202
+ end
203
+
204
+ # Updates [access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes) that share a common code across multiple devices.
205
+ #
206
+ # Specify the `common_code_key` to identify the set of access codes that you want to update.
207
+ #
208
+ # See also [Update Linked Access Codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/creating-and-updating-multiple-linked-access-codes#update-linked-access-codes).
209
+ # @param common_code_key Key that links the group of access codes, assigned on creation by `/access_codes/create_multiple`.
210
+ # @param ends_at Date and time at which the validity of the new access code ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
211
+ # @param name Name of the new access code. Enables administrators and users to identify the access code easily, especially when there are numerous access codes.
212
+ #
213
+ # Note that the name provided on Seam is used to identify the code on Seam and is not necessarily the name that will appear in the lock provider's app or on the device. This is because lock providers may have constraints on names, such as length, uniqueness, or characters that can be used. In addition, some lock providers may break down names into components such as `first_name` and `last_name`.
214
+ #
215
+ # To provide a consistent experience, Seam identifies the code on Seam by its name but may modify the name that appears on the lock provider's app or on the device. For example, Seam may add additional characters or truncate the name to meet provider constraints.
216
+ #
217
+ # To help your users identify codes set by Seam, Seam provides the name exactly as it appears on the lock provider's app or on the device as a separate property called `appearance`. This is an object with a `name` property and, optionally, `first_name` and `last_name` properties (for providers that break down a name into components).
218
+ # @param starts_at Date and time at which the validity of the new access code starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
219
+ # @return [nil] OK
220
+ def update_multiple(common_code_key:, ends_at: nil, name: nil, starts_at: nil)
221
+ @client.post("/access_codes/update_multiple", {common_code_key: common_code_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact)
222
+
223
+ nil
224
+ end
225
+ end
226
+ end
227
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Clients
5
+ class AccessCodesSimulate
6
+ def initialize(client:, defaults:)
7
+ @client = client
8
+ @defaults = defaults
9
+ end
10
+
11
+ # Simulates the creation of an [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) in a [sandbox workspace](https://docs.seam.co/core-concepts/workspaces#sandbox-workspaces).
12
+ # @param code Code of the simulated unmanaged access code.
13
+ # @param device_id ID of the device for which you want to simulate the creation of an unmanaged access code.
14
+ # @param name Name of the simulated unmanaged access code.
15
+ # @return [Seam::Resources::UnmanagedAccessCode] OK
16
+ def create_unmanaged_access_code(code:, device_id:, name:)
17
+ res = @client.post("/access_codes/simulate/create_unmanaged_access_code", {code: code, device_id: device_id, name: name}.compact)
18
+
19
+ Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_code"])
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Clients
5
+ class AccessCodesUnmanaged
6
+ def initialize(client:, defaults:)
7
+ @client = client
8
+ @defaults = defaults
9
+ end
10
+
11
+ # Converts an [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes) to an [access code managed through Seam](https://docs.seam.co/low-level-apis/smart-locks/access-codes).
12
+ #
13
+ # An unmanaged access code has a limited set of operations that you can perform on it. Once you convert an unmanaged access code to a managed access code, the full set of access code operations and lifecycle events becomes available for it.
14
+ #
15
+ # Note that not all device providers support converting an unmanaged access code to a managed access code.
16
+ # @param access_code_id ID of the unmanaged access code that you want to convert to a managed access code.
17
+ # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the access code is allowed.
18
+ # @param force Indicates whether to force the access code conversion. To switch management of an access code from one Seam workspace to another, set `force` to `true`.
19
+ # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the access code is allowed.
20
+ # @return [nil] OK
21
+ def convert_to_managed(access_code_id:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil)
22
+ @client.post("/access_codes/unmanaged/convert_to_managed", {access_code_id: access_code_id, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)
23
+
24
+ nil
25
+ end
26
+
27
+ # Deletes an [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
28
+ # @param access_code_id ID of the unmanaged access code that you want to delete.
29
+ # @return [nil] OK
30
+ def delete(access_code_id:)
31
+ @client.post("/access_codes/unmanaged/delete", {access_code_id: access_code_id}.compact)
32
+
33
+ nil
34
+ end
35
+
36
+ # Returns a specified [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
37
+ #
38
+ # You must specify either `access_code_id` or both `device_id` and `code`.
39
+ # @param access_code_id ID of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
40
+ # @param code Code of the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
41
+ # @param device_id ID of the device containing the unmanaged access code that you want to get. You must specify either `access_code_id` or both `device_id` and `code`.
42
+ # @return [Seam::Resources::UnmanagedAccessCode] OK
43
+ def get(access_code_id: nil, code: nil, device_id: nil)
44
+ res = @client.post("/access_codes/unmanaged/get", {access_code_id: access_code_id, code: code, device_id: device_id}.compact)
45
+
46
+ Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_code"])
47
+ end
48
+
49
+ # Returns a list of all [unmanaged access codes](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
50
+ # @param device_id ID of the device for which you want to list unmanaged access codes.
51
+ # @param limit Numerical limit on the number of unmanaged access codes to return.
52
+ # @param page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
53
+ # @param search String for which to search. Filters returned access codes to include all records that satisfy a partial match using `name`, `code` or `access_code_id`.
54
+ # @param user_identifier_key Your user ID for the user by which to filter unmanaged access codes.
55
+ # @return [Seam::Resources::UnmanagedAccessCode] OK
56
+ def list(device_id:, limit: nil, page_cursor: nil, search: nil, user_identifier_key: nil)
57
+ res = @client.post("/access_codes/unmanaged/list", {device_id: device_id, limit: limit, page_cursor: page_cursor, search: search, user_identifier_key: user_identifier_key}.compact)
58
+
59
+ Seam::Resources::UnmanagedAccessCode.load_from_response(res.body["access_codes"])
60
+ end
61
+
62
+ # Updates a specified [unmanaged access code](https://docs.seam.co/low-level-apis/smart-locks/access-codes/migrating-existing-access-codes).
63
+ # @param access_code_id ID of the unmanaged access code that you want to update.
64
+ # @param is_managed
65
+ # @param allow_external_modification Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed.
66
+ # @param force Indicates whether to force the unmanaged access code update.
67
+ # @param is_external_modification_allowed Indicates whether [external modification](https://docs.seam.co/low-level-apis/smart-locks/access-codes#external-modification) of the code is allowed.
68
+ # @return [nil] OK
69
+ def update(access_code_id:, is_managed:, allow_external_modification: nil, force: nil, is_external_modification_allowed: nil)
70
+ @client.post("/access_codes/unmanaged/update", {access_code_id: access_code_id, is_managed: is_managed, allow_external_modification: allow_external_modification, force: force, is_external_modification_allowed: is_external_modification_allowed}.compact)
71
+
72
+ nil
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,117 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Clients
5
+ class AccessGrants
6
+ def initialize(client:, defaults:)
7
+ @client = client
8
+ @defaults = defaults
9
+ end
10
+
11
+ def unmanaged
12
+ @unmanaged ||= Seam::Clients::AccessGrantsUnmanaged.new(client: @client, defaults: @defaults)
13
+ end
14
+
15
+ # Creates a new [Access Grant](https://docs.seam.co/use-cases/granting-access/access-grants). Access Grants are the default and recommended way to grant a user access to any physical space, irrespective of the locking hardware. They work with both standalone smart locks (using `device_ids`) and access control systems (using `acs_entrance_ids` or `space_ids`), and can issue PIN codes, key cards, and mobile keys through a single request.
16
+ # @param requested_access_methods
17
+ # @param user_identity_id ID of user identity for whom access is being granted.
18
+ # @param user_identity When used, creates a new user identity with the given details, and grants them access.
19
+ # @param access_grant_key Unique key for the access grant within the workspace.
20
+ # @param acs_entrance_ids Set of IDs of the [entrances](https://docs.seam.co/api/acs/systems/list) to which access is being granted.
21
+ # @param customization_profile_id ID of the customization profile to apply to the Access Grant and its access methods.
22
+ # @param device_ids Set of IDs of the [devices](https://docs.seam.co/api/devices/list) to which access is being granted.
23
+ # @param ends_at Date and time at which the validity of the new grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
24
+ # @param location
25
+ # @deprecated location: Create a space first, then reference it using `space_ids`.
26
+ # @param location_ids
27
+ # @deprecated location_ids: Use `space_ids`.
28
+ # @param name Name for the access grant.
29
+ # @param reservation_key Reservation key for the access grant.
30
+ # @param space_ids Set of IDs of existing spaces to which access is being granted.
31
+ # @param space_keys Set of keys of existing spaces to which access is being granted.
32
+ # @param starts_at Date and time at which the validity of the new grant starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
33
+ # @return [Seam::Resources::AccessGrant] OK
34
+ def create(requested_access_methods:, user_identity_id: nil, user_identity: nil, access_grant_key: nil, acs_entrance_ids: nil, customization_profile_id: nil, device_ids: nil, ends_at: nil, location: nil, location_ids: nil, name: nil, reservation_key: nil, space_ids: nil, space_keys: nil, starts_at: nil)
35
+ res = @client.post("/access_grants/create", {requested_access_methods: requested_access_methods, user_identity_id: user_identity_id, user_identity: user_identity, access_grant_key: access_grant_key, acs_entrance_ids: acs_entrance_ids, customization_profile_id: customization_profile_id, device_ids: device_ids, ends_at: ends_at, location: location, location_ids: location_ids, name: name, reservation_key: reservation_key, space_ids: space_ids, space_keys: space_keys, starts_at: starts_at}.compact)
36
+
37
+ Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"])
38
+ end
39
+
40
+ # Delete an Access Grant.
41
+ # @param access_grant_id ID of Access Grant to delete.
42
+ # @return [nil] OK
43
+ def delete(access_grant_id:)
44
+ @client.post("/access_grants/delete", {access_grant_id: access_grant_id}.compact)
45
+
46
+ nil
47
+ end
48
+
49
+ # Get an Access Grant.
50
+ # @param access_grant_id ID of Access Grant to get.
51
+ # @param access_grant_key Unique key of Access Grant to get.
52
+ # @return [Seam::Resources::AccessGrant] OK
53
+ def get(access_grant_id: nil, access_grant_key: nil)
54
+ res = @client.post("/access_grants/get", {access_grant_id: access_grant_id, access_grant_key: access_grant_key}.compact)
55
+
56
+ Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"])
57
+ end
58
+
59
+ # Gets all related resources for one or more Access Grants.
60
+ # @param access_grant_ids IDs of the access grants that you want to get along with their related resources.
61
+ # @param access_grant_keys Keys of the access grants that you want to get along with their related resources.
62
+ # @param exclude
63
+ # @param include
64
+ # @return [Seam::Resources::Batch] OK
65
+ def get_related(access_grant_ids: nil, access_grant_keys: nil, exclude: nil, include: nil)
66
+ res = @client.post("/access_grants/get_related", {access_grant_ids: access_grant_ids, access_grant_keys: access_grant_keys, exclude: exclude, include: include}.compact)
67
+
68
+ Seam::Resources::Batch.load_from_response(res.body["batch"])
69
+ end
70
+
71
+ # Gets an Access Grant.
72
+ # @param access_code_id ID of the access code by which you want to filter the list of Access Grants.
73
+ # @param access_grant_ids IDs of the access grants to retrieve.
74
+ # @param access_grant_key Filter Access Grants by access_grant_key. Use null to filter for Access Grants without an access_grant_key.
75
+ # @param acs_entrance_id ID of the entrance by which you want to filter the list of Access Grants.
76
+ # @param acs_system_id ID of the access system by which you want to filter the list of Access Grants.
77
+ # @param customer_key Customer key for which you want to list access grants.
78
+ # @param device_id ID of the device by which you want to filter the list of Access Grants.
79
+ # @param limit Numerical limit on the number of access grants to return.
80
+ # @param location_id
81
+ # @deprecated location_id: Use `space_id`.
82
+ # @param page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
83
+ # @param reservation_key Filter Access Grants by reservation_key.
84
+ # @param space_id ID of the space by which you want to filter the list of Access Grants.
85
+ # @param user_identity_id ID of user identity by which you want to filter the list of Access Grants.
86
+ # @return [Seam::Resources::AccessGrant] OK
87
+ def list(access_code_id: nil, access_grant_ids: nil, access_grant_key: nil, acs_entrance_id: nil, acs_system_id: nil, customer_key: nil, device_id: nil, limit: nil, location_id: nil, page_cursor: nil, reservation_key: nil, space_id: nil, user_identity_id: nil)
88
+ res = @client.post("/access_grants/list", {access_code_id: access_code_id, access_grant_ids: access_grant_ids, access_grant_key: access_grant_key, acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, customer_key: customer_key, device_id: device_id, limit: limit, location_id: location_id, page_cursor: page_cursor, reservation_key: reservation_key, space_id: space_id, user_identity_id: user_identity_id}.compact)
89
+
90
+ Seam::Resources::AccessGrant.load_from_response(res.body["access_grants"])
91
+ end
92
+
93
+ # Adds additional requested access methods to an existing Access Grant.
94
+ # @param access_grant_id ID of the Access Grant to add access methods to.
95
+ # @param requested_access_methods Array of requested access methods to add to the access grant.
96
+ # @return [Seam::Resources::AccessGrant] OK
97
+ def request_access_methods(access_grant_id:, requested_access_methods:)
98
+ res = @client.post("/access_grants/request_access_methods", {access_grant_id: access_grant_id, requested_access_methods: requested_access_methods}.compact)
99
+
100
+ Seam::Resources::AccessGrant.load_from_response(res.body["access_grant"])
101
+ end
102
+
103
+ # Updates an existing Access Grant's time window.
104
+ # @param access_grant_id ID of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
105
+ # @param access_grant_key Key of the Access Grant to update. Provide either `access_grant_id` or `access_grant_key`.
106
+ # @param ends_at Date and time at which the validity of the grant ends, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. Must be a time in the future and after `starts_at`.
107
+ # @param name Display name for the access grant.
108
+ # @param starts_at Date and time at which the validity of the grant starts, in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
109
+ # @return [nil] OK
110
+ def update(access_grant_id: nil, access_grant_key: nil, ends_at: nil, name: nil, starts_at: nil)
111
+ @client.post("/access_grants/update", {access_grant_id: access_grant_id, access_grant_key: access_grant_key, ends_at: ends_at, name: name, starts_at: starts_at}.compact)
112
+
113
+ nil
114
+ end
115
+ end
116
+ end
117
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Seam
4
+ module Clients
5
+ class AccessGrantsUnmanaged
6
+ def initialize(client:, defaults:)
7
+ @client = client
8
+ @defaults = defaults
9
+ end
10
+
11
+ # Get an unmanaged Access Grant (where is_managed = false).
12
+ # @param access_grant_id ID of unmanaged Access Grant to get.
13
+ # @return [Seam::Resources::UnmanagedAccessGrant] OK
14
+ def get(access_grant_id:)
15
+ res = @client.post("/access_grants/unmanaged/get", {access_grant_id: access_grant_id}.compact)
16
+
17
+ Seam::Resources::UnmanagedAccessGrant.load_from_response(res.body["access_grant"])
18
+ end
19
+
20
+ # Gets unmanaged Access Grants (where is_managed = false).
21
+ # @param acs_entrance_id ID of the entrance by which you want to filter the list of unmanaged Access Grants.
22
+ # @param acs_system_id ID of the access system by which you want to filter the list of unmanaged Access Grants.
23
+ # @param limit Numerical limit on the number of unmanaged access grants to return.
24
+ # @param page_cursor Identifies the specific page of results to return, obtained from the previous page's `next_page_cursor`.
25
+ # @param reservation_key Filter unmanaged Access Grants by reservation_key.
26
+ # @param user_identity_id ID of user identity by which you want to filter the list of unmanaged Access Grants.
27
+ # @return [Seam::Resources::UnmanagedAccessGrant] OK
28
+ def list(acs_entrance_id: nil, acs_system_id: nil, limit: nil, page_cursor: nil, reservation_key: nil, user_identity_id: nil)
29
+ res = @client.post("/access_grants/unmanaged/list", {acs_entrance_id: acs_entrance_id, acs_system_id: acs_system_id, limit: limit, page_cursor: page_cursor, reservation_key: reservation_key, user_identity_id: user_identity_id}.compact)
30
+
31
+ Seam::Resources::UnmanagedAccessGrant.load_from_response(res.body["access_grants"])
32
+ end
33
+
34
+ # Updates an unmanaged Access Grant to make it managed.
35
+ #
36
+ # This endpoint can only be used to convert unmanaged access grants to managed ones by setting `is_managed` to `true`. It cannot be used to convert managed access grants back to unmanaged.
37
+ #
38
+ # When converting an unmanaged access grant to managed, all associated access methods will also be converted to managed.
39
+ # @param access_grant_id ID of the unmanaged Access Grant to update.
40
+ # @param is_managed Must be set to true to convert the unmanaged access grant to managed.
41
+ # @param access_grant_key Unique key for the access grant. If not provided, the existing key will be preserved.
42
+ # @return [nil] OK
43
+ def update(access_grant_id:, is_managed:, access_grant_key: nil)
44
+ @client.post("/access_grants/unmanaged/update", {access_grant_id: access_grant_id, is_managed: is_managed, access_grant_key: access_grant_key}.compact)
45
+
46
+ nil
47
+ end
48
+ end
49
+ end
50
+ end