turnkey_client 0.0.4 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/lib/turnkey_client/api/organizations_api.rb +58 -0
  3. data/lib/turnkey_client/api/policies_api.rb +58 -0
  4. data/lib/turnkey_client/api/sessions_api.rb +116 -0
  5. data/lib/turnkey_client/api/signing_api.rb +58 -0
  6. data/lib/turnkey_client/api/users_api.rb +232 -0
  7. data/lib/turnkey_client/models/activity.rb +13 -4
  8. data/lib/turnkey_client/models/activity_type.rb +11 -0
  9. data/lib/turnkey_client/models/any.rb +200 -0
  10. data/lib/turnkey_client/models/api_key_curve.rb +28 -0
  11. data/lib/turnkey_client/models/api_key_params_v2.rb +250 -0
  12. data/lib/turnkey_client/models/config.rb +216 -0
  13. data/lib/turnkey_client/models/create_api_keys_intent_v2.rb +228 -0
  14. data/lib/turnkey_client/models/create_api_keys_request.rb +2 -2
  15. data/lib/turnkey_client/models/create_oauth_providers_intent.rb +228 -0
  16. data/lib/turnkey_client/models/create_oauth_providers_request.rb +288 -0
  17. data/lib/turnkey_client/models/create_oauth_providers_result.rb +213 -0
  18. data/lib/turnkey_client/models/create_policies_intent.rb +213 -0
  19. data/lib/turnkey_client/models/create_policies_request.rb +288 -0
  20. data/lib/turnkey_client/models/create_policies_result.rb +213 -0
  21. data/lib/turnkey_client/models/create_read_only_session_intent.rb +196 -0
  22. data/lib/turnkey_client/models/create_read_only_session_request.rb +288 -0
  23. data/lib/turnkey_client/models/create_read_only_session_result.rb +286 -0
  24. data/lib/turnkey_client/models/create_read_write_session_intent.rb +246 -0
  25. data/lib/turnkey_client/models/create_read_write_session_request.rb +288 -0
  26. data/lib/turnkey_client/models/create_read_write_session_result.rb +286 -0
  27. data/lib/turnkey_client/models/create_sub_organization_intent_v5.rb +272 -0
  28. data/lib/turnkey_client/models/create_sub_organization_intent_v6.rb +272 -0
  29. data/lib/turnkey_client/models/create_sub_organization_request.rb +2 -2
  30. data/lib/turnkey_client/models/create_sub_organization_result_v5.rb +230 -0
  31. data/lib/turnkey_client/models/create_sub_organization_result_v6.rb +230 -0
  32. data/lib/turnkey_client/models/credential_type.rb +3 -0
  33. data/lib/turnkey_client/models/delete_oauth_providers_intent.rb +228 -0
  34. data/lib/turnkey_client/models/delete_oauth_providers_request.rb +288 -0
  35. data/lib/turnkey_client/models/delete_oauth_providers_result.rb +213 -0
  36. data/lib/turnkey_client/models/email_auth_intent.rb +14 -4
  37. data/lib/turnkey_client/models/email_auth_intent_v2.rb +265 -0
  38. data/lib/turnkey_client/models/email_auth_request.rb +2 -2
  39. data/lib/turnkey_client/models/email_customization_params.rb +1 -1
  40. data/lib/turnkey_client/models/external_data_v1_quorum.rb +228 -0
  41. data/lib/turnkey_client/models/get_oauth_providers_request.rb +221 -0
  42. data/lib/turnkey_client/models/get_oauth_providers_response.rb +213 -0
  43. data/lib/turnkey_client/models/get_organization_configs_request.rb +211 -0
  44. data/lib/turnkey_client/models/get_organization_configs_response.rb +210 -0
  45. data/lib/turnkey_client/models/get_sub_org_ids_request.rb +1 -1
  46. data/lib/turnkey_client/models/intent.rb +103 -9
  47. data/lib/turnkey_client/models/oauth_intent.rb +246 -0
  48. data/lib/turnkey_client/models/oauth_provider.rb +299 -0
  49. data/lib/turnkey_client/models/oauth_provider_params.rb +226 -0
  50. data/lib/turnkey_client/models/oauth_request.rb +288 -0
  51. data/lib/turnkey_client/models/oauth_result.rb +241 -0
  52. data/lib/turnkey_client/models/result.rb +85 -4
  53. data/lib/turnkey_client/models/root_user_params_v2.rb +272 -0
  54. data/lib/turnkey_client/models/root_user_params_v3.rb +272 -0
  55. data/lib/turnkey_client/models/sign_raw_payloads_intent.rb +256 -0
  56. data/lib/turnkey_client/models/sign_raw_payloads_request.rb +288 -0
  57. data/lib/turnkey_client/models/sign_raw_payloads_result.rb +207 -0
  58. data/lib/turnkey_client/models/status.rb +225 -0
  59. data/lib/turnkey_client/models/user.rb +18 -1
  60. data/lib/turnkey_client/models/wallet_account.rb +4 -19
  61. data/lib/turnkey_client/version.rb +1 -1
  62. data/lib/turnkey_client.rb +41 -0
  63. data/turnkey_client-0.0.4.gem +0 -0
  64. metadata +44 -2
@@ -0,0 +1,265 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class EmailAuthIntentV2
15
+ # Email of the authenticating user.
16
+ attr_accessor :email
17
+
18
+ # Client-side public key generated by the user, to which the email auth bundle (credentials) will be encrypted.
19
+ attr_accessor :target_public_key
20
+
21
+ # Optional human-readable name for an API Key. If none provided, default to Email Auth - <Timestamp>
22
+ attr_accessor :api_key_name
23
+
24
+ # Expiration window (in seconds) indicating how long the API key is valid. If not provided, a default of 15 minutes will be used.
25
+ attr_accessor :expiration_seconds
26
+
27
+ attr_accessor :email_customization
28
+
29
+ # Invalidate all other previously generated Email Auth API keys
30
+ attr_accessor :invalidate_existing
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'email' => :'email',
36
+ :'target_public_key' => :'targetPublicKey',
37
+ :'api_key_name' => :'apiKeyName',
38
+ :'expiration_seconds' => :'expirationSeconds',
39
+ :'email_customization' => :'emailCustomization',
40
+ :'invalidate_existing' => :'invalidateExisting'
41
+ }
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'email' => :'Object',
48
+ :'target_public_key' => :'Object',
49
+ :'api_key_name' => :'Object',
50
+ :'expiration_seconds' => :'Object',
51
+ :'email_customization' => :'Object',
52
+ :'invalidate_existing' => :'Object'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::EmailAuthIntentV2` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::EmailAuthIntentV2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'email')
78
+ self.email = attributes[:'email']
79
+ end
80
+
81
+ if attributes.key?(:'target_public_key')
82
+ self.target_public_key = attributes[:'target_public_key']
83
+ end
84
+
85
+ if attributes.key?(:'api_key_name')
86
+ self.api_key_name = attributes[:'api_key_name']
87
+ end
88
+
89
+ if attributes.key?(:'expiration_seconds')
90
+ self.expiration_seconds = attributes[:'expiration_seconds']
91
+ end
92
+
93
+ if attributes.key?(:'email_customization')
94
+ self.email_customization = attributes[:'email_customization']
95
+ end
96
+
97
+ if attributes.key?(:'invalidate_existing')
98
+ self.invalidate_existing = attributes[:'invalidate_existing']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ if @email.nil?
107
+ invalid_properties.push('invalid value for "email", email cannot be nil.')
108
+ end
109
+
110
+ if @target_public_key.nil?
111
+ invalid_properties.push('invalid value for "target_public_key", target_public_key cannot be nil.')
112
+ end
113
+
114
+ invalid_properties
115
+ end
116
+
117
+ # Check to see if the all the properties in the model are valid
118
+ # @return true if the model is valid
119
+ def valid?
120
+ return false if @email.nil?
121
+ return false if @target_public_key.nil?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ email == o.email &&
131
+ target_public_key == o.target_public_key &&
132
+ api_key_name == o.api_key_name &&
133
+ expiration_seconds == o.expiration_seconds &&
134
+ email_customization == o.email_customization &&
135
+ invalidate_existing == o.invalidate_existing
136
+ end
137
+
138
+ # @see the `==` method
139
+ # @param [Object] Object to be compared
140
+ def eql?(o)
141
+ self == o
142
+ end
143
+
144
+ # Calculates hash code according to all attributes.
145
+ # @return [Integer] Hash code
146
+ def hash
147
+ [email, target_public_key, api_key_name, expiration_seconds, email_customization, invalidate_existing].hash
148
+ end
149
+
150
+ # Builds the object from hash
151
+ # @param [Hash] attributes Model attributes in the form of hash
152
+ # @return [Object] Returns the model itself
153
+ def self.build_from_hash(attributes)
154
+ new.build_from_hash(attributes)
155
+ end
156
+
157
+ # Builds the object from hash
158
+ # @param [Hash] attributes Model attributes in the form of hash
159
+ # @return [Object] Returns the model itself
160
+ def build_from_hash(attributes)
161
+ return nil unless attributes.is_a?(Hash)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if type =~ /\AArray<(.*)>/i
164
+ # check to ensure the input is an array given that the attribute
165
+ # is documented as an array but the input is not
166
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
167
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
168
+ end
169
+ elsif !attributes[self.class.attribute_map[key]].nil?
170
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
171
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
172
+ self.send("#{key}=", nil)
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ TurnkeyClient.const_get(type).build_from_hash(value)
217
+ end
218
+ end
219
+
220
+ # Returns the string representation of the object
221
+ # @return [String] String presentation of the object
222
+ def to_s
223
+ to_hash.to_s
224
+ end
225
+
226
+ # to_body is an alias to to_hash (backward compatibility)
227
+ # @return [Hash] Returns the object in the form of hash
228
+ def to_body
229
+ to_hash
230
+ end
231
+
232
+ # Returns the object in the form of hash
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_hash
235
+ hash = {}
236
+ self.class.attribute_map.each_pair do |attr, param|
237
+ value = self.send(attr)
238
+ if value.nil?
239
+ is_nullable = self.class.openapi_nullable.include?(attr)
240
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
241
+ end
242
+
243
+ hash[param] = _to_hash(value)
244
+ end
245
+ hash
246
+ end
247
+
248
+ # Outputs non-array value in the form of hash
249
+ # For object, use to_hash. Otherwise, just return the value
250
+ # @param [Object] value Any valid value
251
+ # @return [Hash] Returns the value in the form of hash
252
+ def _to_hash(value)
253
+ if value.is_a?(Array)
254
+ value.compact.map { |v| _to_hash(v) }
255
+ elsif value.is_a?(Hash)
256
+ {}.tap do |hash|
257
+ value.each { |k, v| hash[k] = _to_hash(v) }
258
+ end
259
+ elsif value.respond_to? :to_hash
260
+ value.to_hash
261
+ else
262
+ value
263
+ end
264
+ end end
265
+ end
@@ -129,7 +129,7 @@ module TurnkeyClient
129
129
  # @return true if the model is valid
130
130
  def valid?
131
131
  return false if @type.nil?
132
- type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH'])
132
+ type_validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH_V2'])
133
133
  return false unless type_validator.valid?(@type)
134
134
  return false if @timestamp_ms.nil?
135
135
  return false if @organization_id.nil?
@@ -140,7 +140,7 @@ module TurnkeyClient
140
140
  # Custom attribute writer method checking allowed values (enum).
141
141
  # @param [Object] type Object to be assigned
142
142
  def type=(type)
143
- validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH'])
143
+ validator = EnumAttributeValidator.new('Object', ['ACTIVITY_TYPE_EMAIL_AUTH_V2'])
144
144
  unless validator.valid?(type)
145
145
  fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
146
146
  end
@@ -15,7 +15,7 @@ module TurnkeyClient
15
15
  # The name of the application.
16
16
  attr_accessor :app_name
17
17
 
18
- # A URL pointing to a logo. Note this logo will be resized to fit into 340px x 124px.
18
+ # A URL pointing to a logo in PNG format. Note this logo will be resized to fit into 340px x 124px.
19
19
  attr_accessor :logo_url
20
20
 
21
21
  # A template for the URL to be used in a magic link button, e.g. `https://dapp.xyz/%s`. The auth bundle will be interpolated into the `%s`.
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #API Reference
3
+
4
+ #Review our [API Introduction](../api-introduction) to get started.
5
+
6
+ OpenAPI spec version: 1.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module TurnkeyClient
14
+ class ExternalDataV1Quorum
15
+ # Count of unique approvals required to meet quorum.
16
+ attr_accessor :threshold
17
+
18
+ # Unique identifiers of quorum set members.
19
+ attr_accessor :user_ids
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'threshold' => :'threshold',
25
+ :'user_ids' => :'userIds'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'threshold' => :'Object',
33
+ :'user_ids' => :'Object'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `TurnkeyClient::ExternalDataV1Quorum` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `TurnkeyClient::ExternalDataV1Quorum`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'threshold')
59
+ self.threshold = attributes[:'threshold']
60
+ end
61
+
62
+ if attributes.key?(:'user_ids')
63
+ if (value = attributes[:'user_ids']).is_a?(Array)
64
+ self.user_ids = value
65
+ end
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @threshold.nil?
74
+ invalid_properties.push('invalid value for "threshold", threshold cannot be nil.')
75
+ end
76
+
77
+ if @user_ids.nil?
78
+ invalid_properties.push('invalid value for "user_ids", user_ids cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @threshold.nil?
88
+ return false if @user_ids.nil?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ threshold == o.threshold &&
98
+ user_ids == o.user_ids
99
+ end
100
+
101
+ # @see the `==` method
102
+ # @param [Object] Object to be compared
103
+ def eql?(o)
104
+ self == o
105
+ end
106
+
107
+ # Calculates hash code according to all attributes.
108
+ # @return [Integer] Hash code
109
+ def hash
110
+ [threshold, user_ids].hash
111
+ end
112
+
113
+ # Builds the object from hash
114
+ # @param [Hash] attributes Model attributes in the form of hash
115
+ # @return [Object] Returns the model itself
116
+ def self.build_from_hash(attributes)
117
+ new.build_from_hash(attributes)
118
+ end
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+ self.class.openapi_types.each_pair do |key, type|
126
+ if type =~ /\AArray<(.*)>/i
127
+ # check to ensure the input is an array given that the attribute
128
+ # is documented as an array but the input is not
129
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
130
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
131
+ end
132
+ elsif !attributes[self.class.attribute_map[key]].nil?
133
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
134
+ elsif attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
135
+ self.send("#{key}=", nil)
136
+ end
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :DateTime
149
+ DateTime.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :Boolean
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ TurnkeyClient.const_get(type).build_from_hash(value)
180
+ end
181
+ end
182
+
183
+ # Returns the string representation of the object
184
+ # @return [String] String presentation of the object
185
+ def to_s
186
+ to_hash.to_s
187
+ end
188
+
189
+ # to_body is an alias to to_hash (backward compatibility)
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_body
192
+ to_hash
193
+ end
194
+
195
+ # Returns the object in the form of hash
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_hash
198
+ hash = {}
199
+ self.class.attribute_map.each_pair do |attr, param|
200
+ value = self.send(attr)
201
+ if value.nil?
202
+ is_nullable = self.class.openapi_nullable.include?(attr)
203
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
204
+ end
205
+
206
+ hash[param] = _to_hash(value)
207
+ end
208
+ hash
209
+ end
210
+
211
+ # Outputs non-array value in the form of hash
212
+ # For object, use to_hash. Otherwise, just return the value
213
+ # @param [Object] value Any valid value
214
+ # @return [Hash] Returns the value in the form of hash
215
+ def _to_hash(value)
216
+ if value.is_a?(Array)
217
+ value.compact.map { |v| _to_hash(v) }
218
+ elsif value.is_a?(Hash)
219
+ {}.tap do |hash|
220
+ value.each { |k, v| hash[k] = _to_hash(v) }
221
+ end
222
+ elsif value.respond_to? :to_hash
223
+ value.to_hash
224
+ else
225
+ value
226
+ end
227
+ end end
228
+ end