update
This commit is contained in:
23
src/ai/index.ts
Normal file
23
src/ai/index.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts";
|
||||
type AiOptions = CNBCoreOptions<{
|
||||
group?: string;
|
||||
}>
|
||||
class AiBase extends CNBCore {
|
||||
group: string;
|
||||
constructor(options: AiOptions) {
|
||||
super({ token: options.token, cookie: options.cookie });
|
||||
this.group = options.group || '';
|
||||
}
|
||||
autoPr(repo: string, data: { body: string, branch?: string, title: string }): Promise<Result<any>> {
|
||||
const group = this.group || '';
|
||||
const url = `/${group}/${repo}/-/build/ai/auto-pr`;
|
||||
const postData = {
|
||||
...data,
|
||||
branch: data.branch || 'refs/heads/main',
|
||||
title: data.title || ''
|
||||
};
|
||||
return this.post({ url, data: postData });
|
||||
}
|
||||
}
|
||||
|
||||
export { AiBase };
|
||||
Reference in New Issue
Block a user