MCPcopy Index your code
hub / github.com/varHarrie/varharrie.github.io / request

Method request

src/services/github.ts:149–169  ·  view source on GitHub ↗
(method: string, url: string, data?: Record<string, unknown>)

Source from the content-addressed store, hash-verified

147 constructor(private token: string, private owner: string, private repo: string) {}
148
149 private async request(method: string, url: string, data?: Record<string, unknown>) {
150 let query = '';
151 let body = data;
152
153 if (data && !hasBody(method)) {
154 query = toQuery(data);
155 body = undefined;
156 }
157
158 const response = await fetch([this.apiBase, url, query].join(''), {
159 method,
160 headers: {
161 'Content-Type': 'application/json;charset=UTF-8',
162 Accept: 'application/vnd.github.v3+json',
163 Authorization: `token ${this.token}`,
164 },
165 body: body ? JSON.stringify(body) : undefined,
166 });
167
168 return response.json();
169 }
170
171 public async listMilestones(options: ListMilestonesOptions = {}): Promise<Milestone[]> {
172 const { state, sort, direction, page, pageSize } = options;

Callers 5

listMilestonesMethod · 0.95
listIssuesMethod · 0.95
getIssueMethod · 0.95
listCommentsMethod · 0.95
listRepositoriesMethod · 0.95

Calls 2

hasBodyFunction · 0.85
toQueryFunction · 0.85

Tested by

no test coverage detected