diff --git a/packages/core/src/resources/ProtectedBranches.ts b/packages/core/src/resources/ProtectedBranches.ts index a7b50ab3d..1cfbb3175 100644 --- a/packages/core/src/resources/ProtectedBranches.ts +++ b/packages/core/src/resources/ProtectedBranches.ts @@ -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; @@ -20,37 +21,39 @@ export interface ExtendedProtectedBranchAccessLevel { export interface ProtectedBranchSchema extends Record { 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[]; - allowedToPush?: Record[]; - allowedToUnprotect?: Record[]; + 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; };