{"version":3,"sources":["/home/renatorib/p/publissue/packages/api/dist/__chunks/IWNXDJL3.cjs","../../src/publissue/createRepository.ts"],"names":["createRepository","props","result","PublissueError"],"mappings":"AAAA,sHAAkC,MCmBlC,SAAsBA,CAAAA,CAEpBC,CAAAA,CAIA,CAMA,IAAMC,CAAAA,CAAS,MAAM,IAAA,CAAK,IAAA,CAAa,kBAAA,CAAoB,CACzD,IAAA,CAAM,IAAA,CAAK,SAAA,CAAU,CACnB,IAAA,CAAM,IAAA,CAAK,IAAA,CAAK,IAAA,CAChB,WAAA,CAAaD,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAO,WAAA,CACpB,QAAA,CAAUA,CAAAA,EAAA,IAAA,CAAA,KAAA,CAAA,CAAAA,CAAAA,CAAO,WAAA,CACjB,SAAA,CAAW,CAAA,CACb,CAAC,CACH,CAAC,CAAA,CAED,EAAA,CAAI,CAACC,CAAAA,CAAO,EAAA,CACV,MAAM,IAAIC,mBAAAA,CAAeD,CAAAA,CAAO,QAAQ,CAAA,CAG1C,OAAA,IAAA,CAAK,IAAA,CAAK,EAAA,CAAKA,CAAAA,CAAO,IAAA,CAAK,OAAA,CAEpB,CACL,EAAA,CAAIA,CAAAA,CAAO,IAAA,CAAK,OAAA,CAChB,GAAA,CAAKA,CAAAA,CAAO,IAAA,CAAK,QACnB,CACF,CAAA,cAAA","file":"/home/renatorib/p/publissue/packages/api/dist/__chunks/IWNXDJL3.cjs","sourcesContent":[null,"// import { graphql, operation, RepositoryVisibility } from \"../lib/graphql\";\nimport { Publissue } from \".\";\nimport { PublissueError } from \"../lib\";\n\n// Cannot use graphql here because of auto_init arg\n/* const CreateRepositoryMutation = operation(\n  graphql(`\n    mutation CreateRepository($input: CreateRepositoryInput!) {\n      createRepository(input: $input) {\n        repository {\n          id\n        }\n      }\n    }\n  `),\n).withMap((data) => {\n  return data.createRepository!.repository!;\n}); */\n\nexport async function createRepository(\n  this: Publissue,\n  props?: {\n    description?: string;\n    homepageUrl?: string;\n  },\n) {\n  type Result = {\n    node_id: string;\n    html_url: string;\n  };\n\n  const result = await this.rest<Result>(\"POST /user/repos\", {\n    body: JSON.stringify({\n      name: this.repo.name,\n      description: props?.description,\n      homepage: props?.homepageUrl,\n      auto_init: true,\n    }),\n  });\n\n  if (!result.ok) {\n    throw new PublissueError(result.response);\n  }\n\n  this.repo.id = result.data.node_id;\n\n  return {\n    id: result.data.node_id,\n    url: result.data.html_url,\n  };\n}\n"]}