Radish alpha
r
Radicle desktop app
Radicle
Git (anonymous pull)
Log in to clone via SSH
Add `create_issue_comment_handler`
Sebastian Martinez committed 1 year ago
commit ea981634d04bee0be69d150d3267d63a1e7780a7
parent daaef13ff2d0340e99f3e92149f71792e23f7f03
1 file changed +17 -0
modified crates/test-http-api/src/api.rs
@@ -61,6 +61,7 @@ pub fn router(ctx: Context) -> Router {
        .route("/get_diff", post(diff_handler))
        .route("/list_issues", post(issues_handler))
        .route("/create_issue", post(create_issue_handler))
+
        .route("/create_issue_comment", post(create_issue_comment_handler))
        .route("/edit_issue", post(edit_issue_handler))
        .route("/issue_by_id", post(issue_handler))
        .route("/list_patches", post(patches_handler))
@@ -173,6 +174,22 @@ async fn create_issue_handler(
}

#[derive(Serialize, Deserialize)]
+
struct CreateIssueCommentBody {
+
    pub rid: identity::RepoId,
+
    pub new: types::cobs::thread::NewIssueComment,
+
    pub opts: types::cobs::CobOptions,
+
}
+

+
async fn create_issue_comment_handler(
+
    State(ctx): State<Context>,
+
    Json(CreateIssueCommentBody { rid, opts, new }): Json<CreateIssueCommentBody>,
+
) -> impl IntoResponse {
+
    let comment = ctx.create_issue_comment(rid, new, opts)?;
+

+
    Ok::<_, Error>(Json(comment))
+
}
+

+
#[derive(Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct EditIssuesBody {
    pub rid: identity::RepoId,