workos 0.10.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +1 -1
  3. data/.ruby-version +1 -1
  4. data/.semaphore/semaphore.yml +8 -2
  5. data/Gemfile.lock +49 -36
  6. data/LICENSE +1 -1
  7. data/README.md +13 -230
  8. data/lib/workos.rb +5 -0
  9. data/lib/workos/client.rb +21 -4
  10. data/lib/workos/connection.rb +12 -1
  11. data/lib/workos/directory.rb +53 -0
  12. data/lib/workos/directory_group.rb +44 -0
  13. data/lib/workos/directory_sync.rb +63 -7
  14. data/lib/workos/directory_user.rb +63 -0
  15. data/lib/workos/organizations.rb +150 -0
  16. data/lib/workos/passwordless.rb +4 -0
  17. data/lib/workos/portal.rb +0 -80
  18. data/lib/workos/profile.rb +1 -2
  19. data/lib/workos/profile_and_token.rb +28 -0
  20. data/lib/workos/sso.rb +37 -104
  21. data/lib/workos/types.rb +3 -0
  22. data/lib/workos/types/connection_struct.rb +3 -0
  23. data/lib/workos/types/directory_group_struct.rb +13 -0
  24. data/lib/workos/types/directory_struct.rb +16 -0
  25. data/lib/workos/types/directory_user_struct.rb +19 -0
  26. data/lib/workos/version.rb +1 -1
  27. data/sorbet/rbi/gems/addressable.rbi +199 -0
  28. data/sorbet/rbi/gems/ast.rbi +49 -0
  29. data/sorbet/rbi/gems/codecov.rbi +37 -0
  30. data/sorbet/rbi/gems/crack.rbi +62 -0
  31. data/sorbet/rbi/gems/docile.rbi +36 -0
  32. data/sorbet/rbi/gems/hashdiff.rbi +66 -0
  33. data/sorbet/rbi/gems/parallel.rbi +83 -0
  34. data/sorbet/rbi/gems/parser.rbi +1429 -0
  35. data/sorbet/rbi/gems/public_suffix.rbi +104 -0
  36. data/sorbet/rbi/gems/rainbow.rbi +118 -0
  37. data/sorbet/rbi/gems/rake.rbi +644 -0
  38. data/sorbet/rbi/gems/regexp_parser.rbi +926 -0
  39. data/sorbet/rbi/gems/rexml.rbi +628 -0
  40. data/sorbet/rbi/gems/rspec-core.rbi +1898 -0
  41. data/sorbet/rbi/gems/rspec-expectations.rbi +1127 -0
  42. data/sorbet/rbi/gems/rspec-mocks.rbi +1099 -0
  43. data/sorbet/rbi/gems/rspec-support.rbi +280 -0
  44. data/sorbet/rbi/gems/rspec.rbi +15 -0
  45. data/sorbet/rbi/gems/rubocop-ast.rbi +1355 -0
  46. data/sorbet/rbi/gems/rubocop.rbi +7253 -0
  47. data/sorbet/rbi/gems/ruby-progressbar.rbi +304 -0
  48. data/sorbet/rbi/gems/simplecov-html.rbi +35 -0
  49. data/sorbet/rbi/gems/simplecov.rbi +406 -0
  50. data/sorbet/rbi/gems/unicode-display_width.rbi +17 -0
  51. data/sorbet/rbi/gems/vcr.rbi +572 -0
  52. data/sorbet/rbi/gems/webmock.rbi +556 -0
  53. data/sorbet/rbi/gems/yard.rbi +1165 -0
  54. data/sorbet/rbi/sorbet-typed/lib/rake/all/rake.rbi +645 -0
  55. data/sorbet/rbi/sorbet-typed/lib/rspec-core/all/rspec-core.rbi +1891 -0
  56. data/sorbet/rbi/sorbet-typed/lib/rubocop/~>0.85/rubocop.rbi +2072 -0
  57. data/sorbet/rbi/sorbet-typed/lib/yard/all/yard.rbi +1214 -0
  58. data/sorbet/rbi/todo.rbi +1 -3
  59. data/spec/lib/workos/audit_trail_spec.rb +0 -8
  60. data/spec/lib/workos/directory_sync_spec.rb +347 -40
  61. data/spec/lib/workos/organizations_spec.rb +164 -0
  62. data/spec/lib/workos/passwordless_spec.rb +0 -8
  63. data/spec/lib/workos/portal_spec.rb +0 -121
  64. data/spec/lib/workos/sso_spec.rb +141 -187
  65. data/spec/spec_helper.rb +2 -1
  66. data/spec/support/fixtures/vcr_cassettes/directory_sync/delete_directory.yml +72 -0
  67. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections.yml → directory_sync/list_directories/with_after.yml} +7 -7
  68. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_limit_param.yml → directory_sync/list_directories/with_before.yml} +8 -8
  69. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_connection_type_param.yml → directory_sync/list_directories/with_domain.yml} +11 -10
  70. data/spec/support/fixtures/vcr_cassettes/{sso/list_connections_with_after_param.yml → directory_sync/list_directories/with_limit.yml} +12 -10
  71. data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_directories.yml → list_directories/with_no_options.yml} +1 -1
  72. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories/with_search.yml +73 -0
  73. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_after.yml +76 -0
  74. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_before.yml +74 -0
  75. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_directory.yml +78 -0
  76. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_limit.yml +74 -0
  77. data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_groups.yml → list_groups/with_no_options.yml} +16 -6
  78. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups/with_user.yml +72 -0
  79. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_after.yml +86 -0
  80. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_before.yml +75 -0
  81. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_directory.yml +93 -0
  82. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_group.yml +76 -0
  83. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users/with_limit.yml +75 -0
  84. data/spec/support/fixtures/vcr_cassettes/directory_sync/{list_users.yml → list_users/with_no_options.yml} +16 -6
  85. data/spec/support/fixtures/vcr_cassettes/organization/get.yml +73 -0
  86. data/spec/support/fixtures/vcr_cassettes/organization/get_invalid.yml +72 -0
  87. data/spec/support/fixtures/vcr_cassettes/organization/update.yml +73 -0
  88. data/spec/support/fixtures/vcr_cassettes/organization/update_invalid.yml +73 -0
  89. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_after.yml +73 -0
  90. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_before.yml +73 -0
  91. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_connection_type.yml +73 -0
  92. data/spec/support/fixtures/vcr_cassettes/sso/{list_connections_with_domain_param.yml → list_connections/with_domain.yml} +6 -6
  93. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_limit.yml +74 -0
  94. data/spec/support/fixtures/vcr_cassettes/sso/list_connections/with_no_options.yml +73 -0
  95. data/spec/support/fixtures/vcr_cassettes/sso/{list_connections_with_organization_id_param.yml → list_connections/with_organization_id.yml} +6 -6
  96. data/workos.gemspec +2 -0
  97. metadata +109 -44
  98. data/sorbet/rbi/hidden-definitions/errors.txt +0 -24896
  99. data/sorbet/rbi/hidden-definitions/hidden.rbi +0 -38411
  100. data/sorbet/rbi/sorbet-typed/lib/bundler/all/bundler.rbi +0 -8684
  101. data/sorbet/rbi/sorbet-typed/lib/ruby/all/gem.rbi +0 -4222
  102. data/sorbet/rbi/sorbet-typed/lib/ruby/all/open3.rbi +0 -111
  103. data/sorbet/rbi/sorbet-typed/lib/ruby/all/resolv.rbi +0 -543
  104. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_directories_with_domain_param.yml +0 -63
  105. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_groups_with_directory_param.yml +0 -62
  106. data/spec/support/fixtures/vcr_cassettes/directory_sync/list_users_with_directory_param.yml +0 -62
  107. data/spec/support/fixtures/vcr_cassettes/sso/create_connection_with_invalid_source.yml +0 -58
  108. data/spec/support/fixtures/vcr_cassettes/sso/create_connection_with_valid_source.yml +0 -63
  109. data/spec/support/fixtures/vcr_cassettes/sso/list_connections_with_before_param.yml +0 -73
@@ -23,6 +23,10 @@ module WorkOS
23
23
  # received from WorkOS will contain. The state parameter can be used to
24
24
  # encode arbitrary information to help restore application state between
25
25
  # redirects.
26
+ # @option options [String] connection Optional parameter for the ID of a
27
+ # specific connection. This can be used to create a Passwordless Session
28
+ # for a specific connection rather than using the domain from the email
29
+ # to determine the Organization and Connection.
26
30
  # @option options [String] type The type of Passwordless Session to
27
31
  # create. Currently, the only supported value is 'MagicLink'.
28
32
  # @option options [String] redirect_uri The URI where users are directed
data/lib/workos/portal.rb CHANGED
@@ -15,30 +15,6 @@ module WorkOS
15
15
  GENERATE_LINK_INTENTS = WorkOS::Types::Intent.values.map(&:serialize).
16
16
  freeze
17
17
 
18
- # Create an organization
19
- #
20
- # @param [Array<String>] domains List of domains that belong to the
21
- # organization
22
- # @param [String] name A unique, descriptive name for the organization
23
- sig do
24
- params(
25
- domains: T::Array[String],
26
- name: String,
27
- ).returns(WorkOS::Organization)
28
- end
29
- def create_organization(domains:, name:)
30
- request = post_request(
31
- auth: true,
32
- body: { domains: domains, name: name },
33
- path: '/organizations',
34
- )
35
-
36
- response = execute_request(request: request)
37
- check_and_raise_organization_error(response: response)
38
-
39
- WorkOS::Organization.new(response.body)
40
- end
41
-
42
18
  # Generate a link to grant access to an organization's Admin Portal
43
19
  #
44
20
  # @param [String] intent The access scope for the generated Admin Portal
@@ -73,64 +49,8 @@ module WorkOS
73
49
  JSON.parse(response.body)['link']
74
50
  end
75
51
 
76
- # Retrieve a list of organizations that have connections configured
77
- # within your WorkOS dashboard.
78
- #
79
- # @param [Array<String>] domains Filter organizations to only return those
80
- # that are associated with the provided domains.
81
- # @param [String] before A pagination argument used to request
82
- # organizations before the provided Organization ID.
83
- # @param [String] after A pagination argument used to request
84
- # organizations after the provided Organization ID.
85
- # @param [Integer] limit A pagination argument used to limit the number
86
- # of listed Organizations that are returned.
87
- sig do
88
- params(
89
- options: T::Hash[Symbol, String],
90
- ).returns(WorkOS::Types::ListStruct)
91
- end
92
- def list_organizations(options = {})
93
- response = execute_request(
94
- request: get_request(
95
- path: '/organizations',
96
- auth: true,
97
- params: options,
98
- ),
99
- )
100
-
101
- parsed_response = JSON.parse(response.body)
102
-
103
- organizations = parsed_response['data'].map do |organization|
104
- ::WorkOS::Organization.new(organization.to_json)
105
- end
106
-
107
- WorkOS::Types::ListStruct.new(
108
- data: organizations,
109
- list_metadata: parsed_response['listMetadata'],
110
- )
111
- end
112
-
113
52
  private
114
53
 
115
- sig { params(response: Net::HTTPResponse).void }
116
- def check_and_raise_organization_error(response:)
117
- begin
118
- body = JSON.parse(response.body)
119
- return unless body['message']
120
-
121
- message = body['message']
122
- request_id = response['x-request-id']
123
- rescue StandardError
124
- message = 'Something went wrong'
125
- end
126
-
127
- raise APIError.new(
128
- message: message,
129
- http_status: nil,
130
- request_id: request_id,
131
- )
132
- end
133
-
134
54
  sig { params(intent: String).void }
135
55
  def validate_intent(intent)
136
56
  return if GENERATE_LINK_INTENTS.include?(intent)
@@ -13,7 +13,7 @@ module WorkOS
13
13
  sig { returns(String) }
14
14
  attr_accessor :id, :email, :first_name, :last_name, :connection_id,
15
15
  :connection_type, :idp_id, :raw_attributes
16
- # rubocop:disable Metrics/AbcSize
16
+
17
17
  sig { params(profile_json: String).void }
18
18
  def initialize(profile_json)
19
19
  raw = parse_json(profile_json)
@@ -27,7 +27,6 @@ module WorkOS
27
27
  @idp_id = raw.idp_id
28
28
  @raw_attributes = raw.raw_attributes
29
29
  end
30
- # rubocop:enable Metrics/AbcSize
31
30
 
32
31
  sig { returns(String) }
33
32
  def full_name
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ # typed: true
3
+
4
+ module WorkOS
5
+ # The ProfileAndToken class represents a Profile and a corresponding
6
+ # Access Token. This class is not meant to be instantiated in user space, and
7
+ # is instantiated internally but exposed.
8
+ class ProfileAndToken
9
+ extend T::Sig
10
+
11
+ attr_accessor :access_token, :profile
12
+
13
+ sig { params(profile_and_token_json: String).void }
14
+ def initialize(profile_and_token_json)
15
+ json = JSON.parse(profile_and_token_json, symbolize_names: true)
16
+
17
+ @access_token = T.let(json[:access_token], String)
18
+ @profile = WorkOS::Profile.new(profile_and_token_json)
19
+ end
20
+
21
+ def to_json(*)
22
+ {
23
+ access_token: access_token,
24
+ profile: profile.to_json,
25
+ }
26
+ end
27
+ end
28
+ end
data/lib/workos/sso.rb CHANGED
@@ -26,10 +26,10 @@ module WorkOS
26
26
  # required
27
27
  # @param [String] provider A provider name for an Identity Provider
28
28
  # configured on your WorkOS dashboard. Only 'Google' is supported.
29
+ # @param [String] connection The ID for a Connection configured on
30
+ # WorkOS.
29
31
  # @param [String] client_id The WorkOS client ID for the environment
30
32
  # where you've configured your SSO connection.
31
- # @param [String] project_id The WorkOS project ID for the project.
32
- # The project_id is deprecated in Dashboard2.
33
33
  # @param [String] redirect_uri The URI where users are directed
34
34
  # after completing the authentication step. Must match a
35
35
  # configured redirect URI on your WorkOS dashboard.
@@ -54,28 +54,26 @@ module WorkOS
54
54
  sig do
55
55
  params(
56
56
  redirect_uri: String,
57
- project_id: T.nilable(String),
58
57
  client_id: T.nilable(String),
59
58
  domain: T.nilable(String),
60
59
  provider: T.nilable(String),
60
+ connection: T.nilable(String),
61
61
  state: T.nilable(String),
62
62
  ).returns(String)
63
63
  end
64
64
  def authorization_url(
65
65
  redirect_uri:,
66
- project_id: nil,
67
66
  client_id: nil,
68
67
  domain: nil,
69
68
  provider: nil,
69
+ connection: nil,
70
70
  state: ''
71
71
  )
72
- if project_id
73
- warn '[DEPRECATION] `project_id` is deprecated.
74
- Please use `client_id` instead.'
75
- client_id = project_id
76
- end
77
-
78
- validate_domain_and_provider(provider: provider, domain: domain)
72
+ validate_authorization_url_arguments(
73
+ provider: provider,
74
+ domain: domain,
75
+ connection: connection,
76
+ )
79
77
 
80
78
  query = URI.encode_www_form({
81
79
  client_id: client_id,
@@ -84,6 +82,7 @@ module WorkOS
84
82
  state: state,
85
83
  domain: domain,
86
84
  provider: provider,
85
+ connection: connection,
87
86
  }.compact)
88
87
 
89
88
  "https://#{WorkOS::API_HOSTNAME}/sso/authorize?#{query}"
@@ -93,40 +92,16 @@ module WorkOS
93
92
  #
94
93
  # @param [String] code The authorization code provided in the callback URL
95
94
  # @param [String] client_id The WorkOS client ID for the environment
96
- # where you've configured your SSO connection
97
- # @param [String] project_id The WorkOS project ID for the project.
98
- # The project_id is deprecated in Dashboard2.
95
+ # where you've configured your SSO connection
99
96
  #
100
- # @example
101
- # WorkOS::SSO.profile(
102
- # code: 'acme.com',
103
- # client_id: 'project_01DG5TGK363GRVXP3ZS40WNGEZ'
104
- # )
105
- # => #<WorkOS::Profile:0x00007fb6e4193d20
106
- # @id="prof_01DRA1XNSJDZ19A31F183ECQW5",
107
- # @email="demo@workos-okta.com",
108
- # @first_name="WorkOS",
109
- # @connection_type="OktaSAML",
110
- # @last_name="Demo",
111
- # @idp_id="00u1klkowm8EGah2H357",
112
- # @access_token="01DVX6QBS3EG6FHY2ESAA5Q65X"
113
- # >
114
- #
115
- # @return [WorkOS::Profile]
97
+ # @return [WorkOS::ProfileAndToken]
116
98
  sig do
117
99
  params(
118
100
  code: String,
119
- project_id: T.nilable(String),
120
101
  client_id: T.nilable(String),
121
- ).returns(WorkOS::Profile)
102
+ ).returns(WorkOS::ProfileAndToken)
122
103
  end
123
- def profile(code:, project_id: nil, client_id: nil)
124
- if project_id
125
- warn '[DEPRECATION] `project_id` is deprecated.
126
- Please use `client_id` instead.'
127
- client_id = project_id
128
- end
129
-
104
+ def profile_and_token(code:, client_id: nil)
130
105
  body = {
131
106
  client_id: client_id,
132
107
  client_secret: WorkOS.key!,
@@ -135,65 +110,9 @@ module WorkOS
135
110
  }
136
111
 
137
112
  response = client.request(post_request(path: '/sso/token', body: body))
138
- check_and_raise_profile_error(response: response)
113
+ check_and_raise_profile_and_token_error(response: response)
139
114
 
140
- WorkOS::Profile.new(response.body)
141
- end
142
-
143
- # Promote a DraftConnection created via the WorkOS.js embed such that the
144
- # Enterprise users can begin signing into your application.
145
- #
146
- # @param [String] token The Draft Connection token that's been provided to
147
- # you by the WorkOS.js
148
- #
149
- # @example
150
- # WorkOS::SSO.promote_draft_connection(
151
- # token: 'draft_conn_429u59js',
152
- # )
153
- # => true
154
- #
155
- # @return [Bool] - returns `true` if successful, `false` otherwise.
156
- # @see https://github.com/workos-inc/ruby-idp-link-example
157
- sig { params(token: String).returns(T::Boolean) }
158
- def promote_draft_connection(token:)
159
- request = post_request(
160
- auth: true,
161
- path: "/draft_connections/#{token}/activate",
162
- )
163
-
164
- response = client.request(request)
165
-
166
- response.is_a? Net::HTTPSuccess
167
- end
168
-
169
- # Create a Connection
170
- #
171
- # @param [String] source The Draft Connection token that's been provided
172
- # to you by WorkOS.js
173
- #
174
- # @example
175
- # WorkOS::SSO.create_connection(source: 'draft_conn_429u59js')
176
- # => #<WorkOS::Connection:0x00007fb6e4193d20
177
- # @id="conn_02DRA1XNSJDZ19A31F183ECQW9",
178
- # @name="Foo Corp",
179
- # @connection_type="OktaSAML",
180
- # @domains=
181
- # [{:object=>"connection_domain",
182
- # :id=>"domain_01E6PK9N3XMD8RHWF7S66380AR",
183
- # :domain=>"example.com"}]>
184
- #
185
- # @return [WorkOS::Connection]
186
- sig { params(source: String).returns(WorkOS::Connection) }
187
- def create_connection(source:)
188
- request = post_request(
189
- auth: true,
190
- path: '/connections',
191
- body: { source: source },
192
- )
193
-
194
- response = execute_request(request: request)
195
-
196
- WorkOS::Connection.new(response.body)
115
+ WorkOS::ProfileAndToken.new(response.body)
197
116
  end
198
117
 
199
118
  # Retrieve connections.
@@ -215,7 +134,7 @@ module WorkOS
215
134
  sig do
216
135
  params(
217
136
  options: T::Hash[Symbol, String],
218
- ).returns(T::Array[T::Hash[String, T.nilable(String)]])
137
+ ).returns(WorkOS::Types::ListStruct)
219
138
  end
220
139
  def list_connections(options = {})
221
140
  response = execute_request(
@@ -226,7 +145,15 @@ module WorkOS
226
145
  ),
227
146
  )
228
147
 
229
- JSON.parse(response.body)['data']
148
+ parsed_response = JSON.parse(response.body)
149
+ connections = parsed_response['data'].map do |connection|
150
+ ::WorkOS::Connection.new(connection.to_json)
151
+ end
152
+
153
+ WorkOS::Types::ListStruct.new(
154
+ data: connections,
155
+ list_metadata: parsed_response['listMetadata'],
156
+ )
230
157
  end
231
158
 
232
159
  # Get a Connection
@@ -284,11 +211,17 @@ module WorkOS
284
211
  params(
285
212
  domain: T.nilable(String),
286
213
  provider: T.nilable(String),
214
+ connection: T.nilable(String),
287
215
  ).void
288
216
  end
289
- def validate_domain_and_provider(domain:, provider:)
290
- if [domain, provider].all?(&:nil?)
291
- raise ArgumentError, 'Either domain or provider is required.'
217
+ def validate_authorization_url_arguments(
218
+ domain:,
219
+ provider:,
220
+ connection:
221
+ )
222
+ if [domain, provider, connection].all?(&:nil?)
223
+ raise ArgumentError, 'Either connection, domain, or ' \
224
+ 'provider is required.'
292
225
  end
293
226
 
294
227
  return unless provider && !PROVIDERS.include?(provider)
@@ -298,10 +231,10 @@ module WorkOS
298
231
  end
299
232
 
300
233
  sig { params(response: Net::HTTPResponse).void }
301
- def check_and_raise_profile_error(response:)
234
+ def check_and_raise_profile_and_token_error(response:)
302
235
  begin
303
236
  body = JSON.parse(response.body)
304
- return if body['profile']
237
+ return if body['access_token'] && body['profile']
305
238
 
306
239
  message = body['message']
307
240
  request_id = response['x-request-id']
data/lib/workos/types.rb CHANGED
@@ -6,11 +6,14 @@ module WorkOS
6
6
  # so we're using Sorbet throughout this Ruby gem.
7
7
  module Types
8
8
  require_relative 'types/connection_struct'
9
+ require_relative 'types/directory_struct'
10
+ require_relative 'types/directory_group_struct'
9
11
  require_relative 'types/intent_enum'
10
12
  require_relative 'types/list_struct'
11
13
  require_relative 'types/organization_struct'
12
14
  require_relative 'types/passwordless_session_struct'
13
15
  require_relative 'types/profile_struct'
14
16
  require_relative 'types/provider_enum'
17
+ require_relative 'types/directory_user_struct'
15
18
  end
16
19
  end
@@ -10,6 +10,9 @@ module WorkOS
10
10
  const :name, String
11
11
  const :connection_type, String
12
12
  const :domains, T::Array[T.untyped]
13
+ const :organization_id, String
14
+ const :state, String
15
+ const :status, String
13
16
  end
14
17
  end
15
18
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ module WorkOS
5
+ module Types
6
+ # This DirectoryGroupStruct acts as a typed interface
7
+ # for the DirectoryGroup class
8
+ class DirectoryGroupStruct < T::Struct
9
+ const :id, String
10
+ const :name, String
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ module WorkOS
5
+ module Types
6
+ # This DirectoryStruct acts as a typed interface
7
+ # for the Directory class
8
+ class DirectoryStruct < T::Struct
9
+ const :id, String
10
+ const :name, String
11
+ const :domain, String
12
+ const :type, String
13
+ const :state, String
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+ # typed: strict
3
+
4
+ module WorkOS
5
+ module Types
6
+ # The DirectoryUserStruct acts as a typed interface
7
+ # for the DirectoryUser class
8
+ class DirectoryUserStruct < T::Struct
9
+ const :id, String
10
+ const :idp_id, String
11
+ const :emails, T::Array[T.untyped]
12
+ const :first_name, T.nilable(String)
13
+ const :last_name, T.nilable(String)
14
+ const :username, T.nilable(String)
15
+ const :state, T.nilable(String)
16
+ const :raw_attributes, T::Hash[Symbol, Object]
17
+ end
18
+ end
19
+ end