Skip to content

Commit ac53575

Browse files
committed
chore: init new apis
1 parent 65ec679 commit ac53575

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3005
-2267
lines changed

apispec/nildb/accounts.openapi.yaml

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# components:
2+
# schemas:
3+
# Account:
4+
# type: object
5+
# required:
6+
# - _id
7+
# - _type
8+
# - _created
9+
# - _updated
10+
# - publicKey
11+
# - name
12+
# - schemas
13+
# - queries
14+
# properties:
15+
# _id:
16+
# description: The accounts decentralised identifier (DID)
17+
# type: string
18+
# example: 'did:nil:testnet:nillion1eunreuzltxglx9fx493l2r8ef6rdlrau4dsdnc'
19+
# _type:
20+
# type: string
21+
# enum: ['admin', 'organization']
22+
# _created:
23+
# type: string
24+
# format: date-time
25+
# _updated:
26+
# type: string
27+
# format: date-time
28+
# publicKey:
29+
# type: string
30+
# name:
31+
# type: string
32+
# schemas:
33+
# description: A list of schema ids that belong to this account
34+
# type: array
35+
# items:
36+
# $ref: './base.openapi.yaml#/components/schemas/UUID'
37+
# queries:
38+
# description: A list of query ids that belong to this account
39+
# type: array
40+
# items:
41+
# $ref: './base.openapi.yaml#/components/schemas/UUID'
42+
43+
# paths:
44+
# /api/v1/accounts:
45+
# get:
46+
# summary: Get account information
47+
# description: Retrieve an organization's account details
48+
# tags:
49+
# - Accounts
50+
# security:
51+
# - jwt: []
52+
# responses:
53+
# '200':
54+
# description: "The organization's account details"
55+
# content:
56+
# application/json:
57+
# schema:
58+
# type: object
59+
# required:
60+
# - data
61+
# properties:
62+
# data:
63+
# $ref: '#/components/schemas/Account'
64+
# '400':
65+
# $ref: './base.openapi.yaml#/components/responses/400'
66+
# '401':
67+
# $ref: './base.openapi.yaml#/components/responses/401'
68+
# '500':
69+
# $ref: './base.openapi.yaml#/components/responses/500'
70+
71+
openapi: 3.0.0
72+
info:
73+
title: nilDB API - Accounts
74+
version: 0.5.0
75+
description: Account management for nilDB API
76+
servers:
77+
- url: https://nildb-demo.nillion.network/api/v1/
78+
tags:
79+
- name: Accounts
80+
description: Account operations
81+
82+
components:
83+
securitySchemes:
84+
jwt:
85+
type: http
86+
scheme: bearer
87+
bearerFormat: JWT
88+
description: |
89+
A DID-JWT using the ES256K algorithm for authenticated endpoints.
90+
schemas:
91+
UUID:
92+
description: A universally unique identifier
93+
type: string
94+
format: uuid
95+
Account:
96+
type: object
97+
required:
98+
- _id
99+
- _type
100+
- _created
101+
- _updated
102+
- publicKey
103+
- name
104+
- schemas
105+
- queries
106+
properties:
107+
_id:
108+
description: The accounts decentralised identifier (DID)
109+
type: string
110+
example: 'did:nil:testnet:nillion1eunreuzltxglx9fx493l2r8ef6rdlrau4dsdnc'
111+
_type:
112+
type: string
113+
enum: ['admin', 'organization']
114+
_created:
115+
type: string
116+
format: date-time
117+
_updated:
118+
type: string
119+
format: date-time
120+
publicKey:
121+
type: string
122+
name:
123+
type: string
124+
schemas:
125+
description: A list of schema ids that belong to this account
126+
type: array
127+
items:
128+
$ref: '#/components/schemas/UUID'
129+
queries:
130+
description: A list of query ids that belong to this account
131+
type: array
132+
items:
133+
$ref: '#/components/schemas/UUID'
134+
responses:
135+
'400':
136+
description: Validation or processing errors
137+
content:
138+
application/json:
139+
schema:
140+
type: object
141+
properties:
142+
ts:
143+
type: string
144+
format: date-time
145+
errors:
146+
type: array
147+
items:
148+
oneOf:
149+
- type: string
150+
- type: object
151+
properties:
152+
code:
153+
type: string
154+
message:
155+
type: string
156+
'401':
157+
description: Missing or invalid JWT
158+
'500':
159+
description: Internal server error
160+
161+
paths:
162+
/api/v1/accounts:
163+
get:
164+
summary: Get account information
165+
description: Retrieve an organization's account details
166+
tags:
167+
- Accounts
168+
security:
169+
- jwt: []
170+
responses:
171+
'200':
172+
description: "The organization's account details"
173+
content:
174+
application/json:
175+
schema:
176+
type: object
177+
required:
178+
- data
179+
properties:
180+
data:
181+
$ref: '#/components/schemas/Account'
182+
'400':
183+
$ref: '#/components/responses/400'
184+
'401':
185+
$ref: '#/components/responses/401'
186+
'500':
187+
$ref: '#/components/responses/500'

apispec/nildb/base.openapi.yaml

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
openapi: 3.0.0
2+
info:
3+
title: nilDB API
4+
version: 0.5.0
5+
description: |
6+
Visit [docs.nillion.com](https://docs.nillion.com) and [github.com/NillionNetwork/nildb](https://github.com/NillionNetwork/nildb) to learn more.
7+
8+
servers:
9+
- url: /
10+
11+
tags:
12+
- name: Accounts
13+
description: Account details
14+
- name: Data
15+
description: Create, read, update and delete data for specified schemas
16+
- name: Query
17+
description: Manage and execute queries
18+
- name: Schema
19+
description: Manage your schemas
20+
- name: Node
21+
description: Node information
22+
- name: Beta
23+
description: Features under incubation
24+
25+
components:
26+
securitySchemes:
27+
jwt:
28+
type: http
29+
scheme: bearer
30+
bearerFormat: JWT
31+
description: |
32+
A DID-JWT using the ES256K algorithm for authenticated endpoints.
33+
JWT payload must include:
34+
- iat: Issued at timestamp
35+
- exp: Expiration timestamp (recommended)
36+
- aud: Target node decentralised identifier (DID)
37+
- iss: Client's decentralised identifier (DID)
38+
schemas:
39+
UUID:
40+
description: A universally unique identifier for the item.
41+
type: string
42+
format: uuid
43+
Filter:
44+
type: object
45+
minProperties: 1
46+
additionalProperties: true
47+
description: MongoDB-style query filter
48+
DocumentBase:
49+
type: object
50+
properties:
51+
_id:
52+
$ref: '#/components/schemas/UUID'
53+
_created:
54+
type: string
55+
format: date-time
56+
description: The creation timestamp.
57+
_updated:
58+
type: string
59+
format: date-time
60+
description: The last update timestamp.
61+
required:
62+
- _id
63+
- _created
64+
- _updated
65+
Schema:
66+
allOf:
67+
- $ref: '#/components/schemas/DocumentBase'
68+
- type: object
69+
required:
70+
- name
71+
- owner
72+
- schema
73+
properties:
74+
name:
75+
description: A user friendly schema name
76+
type: string
77+
owner:
78+
description: The decentralised identifier (DID) of the owning organization
79+
type: string
80+
example: 'did:nil:testnet:nillion1eunreuzltxglx9fx493l2r8ef6rdlrau4dsdnc'
81+
schema:
82+
description: The json schema used to validate data before insertion into the schema collection
83+
type: object
84+
85+
DataDocument:
86+
allOf:
87+
- $ref: '#/components/schemas/DocumentBase'
88+
- type: object
89+
additionalProperties: true
90+
description: The document's additional properties. Schema dependent.
91+
92+
Error:
93+
type: object
94+
required:
95+
- ts
96+
- errors
97+
properties:
98+
ts:
99+
type: string
100+
format: date-time
101+
description: The error's timestamp.
102+
errors:
103+
description: A list of error messages
104+
type: array
105+
items:
106+
anyOf:
107+
- type: string
108+
- type: object
109+
properties:
110+
code:
111+
type: string
112+
message:
113+
type: string
114+
responses:
115+
201:
116+
description: Resource created
117+
204:
118+
description: Resource deleted
119+
400:
120+
description: Validation or processing errors
121+
content:
122+
application/json:
123+
schema:
124+
$ref: '#/components/schemas/Error'
125+
401:
126+
description: Missing or invalid JWT
127+
404:
128+
description: Resource not found
129+
500:
130+
description: Internal server error
131+
132+
paths:
133+
# Account endpoints
134+
/api/v1/accounts:
135+
$ref: './accounts.openapi.yaml#/paths/~1api~1v1~1accounts'
136+
137+
# # Schema endpoints
138+
# /api/v1/schemas:
139+
# $ref: './schemas.openapi.yaml#/paths/~1api~1v1~1schemas'
140+
141+
# # Query endpoints
142+
# /api/v1/queries:
143+
# $ref: './queries.openapi.yaml#/paths/~1api~1v1~1queries'
144+
# /api/v1/queries/execute:
145+
# $ref: './queries.openapi.yaml#/paths/~1api~1v1~1queries~1execute'
146+
147+
# # Data endpoints
148+
# /api/v1/data/create:
149+
# $ref: './data.openapi.yaml#/paths/~1api~1v1~1data~1create'
150+
# /api/v1/data/read:
151+
# $ref: './data.openapi.yaml#/paths/~1api~1v1~1data~1read'
152+
# /api/v1/data/update:
153+
# $ref: './data.openapi.yaml#/paths/~1api~1v1~1data~1update'
154+
# /api/v1/data/tail:
155+
# $ref: './data.openapi.yaml#/paths/~1api~1v1~1data~1tail'
156+
# /api/v1/data/delete:
157+
# $ref: './data.openapi.yaml#/paths/~1api~1v1~1data~1delete'
158+
# /api/v1/data/flush:
159+
# $ref: './data.openapi.yaml#/paths/~1api~1v1~1data~1flush'
160+
161+
# # System endpoints
162+
# /health:
163+
# $ref: './system.openapi.yaml#/paths/~1health'
164+
# /about:
165+
# $ref: './system.openapi.yaml#/paths/~1about'

0 commit comments

Comments
 (0)