10000 Sync changes from upstream repository · Git-Beadup/developer.github.com@c6dff9f · GitHub
[go: up one dir, main page]

Skip to content

Commit c6dff9f

Browse files
author
Hubot
committed
Sync changes from upstream repository
1 parent af662df commit c6dff9f

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
kind: change
3+
title: Get the contents of a repository’s license
4+
created_at: 2015-08-04
5+
author_name: benbalter
6+
---
7+
8+
The [License API Preview](/v3/licenses/) now allows you to retrieve the contents of a repository's open source license. As before, when the appropriate preview media type is passed, the repository endpoint will return information about the detected license, if any:
9+
10+
curl -H "Accept: application/vnd.github.drax-preview+json" https://api.github.com/repos/benbalter/gman
11+
12+
You can now also get the content's of the repository's license file, whether or not the license was successfully identified via the license contents endpoint:
13+
14+
curl -H "Accept: application/vnd.github.drax-preview+json" https://api.github.com/repos/benbalter/gman/license
15+
16+
Similar to [the repository contents API](/v3/repos/contents/#get-contents), the license contents method also supports [custom media types](/v3/repos/contents/#custom-media-types) for retrieving the raw license content or rendered license HTML.
17+
18+
curl -H "Accept: application/vnd.github.drax-preview.raw" https://api.github.com/repos/benbalter/gman/license
19+
20+
For more information, see [the license API documentation](/v3/licenses/#get-the-contents-of-a-repositorys-license).

content/v3/licenses.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,16 @@ It's important to note that the API simply attempts to identity the project's li
6161

6262
<%= headers 200 %>
6363
<%= json(:licensee) %>
64+
65+
## Get the contents of a repository's license
66+
67+
This method returns the contents of the repository's license file, if one is detected.
68+
69+
GET /repos/:owner/:repo/license
70+
71+
Similar to [the repository contents API](/v3/repos/contents/#get-contents), this method also supports [custom media types](/v3/repos/contents/#custom-media-types) for retrieving the raw license content or rendered license HTML.
72+
73+
### Response
74+
75+
<%= headers 200 %>
76+
<%= json(:license_contents) %>

lib/resources.rb

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,31 @@ def fetch_content(key)
24912491
"network_count"=>6,
24922492
"subscribers_count"=>6
24932493
}
2494+
2495+
LICENSE_CONTENTS ||= {
2496+
"name" => "LICENSE",
2497+
"path" => "LICENSE",
2498+
"sha" => "401c59dcc4570b954dd6d345e76199e1f4e76266",
2499+
"size" => 1077,
2500+
"url" => "https://api.github.com/repos/benbalter/gman/contents/LICENSE?ref=master",
2501+
"html_url" => "https://github.com/benbalter/gman/blob/master/LICENSE",
2502+
"git_url" => "https://api.github.com/repos/benbalter/gman/git/blobs/401c59dcc4570b954dd6d345e76199e1f4e76266",
2503+
"download_url" => "https://raw.githubusercontent.com/benbalter/gman/master/LICENSE?lab=true",
2504+
"type" => "file",
2505+
"content" => "VGhlIE1JVCBMaWNlbnNlIChNSVQpCgpDb3B5cmlnaHQgKGMpIDIwMTMgQmVu\nIEJhbHRlcgoKUGVybWlzc2lvbiBpcyBoZXJlYnkgZ3JhbnRlZCwgZnJlZSBv\nZiBjaGFyZ2UsIHRvIGFueSBwZXJzb24gb2J0YWluaW5nIGEgY29weSBvZgp0\naGlzIHNvZnR3YXJlIGFuZCBhc3NvY2lhdGVkIGRvY3VtZW50YXRpb24gZmls\nZXMgKHRoZSAiU29mdHdhcmUiKSwgdG8gZGVhbCBpbgp0aGUgU29mdHdhcmUg\nd2l0aG91dCByZXN0cmljdGlvbiwgaW5jbHVkaW5nIHdpdGhvdXQgbGltaXRh\ndGlvbiB0aGUgcmlnaHRzIHRvCnVzZSwgY29weSwgbW9kaWZ5LCBtZXJnZSwg\ncHVibGlzaCwgZGlzdHJpYnV0ZSwgc3VibGljZW5zZSwgYW5kL29yIHNlbGwg\nY29waWVzIG9mCnRoZSBTb2Z0d2FyZSwgYW5kIHRvIHBlcm1pdCBwZXJzb25z\nIHRvIHdob20gdGhlIFNvZnR3YXJlIGlzIGZ1cm5pc2hlZCB0byBkbyBzbywK\nc3ViamVjdCB0byB0aGUgZm9sbG93aW5nIGNvbmRpdGlvbnM6CgpUaGUgYWJv\ndmUgY29weXJpZ2h0IG5vdGljZSBhbmQgdGhpcyBwZXJtaXNzaW9uIG5vdGlj\nZSBzaGFsbCBiZSBpbmNsdWRlZCBpbiBhbGwKY29waWVzIG9yIHN1YnN0YW50\naWFsIHBvcnRpb25zIG9mIHRoZSBTb2Z0d2FyZS4KClRIRSBTT0ZUV0FSRSBJ\nUyBQUk9WSURFRCAiQVMgSVMiLCBXSVRIT1VUIFdBUlJBTlRZIE9GIEFOWSBL\nSU5ELCBFWFBSRVNTIE9SCklNUExJRUQsIElOQ0xVRElORyBCVVQgTk9UIExJ\nTUlURUQgVE8gVEhFIFdBUlJBTlRJRVMgT0YgTUVSQ0hBTlRBQklMSVRZLCBG\nSVRORVNTCkZPUiBBIFBBUlRJQ1VMQVIgUFVSUE9TRSBBTkQgTk9OSU5GUklO\nR0VNRU5ULiBJTiBOTyBFVkVOVCBTSEFMTCBUSEUgQVVUSE9SUyBPUgpDT1BZ\nUklHSFQgSE9MREVSUyBCRSBMSUFCTEUgRk9SIEFOWSBDTEFJTSwgREFNQUdF\nUyBPUiBPVEhFUiBMSUFCSUxJVFksIFdIRVRIRVIKSU4gQU4gQUNUSU9OIE9G\nIENPTlRSQUNULCBUT1JUIE9SIE9USEVSV0lTRSwgQVJJU0lORyBGUk9NLCBP\nVVQgT0YgT1IgSU4KQ09OTkVDVElPTiBXSVRIIFRIRSBTT0ZUV0FSRSBPUiBU\nSEUgVVNFIE9SIE9USEVSIERFQUxJTkdTIElOIFRIRSBTT0ZUV0FSRS4K\n",
2506+
"encoding" => "base64",
2507+
"_links" => {
2508+
"self" => "https://api.github.com/repos/benbalter/gman/contents/LICENSE?ref=master",
2509+
"git" => "https://api.github.com/repos/benbalter/gman/git/blobs/401c59dcc4570b954dd6d345e76199e1f4e76266",
2510+
"html" => "https://github.com/benbalter/gman/blob/master/LICENSE"
2511+
},
2512+
"license" => {
2513+
"key" => "mit",
2514+
"name" => "MIT License",
2515+
"url" => "https://api.github.com/licenses/mit",
2516+
"featured" => true
2517+
}
2518+
}
24942519
end
24952520
end
24962521

0 commit comments

Comments
 (0)
0