Skip to content

Commit dcbd4d7

Browse files
committed
Enable getting attributes
1 parent 5e6d51d commit dcbd4d7

File tree

19 files changed

+898
-858
lines changed

19 files changed

+898
-858
lines changed

Cargo.lock

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

rfd-api-spec.json

Lines changed: 80 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -255,44 +255,6 @@
255255
}
256256
}
257257
},
258-
"/api-user/{identifier}/link": {
259-
"post": {
260-
"summary": "Link an existing login provider to this user",
261-
"operationId": "link_provider",
262-
"parameters": [
263-
{
264-
"in": "path",
265-
"name": "identifier",
266-
"required": true,
267-
"schema": {
268-
"type": "string",
269-
"format": "uuid"
270-
}
271-
}
272-
],
273-
"requestBody": {
274-
"content": {
275-
"application/json": {
276-
"schema": {
277-
"$ref": "#/components/schemas/ApiUserProviderLinkPayload"
278-
}
279-
}
280-
},
281-
"required": true
282-
},
283-
"responses": {
284-
"204": {
285-
"description": "resource updated"
286-
},
287-
"4XX": {
288-
"$ref": "#/components/responses/Error"
289-
},
290-
"5XX": {
291-
"$ref": "#/components/responses/Error"
292-
}
293-
}
294-
}
295-
},
296258
"/api-user/{identifier}/token": {
297259
"get": {
298260
"summary": "List the active and expired API tokens for a given user",
@@ -458,51 +420,6 @@
458420
}
459421
}
460422
},
461-
"/api-user-provider/{identifier}/link-token": {
462-
"post": {
463-
"summary": "Create a new link token for linking this provider to a different api user",
464-
"operationId": "create_link_token",
465-
"parameters": [
466-
{
467-
"in": "path",
468-
"name": "identifier",
469-
"required": true,
470-
"schema": {
471-
"type": "string",
472-
"format": "uuid"
473-
}
474-
}
475-
],
476-
"requestBody": {
477-
"content": {
478-
"application/json": {
479-
"schema": {
480-
"$ref": "#/components/schemas/ApiUserLinkRequestPayload"
481-
}
482-
}
483-
},
484-
"required": true
485-
},
486-
"responses": {
487-
"200": {
488-
"description": "successful operation",
489-
"content": {
490-
"application/json": {
491-
"schema": {
492-
"$ref": "#/components/schemas/ApiUserLinkRequestResponse"
493-
}
494-
}
495-
}
496-
},
497-
"4XX": {
498-
"$ref": "#/components/responses/Error"
499-
},
500-
"5XX": {
501-
"$ref": "#/components/responses/Error"
502-
}
503-
}
504-
}
505-
},
506423
"/github": {
507424
"post": {
508425
"tags": [
@@ -1335,6 +1252,48 @@
13351252
}
13361253
}
13371254
},
1255+
"/rfd/{number}/attr/{attr}": {
1256+
"get": {
1257+
"summary": "Get an attribute of a given RFD",
1258+
"operationId": "get_rfd_attr",
1259+
"parameters": [
1260+
{
1261+
"in": "path",
1262+
"name": "attr",
1263+
"required": true,
1264+
"schema": {
1265+
"$ref": "#/components/schemas/ViewRfdAttr"
1266+
}
1267+
},
1268+
{
1269+
"in": "path",
1270+
"name": "number",
1271+
"required": true,
1272+
"schema": {
1273+
"type": "string"
1274+
}
1275+
}
1276+
],
1277+
"responses": {
1278+
"200": {
1279+
"description": "successful operation",
1280+
"content": {
1281+
"application/json": {
1282+
"schema": {
1283+
"$ref": "#/components/schemas/RfdAttr"
1284+
}
1285+
}
1286+
}
1287+
},
1288+
"4XX": {
1289+
"$ref": "#/components/responses/Error"
1290+
},
1291+
"5XX": {
1292+
"$ref": "#/components/responses/Error"
1293+
}
1294+
}
1295+
}
1296+
},
13381297
"/rfd/{number}/visibility": {
13391298
"post": {
13401299
"summary": "Modify the visibility of an RFD",
@@ -3295,29 +3254,6 @@
32953254
}
32963255
]
32973256
},
3298-
"ApiUserLinkRequestPayload": {
3299-
"type": "object",
3300-
"properties": {
3301-
"user_identifier": {
3302-
"type": "string",
3303-
"format": "uuid"
3304-
}
3305-
},
3306-
"required": [
3307-
"user_identifier"
3308-
]
3309-
},
3310-
"ApiUserLinkRequestResponse": {
3311-
"type": "object",
3312-
"properties": {
3313-
"token": {
3314-
"$ref": "#/components/schemas/SecretString"
3315-
}
3316-
},
3317-
"required": [
3318-
"token"
3319-
]
3320-
},
33213257
"ApiUserProvider": {
33223258
"type": "object",
33233259
"properties": {
@@ -3372,17 +3308,6 @@
33723308
"updated_at"
33733309
]
33743310
},
3375-
"ApiUserProviderLinkPayload": {
3376-
"type": "object",
3377-
"properties": {
3378-
"token": {
3379-
"type": "string"
3380-
}
3381-
},
3382-
"required": [
3383-
"token"
3384-
]
3385-
},
33863311
"ApiUserUpdateParams": {
33873312
"type": "object",
33883313
"properties": {
@@ -3443,6 +3368,13 @@
34433368
"updated_at"
34443369
]
34453370
},
3371+
"ContentFormat": {
3372+
"type": "string",
3373+
"enum": [
3374+
"asciidoc",
3375+
"markdown"
3376+
]
3377+
},
34463378
"CreateMapper": {
34473379
"type": "object",
34483380
"properties": {
@@ -3552,6 +3484,9 @@
35523484
"nullable": true,
35533485
"type": "string"
35543486
},
3487+
"format": {
3488+
"$ref": "#/components/schemas/ContentFormat"
3489+
},
35553490
"id": {
35563491
"type": "string",
35573492
"format": "uuid"
@@ -3592,6 +3527,7 @@
35923527
"commit",
35933528
"committed_at",
35943529
"content",
3530+
"format",
35953531
"id",
35963532
"pdfs",
35973533
"rfd_number",
@@ -3899,6 +3835,9 @@
38993835
"nullable": true,
39003836
"type": "string"
39013837
},
3838+
"format": {
3839+
"$ref": "#/components/schemas/ContentFormat"
3840+
},
39023841
"id": {
39033842
"type": "string",
39043843
"format": "uuid"
@@ -3932,6 +3871,7 @@
39323871
"required": [
39333872
"commit",
39343873
"committed_at",
3874+
"format",
39353875
"id",
39363876
"rfd_number",
39373877
"sha",
@@ -4370,6 +4310,21 @@
43704310
"visibility"
43714311
]
43724312
},
4313+
"RfdAttr": {
4314+
"type": "object",
4315+
"properties": {
4316+
"name": {
4317+
"$ref": "#/components/schemas/ViewRfdAttr"
4318+
},
4319+
"value": {
4320+
"type": "string"
4321+
}
4322+
},
4323+
"required": [
4324+
"name",
4325+
"value"
4326+
]
4327+
},
43734328
"RfdVisibility": {
43744329
"type": "object",
43754330
"properties": {
@@ -4471,6 +4426,14 @@
44714426
"SecretString": {
44724427
"type": "string"
44734428
},
4429+
"ViewRfdAttr": {
4430+
"type": "string",
4431+
"enum": [
4432+
"discussion",
4433+
"labels",
4434+
"state"
4435+
]
4436+
},
44744437
"Visibility": {
44754438
"type": "string",
44764439
"enum": [

rfd-api/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ rand_core = { workspace = true, features = ["std"] }
3131
regex = { workspace = true }
3232
reqwest = { workspace = true }
3333
ring = { workspace = true }
34+
rfd-data = { path = "../rfd-data" }
3435
rfd-model = { path = "../rfd-model" }
3536
rsa = { workspace = true, features = ["sha2"] }
3637
schemars = { workspace = true, features = ["chrono"] }

rfd-api/src/context.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use jsonwebtoken::jwk::JwkSet;
1111
use oauth2::CsrfToken;
1212
use partial_struct::partial;
1313
use rfd_model::{
14-
schema_ext::{LoginAttemptState, Visibility},
14+
schema_ext::{ContentFormat, LoginAttemptState, Visibility},
1515
storage::{
1616
AccessGroupFilter, AccessGroupStore, AccessTokenStore, ApiKeyFilter, ApiKeyStore,
1717
ApiUserFilter, ApiUserProviderFilter, ApiUserProviderStore, ApiUserStore, JobStore,
@@ -190,6 +190,7 @@ pub struct FullRfd {
190190
pub labels: Option<String>,
191191
#[partial(ListRfd(skip))]
192192
pub content: String,
193+
pub format: ContentFormat,
193194
pub sha: String,
194195
pub commit: String,
195196
pub committed_at: DateTime<Utc>,
@@ -579,6 +580,7 @@ impl ApiContext {
579580
state: revision.state,
580581
authors: revision.authors,
581582
labels: revision.labels,
583+
format: revision.content_format,
582584
sha: revision.sha,
583585
commit: revision.commit_sha,
584586
committed_at: revision.committed_at,
@@ -641,6 +643,7 @@ impl ApiContext {
641643
authors: revision.authors,
642644
labels: revision.labels,
643645
content: revision.content,
646+
format: revision.content_format,
644647
sha: revision.sha,
645648
commit: revision.commit_sha,
646649
committed_at: revision.committed_at,

0 commit comments

Comments
 (0)