mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
Additional tweaks to protected branch types (#3375)
* Include id as an optional addition for when using the accessLevel property
This commit is contained in:
parent
3aa40e213e
commit
8aa48a5516
@ -17,8 +17,9 @@ export type CamelizeString<T extends PropertyKey> = T extends string
|
||||
|
||||
export type Camelize<T> = { [K in keyof T as CamelizeString<K>]: Camelize<T[K]> };
|
||||
|
||||
export type Never<T> = { [P in keyof T]?: never };
|
||||
export type OneOf<T> = { [K in keyof T]: Pick<T, K> & Never<Omit<T, K>> }[keyof T];
|
||||
export type Simplify<T> = T extends infer S ? { [K in keyof S]: S[K] } : never;
|
||||
export type Never<T> = Simplify<{ [P in keyof T]?: never }>;
|
||||
export type OneOf<T> = { [K in keyof T]: Simplify<Pick<T, K> & Never<Omit<T, K>>> }[keyof T];
|
||||
export type OneOrNoneOf<T> = Never<T> | OneOf<T>;
|
||||
export type AllOrNone<T extends Record<string, any>> = T | Partial<Record<keyof T, never>>;
|
||||
|
||||
|
||||
@ -28,21 +28,28 @@ export interface ProtectedBranchSchema extends Record<string, unknown> {
|
||||
code_owner_approval_required: boolean;
|
||||
}
|
||||
|
||||
export type ProtectedBranchAllowOptions = OneOf<{
|
||||
user_id: number;
|
||||
group_id: number;
|
||||
access_level: number;
|
||||
export type CreateProtectedBranchAllowOptions = OneOf<{
|
||||
userId: number;
|
||||
groupId: number;
|
||||
accessLevel: ProtectedBranchAccessLevel;
|
||||
}>;
|
||||
|
||||
export type EditsProtectedBranchAllowOptions = {
|
||||
export type EditProtectedBranchAllowOptions = {
|
||||
_destroy?: boolean;
|
||||
} & ProtectedBranchAllowOptions;
|
||||
} & (
|
||||
| { userId: number }
|
||||
| { groupId: number }
|
||||
| {
|
||||
accessLevel: ProtectedBranchAccessLevel;
|
||||
id: number;
|
||||
}
|
||||
);
|
||||
|
||||
export type CreateProtectedBranchOptions = {
|
||||
allowForcePush?: boolean;
|
||||
allowedToMerge?: ProtectedBranchAllowOptions[];
|
||||
allowedToPush?: ProtectedBranchAllowOptions[];
|
||||
allowedToUnprotect?: ProtectedBranchAllowOptions[];
|
||||
allowedToMerge?: CreateProtectedBranchAllowOptions[];
|
||||
allowedToPush?: CreateProtectedBranchAllowOptions[];
|
||||
allowedToUnprotect?: CreateProtectedBranchAllowOptions[];
|
||||
codeOwnerApprovalRequired?: boolean;
|
||||
mergeAccessLevel?: ProtectedBranchAccessLevel;
|
||||
pushAccessLevel?: ProtectedBranchAccessLevel;
|
||||
@ -51,9 +58,9 @@ export type CreateProtectedBranchOptions = {
|
||||
|
||||
export type EditProtectedBranchOptions = {
|
||||
allowForcePush?: boolean;
|
||||
allowedToMerge?: EditsProtectedBranchAllowOptions[];
|
||||
allowedToPush?: EditsProtectedBranchAllowOptions[];
|
||||
allowedToUnprotect?: EditsProtectedBranchAllowOptions[];
|
||||
allowedToMerge?: EditProtectedBranchAllowOptions[];
|
||||
allowedToPush?: EditProtectedBranchAllowOptions[];
|
||||
allowedToUnprotect?: EditProtectedBranchAllowOptions[];
|
||||
codeOwnerApprovalRequired?: boolean;
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user