diff --git a/sig/cognito_idp.rbs b/sig/cognito_idp.rbs new file mode 100644 index 0000000..99b5e26 --- /dev/null +++ b/sig/cognito_idp.rbs @@ -0,0 +1,3 @@ +module CognitoIdp + VERSION: String +end diff --git a/sig/cognito_idp/authorization_uri.rbs b/sig/cognito_idp/authorization_uri.rbs new file mode 100644 index 0000000..8a2b6c4 --- /dev/null +++ b/sig/cognito_idp/authorization_uri.rbs @@ -0,0 +1,25 @@ +module CognitoIdp + class AuthorizationUri + attr_reader client_id: String + attr_reader code_challenge_method: String? + attr_reader code_challenge: String? + attr_reader domain: String + attr_reader idp_identifier: String? + attr_reader identity_provider: String? + attr_reader nonce: String? + attr_reader redirect_uri: String + attr_reader response_type: Symbol + attr_reader scope: String | Array[String] | nil + attr_reader state: String? + + def initialize: (client_id: String, domain: String, redirect_uri: String, ?response_type: Symbol, **untyped) -> void + + def to_s: () -> String + + private + + def params: () -> Hash[Symbol, untyped] + + def scope_string: () -> String? + end +end diff --git a/sig/cognito_idp/client.rbs b/sig/cognito_idp/client.rbs index 6742dfb..84df8dd 100644 --- a/sig/cognito_idp/client.rbs +++ b/sig/cognito_idp/client.rbs @@ -1,6 +1,32 @@ module CognitoIdp - module Client - VERSION: String - # See the writing guide of rbs: https://github.com/ruby/rbs#guides + class Client + attr_reader adapter: Symbol + attr_reader client_id: String + attr_reader client_secret: String? + attr_reader domain: String + + def initialize: (client_id: String, domain: String, ?client_secret: String?, ?adapter: Symbol, ?stubs: untyped) -> void + + def inspect: () -> String + + def authorization_uri: (redirect_uri: String, **untyped) -> String + + def get_token: (grant_type: String | Symbol, **untyped) -> Token + | (grant_type: String | Symbol, **untyped) { (Token) -> void } -> Token + + def get_user_info: (Token | String) -> UserInfo + | (Token | String) { (UserInfo) -> void } -> UserInfo + + def revoke_token: (Token | String) -> void + + def logout_uri: (**untyped) -> String + + private + + def connection: () -> untyped + + def handle_error_response: (untyped) -> void + + def basic_authorization_headers: () -> Hash[String, String]? end end diff --git a/sig/cognito_idp/error.rbs b/sig/cognito_idp/error.rbs new file mode 100644 index 0000000..3c2a4ad --- /dev/null +++ b/sig/cognito_idp/error.rbs @@ -0,0 +1,13 @@ +module CognitoIdp + class Error < StandardError + attr_reader error: String + attr_reader error_description: String? + attr_reader http_status: Integer? + + def initialize: (error: String, ?error_description: String?, ?http_status: Integer?) -> void + + private + + def build_message: () -> String + end +end diff --git a/sig/cognito_idp/logout_uri.rbs b/sig/cognito_idp/logout_uri.rbs new file mode 100644 index 0000000..157f9a7 --- /dev/null +++ b/sig/cognito_idp/logout_uri.rbs @@ -0,0 +1,21 @@ +module CognitoIdp + class LogoutUri + attr_reader client_id: String + attr_reader domain: String + attr_reader logout_uri: String? + attr_reader redirect_uri: String? + attr_reader response_type: Symbol? + attr_reader scope: String | Array[String] | nil + attr_reader state: String? + + def initialize: (client_id: String, domain: String, **untyped) -> void + + def to_s: () -> String + + private + + def params: () -> Hash[Symbol, untyped] + + def scope_string: () -> String? + end +end diff --git a/sig/cognito_idp/token.rbs b/sig/cognito_idp/token.rbs new file mode 100644 index 0000000..606d8d9 --- /dev/null +++ b/sig/cognito_idp/token.rbs @@ -0,0 +1,16 @@ +module CognitoIdp + class Token + attr_reader access_token: String? + attr_reader id_token: String? + attr_reader token_type: String? + attr_reader expires_at: Time? + attr_reader expires_in: Integer? + attr_reader refresh_token: String? + + def initialize: (Hash[String | Symbol, untyped]) -> void + + def expired?: () -> bool + + def inspect: () -> String + end +end diff --git a/sig/cognito_idp/user_info.rbs b/sig/cognito_idp/user_info.rbs new file mode 100644 index 0000000..4c0e92c --- /dev/null +++ b/sig/cognito_idp/user_info.rbs @@ -0,0 +1,11 @@ +module CognitoIdp + class UserInfo + def initialize: (Hash[String | Symbol, untyped]) -> void + + private + + def method_missing: (Symbol, *untyped) -> untyped + + def respond_to_missing?: (Symbol, ?bool) -> bool + end +end