@@ -14,31 +14,46 @@ Import `const langGetter = require('github-lang-getter');`
1414
1515Return the language makeup of a user's repositories, in bytes
1616
17- The numbers returned by these methods reflect the number of bytes committed by all contributors.
17+ NOTE: The numbers returned by these methods reflect the number of bytes committed by all contributors.
1818
1919```
20- var visibility = 'all'; // can be all, public, or private
2120var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
22- langGetter.getRepoLanguages(visibility, token).then((result) => {
21+ langGetter.getRepoLanguages(token).then((result) => {
2322 console.log(result);
2423}).catch((err) => {
2524 console.log(err);
2625});
2726```
2827
29- or
28+ For ` getRepoLanguages ` , you can also supply an optional second parameter to specify the ` visibility ` and ` affiliation ` of repositories to find.
29+ NOTE: Both ` visibility ` and ` affiliation ` are optional.
3030
3131```
32- var username = 'YOUR-USERNAME';
3332var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
34- langGetter.getRepoLanguagesByUsername(username, token).then((result) => {
33+ var options = {
34+ visibility: 'all' // 'all', 'public', or 'private'
35+ affiliation: ['owner'] // combination of 'owner', 'collaborator', and 'organization_member'
36+ };
37+ langGetter.getRepoLanguages(token, options).then((result) => {
3538 console.log(result);
3639}).catch((err) => {
3740 console.log(err);
3841});
3942```
4043
41- Returns an object like
44+ You can also use ` getRepoLanguagesByUsername ` to query for another user's language makeup.
45+
46+ ```
47+ var username = 'GITHUB-USERNAME';
48+ var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
49+ langGetter.getRepoLanguagesByUsername(token, username).then((result) => {
50+ console.log(result);
51+ }).catch((err) => {
52+ console.log(err);
53+ });
54+ ```
55+
56+ The above methods return an object similar to the following:
4257
4358```
4459{
@@ -52,31 +67,46 @@ Returns an object like
5267
5368Return the language makeup of a user's commits, in bytes
5469
55- The numbers returned by these methods reflect the number of bytes only committed by the user.
70+ NOTE: The numbers returned by these methods reflect the number of bytes only committed by the user.
5671
5772```
58- var visibility = 'all'; // can be all, public, or private
5973var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
60- langGetter.getCommitLanguages(visibility, token).then((result) => {
74+ langGetter.getCommitLanguages(token).then((result) => {
6175 console.log(result);
6276}).catch((err) => {
6377 console.log(err);
6478});
6579```
6680
67- or
81+ For ` getCommitLanguages ` , you can also supply an optional second parameter to specify the ` visibility ` and ` affiliation ` of repositories to find.
82+ NOTE: Both ` visibility ` and ` affiliation ` are optional.
83+
84+ ```
85+ var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
86+ var options = {
87+ visibility: 'all' // 'all', 'public', or 'private'
88+ affiliation: ['owner'] // combination of 'owner', 'collaborator', and 'organization_member'
89+ };
90+ langGetter.getCommitLanguages(token, options).then((result) => {
91+ console.log(result);
92+ }).catch((err) => {
93+ console.log(err);
94+ });
95+ ```
96+
97+ You can also use ` getCommitLanguagesByUsername ` to query for another user's language makeup.
6898
6999```
70100var username = 'YOUR-USERNAME';
71101var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
72- langGetter.getCommitLanguagesByUsername(username, token ).then((result) => {
102+ langGetter.getCommitLanguagesByUsername(token, username ).then((result) => {
73103 console.log(result);
74104}).catch((err) => {
75105 console.log(err);
76106});
77107```
78108
79- Returns an object like
109+ The above methods return an object similar to the following:
80110
81111```
82112{
@@ -130,11 +160,14 @@ Bug fixes and new features are encouraged, feel free to fork and make a pull req
130160- Follow the ESLint rules set in .eslintrc.js
131161- Add Mocha tests for new functionality
132162
163+ ## CHANGELOG
164+
165+ [ View changes here] ( CHANGELOG.md )
166+
133167## TODOS
134168
135169- Improve API calls to prevent Github rate limit errors
136170- Find a way to exclude bytes in files that are a result of build processes
137- - Add methods to get language stats by Github username (only for public repos)
138171
139172## License
140173
0 commit comments