2022-11-04 00:55:07 +08:00
|
|
|
import { request } from "@octokit/request";
|
|
|
|
import { getUserAgent } from "universal-user-agent";
|
|
|
|
import { VERSION } from "./version";
|
|
|
|
import { withDefaults } from "./with-defaults";
|
2023-10-26 04:27:07 +08:00
|
|
|
const graphql = withDefaults(request, {
|
|
|
|
headers: {
|
|
|
|
"user-agent": `octokit-graphql.js/${VERSION} ${getUserAgent()}`
|
|
|
|
},
|
|
|
|
method: "POST",
|
|
|
|
url: "/graphql"
|
2022-11-04 00:55:07 +08:00
|
|
|
});
|
2023-10-26 04:27:07 +08:00
|
|
|
import { GraphqlResponseError } from "./error";
|
|
|
|
function withCustomRequest(customRequest) {
|
|
|
|
return withDefaults(customRequest, {
|
|
|
|
method: "POST",
|
|
|
|
url: "/graphql"
|
|
|
|
});
|
2022-11-04 00:55:07 +08:00
|
|
|
}
|
2023-10-26 04:27:07 +08:00
|
|
|
export {
|
|
|
|
GraphqlResponseError,
|
|
|
|
graphql,
|
|
|
|
withCustomRequest
|
|
|
|
};
|