Files
cnb/src/ai/index.ts
2026-01-12 03:18:09 +08:00

19 lines
582 B
TypeScript

import { CNBCore, CNBCoreOptions, RequestOptions, Result } from "../cnb-core.ts";
class AiBase extends CNBCore {
group: string;
constructor(options: CNBCoreOptions) {
super({ token: options.token, cookie: options.cookie });
}
autoPr(repo: string, data: { body: string, branch?: string, title: string }): Promise<Result<any>> {
const url = `/${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 };