@@ -41,12 +41,12 @@ the passed options and sends the request using [fetch](https://developer.mozilla
4141``` js
4242request (" POST /repos/:owner/:repo/issues/:number/labels" , {
4343 mediaType: {
44- previews: [" symmetra" ]
44+ previews: [" symmetra" ],
4545 },
4646 owner: " octokit" ,
4747 repo: " request.js" ,
4848 number: 1 ,
49- labels: [" 🐛 bug" ]
49+ labels: [" 🐛 bug" ],
5050});
5151```
5252
@@ -102,10 +102,10 @@ const { request } = require("@octokit/request");
102102// https://developer.github.com/v3/repos/#list-organization-repositories
103103const result = await request (" GET /orgs/:org/repos" , {
104104 headers: {
105- authorization: " token 0000000000000000000000000000000000000001"
105+ authorization: " token 0000000000000000000000000000000000000001" ,
106106 },
107107 org: " octokit" ,
108- type: " private"
108+ type: " private" ,
109109});
110110
111111console .log (` ${ result .data .length } repos found.` );
@@ -118,7 +118,7 @@ For GraphQL request we recommend using [`@octokit/graphql`](https://github.com/o
118118``` js
119119const result = await request (" POST /graphql" , {
120120 headers: {
121- authorization: " token 0000000000000000000000000000000000000001"
121+ authorization: " token 0000000000000000000000000000000000000001" ,
122122 },
123123 query: ` query ($login: String!) {
124124 organization(login: $login) {
@@ -128,8 +128,8 @@ const result = await request("POST /graphql", {
128128 }
129129 }` ,
130130 variables: {
131- login: " octokit"
132- }
131+ login: " octokit" ,
132+ },
133133});
134134```
135135
@@ -142,10 +142,10 @@ const result = await request({
142142 method: " GET" ,
143143 url: " /orgs/:org/repos" ,
144144 headers: {
145- authorization: " token 0000000000000000000000000000000000000001"
145+ authorization: " token 0000000000000000000000000000000000000001" ,
146146 },
147147 org: " octokit" ,
148- type: " private"
148+ type: " private" ,
149149});
150150```
151151
@@ -156,8 +156,8 @@ The simplest way to authenticate a request is to set the `Authorization` header
156156``` js
157157const requestWithAuth = request .defaults ({
158158 headers: {
159- authorization: " token 0000000000000000000000000000000000000001"
160- }
159+ authorization: " token 0000000000000000000000000000000000000001" ,
160+ },
161161});
162162const result = await request (" GET /user" );
163163```
@@ -169,22 +169,22 @@ const { createAppAuth } = require("@octokit/auth-app");
169169const auth = createAppAuth ({
170170 id: process .env .APP_ID ,
171171 privateKey: process .env .PRIVATE_KEY ,
172- installationId: 123
172+ installationId: 123 ,
173173});
174174const requestWithAuth = request .defaults ({
175175 request: {
176- hook: auth .hook
176+ hook: auth .hook ,
177177 },
178178 mediaType: {
179- previews: [" machine-man" ]
180- }
179+ previews: [" machine-man" ],
180+ },
181181});
182182
183183const { data: app } = await requestWithAuth (" GET /app" );
184184const { data: app } = await requestWithAuth (" POST /repos/:owner/:repo/issues" , {
185185 owner: " octocat" ,
186186 repo: " hello-world" ,
187- title: " Hello from the engine room"
187+ title: " Hello from the engine room" ,
188188});
189189```
190190
@@ -416,10 +416,10 @@ const myrequest = require("@octokit/request").defaults({
416416 baseUrl: " https://github-enterprise.acme-inc.com/api/v3" ,
417417 headers: {
418418 " user-agent" : " myApp/1.2.3" ,
419- authorization: ` token 0000000000000000000000000000000000000001`
419+ authorization: ` token 0000000000000000000000000000000000000001` ,
420420 },
421421 org: " my-project" ,
422- per_page: 100
422+ per_page: 100 ,
423423});
424424
425425myrequest (` GET /orgs/:org/repos` );
@@ -431,14 +431,14 @@ You can call `.defaults()` again on the returned method, the defaults will casca
431431const myProjectRequest = request .defaults ({
432432 baseUrl: " https://github-enterprise.acme-inc.com/api/v3" ,
433433 headers: {
434- " user-agent" : " myApp/1.2.3"
434+ " user-agent" : " myApp/1.2.3" ,
435435 },
436- org: " my-project"
436+ org: " my-project" ,
437437});
438438const myProjectRequestWithAuth = myProjectRequest .defaults ({
439439 headers: {
440- authorization: ` token 0000000000000000000000000000000000000001`
441- }
440+ authorization: ` token 0000000000000000000000000000000000000001` ,
441+ },
442442});
443443```
444444
@@ -453,7 +453,7 @@ See https://github.com/octokit/endpoint.js. Example
453453``` js
454454const options = request .endpoint (" GET /orgs/:org/repos" , {
455455 org: " my-project" ,
456- type: " private"
456+ type: " private" ,
457457});
458458
459459// {
@@ -487,8 +487,8 @@ const response = await request("POST /markdown/raw", {
487487 data: " Hello world github/linguist#1 **cool**, and #1!" ,
488488 headers: {
489489 accept: " text/html;charset=utf-8" ,
490- " content-type" : " text/plain"
491- }
490+ " content-type" : " text/plain" ,
491+ },
492492});
493493
494494// Request is sent as
@@ -527,9 +527,9 @@ request(
527527 headers: {
528528 " content-type" : " text/plain" ,
529529 " content-length" : 14 ,
530- authorization: ` token 0000000000000000000000000000000000000001`
530+ authorization: ` token 0000000000000000000000000000000000000001` ,
531531 },
532- data: " Hello, world!"
532+ data: " Hello, world!" ,
533533 }
534534);
535535```
0 commit comments