Skip to content

Commit d79af7b

Browse files
committed
Document response for getting symlink content
1 parent 3b707fd commit d79af7b

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

content/v3/repos/contents.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,15 @@ ref
5353
<%= headers 200 %>
5454
<%= json :directory_content %>
5555

56+
### Response if content is a symlink
57+
58+
If the requested `:path` points to a symlink, and the symlink's target is a normal file in the repository, then the API responds with the content of the file (in the [format shown above](#response-if-content-is-a-file)).
59+
60+
Otherwise, the API responds with a hash describing the symlink itself:
61+
62+
<%= headers 200 %>
63+
<%= json :symlink_content %>
64+
5665
## Get archive link
5766

5867
This method will return a `302` to a URL to download a tarball

lib/resources.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,23 @@ def text_html(response, status, head = {})
10031003
},
10041004
}
10051005

1006+
SYMLINK_CONTENT = {
1007+
"type" => "symlink",
1008+
"target" => "/path/to/symlink/target",
1009+
"size" => 23,
1010+
"name" => "some-symlink",
1011+
"path" => "bin/some-symlink",
1012+
"sha" => "452a98979c88e093d682cab404a3ec82babebb48",
1013+
"url" => "https://api.github.com/repos/pengwynn/octokit/contents/bin/some-symlink",
1014+
"git_url" => "https://api.github.com/repos/pengwynn/octokit/git/blobs/452a98979c88e093d682cab404a3ec82babebb48",
1015+
"html_url" => "http://github.dev/pengwynn/octokit/blob/master/bin/some-symlink",
1016+
"_links" => {
1017+
"git" => "https://api.github.com/repos/pengwynn/octokit/git/blobs/452a98979c88e093d682cab404a3ec82babebb48",
1018+
"self" => "https://api.github.com/repos/pengwynn/octokit/contents/bin/some-symlink",
1019+
"html" => "http://github.dev/pengwynn/octokit/blob/master/bin/some-symlink"
1020+
},
1021+
}
1022+
10061023
DIRECTORY_CONTENT = [
10071024
{
10081025
"type" => "file",

0 commit comments

Comments
 (0)