feat(client): add rich domain classes, helpers, and refactor GitLabClient internals
This commit is contained in:
21
ts/gitlab.classes.protectedbranch.ts
Normal file
21
ts/gitlab.classes.protectedbranch.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { IGitLabProtectedBranch } from './gitlab.interfaces.js';
|
||||
|
||||
export class GitLabProtectedBranch {
|
||||
public readonly id: number;
|
||||
public readonly name: string;
|
||||
public readonly allowForcePush: boolean;
|
||||
|
||||
constructor(raw: IGitLabProtectedBranch) {
|
||||
this.id = raw.id;
|
||||
this.name = raw.name || '';
|
||||
this.allowForcePush = raw.allow_force_push ?? false;
|
||||
}
|
||||
|
||||
toJSON(): IGitLabProtectedBranch {
|
||||
return {
|
||||
id: this.id,
|
||||
name: this.name,
|
||||
allow_force_push: this.allowForcePush,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user