Skip to content

Commit

Permalink
Update missing type information
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalrymple committed Jul 29, 2023
1 parent f8b7fe0 commit c6cca5b
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions packages/core/src/resources/ProtectedBranches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import type {
} from '../infrastructure';

export type ProtectedBranchAccessLevel = 0 | 30 | 40 | 60;
export interface ExtendedProtectedBranchAccessLevel {
export interface ExtendedProtectedBranchAccessLevelSchema {
id: number;
access_level: ProtectedBranchAccessLevel;
access_level_description: string;
user_id?: number | null;
Expand All @@ -20,37 +21,39 @@ export interface ExtendedProtectedBranchAccessLevel {
export interface ProtectedBranchSchema extends Record<string, unknown> {
id: number;
name: string;
push_access_levels?: ExtendedProtectedBranchAccessLevel[];
merge_access_levels?: ExtendedProtectedBranchAccessLevel[];
unprotect_access_levels?: ExtendedProtectedBranchAccessLevel[];
push_access_levels?: ExtendedProtectedBranchAccessLevelSchema[];
merge_access_levels?: ExtendedProtectedBranchAccessLevelSchema[];
unprotect_access_levels?: ExtendedProtectedBranchAccessLevelSchema[];
allow_force_push: boolean;
code_owner_approval_required: boolean;
}

export type ProtectedBranchAllowOptions = OneOf<{
user_id: number;
group_id: number;
access_level: number;
}>;

export type EditsProtectedBranchAllowOptions = {
_destroy?: boolean;
} & ProtectedBranchAllowOptions;

export type CreateProtectedBranchOptions = {
allowForcePush?: boolean;
allowedToMerge?: Record<string, number>[];
allowedToPush?: Record<string, number>[];
allowedToUnprotect?: Record<string, number>[];
allowedToMerge?: ProtectedBranchAllowOptions[];
allowedToPush?: ProtectedBranchAllowOptions[];
allowedToUnprotect?: ProtectedBranchAllowOptions[];
codeOwnerApprovalRequired?: boolean;
mergeAccessLevel?: ProtectedBranchAccessLevel;
pushAccessLevel?: ProtectedBranchAccessLevel;
unprotectAccessLevel?: ProtectedBranchAccessLevel;
};

export type EditProtectedBranchAllow = {
_destroy?: boolean;
} & OneOf<{
user_id: number;
group_id: number;
access_level: number;
}>;

export type EditProtectedBranchOptions = {
allowForcePush?: boolean;
allowedToMerge?: EditProtectedBranchAllow[];
allowedToPush?: EditProtectedBranchAllow[];
allowedToUnprotect?: EditProtectedBranchAllow[];
allowedToMerge?: EditsProtectedBranchAllowOptions[];
allowedToPush?: EditsProtectedBranchAllowOptions[];
allowedToUnprotect?: EditsProtectedBranchAllowOptions[];
codeOwnerApprovalRequired?: boolean;
};

Expand Down

0 comments on commit c6cca5b

Please sign in to comment.