19 lines
386 B
TypeScript
19 lines
386 B
TypeScript
import type { IGiteaBranch } from './gitea.interfaces.js';
|
|
|
|
export class GiteaBranch {
|
|
public readonly name: string;
|
|
public readonly commitSha: string;
|
|
|
|
constructor(raw: IGiteaBranch) {
|
|
this.name = raw.name || '';
|
|
this.commitSha = raw.commit?.id || '';
|
|
}
|
|
|
|
toJSON(): IGiteaBranch {
|
|
return {
|
|
name: this.name,
|
|
commit: { id: this.commitSha },
|
|
};
|
|
}
|
|
}
|