(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8538],{7065:e=>{e.exports={codeBlock:"RestCodeSamples_codeBlock__EV_jQ",method:"RestCodeSamples_method__XQrie",requestCodeBlock:"RestCodeSamples_requestCodeBlock__SgBKI",responseCodeBlock:"RestCodeSamples_responseCodeBlock__QlM4d",segmentedControl:"RestCodeSamples_segmentedControl__HB8Q6"}},37366:e=>{e.exports={statusTable:"RestOperation_statusTable__ET38Q",codeBlock:"RestOperation_codeBlock__mf2k2",stickyCodeColumn:"RestOperation_stickyCodeColumn__jWPMY"}},44994:(e,t,s)=>{"use strict";s.d(t,{F:()=>u});var r=s(37876),n=s(14232),a=s(15039),i=s.n(a),l=s(84148),o=s.n(l),c=s(57596),p=s(65793);let d={NOTE:{icon:c.mo0,color:"accent"},IMPORTANT:{icon:c.cQD,color:"done"},WARNING:{icon:c._0O,color:"attention"},TIP:{icon:c.XLj,color:"success"},CAUTION:{icon:c.wFz,color:"danger"}};function u({className:e,html:t,children:s,type:a="IMPORTANT"}){if(t&&s)throw Error("Can't specify 'html' and 'children'");let{t:l}=(0,p.B)("alerts");return(0,r.jsxs)("div",{"data-testid":"alert","data-container":"alert",className:i()(e,o().container,`ghd-alert ghd-alert-${d[a].color}`),children:[(0,r.jsxs)("p",{className:"ghd-alert-title",children:[(0,n.createElement)(d[a].icon,{size:16,className:"mr-2"}),l(a)]}),t?(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:t}}):s]})}},71587:(e,t,s)=>{"use strict";s.d(t,{R:()=>eg});var r,n,a=s(37876),i=s(14232),l=s(97859),o=s(7270),c=s(50265),p=s(96037),d=s(89099),u=s(94419),h=s(15039),m=s.n(h),g=s(76756),f=s(65793),x=s(44994);function j({slug:e,previews:t,heading:s}){return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{className:"h4",id:`${e}-preview-notices`,children:(0,a.jsx)("a",{href:`#${e}-preview-notices`,children:s})}),t.map((e,t)=>(0,a.jsx)(x.F,{type:"NOTE",html:e},JSON.stringify(e)+t))]})}var y=s(36627),b=s(12007),_=s(96523),$=s(90572),v=s(84583),A=s(57596),N=s(70332),T=s(65894),k=s(91422),C=s(10035),O=s(45862),S=s(6304),q=s.n(S),w=s(86715),E=s(40287),R=s(31239),I=s(19835);function P(e,t){return!!e?.progAccess?.allowPermissionlessAccess&&(t.startsWith("free-pro-team")||t.startsWith("enterprise-cloud"))}function B(e){return e.replace(/'/g,"'\\''")}let H={"application/x-www-form-urlencoded":"--data-urlencode","multipart/form-data":"--form","application/octet-stream":"--data-binary"},L=e=>e;function M(e,t,s=L){let r="",n=`${s(e)}`,a="=";if(e||(a=""),"string"==typeof t){let e=B(t);r+=` -f '${n}${a}${e}'`}else if("number"==typeof t||"boolean"==typeof t||null===t)r+=` -F "${n}${a}${t}"`;else if(Array.isArray(t))for(let a=0;a`${n}[${a}]${e}`);else{let t=()=>`${s(e)}[${a}]`;r+=M(e,i,t)}}else"object"==typeof t&&(r+=U(t,e=>`${n}[${e}]`));return r}function U(e,t=L){let s="";for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e=0;e`${t(s)}[${e}]`)}else"object"==typeof n&&null!==n?s+=U(n,e=>`${t(r)}[${e}]`):s+=M(r,n,t);return s}function V(e,t){let s=new URLSearchParams;for(let r of e.parameters)if("query"===r.in&&!0===r.required){let e=function(e,t){let s=null;return JSON.stringify(e,(e,r)=>(r&&Object.prototype.hasOwnProperty.call(r,t)&&(s=r[t]),r)),s}(t.response?.example,r.name);s.append(r.name,e||r.name.toUpperCase())}return s.toString()}function D(e){let t=e?.response?.contentType;return t&&"application/json"!==t?t:"application/vnd.github+json"}var F=s(7065),Q=s.n(F);function Y({verb:e,requestPath:t}){let s=t.length>25?t.replaceAll("/","/").replaceAll("_","_"):t;return(0,a.jsxs)("div",{className:m()(Q().method,"my-0 text-mono d-flex flex-row flex-items-start "),children:[(0,a.jsx)("span",{className:"IssueLabel IssueLabel--big color-bg-accent-emphasis color-fg-on-emphasis text-uppercase mr-2",children:e}),(0,a.jsx)("span",{dangerouslySetInnerHTML:{__html:s}})]})}var G=((r={}).example="example",r.schema="schema",r),J=((n={}).curl="curl",n.javascript="javascript",n.ghcli="ghcli",n),K=s(91078),W=s(25729);let X=Object.values(G);function z(e){return e===J.javascript?"javascript":"curl"}function Z(e){e.className="hljs",delete e.dataset.highlighted,k.A.highlightElement(e)}function ee({operation:e,slug:t,heading:s}){let r,n,l,{t:o}=(0,f.B)(["rest_reference"]),{isEnterpriseServer:c,isEnterpriseCloud:p}=(0,K.M)(),d=(0,i.useRef)(null),u=(0,i.useRef)(null),h=(0,i.useRef)(!0),g=(0,i.useRef)(null),{currentVersion:x}=(0,K.M)(),{allVersions:j}=(0,W.O4)(),y=e.codeExamples.map(t=>({description:t.request.description,curl:function(e,t,s,r){let n="";t?.request?.contentType==="application/octet-stream"?n='-H "Content-Type: application/octet-stream"':t?.request?.contentType==="multipart/form-data"&&(n='-H "Content-Type: multipart/form-data"');let a=P(e,s);"manage-ghes"===e.subcategory&&(n="get"===e.verb?'-H "Content-Type: application/json"':`-H "Content-Type: ${t?.request?.contentType}"`),"inference"===e.subcategory&&(n='-H "Content-Type: application/json"');let i=t?.request?.parameters?(0,R.Q)(e.requestPath).expand(t.request.parameters):e.requestPath,l=V(e,t);i+=l?`?${l}`:"";let o="";if(t?.request?.bodyParameters){o=`-d '${JSON.stringify(t.request.bodyParameters).replace(/'/g,"'\\''")}'`;let e=t.request.contentType;if(e in H){o="";let{bodyParameters:s}=t.request;if(s&&"object"==typeof s&&!Array.isArray(s))for(let t of Object.keys(s)){let r=B(String(s[t]));o=`${o} ${H[e]} '${t}=${r}'`}else{let t=B(String(s));o=`${H[e]} "${t}"`}}}let c=a?"":'-H "Authorization: Bearer "',p=r[s].apiVersions.length>0&&r[s].latestApiVersion?`-H "X-GitHub-Api-Version: ${r[s].latestApiVersion}"`:"",d=`-H "Accept: ${D(t)}"`,u=`${e.serverUrl}${i}`;i.includes("?")&&(u=`"${u}"`),("management-console"===e.subcategory||"manage-ghes"===e.subcategory)&&(c='-u "api_key:your-password"',p="",d='-H "Accept: application/vnd.github+json"'===d?"":d),a&&"management-console"!==e.subcategory&&"manage-ghes"!==e.subcategory&&(c=""),e?.progAccess?.basicAuth&&(c='-u ":"');let h=["get"!==e.verb&&`-X ${e.verb.toUpperCase()}`,d,c,p,n,u,o].filter(Boolean);return`curl -L \\ ${h.join(" \\\n ")}`}(e,t,x,j),javascript:function(e,t,s,r){let n=P(e,s),a={};t.request&&(Object.assign(a,t.request.parameters),t.request.bodyParameters&&"object"!=typeof t.request.bodyParameters?a.data=t.request.bodyParameters:Object.assign(a,t.request.bodyParameters));let i="";if("delete"===e.verb||"patch"===e.verb||"post"===e.verb||"put"===e.verb){let t=e.parameters.filter(e=>"query"===e.in).map(e=>e.name);t.length>0&&(i=`{?${t.join(",")}}`)}r[s].apiVersions.length>0&&r[s].latestApiVersion&&(a.headers={"X-GitHub-Api-Version":`${r[s].latestApiVersion}`});let l=`// Octokit.js // https://github.com/octokit/core.js#readme `,o=`const octokit = new Octokit(${(0,I.A)({auth:"YOUR-TOKEN"},null,2)}) `,c=`const octokit = new Octokit() `,p=`import { createOAuthAppAuth } from "@octokit/auth-oauth-app" const octokit = new Octokit({ authStrategy: createOAuthAppAuth, auth:{ clientType: 'oauth-app', clientId: '', clientSecret: '' } }) `,d=e?.progAccess?.basicAuth?p:o;return n&&(d=c),`${l}${d}await octokit.request('${e.verb.toUpperCase()} ${e.requestPath}${i}', ${(0,I.A)(a,null,2)})`}(e,t,x,j),ghcli:function(e,t,s,r){if(e?.progAccess?.basicAuth)return;let n=D(t),a="https://api.github.com"!==e.serverUrl?"--hostname HOSTNAME":"",i=t?.request?.parameters?(0,R.Q)(e.requestPath).expand(t.request.parameters):e.requestPath,l=r[s].apiVersions.length>0&&r[s].latestApiVersion?`-H "X-GitHub-Api-Version: ${r[s].latestApiVersion}"`:"",o=V(e,t);i+=o?`?${o}`:"";let c="",{bodyParameters:p}=t.request;if(p){if(Array.isArray(p))throw Error("Array of arrays found in body parameters");if("object"==typeof p){let t=e.requestPath.includes("/gists")&&("Create a gist"===e.title||"Update a gist"===e.title);if(function e(t){if(Array.isArray(t))return!0;if("object"==typeof t&&null!==t){for(let s of Object.values(t))if(e(s))return!0}return!1}(p)||t){let e=JSON.stringify(p,(e,t)=>"string"==typeof t&&/^\d+$/.test(t)?parseInt(t,10):"true"===t||"false"!==t&&t,2).replace(/'/g,"'\\''");c=`--input - <<< '${e}'`}else c+=U(p)}else c+=M("",p)}let d=["get"!==e.verb&&`--method ${e.verb.toUpperCase()}`,`-H "Accept: ${n}"`,l,a,i,c].filter(Boolean);return`# GitHub CLI api # https://cli.github.com/manual/gh_api gh api \\ ${d.join(" \\\n ")}`}(e,t,x,j),response:t.response,request:t.request})),k=[J.curl];"models"!==e.category&&"management-console"!==e.subcategory&&"manage-ghes"!==e.subcategory&&(k.push(J.javascript),y.some(e=>void 0===e.ghcli)||k.push(J.ghcli));let C=(r=y.length>1&&!y.every(e=>e.response.contentType===y[0].response.contentType),n=y.length>1&&!y.every(e=>e.request?.contentType===y[0].request?.contentType),l=r||n,y.map((e,t)=>{let s=e.request?.contentType,a=e.response.contentType,i=e.description;return l&&(n&&r?i=`${e.description} (${s} → ${a})`:n?i=`${e.description} (${s})`:r&&(i=`${e.description} (${a})`)),{text:i,languageIndex:t}})),[O,S]=(0,i.useState)(k[0]),[q,L]=(0,i.useState)(C[0]),[F,et]=(0,i.useState)(X[0]),es=1===y.length,er=y[q.languageIndex],en=e=>{et(e)},ea=e=>{S(e),T.A.set(E.hq,e)};(0,i.useEffect)(()=>{let e=T.A.get(E.hq),t=k.find(t=>t===e);e&&t&&S(e)},[]),(0,i.useEffect)(()=>{let e=d.current;e&&!h.current&&Z(e)},[O]),(0,i.useEffect)(()=>{let e=u.current,t=g.current;t&&(t.scrollTop=0),e&&!h.current&&Z(e)},[F]),(0,i.useEffect)(()=>{let e=d.current;e&&Z(e);let t=u.current;t&&Z(t)},[q]),(0,i.useEffect)(()=>{h.current&&(h.current=!1)},[]);let[ei,el]=(0,w.A)(er[O],{successDuration:1400}),eo=JSON.stringify(er.response.example,null,2),ec=JSON.stringify(er.response.schema,null,2);return c&&(eo=eo&&eo.replaceAll("api.github.com","HOSTNAME"),ec=ec&&ec.replaceAll("api.github.com","HOSTNAME")),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{className:"mt-0 pt-0 h4",id:`${t}--code-samples`,children:(0,a.jsx)("a",{href:`#${t}--code-samples`,children:s})}),p&&O===J.curl?(0,a.jsxs)("span",{className:"f5",children:[(0,a.jsx)(A.mo0,{className:"d-inline mx-1"}),(0,a.jsx)("p",{className:"d-inline",dangerouslySetInnerHTML:{__html:o("data_residency_notice")}})]}):null,(0,a.jsx)("h4",{className:"mt-3 mb-3 h5",children:es?o("request_example"):o("request_examples")}),!es&&(0,a.jsx)("div",{className:"pb-5 pt-2",children:(0,a.jsxs)(b.A,{id:"example-type-picker",children:[(0,a.jsx)(b.A.Label,{visuallyHidden:!0,children:"Select the example type"}),(0,a.jsx)(_.A,{onChange:e=>{L(C[Number(e.currentTarget.value)])},children:C.map(e=>(0,a.jsx)(_.A.Option,{value:e.languageIndex.toString(),children:e.text},e.languageIndex))})]})}),(0,a.jsxs)("div",{className:"rounded-1 border",children:[(0,a.jsx)("div",{className:"my-0 p-3",children:(0,a.jsx)(Y,{verb:e.verb,requestPath:e.requestPath})}),(0,a.jsxs)("div",{className:"border-top d-inline-flex flex-justify-between width-full flex-items-center pt-2",children:[(0,a.jsx)("div",{className:"d-inline-flex ml-2",children:(0,a.jsx)($.I,{className:Q().segmentedControl,"aria-label":`Example language selector for ${e.title}`,children:k.map(e=>(0,a.jsx)($.I.Button,{selected:e===O,onClick:t=>{t.preventDefault(),ea(e)},onKeyDown:t=>{"Enter"===t.key&&ea(e)},children:o(`code_sample_options.${e}`)},e))})}),(0,a.jsx)("div",{className:"mr-2",children:(0,a.jsx)(v.K,{icon:ei?A.Srz:A.TdU,className:"js-btn-copy btn-octicon","aria-label":`${o("button_text.copy_to_clipboard")} ${O} request example`,onClick:()=>{el(),(0,N.iP)("Copied!")}})})]}),(0,a.jsx)("div",{className:m()(Q().codeBlock,Q().requestCodeBlock,`border-top rounded-1 my-0 ${z(O)}`),"data-highlight":z(O),tabIndex:0,children:(0,a.jsx)("code",{ref:d,children:er[O]})})]}),(0,a.jsx)("h4",{className:"mt-5 mb-2 h5",dangerouslySetInnerHTML:{__html:er.response.description||o("response")}}),(0,a.jsxs)("div",{className:"border rounded-1 pt-2",children:[er.response.schema?(0,a.jsx)($.I,{className:m()(Q().segmentedControl,"mx-2"),"aria-label":`Example response format selector for ${e.title}`,children:X.map(e=>(0,a.jsx)($.I.Button,{selected:e===F,onClick:t=>{t.preventDefault(),en(e)},onKeyDown:t=>{"Enter"===t.key&&en(e)},children:o(`response_options.${e}`)},e))}):null,(0,a.jsxs)("div",{className:"",children:[er.response.statusCode&&(0,a.jsx)("div",{className:m()(Q().codeBlock,"rounded-1 p-3 my-0 color-bg-default"),children:(0,a.jsx)("code",{children:`Status: ${er.response.statusCode}`})}),er.response.example&&(0,a.jsx)("div",{ref:g,className:m()(Q().codeBlock,Q().responseCodeBlock,"border-top rounded-1 my-0"),"data-highlight":"json",tabIndex:0,children:(0,a.jsx)("code",{ref:u,children:F===G.example?eo:ec})})]})]})]})}function et({statusCodes:e,slug:t,heading:s}){let{t:r}=(0,f.B)("rest_reference");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{className:"mt-4 mb-3 pt-3 h4",id:`${t}--status-codes`,children:(0,a.jsx)("a",{href:`#${t}--status-codes`,children:s})}),(0,a.jsxs)("table",{children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:"text-left",children:[(0,a.jsx)("th",{children:r("status_code")}),(0,a.jsx)("th",{children:r("description")})]})}),(0,a.jsx)("tbody",{children:e.map((e,t)=>(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{children:(0,a.jsx)("code",{children:e.httpStatusCode})}),(0,a.jsx)("td",{children:(0,a.jsx)("div",{dangerouslySetInnerHTML:{__html:e.description}})})]},`${e.description}-${t}}`))})]})]})}k.A.registerLanguage("json",C.A),k.A.registerLanguage("javascript",O.A),k.A.registerLanguage("curl",q());var es=s(90039);function er({progAccess:e,slug:t,operationTitle:s}){let{currentVersion:r}=(0,K.M)(),{t:n}=(0,f.B)("rest_reference");if("enterprise-server@3.9"===r||"enterprise-server@3.8"===r||!e)return null;let{userToServerRest:i,serverToServer:l,fineGrainedPat:o,basicAuth:c=!1,allowPermissionlessAccess:p=!1}=e,d=!(i||l||o);if(!c&&d&&p)return null;let u=n(c?"basic_auth_heading":"fine_grained_access").replace("{{ RESTOperationTitle }}",s),h=c?`${t}--basic-authentication`:`${t}--fine-grained-access-tokens`;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h3",{className:"mt-4 mb-3 pt-3 h4",id:h,children:(0,a.jsx)("a",{href:`#${h}`,children:u})}),d?(0,a.jsx)(en,{basicAuth:c}):(0,a.jsx)(ea,{progAccess:e})]})}function en({basicAuth:e}){let{t}=(0,f.B)("rest_reference");return e?(0,a.jsx)("p",{dangerouslySetInnerHTML:{__html:t("basic_auth")}}):(0,a.jsx)("p",{children:t("no_fine_grained_access")})}function ea({progAccess:e}){let t=(0,d.useRouter)(),{currentVersion:s}=(0,K.M)(),{t:r}=(0,f.B)("rest_reference"),n=e.permissions.map((e,t)=>{let s=Object.entries(e),r=s.length;return(0,a.jsx)("li",{children:s.map(([e,s],n)=>(0,a.jsxs)("span",{children:[(0,a.jsx)("span",{children:`${e} (${s})`}),n1?`${r("permission_sets")}:`:`${r("permission_set")}:`,c=r(0===l?"allows_public_read_access_no_permissions":"allows_public_read_access");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("p",{children:[r("works_with_fine_grained_tokens"),":"]}),(0,a.jsxs)("ul",{children:[e.userToServerRest&&(0,a.jsx)("li",{children:(0,a.jsx)(es.N,{href:`${i}/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-user-access-token-for-a-github-app`,children:r("user_access_token_name")})}),e.serverToServer&&(0,a.jsx)("li",{children:(0,a.jsx)(es.N,{href:`${i}/apps/creating-github-apps/authenticating-with-a-github-app/generating-an-installation-access-token-for-a-github-app`,children:r("installation_access_token_name")})}),e.fineGrainedPat&&(0,a.jsx)("li",{children:(0,a.jsx)(es.N,{href:`${i}/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token`,children:r("fine_grained_access_token_name")})})]}),(0,a.jsx)("p",{children:o}),n.length>0&&(0,a.jsx)("ul",{children:n}),e.allowsPublicRead&&(0,a.jsx)("p",{children:c})]})}var ei=s(37366),el=s.n(ei);let eo={name:"accept",type:"string",description:"

Setting to application/vnd.github+json is recommended.

",isRequired:!1},ec={name:"content-type",type:"string",description:"

Setting to application/json is required.

",isRequired:!0};function ep({operation:e}){let t=(0,u.y)(e.title),{t:s}=(0,f.B)("rest_reference"),r=(0,d.useRouter)(),n="management-console"===e.subcategory||"manage-ghes"===e.subcategory?[]:"inference"===e.subcategory?[ec,eo]:[eo],l=e.previews?.length||0,o=e.statusCodes?.length>0,c=e.codeExamples?.length>0,p=e.parameters?.length>0||e.bodyParameters?.length>0,h=(0,i.useRef)(null);return(0,i.useEffect)(()=>{r.asPath.includes("#")&&r.asPath.split("#")[1]===t&&h?.current?.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})},[]),(0,a.jsxs)("div",{className:"pb-8",ref:h,children:[(0,a.jsx)(g.D,{as:"h2",slug:t,children:e.title}),(0,a.jsxs)("div",{className:"d-flex flex-wrap gutter mt-4",children:[(0,a.jsxs)("div",{className:"col-md-12 col-lg-6",children:[(0,a.jsx)("div",{className:m()(el().codeBlock),dangerouslySetInnerHTML:{__html:e.descriptionHTML}}),(0,a.jsx)(er,{progAccess:e.progAccess,slug:t,operationTitle:e.title}),p&&(0,a.jsx)(y.A,{slug:t,numPreviews:l,heading:s("parameters").replace("{{ RESTOperationTitle }}",e.title),headers:n,parameters:e.parameters,bodyParameters:e.bodyParameters}),o&&(0,a.jsx)(et,{statusCodes:e.statusCodes,slug:t,heading:s("http_status_code").replace("{{ RESTOperationTitle }}",e.title)})]}),(0,a.jsxs)("div",{className:m()("col-md-12 col-lg-6 position-sticky flex-self-start",el().stickyCodeColumn),children:[c&&(0,a.jsx)(ee,{operation:e,slug:t,heading:s("code_samples").replace("{{ RESTOperationTitle }}",e.title)}),l>0&&(0,a.jsx)(j,{slug:t,previews:e.previews,heading:e.previews.length>1?`${s("preview_notices").replace("{{ RESTOperationTitle }}",e.title)}`:`${s("preview_notice").replace("{{ RESTOperationTitle }}",e.title)}`})]})]})]})}var ed=s(95004),eu=s(39081),eh=s(43152),em=s(92295);let eg=({restOperations:e})=>{let{title:t,intro:s,renderedPage:r,permissions:n,product:d}=(0,ed.O)();return(0,i.useEffect)(()=>{for(let e of document.querySelectorAll("pre"))(e.scrollWidth>e.clientWidth||e.scrollHeight>e.clientHeight)&&e.setAttribute("tabindex","0")},[]),(0,a.jsxs)(l.i,{children:[(0,a.jsx)(eu.g,{}),(0,a.jsx)(eh.p,{}),(0,a.jsxs)("div",{className:"px-3 px-md-6 my-4 container-xl","data-search":"article-body",children:[(0,a.jsx)("div",{className:"d-none d-xl-block my-3 mr-auto width-full",children:(0,a.jsx)(em.B,{})}),(0,a.jsx)("h1",{id:"title-h1",className:"mb-3",children:t}),s&&(0,a.jsx)(c.h,{"data-testid":"lead","data-search":"lead",children:s}),(0,a.jsx)(p.e,{permissions:n,product:d}),r&&(0,a.jsx)(o.h,{className:"pt-3 pb-4",children:r}),e.length>0&&(0,a.jsx)(o.h,{className:"pt-3 pb-4",children:e.map(e=>(0,a.jsx)(ep,{operation:e},`${e.title}-${e.category}-${e.subcategory}`))})]})]})}},84148:e=>{e.exports={container:"Alert_container__nBNr_"}}}]);