Skip to content

Commit 401a73f

Browse files
committed
litrpc: add credit & debit account REST endpoints
1 parent efde919 commit 401a73f

File tree

3 files changed

+336
-0
lines changed

3 files changed

+336
-0
lines changed

litrpc/lit-accounts.pb.gw.go

Lines changed: 222 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

litrpc/lit-accounts.swagger.json

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,86 @@
7171
]
7272
}
7373
},
74+
"/v1/accounts/credit/{id}": {
75+
"post": {
76+
"summary": "litcli: `accounts creditaccount`\nCreditAccount increases the balance of an existing account in the account\ndatabase.",
77+
"operationId": "Accounts_CreditAccount",
78+
"responses": {
79+
"200": {
80+
"description": "A successful response.",
81+
"schema": {
82+
"$ref": "#/definitions/litrpcAccount"
83+
}
84+
},
85+
"default": {
86+
"description": "An unexpected error response.",
87+
"schema": {
88+
"$ref": "#/definitions/rpcStatus"
89+
}
90+
}
91+
},
92+
"parameters": [
93+
{
94+
"name": "id",
95+
"description": "The ID of the account to update. Either the ID or the label must be set.",
96+
"in": "path",
97+
"required": true,
98+
"type": "string"
99+
},
100+
{
101+
"name": "body",
102+
"in": "body",
103+
"required": true,
104+
"schema": {
105+
"$ref": "#/definitions/AccountsCreditAccountBody"
106+
}
107+
}
108+
],
109+
"tags": [
110+
"Accounts"
111+
]
112+
}
113+
},
114+
"/v1/accounts/debit/{id}": {
115+
"post": {
116+
"summary": "litcli: `accounts debitaccount`\nDebitAccount decreases the balance of an existing account in the account\ndatabase.",
117+
"operationId": "Accounts_DebitAccount",
118+
"responses": {
119+
"200": {
120+
"description": "A successful response.",
121+
"schema": {
122+
"$ref": "#/definitions/litrpcAccount"
123+
}
124+
},
125+
"default": {
126+
"description": "An unexpected error response.",
127+
"schema": {
128+
"$ref": "#/definitions/rpcStatus"
129+
}
130+
}
131+
},
132+
"parameters": [
133+
{
134+
"name": "id",
135+
"description": "The ID of the account to update. Either the ID or the label must be set.",
136+
"in": "path",
137+
"required": true,
138+
"type": "string"
139+
},
140+
{
141+
"name": "body",
142+
"in": "body",
143+
"required": true,
144+
"schema": {
145+
"$ref": "#/definitions/AccountsDebitAccountBody"
146+
}
147+
}
148+
],
149+
"tags": [
150+
"Accounts"
151+
]
152+
}
153+
},
74154
"/v1/accounts/{id}": {
75155
"delete": {
76156
"summary": "litcli: `accounts remove`\nRemoveAccount removes the given account from the account database.",
@@ -150,6 +230,34 @@
150230
}
151231
},
152232
"definitions": {
233+
"AccountsCreditAccountBody": {
234+
"type": "object",
235+
"properties": {
236+
"label": {
237+
"type": "string",
238+
"description": "The label of the account to update. If an account has no label, then the ID\nmust be used instead."
239+
},
240+
"amount": {
241+
"type": "string",
242+
"format": "uint64",
243+
"description": "The amount by which the account's balance should be updated."
244+
}
245+
}
246+
},
247+
"AccountsDebitAccountBody": {
248+
"type": "object",
249+
"properties": {
250+
"label": {
251+
"type": "string",
252+
"description": "The label of the account to update. If an account has no label, then the ID\nmust be used instead."
253+
},
254+
"amount": {
255+
"type": "string",
256+
"format": "uint64",
257+
"description": "The amount by which the account's balance should be updated."
258+
}
259+
}
260+
},
153261
"AccountsUpdateAccountBody": {
154262
"type": "object",
155263
"properties": {

litrpc/lit-accounts.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ http:
1515
get: "/v1/accounts"
1616
- selector: litrpc.Accounts.RemoveAccount
1717
delete: "/v1/accounts/{id}"
18+
- selector: litrpc.Accounts.CreditAccount
19+
post: "/v1/accounts/credit/{id}"
20+
body: "*"
21+
- selector: litrpc.Accounts.DebitAccount
22+
post: "/v1/accounts/debit/{id}"
23+
body: "*"

0 commit comments

Comments
 (0)