@@ -21,12 +21,7 @@ Or use it on its own:
21
21
github = require (' githubot' )
22
22
```
23
23
24
- Specify a different Github API version (default is ` beta ` ):
25
-
26
- ``` coffeescripts
27
- module.exports = (robot) ->
28
- github = require('githubot')(robot, apiVersion: 'preview')
29
- ```
24
+ You can pass additional [ options] ( #options ) to the constructor if needed.
30
25
31
26
## Use ##
32
27
@@ -90,17 +85,45 @@ This will happen with the bespoke methods as well:
90
85
gh .branches " githubot" , (branches ) ->
91
86
```
92
87
93
- ### Options ###
88
+ ## Options ##
89
+
90
+ ### Passing options ###
91
+
92
+ Options may be passed to githubot in three different ways,
93
+ in increasing order of precedence:
94
+
95
+ 1 . Through shell environment variables.
96
+ 2 . Through the constructor:
97
+
98
+ ``` coffeescript
99
+ github = require (' githubot' )(robot, apiVersion : ' preview' )
100
+ ```
101
+ 3 . Using ` withOptions ` , which lets you pass options to only some requests:
102
+
103
+ ``` coffeescript
104
+ github = require (' githubot' )(robot)
105
+ preview = github .withOptions (apiVersion : ' preview' )
106
+ # Uses preview API
107
+ preview .get ' /preview/feature' , -> # ...
108
+ # Uses regular API
109
+ github .get ' /regular/feature' , -> # ...
110
+ ```
111
+
112
+ ### Available options ###
94
113
95
- * ` HUBOT_GITHUB_TOKEN ` : GitHub API token. Required to perform authenticated actions.
114
+ * ` token ` /` process.env.HUBOT_GITHUB_TOKEN ` :
115
+ GitHub API token. Required to perform authenticated actions.
96
116
97
- * ` HUBOT_GITHUB_USER ` : Default GitHub username to use if one is not given.
117
+ * ` defaultUser ` /` process.env.HUBOT_GITHUB_USER ` :
118
+ Default GitHub username to use if one is not given.
98
119
99
- * ` HUBOT_GITHUB_API ` : The base API URL. This is useful for Enterprise Github installations.
120
+ * ` apiRoot ` /` process.env.HUBOT_GITHUB_API ` :
121
+ The base API URL. This is useful for Enterprise Github installations.
100
122
101
- For example, ` HUBOT_GITHUB_API='http ://myprivate.github.int' `
123
+ For example, ` HUBOT_GITHUB_API='https ://myprivate.github.int' `
102
124
103
- * ` HUBOT_CONCURRENT_REQUESTS ` : Limits the allowed number of concurrent requests to the GitHub API. Defaults to 20.
125
+ * ` concurrentRequests ` /` process.env.HUBOT_CONCURRENT_REQUESTS ` :
126
+ Limits the allowed number of concurrent requests to the GitHub API. Defaults to 20.
104
127
105
128
## Bespoke API access ##
106
129
0 commit comments