Skip to content

Commit

Permalink
docs: add pb, redis, qrcodde, shell, timestamp and zencode plugin exa…
Browse files Browse the repository at this point in the history
…mples (#169)

* docs: add pocketbase plugin examples

* docs: add redis plugin examples

* docs: add qrcode plugin examples

* docs: add shell plugin examples

* docs: add timestamp plugin examples

* docs: add zencode plugin examples
  • Loading branch information
matteo-cristino authored Jun 25, 2024
1 parent 15e8bde commit 9090d91
Show file tree
Hide file tree
Showing 55 changed files with 427 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/examples/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ SPDX-License-Identifier: CC-BY-NC-SA-4.0
<!--@include: http/index.md-->
<!--@include: json-schema/index.md-->
<!--@include: oauth/index.md-->
<!--@include: pocketbase/index.md-->
<!--@include: qrcode/index.md-->
<!--@include: redis/index.md-->
<!--@include: shell/index.md-->
<!--@include: timestamp/index.md-->
<!--@include: zencode/index.md-->
11 changes: 11 additions & 0 deletions docs/examples/pocketbase/create_record.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"create_parameters": {
"collection": "organizations",
"record": {
"name": "Jhon org"
}
},
"record_parameters": {
"requestKey": "testCreate"
}
}
7 changes: 7 additions & 0 deletions docs/examples/pocketbase/create_record.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pb_address": "http://127.0.0.1:8090",
"my_credentials": {
"email": "[email protected]",
"password": "testtest"
}
}
9 changes: 9 additions & 0 deletions docs/examples/pocketbase/create_record.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client
Given I send my_credentials 'my_credentials' and login

Given I send create_parameters 'create_parameters' and send record_parameters 'record_parameters' and create record and output into 'result'

Given I have a 'string dictionary' named 'result'
Then print the 'result'
6 changes: 6 additions & 0 deletions docs/examples/pocketbase/delete_record.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"delete_parameters": {
"collection": "organizations",
"id": "q3vijjsacrn32tk"
}
}
7 changes: 7 additions & 0 deletions docs/examples/pocketbase/delete_record.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pb_address": "http://127.0.0.1:8090",
"my_credentials": {
"email": "[email protected]",
"password": "testtest"
}
}
9 changes: 9 additions & 0 deletions docs/examples/pocketbase/delete_record.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client
Given I send my_credentials 'my_credentials' and login

Given I send delete_parameters 'delete_parameters' and delete record and output into 'result'

Given I have a 'string' named 'result'
Then print the 'result'
7 changes: 7 additions & 0 deletions docs/examples/pocketbase/get_one_record.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"show_parameters": {
"collection": "organizations",
"id": "p7viyzsihrn52uj",
"fields": "name"
}
}
3 changes: 3 additions & 0 deletions docs/examples/pocketbase/get_one_record.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pb_address": "http://127.0.0.1:8090"
}
8 changes: 8 additions & 0 deletions docs/examples/pocketbase/get_one_record.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client

Given I send show_parameters 'show_parameters' and get one record and output into 'result'

Given I have a 'string dictionary' named 'result'
Then print the 'result'
10 changes: 10 additions & 0 deletions docs/examples/pocketbase/get_some_records.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"list_parameters": {
"type": "list",
"pagination": {
"page": 2,
"perPage": 20
},
"collection": "organizations"
}
}
3 changes: 3 additions & 0 deletions docs/examples/pocketbase/get_some_records.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pb_address": "http://127.0.0.1:8090"
}
8 changes: 8 additions & 0 deletions docs/examples/pocketbase/get_some_records.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client

Given I send list_parameters 'list_parameters' and get some records and output into 'result'

Given I have a 'string dictionary' named 'result'
Then print the 'result'
70 changes: 70 additions & 0 deletions docs/examples/pocketbase/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<!--
SPDX-FileCopyrightText: 2024 Dyne.org foundation
SPDX-License-Identifier: CC-BY-NC-SA-4.0
-->

## pocketbase plugin examples

### start pb client
::: code-group
<<< @/examples/pocketbase/start_pb.zen{3 gherkin:line-numbers}
<<< @/examples/pocketbase/start_pb.data{json}
<<< @/examples/pocketbase/start_pb.keys{json}
:::

### login
::: code-group
<<< @/examples/pocketbase/login.zen{5 gherkin:line-numbers}
<<< @/examples/pocketbase/login.data{json}
<<< @/examples/pocketbase/login.keys{json}
:::

### password reset
::: code-group
<<< @/examples/pocketbase/pw_reset.zen{6 gherkin:line-numbers}
<<< @/examples/pocketbase/pw_reset.data{json}
<<< @/examples/pocketbase/pw_reset.keys{json}
:::

### get some records
::: code-group
<<< @/examples/pocketbase/get_some_records.zen{5 gherkin:line-numbers}
<<< @/examples/pocketbase/get_some_records.data{json}
<<< @/examples/pocketbase/get_some_records.keys{json}
:::

### get one record
::: code-group
<<< @/examples/pocketbase/get_one_record.zen{5 gherkin:line-numbers}
<<< @/examples/pocketbase/get_one_record.data{json}
<<< @/examples/pocketbase/get_one_record.keys{json}
:::

### create a record
::: code-group
<<< @/examples/pocketbase/create_record.zen{6 gherkin:line-numbers}
<<< @/examples/pocketbase/create_record.data{json}
<<< @/examples/pocketbase/create_record.keys{json}
:::

### update a record
::: code-group
<<< @/examples/pocketbase/update_record.zen{6 gherkin:line-numbers}
<<< @/examples/pocketbase/update_record.data{json}
<<< @/examples/pocketbase/update_record.keys{json}
:::

### delete a record
::: code-group
<<< @/examples/pocketbase/delete_record.zen{6 gherkin:line-numbers}
<<< @/examples/pocketbase/delete_record.data{json}
<<< @/examples/pocketbase/delete_record.keys{json}
:::

### send request
::: code-group
<<< @/examples/pocketbase/send_request.zen{5 gherkin:line-numbers}
<<< @/examples/pocketbase/send_request.data{json}
<<< @/examples/pocketbase/send_request.keys{json}
:::
6 changes: 6 additions & 0 deletions docs/examples/pocketbase/login.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"my_credentials": {
"email": "[email protected]",
"password": "testtest"
}
}
3 changes: 3 additions & 0 deletions docs/examples/pocketbase/login.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pb_address": "http://127.0.0.1:8090"
}
8 changes: 8 additions & 0 deletions docs/examples/pocketbase/login.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client

Given I send my_credentials 'my_credentials' and login and output into 'result'

Given I have a 'string' named 'result'
Then print the 'result'
3 changes: 3 additions & 0 deletions docs/examples/pocketbase/pw_reset.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"email": "[email protected]"
}
7 changes: 7 additions & 0 deletions docs/examples/pocketbase/pw_reset.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pb_address": "http://127.0.0.1:8090",
"my_credentials": {
"email": "[email protected]",
"password": "testtest"
}
}
9 changes: 9 additions & 0 deletions docs/examples/pocketbase/pw_reset.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client
Given I send my_credentials 'my_credentials' and login

Given I send email 'email' and ask password reset and output into 'result'

Given I have a 'string dictionary' named 'result'
Then print the 'result'
4 changes: 4 additions & 0 deletions docs/examples/pocketbase/send_request.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"url": "/api/hello/user",
"send_parameters": {}
}
3 changes: 3 additions & 0 deletions docs/examples/pocketbase/send_request.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pb_address": "http://127.0.0.1:8090"
}
8 changes: 8 additions & 0 deletions docs/examples/pocketbase/send_request.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client

Given I send url 'url' and send send_parameters 'send_parameters' and send request and output into 'result'

Given I have a 'string dictionary' named 'result'
Then print the 'result'
1 change: 1 addition & 0 deletions docs/examples/pocketbase/start_pb.data
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions docs/examples/pocketbase/start_pb.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"pb_address": "http://127.0.0.1:8090"
}
8 changes: 8 additions & 0 deletions docs/examples/pocketbase/start_pb.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client and output into 'result'
# for mobile contracts use instead
# Given I connect to 'pb_address' and start capacitor pb client and output into 'result'

Given I have a 'string' named 'result'
Then print the 'result'
12 changes: 12 additions & 0 deletions docs/examples/pocketbase/update_record.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"update_parameters": {
"id": "q3vijjsacrn32tk",
"collection": "organizations",
"record": {
"name": "new value for name"
}
},
"record_parameters": {
"fields": "id, name"
}
}
7 changes: 7 additions & 0 deletions docs/examples/pocketbase/update_record.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"pb_address": "http://127.0.0.1:8090",
"my_credentials": {
"email": "[email protected]",
"password": "testtest"
}
}
9 changes: 9 additions & 0 deletions docs/examples/pocketbase/update_record.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Rule unknown ignore

Given I connect to 'pb_address' and start pb client
Given I send my_credentials 'my_credentials' and login

Given I send update_parameters 'update_parameters' and send record_parameters 'record_parameters' and update record and output into 'result'

Given I have a 'string dictionary' named 'result'
Then print the 'result'
14 changes: 14 additions & 0 deletions docs/examples/qrcode/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!--
SPDX-FileCopyrightText: 2024 Dyne.org foundation
SPDX-License-Identifier: CC-BY-NC-SA-4.0
-->

## qrcode plugin examples

### create qr code
::: code-group
<<< @/examples/qrcode/qr_code.zen{3 gherkin:line-numbers}
<<< @/examples/qrcode/qr_code.data{json}
<<< @/examples/qrcode/qr_code.keys{json}
:::
3 changes: 3 additions & 0 deletions docs/examples/qrcode/qr_code.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"text": "Hello World!"
}
1 change: 1 addition & 0 deletions docs/examples/qrcode/qr_code.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
6 changes: 6 additions & 0 deletions docs/examples/qrcode/qr_code.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rule unknown ignore

Given I send text 'text' and create qr code and output into 'result'

Given I have a 'string' named 'result'
Then print the 'result'
3 changes: 3 additions & 0 deletions docs/examples/redis/delete.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"key": "some key"
}
3 changes: 3 additions & 0 deletions docs/examples/redis/delete.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"redis": "redis://localhost:6379"
}
6 changes: 6 additions & 0 deletions docs/examples/redis/delete.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rule unknown ignore

Given I connect to 'redis' and send key 'key' and delete key from redis and output into 'result'

Given I have a 'number' named 'result'
Then print the 'result'
28 changes: 28 additions & 0 deletions docs/examples/redis/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<!--
SPDX-FileCopyrightText: 2024 Dyne.org foundation
SPDX-License-Identifier: CC-BY-NC-SA-4.0
-->

## redis plugin examples

### write object into key in redis
::: code-group
<<< @/examples/redis/write.zen{3 gherkin:line-numbers}
<<< @/examples/redis/write.data{json}
<<< @/examples/redis/write.keys{json}
:::

### read key from redis
::: code-group
<<< @/examples/redis/read.zen{3 gherkin:line-numbers}
<<< @/examples/redis/read.data{json}
<<< @/examples/redis/read.keys{json}
:::

### delete key from redis
::: code-group
<<< @/examples/redis/delete.zen{3 gherkin:line-numbers}
<<< @/examples/redis/delete.data{json}
<<< @/examples/redis/delete.keys{json}
:::
3 changes: 3 additions & 0 deletions docs/examples/redis/read.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"key": "some key"
}
3 changes: 3 additions & 0 deletions docs/examples/redis/read.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"redis": "redis://localhost:6379"
}
6 changes: 6 additions & 0 deletions docs/examples/redis/read.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rule unknown ignore

Given I connect to 'redis' and send key 'key' and read key from redis and output into 'result'

Given I have a 'string dictionary' named 'result'
Then print the 'result'
7 changes: 7 additions & 0 deletions docs/examples/redis/write.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"key": "some key",
"object": {
"foo": "bar",
"baz": "qux"
}
}
3 changes: 3 additions & 0 deletions docs/examples/redis/write.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"redis": "redis://localhost:6379"
}
6 changes: 6 additions & 0 deletions docs/examples/redis/write.zen
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Rule unknown ignore

Given I connect to 'redis' and send key 'key' and send object 'object' and write object into key in redis and outpuit into 'result'

Given I have a 'string' named 'result'
Then print the 'result'
3 changes: 3 additions & 0 deletions docs/examples/shell/execute.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"command": "ls -a"
}
1 change: 1 addition & 0 deletions docs/examples/shell/execute.keys
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Loading

0 comments on commit 9090d91

Please sign in to comment.