Skip to content

Commit

Permalink
feature: add use-case docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kojofl committed Oct 4, 2023
1 parent 4876b1a commit 58010a4
Show file tree
Hide file tree
Showing 28 changed files with 591 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ group :jekyll_plugins do
gem 'jekyll-redirect-from'
end

gem "tzinfo-data"
# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", "~> 1.2"
gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
Expand Down
6 changes: 6 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ GEM
ruby2_keywords (>= 0.0.4)
faraday-net_http (3.0.2)
ffi (1.15.5)
ffi (1.15.5-x64-mingw-ucrt)
filesize (0.2.0)
forwardable-extended (2.6.0)
gemoji (4.1.0)
Expand Down Expand Up @@ -98,6 +99,8 @@ GEM
minitest (5.19.0)
nokogiri (1.14.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.14.3-x64-mingw-ucrt)
racc (~> 1.4)
nokogiri (1.14.3-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
Expand Down Expand Up @@ -125,12 +128,15 @@ GEM
unicode-display_width (~> 1.1, >= 1.1.1)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2023.3)
tzinfo (>= 1.0.0)
unicode-display_width (1.8.0)
verbal_expressions (0.1.5)
webrick (1.8.1)

PLATFORMS
arm64-darwin-22
x64-mingw-ucrt
x86_64-linux

DEPENDENCIES
Expand Down
64 changes: 22 additions & 42 deletions _includes/use-cases/use-case-consumption-accept-incoming-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,35 @@ Attempts to accept an incomming request by it's Id.

The items array indicate the decision made for each individual request item in the request.

## Parameters
## Example Body

```js
```json
{
requestId: string,
items: (DecideRequestItemParametersJSON | DecideRequestItemGroupParametersJSON)[]
"items": [
{ "accept": true },
{ "accept": false }
]
}
```

## Return Value

```ts
{
id: string,
isOwn: boolean,
peer: string,
createdAt: string,
status: [LocalRequestStatus](http://www.google.com),
content: RequestJSON;
source?: LocalRequestSourceDTO;
response?: LocalResponseDTO;
}

enum LocalRequestStatus {
Draft = "Draft",
Open = "Open",
DecisionRequired = "DecisionRequired",
ManualDecisionRequired = "ManualDecisionRequired",
Decided = "Decided",
Completed = "Completed",
Expired = "Expired"
}
```
<pre>
<code>
<a href="https://github.com/gmarciani">gmarciani</a>
</code>
</pre>
## Example
{% include rapidoc api_route_regex="^put /api/v2/Requests/Incoming/{id}/Accept$" %}

## Example

```js
const acceptResponse = await runtime.consumptionServices.incommingRequests.accept(
```shell
curl --location --request PUT 'http://{connector_url}/api/v2/Requests/Incoming/{id}/Accept' \
--header 'X-API-KEY: xxx' \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
requestId: "REQ_ID",
items: [{ accept: true }]
"accept": true
},
{
"accept": false,
"code": "an.error.code",
"message": "Error Message"
}
);
if (acceptResponse.isError) {
throw new Error(acceptResponse.error);
}
]
}'
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Checks if an incomming request can be successfully accepted.

The items array indicate the decision made for each individual request item in the request.

## Example Body

```json
{
"items": [
{ "accept": true },
{ "accept": false }
]
}
```

{% include rapidoc api_route_regex="^put /api/v2/Requests/Incoming/{id}/CanAccept$" %}

## Example

```shell
curl --location --request PUT 'http://{connector_url}/api/v2/Requests/Incoming/{id}/CanAccept' \
--header 'X-API-KEY: xxx' \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
"accept": true
},
{
"accept": false,
"code": "an.error.code",
"message": "Error Message"
}
]
}'
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
Checks if an incomming request can be successfully rejected.

The items array indicate the decision made for each individual request item in the request.

## Example Body

```json
{
"items": [
{ "accept": false },
{ "accept": false }
]
}
```

{% include rapidoc api_route_regex="^put /api/v2/Requests/Incoming/{id}/CanReject$" %}

## Example

```shell
curl --location --request PUT 'http://{connector_url}/api/v2/Requests/Incoming/{id}/CanReject' \
--header 'X-API-KEY: xxx' \
--header 'Content-Type: application/json' \
--data '{
"items": [
{
"accept": true
},
{
"accept": false,
"code": "an.error.code",
"message": "Error Message"
}
]
}'
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Validates an outgoing request without creating it.

The content is the to be created request defined in the [data model](/integrate/data-model-overview#request).

## Example Body

```json
{
"content": {
"expiresAt": "2024-01-01T00:00:00.000Z",
"items": [
{
"@type": "ShareAttributeRequestItem",
"mustBeAccepted": true,
"attribute": {
"@type": "IdentityAttribute",
"owner": "",
"value": {
"@type": "DisplayName",
"value": "Example"
}
},
"sourceAttributeId": "<id of attribute above, generated on creation>"
}
]
},
"peer": "peerId"
}
```

{% include rapidoc api_route_regex="^post /api/v2/Requests/Outgoing/Validate$" %}

## Example

```shell
curl --location --request POST 'http://{connector_url}/api/v2/Requests/Outgoing/Validate' \
--header 'X-API-KEY: xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": {
"expiresAt": "2024-01-01T00:00:00.000Z",
"items": [
{
"@type": "ShareAttributeRequestItem",
"mustBeAccepted": true,
"attribute": {
"@type": "IdentityAttribute",
"owner": "",
"value": {
"@type": "DisplayName",
"value": "Example"
}
},
"sourceAttributeId": "<id of attribute above, generated on creation>"
}
]
},
"peer": "peerId"
}'
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// TODO!

// This is an internal use case not exposed by the HTTP-API
39 changes: 39 additions & 0 deletions _includes/use-cases/use-case-consumption-create-an-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Create an attribute.

The content is the to be created attribute, either an 'IdentityAttribute' or an
'RelationshipAttribute', defined in the [data model](/integrate/data-model-overview#attributes).

## Example Body

```json
{
"content": {
"@type": "IdentityAttribute",
"owner": "<your address>",
"value": {
"@type": "DisplayName",
"value": "Example"
}
}
}
```

{% include rapidoc api_route_regex="^post /api/v2/Attributes$" %}

## Example

```shell
curl --location --request POST 'http://{connector_url}/api/v2/Attributes' \
--header 'X-API-KEY: xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": {
"@type": "IdentityAttribute",
"owner": "<your address>",
"value": {
"@type": "DisplayName",
"value": "Example"
}
}
}'
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// TODO!

// This is an internal use case not exposed by the HTTP-API
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// TODO!

// This is an internal use case not exposed by the HTTP-API
3 changes: 3 additions & 0 deletions _includes/use-cases/use-case-consumption-create-draft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// TODO!

// This is an internal use case not exposed by the HTTP-API
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Create outgoing request.

The content is the to be created request defined in the [data model](/integrate/data-model-overview#request).

## Example Body

```json
{
"content": {
"expiresAt": "2024-01-01T00:00:00.000Z",
"items": [
{
"@type": "ShareAttributeRequestItem",
"mustBeAccepted": true,
"attribute": {
"@type": "IdentityAttribute",
"owner": "",
"value": {
"@type": "DisplayName",
"value": "Example"
}
},
"sourceAttributeId": "<id of attribute above, generated on creation>"
}
]
},
"peer": "peerId"
}
```

{% include rapidoc api_route_regex="^post /api/v2/Requests/Outgoing$" %}

## Example

```shell
curl --location --request POST 'http://{connector_url}/api/v2/Requests/Outgoing' \
--header 'X-API-KEY: xxx' \
--header 'Content-Type: application/json' \
--data-raw '{
"content": {
"expiresAt": "2024-01-01T00:00:00.000Z",
"items": [
{
"@type": "ShareAttributeRequestItem",
"mustBeAccepted": true,
"attribute": {
"@type": "IdentityAttribute",
"owner": "",
"value": {
"@type": "DisplayName",
"value": "Example"
}
},
"sourceAttributeId": "<id of attribute above, generated on creation>"
}
]
},
"peer": "peerId"
}'
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

// TODO!

// This is an internal use case not exposed by the HTTP-API
4 changes: 4 additions & 0 deletions _includes/use-cases/use-case-consumption-create-setting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

// TODO!

// This is an internal use case not exposed by the HTTP-API
4 changes: 4 additions & 0 deletions _includes/use-cases/use-case-consumption-delete-draft.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

// TODO!

// This is an internal use case not exposed by the HTTP-API
4 changes: 4 additions & 0 deletions _includes/use-cases/use-case-consumption-delete-setting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

// TODO!

// This is an internal use case not exposed by the HTTP-API
Loading

0 comments on commit 58010a4

Please sign in to comment.