cytechmobile / radicle-jetbrains-plugin

Radicle plugin for Jetbrains IDEs
https://plugins.jetbrains.com/plugin/19664-radicle
Apache License 2.0
15 stars 0 forks source link

Investigate switch to CLI #540

Open gsaslis opened 1 month ago

gsaslis commented 1 month ago

Look at which API endpoints we currently use:

Stelios123 commented 1 month ago

Issues (HTTPD)

  1. Fetch issues (GET)
  2. Fetch single issue (GET)
  3. Create Issue (PATCH)
  4. Edit issue (PATCH)
  5. Change state (PATCH)
  6. Add / remove assignee (PATCH)
  7. Add / remove label (PATCH)
  8. Add comment (PATCH)
  9. Edit Comment
  10. Comment reaction (PATCH)

Patches (HTTPD)

  1. Fetch patches (GET)
  2. Add review (PATCH)
  3. Fetch single patch (GET)
  4. Change state (PATCH)
  5. Add / remove label (PATCH)
  6. Create Patch (POST)
  7. Delete revision comment (PATCH)
  8. Comment reaction (PATCH)
  9. Edit Comment (PATCH)
  10. Edit patch (PATCH)
  11. Create Comment (PATCH)

Fetch rad project (GET) Check api (GET)

Issues (CLI)

  1. rad issue list
  2. rad issue show <issue-id>
  3. rad issue open
  4. rad issue edit <issue-id>
  5. rad issue state <issue-id>
  6. rad issue assign <issue-id> --add <did> --delete <did>
  7. rad issue label <issue-id> --add <label> --delete <label>
  8. rad issue comment <issue-id>
  9. rad issue react <issue-id>

Patches (CLI)

  1. rad patch list
  2. -
  3. rad patch show
  4. -
  5. rad patch label
  6. git push rad
  7. -
  8. -
  9. rad patch edit
  10. rad patch edit
  11. rad patch comment

I think we can use rad cob command to get patches / issues.

To elaborate a little bit we can use : rad cob list --repo rad:zzvuM1U8E3eSJswMg13YuatjKiU7 --type xyz.radicle.issue

to get a list with issues ids and then with

rad cob show --repo rad:zzvuM1U8E3eSJswMg13YuatjKiU7 --type xyz.radicle.issue --object cf1daa986fd69fadfa50fdce1b2fe7cdc5774e2e

we can get in json format the information of a specific issue

Also for patches we can do

rad cob list --repo rad:zzvuM1U8E3eSJswMg13YuatjKiU7 --type xyz.radicle.patch

and then

rad cob show --repo rad:zzvuM1U8E3eSJswMg13YuatjKiU7 --type xyz.radicle.patch--object cf1daa986fd69fadfa50fdce1b2fe7cdc5774e2e

The only thing that changes is the type parameter

gsaslis commented 4 weeks ago

@Stelios123 please also check the rad cob commands!

e.g.

rad cob list --repo $(rad .) --type xyz.radicle.patch

Stelios123 commented 2 weeks ago
Create issue (HTTPD)
curl --location 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{
    "title":"test",
    "description" : "lala",
    "labels" : ["test"],
    "assignees" : [],
    "embeds" : []
}'

Response:

{"success":true,"id":"98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef"}
Create issue (CLI)

rad issue open --title --description --labels --assignees

Action Required

Edit issue (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues/98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{
     "type":"edit",
     "title" : "test2"
}'

Response:

{"success":true,"id":"a1ff328901fca4ebf8f020911ca484adce8f6f10"}
Edit issue (CLI)

rad issue edit <issue-id>

Action Required

Change issue state (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues/98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"state":{"reason":"other","status":"closed"},"type":"lifecycle"}'

Response:

{"success":true,"id":"b2b12eaa0a30c578253a67276c55d71dec5e9fb3"}

Change issue state (CLI)

rad issue state <issue-id>

Action Required

Add issue assignee (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues/98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"type":"assign","assignees":["did:key:z6Mkv7BCz61grUDYDmcQhQVmMdcmZmQu3QjMEuQaW7oxQ4H5"]}'

Response:

{"success":true,"id":"b2b12eaa0a30c578253a67276c55d71dec5e9fb3"}
Add issue assignee (CLI)

rad issue assign <issue-id> --add <did> --delete <did>

Action Required

Add issue label
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues/98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"type":"label","labels":["my label"]}'

Response:

{"success": true, "id": "fd67c9a857109570e30ad6b2a3de1490efdb8874"}
Add issue label (CLI)

rad issue label <issue-id> --add <label> --delete <label>

Action Required

Add issue comment
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues/98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"replyTo":"98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef","type":"comment","body":"test","embeds":[]}'

Response:

{"success":true,"id":"d496e1c65c21f3ab0ec0c21eeaaf456ed3fe053e"}
Add issue comment (CLI)

rad issue comment <issue-id> --message --reply-to

Action Required

Edit issue comment (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues/55632a18157b0c5c765314483576fa314d8c5868' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"body":"test2","type":"comment.edit","embeds":[],"replyTo":"55632a18157b0c5c765314483576fa314d8c5868","id":"c235f1ebbb131f0128a116ce8543b4dcccae921d"}'

Response:

{"success": true, "id": "056460374ceed578f42ef1cb0e2d707f35555c74"}

Action Required

Add comment reaction (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/issues/98a7b0dca39484eb0e0bd7dfba89e8295f29e3ef' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"active":true,"reaction":"👎","type":"comment.react","id":"d496e1c65c21f3ab0ec0c21eeaaf456ed3fe053e"}'

Response:

{"success":true,"id":"7c4d18d2a87575df85a8b74ce579e597de1e5f12"}
Add comment reaction (CLI)

rad issue react <issue-id> --emoji

Action Required

Patches (HTTPD)

Change patch state (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches/b805142a305f29c8db168369d541d0cad18b5eaa' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"state":{"reason":"other","status":"draft"},"type":"lifecycle"}'

Response:

{"success": true, "id": "929238769acf3e4c5e74a36f12cb7733e41fd7be"}
Change patch state (CLI)

Action Required

Change patch label (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches/7ce31bd37ec8c57ba18bb42e9d6936f6c8bdcce3' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"labels":["test"],"type":"label"}'

Response:

{"success": true, "id": "8c18cbe0c756077fee0cbbdadc749fcb5a9219ba"}
Change patch label (CLI)

rad patch <ID> --add "label" --delete "label"

Action Required

Add patch comment (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches/7ce31bd37ec8c57ba18bb42e9d6936f6c8bdcce3' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"type":"revision.comment","body":"test","embeds":[],"revision":"01a5debc9b9756a56cd52f5f3b835f3579a70f0a"}'

Response:

{"success": true, "id": "4b8cf1952dc29502f6b6b47d8d34801b5919f8bf"}
Add patch comment (CLI)

rad patch comment <rev-id>

Action Required

Edit patch comment (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches/7ce31bd37ec8c57ba18bb42e9d6936f6c8bdcce3' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"body":"test1","type":"revision.comment.edit","comment":"21cf5c67d59836e52cfae070e8362c4d23e8511a","embeds":[],"revision":"01a5debc9b9756a56cd52f5f3b835f3579a70f0a"}'

Response:

{"success": true, "id": "e8281b8256490a307bd7bb3ba64c7fafefbf5ecd"}
Edit patch comment (CLI)

Action Required

Delete patch comment (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches/7ce31bd37ec8c57ba18bb42e9d6936f6c8bdcce3' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer y8WkZfJeHk17CSl2hT35ljNA4tFwbPzW' \
--data '{"comment":"0fcc1302cf37b848eef5735fd1fe359aa3388031","type":"revision.comment.redact","revision":"01a5debc9b9756a56cd52f5f3b835f3579a70f0a"}'

Response:

{"success": true, "id": "c97e2e99255c90e6d051cd86ad9b60a638b03f6c"}
Delete patch comment (CLI)

Action Required

Add patch review (HTTPD)
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches/7ce31bd37ec8c57ba18bb42e9d6936f6c8bdcce3' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer y8WkZfJeHk17CSl2hT35ljNA4tFwbPzW' \
--data '{"summary":"test","verdict":"accept","revision":"01a5debc9b9756a56cd52f5f3b835f3579a70f0a","type":"review","labels":[]}'

Response:

{"success": true, "id": "f45309a12dd7fa3bfeb942ea1dc3d11522c9a360"}
Add patch review (CLI)

rad patch review <patch-id>

Action Required

Create patch (HTTPD)
curl --location 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer y8WkZfJeHk17CSl2hT35ljNA4tFwbPzW' \
--data '{"labels":[],"target":"24e8743cbe5f906d498da69b0e74b1e6de166aeb","description":"test","oid":"3b759a49d18689935b8506bbd97f30adff38432f","title":"test"}'

Response:

{"success": true, "id": "e15be962764ebb59191962af446c6682f60b543b"}
Create patch (CLI)

git push rad -o patch.message="Define power requirements" -o patch.message="See details." HEAD:refs/patches

Action Required

React patch comment
curl --location --request PATCH 'http://localhost:8080/api/v1/projects/rad:zzvuM1U8E3eSJswMg13YuatjKiU7/patches/7ce31bd37ec8c57ba18bb42e9d6936f6c8bdcce3' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer SgaAu5c7c7wTfEAa8S1UVb9p8rsk42Dm' \
--data '{"active":true,"reaction":"👍","type":"revision.comment.react","comment":"21cf5c67d59836e52cfae070e8362c4d23e8511a","revision":"01a5debc9b9756a56cd52f5f3b835f3579a70f0a"}'

Response:

{"success": true, "id": "38c10fc4e60a43425612432f4b7ba2d040fa7db2"}

Action Required

Fetch rad projects

curl --location 'http://localhost:8080/api/v1/projects?show=all'

Response

[{"name":"myProject12","description":"","defaultBranch":"master","delegates":[{"id":"did:key:z6Mkv7BCz61grUDYDmcQhQVmMdcmZmQu3QjMEuQaW7oxQ4H5","alias":"stelios"}],"threshold":1,"visibility":{"type":"public"},"head":"24e8743cbe5f906d498da69b0e74b1e6de166aeb","patches":{"open":60,"draft":1,"archived":0,"merged":7},"issues":{"open":6,"closed":3},"id":"rad:zzvuM1U8E3eSJswMg13YuatjKiU7","seeding":23},{"name":"radicle-jetbrains-plugin","description":"The Radicle plugin for Jetbrains IDEs.","defaultBranch":"main","delegates":[{"id":"did:key:z6MkrnXJWPndzPBxpBUaE3L3BnMeWpaQdT1V1FvkoCPFSFS3","alias":"yorgos-laptop"},{"id":"did:key:z6MkpaATbhkGbSMysNomYTFVvKG5bnNKYZ2cCamfoHzX9SnL","alias":"jchrist"},{"id":"did:key:z6Mkv7BCz61grUDYDmcQhQVmMdcmZmQu3QjMEuQaW7oxQ4H5","alias":"stelios"}],"threshold":1,"visibility":{"type":"public"},"head":"b32594864363bed0bf202c01635e981de8395b1b","patches":{"open":5,"draft":0,"archived":6,"merged":72},"issues":{"open":1,"closed":0},"id":"rad:z3WHS4GSf8hChLjGYfPkJY7vCxsBK","seeding":28},{"name":"heartwood","description":"Radicle Heartwood Protocol & Stack","defaultBranch":"master","delegates":[{"id":"did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT","alias":"cloudhead"},{"id":"did:key:z6MktaNvN1KVFMkSRAiN4qK5yvX1zuEEaseeX5sffhzPZRZW","alias":"cloudhead"},{"id":"did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM","alias":"fintohaps"}],"threshold":1,"visibility":{"type":"public"},"head":"8922388caa8ad879bdc2b82267bb5122afb77a1e","patches":{"open":23,"draft":3,"archived":35,"merged":159},"issues":{"open":34,"closed":16},"id":"rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5","seeding":75},{"name":"radicle-ci-integrations-docs","description":"Documentation for Radicle adapters","defaultBranch":"main","delegates":[{"id":"did:key:z6MkkpTPzcq1ybmjQyQpyre15JUeMvZY6toxoZVpLZ8YarsB","alias":"mzampetakis"},{"id":"did:key:z6MkrnXJWPndzPBxpBUaE3L3BnMeWpaQdT1V1FvkoCPFSFS3","alias":"yorgos-laptop"}],"threshold":1,"visibility":{"type":"public"},"head":"5da345ea6809be42beb51090003ef536d0960457","patches":{"open":0,"draft":0,"archived":0,"merged":15},"issues":{"open":0,"closed":0},"id":"rad:z4Uh671FzoooaHjLvmtW9BtGMF9qm","seeding":22},{"name":"radicle-explorer","description":"Radicle web interface","defaultBranch":"master","delegates":[{"id":"did:key:z6MkwPUeUS2fJMfc2HZN1RQTQcTTuhw4HhPySB8JeUg2mVvx","alias":"rudolfs"},{"id":"did:key:z6MkkfM3tPXNPrPevKr3uSiQtHPuwnNhu2yUVjgd2jXVsVz5","alias":"sebastinez"},{"id":"did:key:z6MktaNvN1KVFMkSRAiN4qK5yvX1zuEEaseeX5sffhzPZRZW","alias":"cloudhead"},{"id":"did:key:z6MksFqXN3Yhqk8pTJdUGLwATkRfQvwZXPqR2qMEhbS9wzpT","alias":"cloudhead"},{"id":"did:key:z6MkireRatUThvd3qzfKht1S44wpm4FEWSSa4PRMTSQZ3voM","alias":"fintohaps"}],"threshold":1,"visibility":{"type":"public"},"head":"06cc5595c86eaa6a7589543c043ee35caec3b3b0","patches":{"open":3,"draft":3,"archived":44,"merged":325},"issues":{"open":9,"closed":11},"id":"rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5","seeding":57}]

Fetch rad projects (CLI)

Action Required