forked from gvx/luahub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
APIDOC
190 lines (186 loc) · 7.31 KB
/
APIDOC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
LuaHub documentation
====================
Lua knows only tables, however JSON (which is used to communicate with the
GitHub API) has arrays and objects, so I'll be using those terms here for
clarity.
If you are uncertain how exactly the data returned is formed, you should take a
look at http://develop.github.com/, which gives more information about the API.
API reference
-------------
luahub.
user.
search(name) -> user_array, first_name
Search for a user, returns an array of the results,
which are objects.
If there are any results, a string is returned as well,
which is equivalent to user_array[1].name, which may
aid simple uses of the API.
show(name) -> user
Returns user information on a named user.
show(name, 'following') -> following_array
Returns a list of everyone a certain user follows.
show(name, 'followers') -> followers_array
Returns a list of all followers of a certain user.
show(name, info) -> user
If the second argument is a table, it updates your user
info. Possible keys are:
name, email, blog, company, location.
follow(name)
Follow a user. You must be authed.
unfollow(name)
Unfollow a user. You must be authed.
commits.
list(user_id, repository, branch[, path]) -> commit_array
Lists all commits of a certain branch of a repository,
optionally only those pertaining a certain path.
show(user_id, repository, sha) -> commit
Gives information on a commit given by its sha hash.
tree.
show(user_id, repository, tree_sha) -> tree
Returns a tree listing of a given tree id.
full(user_id, repository, tree_sha) -> tree
Basically the same as show, only returns more blob-
related metadata.
repos.
search(query) -> repository_array, repo_name
Performs a search query, just like the one on GitHub.
If there are any results, the second return value will
be the username and repo namee, suitable for uris, for
example "gvx/luahub".
show(user, repo, extra) -> repository_info
It would be just luahub.repos.show(), but GitHub
provides several specialized calls, to extract other
metadata. Unless otherwise noted,
luahub.repos.show(u, r, 'e') is equivalent to
luahub.repos.show.e(u, r)
Without the extra argument, it retrieves basic
information on the given repository.
show(user) -> repository_array
Lists all public repos (if you are authenticated as
that users, it lists private repos as well).
show(user, repo, values) -> repository_info
If the third argument to show() is a table, the POST
method is used and settings of the repository are
changed. Of course, you need to be authed for this to
work.
Possible keys for the third argument are:
description, homepage, has_wiki, has_issues,
has_downloads.
show.
collaborators(user, repo) -> collaborator_array
Lists the collaborators of a given project.
(Everyone with push access to that repository.)
contributors(user, repo, show_anon) -> contrib_array
Lists all contributors for a project. This one
is different from the alternative from, because
it has an additional argument, show_anon, that
makes the function list anonymous contributors
as well.
network(user, repo) -> network_info
Gives advanced network information, useful if
you want to make your own network graph.
languages(user, repo) -> languages_info
Lists the programming languages used for this
project, and how much they are used.
tags(user, repo) -> tags_info
Lists tags in this project and which SHA they
refer to. It returns an object with the tag
name as key.
branches(user, repo) -> branches_info
Gives an object containing references to all
branches of this repository. Works the same way
as tags().
watch(user, repo) -> nil?
Start watching a repository. You must be authed.
unwatch(user, repo) -> nil?
Stop watching a repository. You must be authed.
watched(user) -> repository_array
Returns a list of repositories watched by a certain
user.
fork(user, repo) -> repo_info
Fork a repository. Returns information of the forked
repository. You must be authed.
keys(repo) -> public_key_array
Returns an array containing all public keys you have
set up for a specific repository.
keys.
add(repo, title, key)
Adds a public key to a given repository.
remove(repo, key_id)
Removes a public key from a repository. This is the
same value as found in the id field of a public key
object, returned by luahub.repos.keys().
pushable() -> pushable_array
Returns an array of all repository you can push to that
are not your own.
create(name, description, homepage, public) -> nil?
Creates a repository with given name. All other arguments
are optional.
delete(name) -> token
First stage of repository deletion, this returns a
special token. If you really want to delete this
repository, call:
delete(name, token)
This completes the repository deletion. Use with caution,
there's no going back.
setprivate(name)
Makes a public repository private.
setpublic(name)
Makes a private repository public.
collaborators.
add(repo, user)
Adds a user to a repository.
remove(repo, user)
Removes a previously added user from a repository.
blob.
show(user, repo, tree_sha, path, meta) -> blob_info
Show information about a specific blob, located by
user, repository, the tree for the specific commit the
blob is located and the path to that blob. If meta is
true, only meta information on that blob is returned,
rather than the actual data.
all(user, repo, tree_sha) -> blob_object
Provides hashes from all blobs at a certain tree. The
keys are the pathnames, and the values are the hashes.
full(user, repo, tree_sha) -> blob_array
While all() only provides the sha, full() lists some
metadata of those blobs. blob_array[n].name gives you
the pathname, while blob_array[n].sha gives you the
blob's hash.
tree.
show(user, repo, tree_sha) -> tree_array
Lists the contents of a tree with some metadata.
full(user, repo, tree_sha) -> tree_array
Lists the contents of a tree with some metadata. I
guess this version supplies more metadata?
full(user, repo, tree_sha) -> tree_array
gist.
To do.
issues.
search(user, repo, state, searchterm) -> issue_array
Returns a list of issues matching the search term. The
param state should be one of 'open' or 'closed'.
list(user, repo, state) -> issue_array
Lists either all closed or open issues for the given
repository.
show(user, repo, issue_id) -> issue
Show a certain issue, based on its ID number.
comments(user, repo, issue_id) -> comments_list
Lists all comments for a given issue.
open(user, repo) -> issue
Opens an issue (once POST is implemented for LuaHub)
close(user, repo, issue_id) -> issue
Closes a given issue.
reopen(user, repo, issue_id) -> issue
Reopens a previously closed issue.
labels(user, repo) -> label_array
Lists all labels in use for a given repository.
addlabel(user, repo, label, issue_id) -> labels
Adds a label to an issue.
addlabel(user, repo, label) -> labels
Adds a label to the project, without attaching it to an
issue.
removelabel(user, repo, label, issue_id) -> labels
Removes a label from a given issue.
comment(user, repo, issue_id) -> comment
(Needs POST to work.) Adds a comment to a given issue.