This package is still in experiment, see Wiki for documentation.
This project is under the MIT License. See the LICENSE file for the full license text.
Gogs API client in Go.
License: MIT License
first:
create new user repository "POST /user/repos" work correct!
create new organisation repository "POST /org/:org/repos" or "POST /admin/users/:org/repos" bring Error:
{"message":"addRepository: getMembers: get team-users: Error 1054: Unknown column 'team_id' in 'where clause'","url":"https://github.com/gogits/go-gogs-client/wiki"}
Gogs Version: 0.9.100.1119
Hello.
Currently in the web client one can attach a file when creating issue. Do you have plans to expose this functionality by rest as well ?
Regards, B.
I am currently using a self hosted instance of Stash for my repositories.
Trying gogs it would be crucial for me to migrate all my repositories. At the moment these fails due to a self signed certificate I am using. Is there a way around it? I could only find a "SKIP_VERIFY" option for the Mailer.
Migration failed: Clone: exit status 128 - fatal: unable to access 'https://@URL_TO_HOST:443/scm/go/my_repository.git/': SSL certificate problem: self signed certificate
Similar to GitHub:
List repositories for the specified org.
GET /orgs/:org/repos
This would make it easier to interact with repositories specific to a given organization.
https://github.com/gogits/go-gogs-client/wiki/Issues-Labels#add-labels-to-an-issue describes a POST request and from the context it seems to require a parameter "labels" from the type array.
The documentation states that querying:
GET {url}/api/v1/users/{username}/{repos}
GET {url}/api/v1/users/{username}/{orgs}
{username}
is the same user that owns the api-token, instead everything is returned.This is what one can expect when issuing the GET {url}/api/v1/user/repos
and similar requests for the authorized user.
Either must the documentation be changed to cover the differences or the code should actually return the public data within the scopes for public data.
Second one makes the most sense.... It would be convenient to actually have an method to get only public data, even for the authorized user, as the data returned for some requests (such as organizations) doesnt tell if this data is a private or public.
Gogs Version: 0.11.29.0727
Would it be possible to add an endpoint for getting a single repository? I'm working on integrating Gogs with the latest version of Drone (0.4) and we have the need to retrieve a Repo by name.
If you have any docs for your API you can point me to I'm happy to submit a pull request and add this functionality to the client.
Would like to be able to specify(or disable) the interval for how often a mirrored repository will look upstream.
The user is logged into door43 then loses wifi connection and tries to upload a project to git.door.43.
You guys may have a better way for the client to handle this error but since I don't know I'm assuming there's not. Thus, I think if as I a client of gogs it's better if I get the 443 error status/message.
Error: getaddrinfo ENOTFOUND git.door43.org git.door43.org:443
at errnoException (dns.js:28)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76)
It would be really nice, if GET /repos/:owner/:repo
could succeed without authentication for public repos. Similar to issue #23.
Would be nice to support the ability to interact with Organization webhooks via the API.
It'll be helpful to have releases API like GitHub
See this thread from drone: https://discourse.drone.io/t/new-commits-in-an-open-pull-request/868/6
Drone right now is fetching .drone.yml
from main repo. It means that if there is an open pull request that changes drone config, it will still be fetched from main repo, not from pull request change.
Is this still unavailable? Help can be offered if pointed to the right direction.
After I have downloaded the zip to Linux 64 bits (Im in Ubuntu 14.04, 64 bits), I runned:
$ ./gogs web
And got:
./gogs: error while loading shared libraries: libpam.so.0: cannot open shared object file: No such file or directory
Someone can help me about this?
I POST to this url, but nothing feedback
/api/v1/admin/users/htfang/orgs
{
"username":"htfang",
"full_name":"tttest",
"description":"nothing",
"website":"nothing",
"location":"location"
}
The GET /repos/:owner/:repo/issues
etc. gets complete issues' info, while I'd like to have a possibility to only get some of it (like, only the id
, state
and title
).
Currently, I can't see a way of interacting with my gogs server when I keep getting:
Bad Request: no CSRF token represnet
Whenever I try to create a repository via the API.
Hi Guys using GOGS in docker (Gogs Version: 0.11.6.0407), trying to use the API , to create SSH Public Keys:
I run the command to attempt to create keys:
curl -k -H "Content-Type: application/json" -d '{
"title": "Test SSH Keys",
"key": "test" }' -X POST https://test.rap.local:3000/api/v1/user/repos?token=6d836a020e19be4ce8952154969c8b6644f1e53a
This is the error I get:
[{"fieldNames":["Name"],"classification":"RequiredError","message":"Required"}
So I then added, a Name field in hope:
curl -k -H "Content-Type: application/json" -d '{
"title": "Test SSH Keys",
"Name": "test",
"key": "test" }' -X POST https://test.rap.local:3000/api/v1/user/repos?token=6d836a020e19be4ce8952154969c8b6644f1e53a
It then created a new repository with no keys.
I am going of the documentation here:
https://github.com/gogits/go-gogs-client/wiki/Users-Public-Keys In the Create a public key section.
The documentation was last updated Dec 6, 2015, have there been any changes to the syntax?
Thanks for your time and help.
Use case: send an email to all Organization Owners when code is pushed to any of the Organization repos. I got it all working except I have to hardcode the recipients for now since the API does not exist yet. Would gladly help by I only know PHP ... so maybe I can write the documentation ... Thanks.
Hello,
the wiki page describing repositories endpoints incorrectly states that in order to create an organization repository, one should use the POST /orgs/:org/repos
while in reality the endpoint is POST /org/:org/repos
:).
When searching for repositories within a user, with e.g the user id 44, will return results for other users as well and not be restricted to the user with user id = 44.
Query example:
GET https://git.giaever.org/api/v1/repos/search?q=gogs&user=44&limit=10
Result example:
{"data":[{"id":41,"owner":{"id":2,"login":"GiaeverPubl","full_name":"Giaever Publishing","email":"","avatar_url":"https://git.giaever.org/avatars/2","username":"GiaeverPubl"},"name":"git.giaever.org","full_name":"GiaeverPubl/git.giaever.org","description":"Git.giaever.org Gogs setup","private":true,"fork":false,"parent":null,"empty":false,"mirror":false,"size":16381952,"html_url":"https://git.giaever.org/GiaeverPubl/git.giaever.org","ssh_url":"[email protected]:GiaeverPubl/git.giaever.org.git","clone_url":"https://git.giaever.org/GiaeverPubl/git.giaever.org.git","website":"https://git.giaever.org","stars_count":0,"forks_count":0,"watchers_count":2,"open_issues_count":0,"default_branch":"master","created_at":"2016-11-18T03:54:55+01:00","updated_at":"2016-11-18T06:45:06+01:00"},{"id":153,"owner":{"id":1,"login":"joachimmg","full_name":"Joachim Marthinsen Giæver","email":"[email protected]","avatar_url":"https://git.giaever.org/avatars/1","username":"joachimmg"},"name":"gogs-api-wpp","full_name":"joachimmg/gogs-api-wpp","description":"Gogs API wordpress plugin","private":true,"fork":false,"parent":null,"empty":false,"mirror":false,"size":90112,"html_url":"https://git.giaever.org/joachimmg/gogs-api-wpp","ssh_url":"[email protected]:joachimmg/gogs-api-wpp.git","clone_url":"https://git.giaever.org/joachimmg/gogs-api-wpp.git","website":"","stars_count":0,"forks_count":0,"watchers_count":1,"open_issues_count":0,"default_branch":"master","created_at":"2017-10-17T10:40:14+02:00","updated_at":"2017-10-20T09:40:35+02:00"},{"id":180,"owner":{"id":1,"login":"joachimmg","full_name":"Joachim Marthinsen Giæver","email":"[email protected]","avatar_url":"https://git.giaever.org/avatars/1","username":"joachimmg"},"name":"gogs-php-api-client","full_name":"joachimmg/gogs-php-api-client","description":"Gogs PHP API Client is a client written in PHP, to easily query a Gogs (Go Git Service) API client.","private":false,"fork":false,"parent":null,"empty":false,"mirror":false,"size":848896,"html_url":"https://git.giaever.org/joachimmg/gogs-php-api-client","ssh_url":"[email protected]:joachimmg/gogs-php-api-client.git","clone_url":"https://git.giaever.org/joachimmg/gogs-php-api-client.git","website":"","stars_count":0,"forks_count":0,"watchers_count":1,"open_issues_count":0,"default_branch":"master","created_at":"2017-10-19T16:44:04+02:00","updated_at":"2017-10-20T09:52:36+02:00"},{"id":183,"owner":{"id":30,"login":"bje007","full_name":"Birger Christoffer Jensen","email":"[email protected]","avatar_url":"https://secure.gravatar.com/avatar/12285f0af02782093a4d18c6fcdfb8a5","username":"bje007"},"name":"test-gogs-api-repo-70","full_name":"bje007/test-gogs-api-repo-70","description":"This is test repo #70 created with Gogs PHP API Client","private":false,"fork":false,"parent":null,"empty":false,"mirror":false,"size":0,"html_url":"https://git.giaever.org/bje007/test-gogs-api-repo-70","ssh_url":"[email protected]:bje007/test-gogs-api-repo-70.git","clone_url":"https://git.giaever.org/bje007/test-gogs-api-repo-70.git","website":"","stars_count":0,"forks_count":0,"watchers_count":2,"open_issues_count":0,"default_branch":"master","created_at":"2017-10-20T11:06:03+02:00","updated_at":"2017-10-20T13:30:02+02:00"}],"ok":true}
Contains at least 2 different owners and none of them has id = 44!
Gogs Version: 0.11.29.0727
The GET /repos/:owner/:repo/issues
gets all open issues for a repository, I'd like to get all of them.
I'm wanting to move away from gitlab (slow, slow, slow) but have an application that uses the api to manage lots of things. From what I can see, the api in gogs is a very poor relation - are there any plans on beefing up the api and making it much more functionally rich ?
Use case is for migration purposes. Would like the ability to batch create teams.
It would be a nice feature to batch create users and batch assign to teams
Hi,
In the https://github.com/gogits/go-gogs-client/wiki/Repositories-Collaborators, I do not understand how to use parameters to change the collaborator permission, Can anyone give me a example about it? Thanks
Is there a way to get a list of all public repos of an user, like https://api.github.com/users/TheLastProject/repos on GitHub? I couldn't find this in the documentation.
Hello,
When I create a new label with the API, the label is created , but gogs returns 0
as id.
After a read it again i get the proper id.
I need to create "build-in" CI service into my git server (like github pages generator). It should be undeletable. But I could not find any system wide hook configuration option in documentation. Is it missed or there is no such option?
A collaborator that only have read access to a repository can delete it.
How?
DELETE {url}/api/v1/repos/*owner username*/*repo name*
Gogs Version: 0.11.29.0727
For use cases like bug reports from server it's good to have an API to create issues with setting labels and assignee and ...
func (c *Client) ListMyPublicKeys(user string) ([]*PublicKey, error) {
keys := make([]*PublicKey, 0, 10)
return keys, c.getParsedResponse("GET", fmt.Sprintf("/user/keys", user), nil, nil, &keys)
}
Shouldn't drop usage of user parameter?
func (c *Client) ListMyPublicKeys() ([]*PublicKey, error) {
keys := make([]*PublicKey, 0, 10)
return keys, c.getParsedResponse("GET", "/user/keys", nil, nil, &keys)
}
Hi,
I'm using Gogs Version: 0.10.34.0330 / 0.11 RC.
I'm trying to create a hook through the api, and I get this response:
[{"fieldNames":["Config"],"classification":"RequiredError","message":"Required"}]
My code is:
import requests
organization = 'test'
repo_name = 'test'
token = 'ac16d61127466efc3d316db76e68b7358c8075b4'
data = {
"type": "gogs",
"config": {
"url": "http://192.168.201.1:8080/hook",
"content_type": "json"
},
"events": [
"create",
"delete",
"fork",
"push",
"issues",
"issue_comment",
"pull_request",
"release",
],
"active": True
}
url = "http://192.168.201.100:3000/api/v1/repos/{o}/{r}/hooks?token={t}".format(o=organization, r=repo_name, t=token)
session = requests.Session()
response = session.post(url, data=data)
print response.text
I started to play w/ API on REST level by issuing
fetch('https://try.gogs.io/api/v1/repos/a_test/another_test/issues/1', {
method:'post',
headers:{Authorization:'Basic '+btoa('user:pass')}
})
but I get back:
Refused to connect to 'https://try.gogs.io/api/v1/repos/a_test/another_test/issues/1' because it violates the following Content Security Policy directive: "connect-src 'self' https://suggestqueries.google.com https://ac.duckduckgo.com".
As far as I understood the code here, no special headers are added (though authorization is by token). Am I doing something wrong or is this a feature?
For GitLab we see a lot of people self-hosting with customer SSL certs. We typically have to set InsecureSkipVerify
to true. This is probably something we'll want to support with the Gogs client as well.
Something like this:
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
gogs.NewClient(url, token, client)
What Gogs Branch is this being built for?
I'm having a problem trying to delete a repo via the rest api. I've tried a few variations of:
curl -X DELETE -u $user:$password "http://$host:3000/api/v1/repos/$user/abc-app-one"
But I'm getting a 204 -- No Content ("message":"deleteBeans: database table is locked"). What have I got wrong?
I'm using Gogs version 0.9.87.0826
How can I import a full projeto do gogs? Is that possible?
I want to import Milestones, issues and commits.
It would be very useful to have endpoints allowing to collaborate with PR.
github api
https://api.github.com/repos/reactjs/redux/issues
gogs api get a user of all issues ?
Hi there,
It's great that I'm able to make a POST HTTP request to the REST API that Gogs exposes to create a repository and all that, but I can't seem to find documentation on how to go about deleting a repository that was created via the same interface.
Is that just not documented? Or is it not supported via the currently exposed REST API?
Thanks a bunch!
As mentioned in my comment (gogs/gogs#1692 (comment)), i'd like to implement issues API, started with comments part.
Please let me know if there is someone already working on it.
If not, i will come with API specification proposal.
Hi,
it would be nice for us to obtain via REST API the list of users of:
thanks!
there's no api on mirror sync api.
please add this api.
thanks. :)
Hi, there seems to be an issue with the authorisation of access tokens using the API. Regardless of username/password combination, basic authorisation headers, or URL based tokens all from admins and not, the post and get commands return a 401.
Am i missing something? and has anyone had this working?
Regards
https://github.com/gogits/go-gogs-client/blob/master/gogs.go#L69
It crashed when creating new repo (Status: 201 created). I think the code intends to filter everything not 2xx as an error, but %100 != 2 filters for not x02.
The actual crash happened in errMap["message"].(string) since the new repo has no message field.
I don't understand how I should install go gogs client, can you add it in the wiki please?
It would be very useful to have a endpoint showing all commits either on a repository basis or user basis. This functionality would look a lot like: https://developer.github.com/v3/git/commits/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.