Skip to content

Commit

Permalink
Merge pull request #27 from passageidentity/PSG-3181-gitbook-document…
Browse files Browse the repository at this point in the history
…ation

Add wrapper function docs
  • Loading branch information
vanessa-passage authored Dec 6, 2023
2 parents 3ada30e + c527143 commit 32f2d6c
Show file tree
Hide file tree
Showing 5 changed files with 610 additions and 61 deletions.
79 changes: 18 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,6 @@ app_info = PassageClient.get_app()

```

The information available in the Passage App struct returned by PassageClient.get_app():

```ruby
Struct.new :name,
:id,
:auth_origin,
:redirect_url,
:login_url,
:rsa_public_key,
:allowed_identifer,
:require_identifier_verification,
:session_timeout_length,
:user_metadata_schema,
:layouts,
:auth_fallback_method,
:auth_fallback_method_ttl
```

## Retrieve User Info

Expand All @@ -104,24 +87,6 @@ class ApplicationController < ActionController::Base
end
```

The information available in the Passage User struct returned by PassageClient.user.get(user_id:):

```ruby
Struct.new :id,
:status,
:email,
:phone,
:email_verified,
:phone_verified,
:created_at,
:updated_at,
:last_login_at,
:login_count,
:recent_events,
:webauthn,
:webauthn_devices,
:user_metadata,
```

## Activate/Deactivate User

Expand Down Expand Up @@ -179,18 +144,6 @@ PassageClient =
devices = PassageClient.user.list_devices(user_id: user_id)
```

The information available in the array of Passage Device struct returned by PassageClient.user.list_devices(user_id:):

```ruby
Struct.new :id,
:cred_id,
:friendly_name,
:usage_count,
:updated_at,
:created_at,
:last_login_at,

```

## List User Devices

Expand Down Expand Up @@ -227,17 +180,21 @@ magic_link =
)
```

The information available in the Passage Magic Link struct returned this method is below:

```ruby
Struct.new :id,
:secret,
:activated,
:user_id,
:app_id,
:identifier,
:type,
:redirect_url,
:ttl,
:url
```
## Available Functions


Class | Method | Description
------------ | ------------- | -------------
*ClientApi* | [**get_app**](docs/custom/ClientApi.md#get_app) | Get App
*ClientApi* | [**create_magic_link**](docs/custom/Passage/ClientApi.md#create_magic_link) | Create Embeddable Magic Link
*AuthApi* | [**auth.authenticate_request**](docs/custom/AuthApi.md#authenticate_request) | Validates user jwt token
*AuthApi* | [**auth.validate_jwt**](docs/custom/AuthApi.md#validate_jwt) | Validates user jwt token
*UserAPI* | [**user.delete_device**](docs/custom/UserApi.md#delete_device) | Delete a device for a user
*UserAPI* | [**user.list_devices**](docs/custom/UserApi.md#list_devices) | List User Devices
*UserAPI* | [**user.activate**](docs/custom/UserApi.md#activate) | Activate User
*UserAPI* | [**user.create**](docs/custom/UserApi.md#create) | Create User
*UserAPI* | [**user.deactivate**](docs/custom/UserApi.md#deactivate) | Deactivate User
*UserAPI* | [**user.delete**](docs/custom/UserApi.md#delete) | Delete User
*UserAPI* | [**user.get**](docs/custom/UserApi.md#get) | Get User
*UserAPI* | [**user.update**](docs/custom/UserApi.md#update) | Update User
*UserAPI* | [**user.signout**](docs/custom/UserApi.md#signout) | Signout User
101 changes: 101 additions & 0 deletions docs/custom/AuthApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Passage::AuthApi

All URIs are relative to *https://api.passage.id/v1*

| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**revoke_user_refresh_tokens**](TokensApi.md#revoke_user_refresh_tokens) | **DELETE** /apps/{app_id}/users/{user_id}/tokens | **Deprecated:** Revokes refresh tokens |
| [**validate_jwt**](TokensApi.md#validate_jwt) | n/a | Validates jwt token


## revoke_user_refresh_tokens

> revoke_user_refresh_tokens(user_id)
Revokes refresh tokens

Revokes all refresh tokens for a user

### Examples

```ruby
require 'passageidentity'

class ApplicationController < ActionController::Base
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)

def revoke_passage_user_tokens!
begin
# tokens are revoked
revoke = PassageClient.auth.revoke_user_refresh_tokens(USER_ID)
rescue Exception => e
# handle exception (user is not authorized)
end
end
end
```


### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **user_id** | **String** | User ID | |

### Return type

bool

### Authorization

[bearerAuth](../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

---


## validate_jwt

> validate_jwt(token)
Validates jwt token

Validates jwt token for a user

### Examples

```ruby
require 'passageidentity'

class ApplicationController < ActionController::Base
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)

def validate_passage_user!
begin
# tokens are revoked
revoke = PassageClient.auth.validate_jwt(token)
rescue Exception => e
# handle exception (user is not authorized)
end
end
end
```

### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **token** | **String** | jwt token | |

### Return type

[**UserInfo**](UserInfo.md)

### Authorization

[bearerAuth](../README.md#bearerAuth)

107 changes: 107 additions & 0 deletions docs/custom/ClientApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Passage::ClientApi

All URIs are relative to *https://api.passage.id/v1*

| Method | HTTP request | Description |
| ------ | ------------ | ----------- |
| [**get_app**](ClientApi.md#get_app) | **GET** /apps/{app_id} | Get App |
| [**create_magic_link**](ClientApi.md#create_magic_link) | **POST** /apps/{app_id}/magic-links | Create Embeddable Magic Link |


## get_app

> <AppResponse> get_app()
Get App

Get app information.

### Examples

```ruby
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)

begin
# Get App
result = PassageClient.get_app()
p result
rescue OpenapiClient::ApiError => e
puts "Error when calling AppsApi->get_app: #{e}"
end
```


### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **app_id** | **String** | App ID | |

### Return type

[**AppResponse**](AppResponse.md)

### Authorization

[bearerAuth](../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

---


## create_magic_link

> <MagicLinkResponse> create_magic_link(create_magic_link_request)
Create Embeddable Magic Link

Create magic link for a user.

### Examples

```ruby
PassageClient = Passage::Client.new(app_id: PASSAGE_APP_ID, api_key: PASSAGE_API_KEY)

api_instance = PassageClient.create_magic_link()

create_magic_link_request = OpenapiClient::create_magic_link({channel: OpenapiClient::MagicLinkChannel::EMAIL, email: 'email_example', magic_link_path: 'magic_link_path_example', phone: 'phone_example', redirect_url: 'redirect_url_example', _send: false, ttl: 37, user_id: 'user_id_example'}) # CreateMagicLinkRequest | magic link request

begin
# Create Embeddable Magic Link
result = PassageClient.create_magic_link.create_magic_link(create_magic_link_request)
p result
rescue OpenapiClient::ApiError => e
puts "Error when calling MagicLinksApi->create_magic_link: #{e}"
end
```

#### Using the create_magic_link_with_http_info variant

This returns an Array which contains the response data, status code and headers.

> <Array(<MagicLinkResponse>, Integer, Hash)> create_magic_link_with_http_info(app_id, create_magic_link_request)

### Parameters

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **create_magic_link_request** | [**CreateMagicLinkRequest**](CreateMagicLinkRequest.md) | magic link request | |

### Return type

[**MagicLinkResponse**](MagicLinkResponse.md)

### Authorization

[bearerAuth](../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: application/json
- **Accept**: application/json

Loading

0 comments on commit 32f2d6c

Please sign in to comment.