MCPcopy
hub / github.com/subquery/subql / getProject

Function getProject

packages/cli/src/controller/project-controller.ts:18–37  ·  view source on GitHub ↗
(url: string, authToken: string, key: string)

Source from the content-addressed store, hash-verified

16};
17
18export async function getProject(url: string, authToken: string, key: string): Promise<ProjectDataType | undefined> {
19 try {
20 const res = await axios<ProjectDataType>({
21 headers: {
22 Authorization: `Bearer ${authToken}`,
23 },
24 method: 'get',
25 url: `/subqueries/${key}`,
26 baseURL: url,
27 });
28 return res.data as unknown as ProjectDataType;
29 } catch (e) {
30 if (axios.isAxiosError(e) && e.response?.status === 404) {
31 return undefined;
32 }
33
34 console.log('ERRROR', e);
35 throw errorHandle(e, 'Failed to get project:');
36 }
37}
38
39export async function createProject(
40 url: string,

Callers 1

Calls 2

errorHandleFunction · 0.90
logMethod · 0.45

Tested by

no test coverage detected