# Token can be created in GIN user settings, under Applications. # An organisation admin account is required to create teams. token="f5058edf6a8e7e6ea2c52af474039902b2aa923b" # Change this to the local installation addresses to test locally. # Include the protocol scheme http:// or https:// and the port if it's not # standard for the protocol. ginhost="https://gin.g-node.org" # Same as above, change to local address to test locally and include port # number if it's not 22. ginssh="gin.g-node.org" organisation="gin4rri" post() { data=$1 url=$2 curl -X -H "Content-Type: application/jsonAuthorization" -H "Authorization: token ${token}" -d "${data}" ${url} } put() { data=$1 url=$2 curl -H "Content-Type: application/jsonAuthorization" -H "Authorization: token ${token}" -d "${data}" -X PUT "${url}" } patch() { data=$1 url=$2 curl -H "Content-Type: application/jsonAuthorization" -H "Authorization: token ${token}" -d "${data}" -X PATCH "${url}" } createrepo() { reponame=$1 data="{\"Name\":\"${reponame}\",\"Description\":\"deleteme\",\"Private\":true}" post ${data} ${ginhost}/api/v1/org/${organisation}/repos } createrepot() { reponame=$1 data="{\"Name\":\"${reponame}\",\"Description\":\"deleteme\",\"Private\":true,\"Readme\":\"Default\",\"auto_init\":true}" post ${data} ${ginhost}/api/v1/org/${organisation}/repos } issuetrackeroption (){ reponame=$1 enable_issuesopt=$2 # todo https://github.com/gogs/docs-api/tree/master/Repositories # PATCH /repos/:owner/:repo/issue-tracker # enable_issues = false ## maybe link to parent issue tracker instead ? data="{\"enable_issues\":${enable_issuesopt}}" patch $data ${ginhost}/api/v1/repos/${organisation}/${reponame}/issue-tracker }