Skip to content

Commit

Permalink
Update API examples (#420)
Browse files Browse the repository at this point in the history
* Update List examples

* Update ID examples

* Update parameter description of ID Generation

* Add nanoid to ID examples
  • Loading branch information
cyb3rko committed Jul 16, 2022
1 parent 43c7f78 commit e7efc70
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 17 deletions.
57 changes: 55 additions & 2 deletions id/examples.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"generate": [
{
"title": "Generate a unique ID",
"title": "Generate an universally unique ID",
"run_check": true,
"request": {
"type": "uuid"
Expand All @@ -11,6 +11,50 @@
"id": "e9c427d8-cef1-48bd-ab89-59a6df29673b"
}
},
{
"title": "Generate an unique lexicographically ID",
"run_check": true,
"request": {
"type": "ulid"
},
"response": {
"type": "ulid",
"id": "01G81FHTX562P4HD0SD3SZM1PA"
}
},
{
"title": "Generate an unique k-sortable ID",
"run_check": true,
"request": {
"type": "ksuid"
},
"response": {
"type": "ksuid",
"id": "2BzSAIfCKDTb9lY6ZQ8vekYIVHT"
}
},
{
"title": "Generate a web-oriented globally unique ID",
"run_check": true,
"request": {
"type": "xid"
},
"response": {
"type": "xid",
"id": "cb8qgv24hjve3rmushhg"
}
},
{
"title": "Generate a URL-friendly unique ID",
"run_check": true,
"request": {
"type": "nanoid"
},
"response": {
"type": "nanoid",
"id": "yznF-9wXo0URikYX10XMv"
}
},
{
"title": "Generate a short ID",
"run_check": true,
Expand Down Expand Up @@ -51,7 +95,16 @@
"run_check": false,
"request": {},
"response": {
"types": ["uuid", "shortid", "snowflake", "bigflake"]
"types": [
"uuid",
"ulid",
"ksuid",
"xid",
"nanoid",
"shortid",
"snowflake",
"bigflake"
]
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions id/proto/id.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ service Id {

// Generate a unique ID. Defaults to uuid.
message GenerateRequest {
// type of id e.g uuid, shortid, snowflake (64 bit), bigflake (128 bit)
// type of id; call 'Types' endpoint for available types
string type = 1;
}

Expand All @@ -22,7 +22,7 @@ message GenerateResponse {
string type = 2;
}

// List the types of IDs available. No query params needed.
// List the types of IDs available.
message TypesRequest {}

message TypesResponse {
Expand Down
26 changes: 13 additions & 13 deletions lists/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"description": "Create a simple text based list",
"run_check": false,
"request": {
"title": "New List",
"name": "New List",
"items": ["This is my list"]
},
"response": {
"list": {
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"created": "2021-09-29T13:33:03+01:00",
"updated": "2021-09-29T13:33:03+01:00",
"title": "New List",
"name": "New List",
"items": ["This is my list"]
}
}
Expand All @@ -30,8 +30,8 @@
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"created": "2021-09-29T13:33:03+01:00",
"updated": "2021-09-29T13:33:03+01:00",
"title": "New List",
"text": "This is my list"
"name": "New List",
"items": ["This is my list"]
}
}
}],
Expand All @@ -43,11 +43,11 @@
"response": {
"lists": [
{
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"created": "2021-09-29T13:33:03+01:00",
"updated": "2021-09-29T13:33:03+01:00",
"title": "New List",
"items": ["This is my list"]
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"created": "2021-09-29T13:33:03+01:00",
"updated": "2021-09-29T13:33:03+01:00",
"name": "New List",
"items": ["This is my list"]
}
]
}
Expand All @@ -59,7 +59,7 @@
"request": {
"list": {
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"title": "Update List",
"name": "Update List",
"items": ["Updated list text"]
}
},
Expand All @@ -68,7 +68,7 @@
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"created": "2021-09-29T13:33:03+01:00",
"updated": "2021-09-29T13:50:20+01:00",
"title": "Update List",
"name": "Update List",
"items": ["Updated list text"]
}
}
Expand All @@ -85,7 +85,7 @@
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"created": "2021-09-29T13:33:03+01:00",
"updated": "2021-09-29T13:50:20+01:00",
"title": "Update List",
"name": "Update List",
"items": ["Updated list text"]
}
}
Expand All @@ -103,7 +103,7 @@
"id": "63c0cdf8-2121-11ec-a881-0242e36f037a",
"created": "2021-09-29T13:33:03+01:00",
"updated": "2021-09-29T13:50:20+01:00",
"title": "Update List",
"name": "Update List",
"items": ["Updated list text"]
}
}
Expand Down

0 comments on commit e7efc70

Please sign in to comment.