Skip to content

Commit ecd59a8

Browse files
committed
More work on writing attributes
1 parent 92687cc commit ecd59a8

File tree

17 files changed

+1200
-296
lines changed

17 files changed

+1200
-296
lines changed

Cargo.lock

Lines changed: 4 additions & 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: 211 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@
12621262
"name": "attr",
12631263
"required": true,
12641264
"schema": {
1265-
"$ref": "#/components/schemas/ViewRfdAttr"
1265+
"$ref": "#/components/schemas/RfdAttrName"
12661266
}
12671267
},
12681268
{
@@ -1292,6 +1292,56 @@
12921292
"$ref": "#/components/responses/Error"
12931293
}
12941294
}
1295+
},
1296+
"put": {
1297+
"summary": "Set an attribute of a given RFD",
1298+
"operationId": "set_rfd_attr",
1299+
"parameters": [
1300+
{
1301+
"in": "path",
1302+
"name": "attr",
1303+
"required": true,
1304+
"schema": {
1305+
"$ref": "#/components/schemas/RfdAttrName"
1306+
}
1307+
},
1308+
{
1309+
"in": "path",
1310+
"name": "number",
1311+
"required": true,
1312+
"schema": {
1313+
"type": "string"
1314+
}
1315+
}
1316+
],
1317+
"requestBody": {
1318+
"content": {
1319+
"application/json": {
1320+
"schema": {
1321+
"$ref": "#/components/schemas/RfdAttrValue"
1322+
}
1323+
}
1324+
},
1325+
"required": true
1326+
},
1327+
"responses": {
1328+
"200": {
1329+
"description": "successful operation",
1330+
"content": {
1331+
"application/json": {
1332+
"schema": {
1333+
"$ref": "#/components/schemas/RfdAttr"
1334+
}
1335+
}
1336+
}
1337+
},
1338+
"4XX": {
1339+
"$ref": "#/components/responses/Error"
1340+
},
1341+
"5XX": {
1342+
"$ref": "#/components/responses/Error"
1343+
}
1344+
}
12951345
}
12961346
},
12971347
"/rfd/{number}/visibility": {
@@ -1616,6 +1666,8 @@
16161666
"ManageMappersAll",
16171667
"GetRfdsAssigned",
16181668
"GetRfdsAll",
1669+
"UpdateRfdsAssigned",
1670+
"UpdateRfdsAll",
16191671
"ManageRfdsVisibilityAssigned",
16201672
"ManageRfdsVisibilityAll",
16211673
"GetDiscussionsAssigned",
@@ -1895,6 +1947,36 @@
18951947
],
18961948
"additionalProperties": false
18971949
},
1950+
{
1951+
"type": "object",
1952+
"properties": {
1953+
"UpdateRfd": {
1954+
"type": "integer",
1955+
"format": "int32"
1956+
}
1957+
},
1958+
"required": [
1959+
"UpdateRfd"
1960+
],
1961+
"additionalProperties": false
1962+
},
1963+
{
1964+
"type": "object",
1965+
"properties": {
1966+
"UpdateRfds": {
1967+
"type": "array",
1968+
"items": {
1969+
"type": "integer",
1970+
"format": "int32"
1971+
},
1972+
"uniqueItems": true
1973+
}
1974+
},
1975+
"required": [
1976+
"UpdateRfds"
1977+
],
1978+
"additionalProperties": false
1979+
},
18981980
{
18991981
"type": "object",
19001982
"properties": {
@@ -2846,6 +2928,76 @@
28462928
"kind"
28472929
]
28482930
},
2931+
{
2932+
"type": "object",
2933+
"properties": {
2934+
"kind": {
2935+
"type": "string",
2936+
"enum": [
2937+
"UpdateRfd"
2938+
]
2939+
},
2940+
"value": {
2941+
"type": "integer",
2942+
"format": "int32"
2943+
}
2944+
},
2945+
"required": [
2946+
"kind",
2947+
"value"
2948+
]
2949+
},
2950+
{
2951+
"type": "object",
2952+
"properties": {
2953+
"kind": {
2954+
"type": "string",
2955+
"enum": [
2956+
"UpdateRfds"
2957+
]
2958+
},
2959+
"value": {
2960+
"type": "array",
2961+
"items": {
2962+
"type": "integer",
2963+
"format": "int32"
2964+
},
2965+
"uniqueItems": true
2966+
}
2967+
},
2968+
"required": [
2969+
"kind",
2970+
"value"
2971+
]
2972+
},
2973+
{
2974+
"type": "object",
2975+
"properties": {
2976+
"kind": {
2977+
"type": "string",
2978+
"enum": [
2979+
"UpdateRfdsAssigned"
2980+
]
2981+
}
2982+
},
2983+
"required": [
2984+
"kind"
2985+
]
2986+
},
2987+
{
2988+
"type": "object",
2989+
"properties": {
2990+
"kind": {
2991+
"type": "string",
2992+
"enum": [
2993+
"UpdateRfdsAll"
2994+
]
2995+
}
2996+
},
2997+
"required": [
2998+
"kind"
2999+
]
3000+
},
28493001
{
28503002
"type": "object",
28513003
"properties": {
@@ -4311,20 +4463,67 @@
43114463
]
43124464
},
43134465
"RfdAttr": {
4466+
"oneOf": [
4467+
{
4468+
"type": "object",
4469+
"properties": {
4470+
"discussion": {
4471+
"type": "string"
4472+
}
4473+
},
4474+
"required": [
4475+
"discussion"
4476+
],
4477+
"additionalProperties": false
4478+
},
4479+
{
4480+
"type": "object",
4481+
"properties": {
4482+
"labels": {
4483+
"type": "string"
4484+
}
4485+
},
4486+
"required": [
4487+
"labels"
4488+
],
4489+
"additionalProperties": false
4490+
},
4491+
{
4492+
"type": "object",
4493+
"properties": {
4494+
"state": {
4495+
"$ref": "#/components/schemas/RfdState"
4496+
}
4497+
},
4498+
"required": [
4499+
"state"
4500+
],
4501+
"additionalProperties": false
4502+
}
4503+
]
4504+
},
4505+
"RfdAttrValue": {
43144506
"type": "object",
43154507
"properties": {
4316-
"name": {
4317-
"$ref": "#/components/schemas/ViewRfdAttr"
4318-
},
43194508
"value": {
43204509
"type": "string"
43214510
}
43224511
},
43234512
"required": [
4324-
"name",
43254513
"value"
43264514
]
43274515
},
4516+
"RfdState": {
4517+
"type": "string",
4518+
"enum": [
4519+
"abandoned",
4520+
"committed",
4521+
"discussion",
4522+
"ideation",
4523+
"prediscussion",
4524+
"published"
4525+
]
4526+
},
43284527
"RfdVisibility": {
43294528
"type": "object",
43304529
"properties": {
@@ -4426,19 +4625,19 @@
44264625
"SecretString": {
44274626
"type": "string"
44284627
},
4429-
"ViewRfdAttr": {
4628+
"Visibility": {
44304629
"type": "string",
44314630
"enum": [
4432-
"discussion",
4433-
"labels",
4434-
"state"
4631+
"public",
4632+
"private"
44354633
]
44364634
},
4437-
"Visibility": {
4635+
"RfdAttrName": {
44384636
"type": "string",
44394637
"enum": [
4440-
"public",
4441-
"private"
4638+
"discussion",
4639+
"labels",
4640+
"state"
44424641
]
44434642
}
44444643
},

rfd-api/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ repository = "https://github.com/oxidecomputer/rfd-api"
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10+
anyhow = { workspace = true }
1011
async-trait = { workspace = true }
1112
base64 = { workspace = true }
1213
chrono = { workspace = true, features = ["serde"] }
@@ -25,7 +26,7 @@ hyper-rustls = { workspace = true }
2526
jsonwebtoken = { workspace = true }
2627
meilisearch-sdk = { workspace = true }
2728
oauth2 = { workspace = true }
28-
octorust = { workspace = true }
29+
octorust = { workspace = true, features = ["httpcache"] }
2930
partial-struct = { workspace = true }
3031
rand = { workspace = true, features = ["std"] }
3132
rand_core = { workspace = true, features = ["std"] }
@@ -36,6 +37,7 @@ reqwest-retry = { workspace = true }
3637
reqwest-tracing = { workspace = true }
3738
ring = { workspace = true }
3839
rfd-data = { path = "../rfd-data" }
40+
rfd-github = { path = "../rfd-github" }
3941
rfd-model = { path = "../rfd-model" }
4042
rsa = { workspace = true, features = ["sha2"] }
4143
schemars = { workspace = true, features = ["chrono"] }

rfd-api/src/config.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,15 @@ pub struct SearchConfig {
147147

148148
#[derive(Debug, Deserialize)]
149149
pub struct ServicesConfig {
150-
pub github: GitHubAuthConfig,
150+
pub github: GitHubConfig,
151+
}
152+
153+
#[derive(Debug, Deserialize)]
154+
pub struct GitHubConfig {
155+
pub auth: GitHubAuthConfig,
156+
pub owner: String,
157+
pub path: String,
158+
pub repo: String,
151159
}
152160

153161
#[derive(Debug, Deserialize)]

0 commit comments

Comments
 (0)