mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-18 15:55:30 +00:00
Handling Admin endpoints for the Users API (#3584)
This commit is contained in:
parent
25888ce45d
commit
d64af2ae12
@ -25,6 +25,10 @@ export interface ShowExpanded<E extends boolean = false> {
|
||||
showExpanded?: E;
|
||||
}
|
||||
|
||||
export interface AsAdmin<A extends boolean = false> {
|
||||
asAdmin?: A;
|
||||
}
|
||||
|
||||
export type BaseRequestOptions<E extends boolean = false> = Sudo &
|
||||
ShowExpanded<E> & { [Key in string]?: any };
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { AllMergeRequestsOptions, MergeRequestSchema } from './MergeRequests';
|
||||
import type { DiscussionNoteSchema, DiscussionSchema } from '../templates/ResourceDiscussions';
|
||||
import type { CommitablePipelineStatus } from './Pipelines';
|
||||
@ -111,7 +111,7 @@ export type CommitSignatureSchema =
|
||||
|
||||
export interface CondensedCommitCommentSchema extends Record<string, unknown> {
|
||||
note: string;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
}
|
||||
|
||||
export interface CommitCommentSchema extends CondensedCommitCommentSchema {
|
||||
@ -137,7 +137,7 @@ export interface CommitStatusSchema extends Record<string, unknown> {
|
||||
started_at?: string;
|
||||
name: string;
|
||||
allow_failure: boolean;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
description?: string;
|
||||
sha: string;
|
||||
target_url: string;
|
||||
|
||||
@ -9,7 +9,7 @@ import type {
|
||||
} from '../infrastructure';
|
||||
import type { CommitSchema } from './Commits';
|
||||
import type { PipelineSchema } from './Pipelines';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { RunnerSchema } from './Runners';
|
||||
import type { EnvironmentSchema } from './Environments';
|
||||
import type { AllMergeRequestsOptions, MergeRequestSchema } from './MergeRequests';
|
||||
@ -29,12 +29,12 @@ export interface DeployableSchema extends Record<string, unknown> {
|
||||
coverage?: string;
|
||||
created_at?: string;
|
||||
finished_at?: string;
|
||||
user?: UserSchema;
|
||||
user?: SimpleUserSchema;
|
||||
pipeline?: PipelineSchema;
|
||||
}
|
||||
|
||||
export interface DeploymentApprovalStatusSchema extends Record<string, unknown> {
|
||||
user: UserSchema;
|
||||
user: SimpleUserSchema;
|
||||
status: 'approved' | 'rejected';
|
||||
created_at: string;
|
||||
comment: string;
|
||||
@ -48,7 +48,7 @@ export interface DeploymentSchema extends Record<string, unknown> {
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
status: DeploymentStatus;
|
||||
user: UserSchema;
|
||||
user: SimpleUserSchema;
|
||||
deployable: DeployableSchema;
|
||||
environment: EnvironmentSchema;
|
||||
pending_approval_count?: number;
|
||||
|
||||
@ -7,7 +7,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import { UserSchema } from './Users';
|
||||
import { SimpleUserSchema } from './Users';
|
||||
|
||||
export interface CondensedEpicLinkSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
@ -29,7 +29,7 @@ export interface EpicLinkSchema extends Record<string, unknown> {
|
||||
parent_id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
author: UserSchema;
|
||||
author: SimpleUserSchema;
|
||||
start_date?: string;
|
||||
start_date_is_fixed: boolean;
|
||||
start_date_fixed?: string;
|
||||
|
||||
@ -9,7 +9,7 @@ import type {
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { TodoSchema } from './TodoLists';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { GroupSchema } from './Groups';
|
||||
import type { SimpleLabelSchema } from '../templates/ResourceLabels';
|
||||
|
||||
@ -29,7 +29,7 @@ export interface EpicSchema extends Record<string, unknown> {
|
||||
relative: string;
|
||||
full: string;
|
||||
};
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
start_date?: string;
|
||||
start_date_is_fixed: boolean;
|
||||
start_date_fixed?: string;
|
||||
|
||||
@ -8,7 +8,7 @@ import type {
|
||||
PaginationRequestOptions,
|
||||
PaginationTypes,
|
||||
} from '../infrastructure';
|
||||
import { UserSchema } from './Users';
|
||||
import { SimpleUserSchema } from './Users';
|
||||
|
||||
export type AllEventOptions = {
|
||||
action?:
|
||||
@ -40,7 +40,7 @@ export interface EventSchema extends Record<string, unknown> {
|
||||
author_id: number;
|
||||
target_title: string;
|
||||
created_at: string;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
author_username: string;
|
||||
}
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import type {
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { CondensedProjectSchema, ProjectSchema } from './Projects';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { CustomAttributeSchema } from '../templates/ResourceCustomAttributes';
|
||||
import { AccessLevel } from '../constants';
|
||||
|
||||
@ -304,8 +304,8 @@ export class Groups<C extends boolean = false> extends BaseResource<C> {
|
||||
allProvisionedUsers<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
groupId: string | number,
|
||||
options?: AllProvisionedUsersOptions & PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<UserSchema[], C, E, P>> {
|
||||
return RequestHelper.get<UserSchema[]>()(
|
||||
): Promise<GitlabAPIResponse<SimpleUserSchema[], C, E, P>> {
|
||||
return RequestHelper.get<SimpleUserSchema[]>()(
|
||||
this,
|
||||
endpoint`groups/${groupId}/provisioned_users`,
|
||||
options,
|
||||
|
||||
@ -8,7 +8,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import { UserSchema } from './Users';
|
||||
import { SimpleUserSchema } from './Users';
|
||||
import { MilestoneSchema } from '../templates/ResourceMilestones';
|
||||
|
||||
export interface IssueLinkSchema extends Record<string, unknown> {
|
||||
@ -19,9 +19,9 @@ export interface IssueLinkSchema extends Record<string, unknown> {
|
||||
state: string;
|
||||
description: string;
|
||||
weight?: number;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
milestone: MilestoneSchema;
|
||||
assignees?: MappedOmit<UserSchema, 'created_at'>[];
|
||||
assignees?: MappedOmit<SimpleUserSchema, 'created_at'>[];
|
||||
title: string;
|
||||
labels?: string[];
|
||||
user_notes_count: number;
|
||||
|
||||
@ -11,7 +11,7 @@ import type {
|
||||
Sudo,
|
||||
UserAgentDetailSchema,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { MergeRequestSchema } from './MergeRequests';
|
||||
import type { TodoSchema } from './TodoLists';
|
||||
import type { MetricImageSchema } from './AlertManagement';
|
||||
@ -30,10 +30,10 @@ export interface IssueSchema extends Record<string, unknown> {
|
||||
description: string;
|
||||
health_status?: string;
|
||||
weight?: number;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
milestone: MilestoneSchema;
|
||||
project_id: number;
|
||||
assignees?: MappedOmit<UserSchema, 'created_at'>[];
|
||||
assignees?: MappedOmit<SimpleUserSchema, 'created_at'>[];
|
||||
type: string;
|
||||
updated_at: string;
|
||||
closed_at?: string;
|
||||
@ -241,8 +241,8 @@ export class Issues<C extends boolean = false> extends BaseResource<C> {
|
||||
projectId: string | number,
|
||||
issueIId: number,
|
||||
options?: Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<MappedOmit<UserSchema, 'created_at'>[], C, E, void>> {
|
||||
return RequestHelper.get<MappedOmit<UserSchema, 'created_at'>[]>()(
|
||||
): Promise<GitlabAPIResponse<MappedOmit<SimpleUserSchema, 'created_at'>[], C, E, void>> {
|
||||
return RequestHelper.get<MappedOmit<SimpleUserSchema, 'created_at'>[]>()(
|
||||
this,
|
||||
endpoint`projects/${projectId}/issues/${issueIId}/participants`,
|
||||
options,
|
||||
|
||||
@ -12,7 +12,7 @@ import type {
|
||||
import type { SimpleProjectSchema } from './Projects';
|
||||
import type { CondensedCommitSchema } from './Commits';
|
||||
import type { RunnerSchema } from './Runners';
|
||||
import type { ExpandedUserSchema, UserSchema } from './Users';
|
||||
import type { ExpandedUserSchema, SimpleUserSchema } from './Users';
|
||||
import type { PipelineSchema } from './Pipelines';
|
||||
|
||||
export type JobScope =
|
||||
@ -105,7 +105,7 @@ export interface JobKubernetesAgentsSchema extends Record<string, unknown> {
|
||||
job: CondensedJobSchema;
|
||||
pipeline: PipelineSchema;
|
||||
project: MappedOmit<SimpleProjectSchema, 'web_url'>;
|
||||
user: UserSchema;
|
||||
user: SimpleUserSchema;
|
||||
}
|
||||
|
||||
export interface JobVariableAttributeOption extends Record<string, unknown> {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { BaseResource } from '@gitbeaker/requester-utils';
|
||||
import { RequestHelper, endpoint } from '../infrastructure';
|
||||
import type { GitlabAPIResponse, MappedOmit, ShowExpanded, Sudo } from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { GroupSchema } from './Groups';
|
||||
import type { ProtectedBranchSchema } from './ProtectedBranches';
|
||||
|
||||
@ -15,7 +15,7 @@ export interface ProjectLevelMergeRequestApprovalSchema extends Record<string, u
|
||||
}
|
||||
|
||||
export interface ApprovedByEntity {
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
}
|
||||
|
||||
export interface MergeRequestLevelMergeRequestApprovalSchema extends Record<string, unknown> {
|
||||
@ -37,9 +37,9 @@ export interface ApprovalRuleSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
name: string;
|
||||
rule_type: string;
|
||||
eligible_approvers?: MappedOmit<UserSchema, 'created_at'>[];
|
||||
eligible_approvers?: MappedOmit<SimpleUserSchema, 'created_at'>[];
|
||||
approvals_required: number;
|
||||
users?: MappedOmit<UserSchema, 'created_at'>[];
|
||||
users?: MappedOmit<SimpleUserSchema, 'created_at'>[];
|
||||
groups?: GroupSchema[];
|
||||
contains_hidden_groups: boolean;
|
||||
overridden: boolean;
|
||||
|
||||
@ -15,7 +15,7 @@ import type { IssueSchema, TimeStatsSchema } from './Issues';
|
||||
import type { ExpandedPipelineSchema, PipelineSchema } from './Pipelines';
|
||||
import type { SimpleProjectSchema } from './Projects';
|
||||
import type { TodoSchema } from './TodoLists';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
|
||||
import type { MilestoneSchema } from '../templates/ResourceMilestones';
|
||||
import type { SimpleLabelSchema } from '../templates/ResourceLabels';
|
||||
@ -91,19 +91,19 @@ export interface CondensedMergeRequestSchema extends Record<string, unknown> {
|
||||
}
|
||||
|
||||
export interface MergeRequestSchema extends CondensedMergeRequestSchema {
|
||||
merged_by: MappedOmit<UserSchema, 'created_at'> | null;
|
||||
merged_by: MappedOmit<SimpleUserSchema, 'created_at'> | null;
|
||||
merged_at: string | null;
|
||||
closed_by: MappedOmit<UserSchema, 'created_at'> | null;
|
||||
closed_by: MappedOmit<SimpleUserSchema, 'created_at'> | null;
|
||||
closed_at: string | null;
|
||||
target_branch: string;
|
||||
source_branch: string;
|
||||
user_notes_count: number;
|
||||
upvotes: number;
|
||||
downvotes: number;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
assignees: MappedOmit<UserSchema, 'created_at'>[] | null;
|
||||
assignee: MappedOmit<UserSchema, 'created_at'> | null;
|
||||
reviewers: MappedOmit<UserSchema, 'created_at'>[] | null;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
assignees: MappedOmit<SimpleUserSchema, 'created_at'>[] | null;
|
||||
assignee: MappedOmit<SimpleUserSchema, 'created_at'> | null;
|
||||
reviewers: MappedOmit<SimpleUserSchema, 'created_at'>[] | null;
|
||||
source_project_id: number;
|
||||
target_project_id: number;
|
||||
labels: string[] | SimpleLabelSchema[];
|
||||
@ -394,8 +394,8 @@ export class MergeRequests<C extends boolean = false> extends BaseResource<C> {
|
||||
projectId: string | number,
|
||||
mergerequestIId: number,
|
||||
options?: Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<MappedOmit<UserSchema, 'created_at'>[], C, E, void>> {
|
||||
return RequestHelper.get<MappedOmit<UserSchema, 'created_at'>[]>()(
|
||||
): Promise<GitlabAPIResponse<MappedOmit<SimpleUserSchema, 'created_at'>[], C, E, void>> {
|
||||
return RequestHelper.get<MappedOmit<SimpleUserSchema, 'created_at'>[]>()(
|
||||
this,
|
||||
endpoint`projects/${projectId}/merge_requests/${mergerequestIId}/participants`,
|
||||
options,
|
||||
|
||||
@ -9,14 +9,14 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { PipelineSchema } from './Pipelines';
|
||||
import type { CondensedMergeRequestSchema } from './MergeRequests';
|
||||
|
||||
export interface MergeTrainSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
merge_request: CondensedMergeRequestSchema;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
pipeline: PipelineSchema;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
|
||||
@ -8,7 +8,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { PipelineSchema } from './Pipelines';
|
||||
import type { PipelineVariableSchema } from './PipelineScheduleVariables';
|
||||
|
||||
@ -22,7 +22,7 @@ export interface CondensedPipelineScheduleSchema extends Record<string, unknown>
|
||||
active: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
owner: MappedOmit<UserSchema, 'created_at'>;
|
||||
owner: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
}
|
||||
|
||||
export interface PipelineScheduleSchema extends CondensedPipelineScheduleSchema {
|
||||
|
||||
@ -9,7 +9,7 @@ import type {
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { ExpandedPipelineSchema } from './Pipelines';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
|
||||
export interface PipelineTriggerTokenSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
@ -18,7 +18,7 @@ export interface PipelineTriggerTokenSchema extends Record<string, unknown> {
|
||||
last_used: string | null;
|
||||
token: string;
|
||||
updated_at: string;
|
||||
owner: MappedOmit<UserSchema, 'created_at'> | null;
|
||||
owner: MappedOmit<SimpleUserSchema, 'created_at'> | null;
|
||||
}
|
||||
|
||||
export class PipelineTriggerTokens<C extends boolean = false> extends BaseResource<C> {
|
||||
|
||||
@ -8,7 +8,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { PipelineVariableSchema } from './PipelineScheduleVariables';
|
||||
|
||||
export type CommitablePipelineStatus = 'pending' | 'running' | 'success' | 'failed' | 'canceled';
|
||||
@ -39,7 +39,7 @@ export interface ExpandedPipelineSchema extends PipelineSchema {
|
||||
before_sha: string;
|
||||
tag: boolean;
|
||||
yaml_errors?: unknown;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
started_at: string;
|
||||
finished_at: string;
|
||||
committed_at?: string;
|
||||
@ -97,7 +97,7 @@ export interface PipelineTestReportSummarySchema extends Record<string, unknown>
|
||||
failed: number;
|
||||
skipped: number;
|
||||
error: number;
|
||||
suite_error?: null;
|
||||
suite_error: string | null;
|
||||
};
|
||||
test_suites?: PipelineTestSuiteSchema[];
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { CommitSchema } from './Commits';
|
||||
import type { MilestoneSchema } from '../templates/ResourceMilestones';
|
||||
|
||||
@ -38,7 +38,7 @@ export interface ReleaseSchema extends Record<string, unknown> {
|
||||
name: string | null;
|
||||
created_at: string;
|
||||
released_at: string | null;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
commit: CommitSchema;
|
||||
milestones: MilestoneSchema[] | null;
|
||||
commit_path: string;
|
||||
|
||||
@ -11,7 +11,7 @@ import type {
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { ProjectRemoteMirrorSchema } from './ProjectRemoteMirrors';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { CondensedNamespaceSchema } from './Namespaces';
|
||||
import type { SimpleGroupSchema } from './Groups';
|
||||
import type { CustomAttributeSchema } from '../templates/ResourceCustomAttributes';
|
||||
@ -21,7 +21,7 @@ export type AccessLevelSettingState = 'disabled' | 'enabled' | 'private';
|
||||
|
||||
export interface ProjectStarrerSchema extends Record<string, unknown> {
|
||||
starred_since: string;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
}
|
||||
|
||||
export interface ProjectStoragePath extends Record<string, unknown> {
|
||||
@ -82,7 +82,7 @@ export interface ProjectSchema extends SimpleProjectSchema {
|
||||
merge_requests_template?: string;
|
||||
empty_repo: boolean;
|
||||
issues_template?: string;
|
||||
owner: Pick<UserSchema, 'id' | 'name' | 'created_at'>;
|
||||
owner: Pick<SimpleUserSchema, 'id' | 'name' | 'created_at'>;
|
||||
issues_enabled: boolean;
|
||||
open_issues_count: number;
|
||||
merge_requests_enabled: boolean;
|
||||
@ -483,8 +483,8 @@ export class Projects<C extends boolean = false> extends BaseResource<C> {
|
||||
allUsers<E extends boolean = false>(
|
||||
projectId: string | number,
|
||||
options?: { search?: string; skipUsers?: number[] } & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<MappedOmit<UserSchema, 'created_at'>[], C, E, void>> {
|
||||
return RequestHelper.get<MappedOmit<UserSchema, 'created_at'>[]>()(
|
||||
): Promise<GitlabAPIResponse<MappedOmit<SimpleUserSchema, 'created_at'>[], C, E, void>> {
|
||||
return RequestHelper.get<MappedOmit<SimpleUserSchema, 'created_at'>[]>()(
|
||||
this,
|
||||
endpoint`projects/${projectId}/users`,
|
||||
options,
|
||||
|
||||
@ -15,7 +15,7 @@ import type { MilestoneSchema } from '../templates/ResourceMilestones';
|
||||
import type { SimpleSnippetSchema } from './Snippets';
|
||||
import type { CommitSchema } from './Commits';
|
||||
import type { NoteSchema } from '../templates/ResourceNotes';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
|
||||
export interface BlobSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
@ -59,7 +59,7 @@ export class Search<C extends boolean = false> extends BaseResource<C> {
|
||||
Sudo &
|
||||
ShowExpanded<E> &
|
||||
PaginationRequestOptions<P>,
|
||||
): Promise<GitlabAPIResponse<UserSchema[], C, E, void>>;
|
||||
): Promise<GitlabAPIResponse<SimpleUserSchema[], C, E, void>>;
|
||||
|
||||
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
scope: 'notes',
|
||||
|
||||
@ -7,7 +7,7 @@ import type {
|
||||
Sudo,
|
||||
UserAgentDetailSchema,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
|
||||
export type SnippetVisibility = 'private' | 'public' | 'internal';
|
||||
|
||||
@ -16,7 +16,7 @@ export interface SimpleSnippetSchema extends Record<string, unknown> {
|
||||
title: string;
|
||||
file_name: string;
|
||||
description?: string;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
updated_at: string;
|
||||
created_at: string;
|
||||
project_id?: string | number;
|
||||
|
||||
@ -8,7 +8,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
import type { SimpleProjectSchema } from './Projects';
|
||||
|
||||
export type TodoAction =
|
||||
@ -31,7 +31,7 @@ export type TodoState = 'pending' | 'done';
|
||||
|
||||
export interface TodoSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
project: Pick<
|
||||
SimpleProjectSchema,
|
||||
'id' | 'name' | 'name_with_namespace' | 'path' | 'path_with_namespace'
|
||||
|
||||
@ -2,6 +2,7 @@ import { BaseResource } from '@gitbeaker/requester-utils';
|
||||
import { RequestHelper, endpoint } from '../infrastructure';
|
||||
import type {
|
||||
AllOrNone,
|
||||
AsAdmin,
|
||||
GitlabAPIResponse,
|
||||
PaginationRequestOptions,
|
||||
PaginationTypes,
|
||||
@ -14,34 +15,40 @@ import type { PersonalAccessTokenSchema } from './PersonalAccessTokens';
|
||||
import type { CustomAttributeSchema } from '../templates/ResourceCustomAttributes';
|
||||
import { AccessLevel } from '../constants';
|
||||
|
||||
export interface UserSchema extends Record<string, unknown> {
|
||||
export interface SimpleUserSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
name: string;
|
||||
username: string;
|
||||
state: string;
|
||||
avatar_url: string;
|
||||
web_url: string;
|
||||
created_at?: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface ExpandedUserSchema extends UserSchema {
|
||||
is_admin: boolean | null;
|
||||
export interface UserSchema extends SimpleUserSchema {
|
||||
locked: boolean | null;
|
||||
bio: string | null;
|
||||
bot: boolean;
|
||||
bot: boolean | null;
|
||||
location: string | null;
|
||||
public_email: string;
|
||||
skype: string;
|
||||
linkedin: string;
|
||||
twitter: string;
|
||||
website_url: string;
|
||||
public_email: string | null;
|
||||
skype: string | null;
|
||||
linkedin: string | null;
|
||||
twitter: string | null;
|
||||
discord: string | null;
|
||||
website_url: string | null;
|
||||
pronouns: string | null;
|
||||
organization: string | null;
|
||||
job_title: string | null;
|
||||
prnouns: string | null;
|
||||
work_information: string | null;
|
||||
followers: number | null;
|
||||
following: number | null;
|
||||
local_time: string | null;
|
||||
is_followed: boolean | null;
|
||||
}
|
||||
|
||||
export interface ExpandedUserSchema extends UserSchema {
|
||||
is_admin: boolean | null;
|
||||
bot: boolean;
|
||||
last_sign_in_at: string;
|
||||
confirmed_at: string;
|
||||
last_activity_on: string;
|
||||
@ -57,15 +64,21 @@ export interface ExpandedUserSchema extends UserSchema {
|
||||
two_factor_enabled: boolean;
|
||||
external: boolean;
|
||||
private_profile: string | null;
|
||||
current_sign_in_ip: string;
|
||||
last_sign_in_ip: string;
|
||||
namespace_id: number | null;
|
||||
created_by: string | null;
|
||||
shared_runners_minutes_limit: number | null;
|
||||
extra_shared_runners_minutes_limit: number | null;
|
||||
is_auditor: boolean | null;
|
||||
}
|
||||
|
||||
export interface AdminUserSchema extends ExpandedUserSchema {
|
||||
current_sign_in_ip: string;
|
||||
last_sign_in_ip: string;
|
||||
using_license_seat: boolean | null;
|
||||
provisioned_by_group_id: number | null;
|
||||
email_reset_offered_at: string | null;
|
||||
shared_runners_minutes_limit?: number | null;
|
||||
extra_shared_runners_minutes_limit?: number | null;
|
||||
is_auditor?: boolean | null;
|
||||
provisioned_by_group_id?: number | null;
|
||||
plan?: string;
|
||||
trial?: boolean;
|
||||
}
|
||||
|
||||
export interface UserActivitySchema extends Record<string, unknown> {
|
||||
@ -147,6 +160,7 @@ export type CreateUserOptions = {
|
||||
bio?: string;
|
||||
canCreateGroup?: boolean;
|
||||
colorSchemeId?: number;
|
||||
commitEmail?: string;
|
||||
email?: string;
|
||||
externUid?: string;
|
||||
external?: boolean;
|
||||
@ -161,7 +175,9 @@ export type CreateUserOptions = {
|
||||
password?: string;
|
||||
privateProfile?: string;
|
||||
projectsLimit?: number;
|
||||
pronouns?: string;
|
||||
provider?: string;
|
||||
publicEmail?: string;
|
||||
resetPassword?: boolean;
|
||||
sharedRunnersMinutesLimit?: number;
|
||||
skipConfirmation?: boolean;
|
||||
@ -219,28 +235,35 @@ export class Users<C extends boolean = false> extends BaseResource<C> {
|
||||
return RequestHelper.post<void>()(this, endpoint`users/${userId}/activate`, options);
|
||||
}
|
||||
|
||||
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
options?: AllUsersOptions &
|
||||
all<A extends boolean = false, E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
options?: { withCustomAttributes: true } & AsAdmin<A> &
|
||||
AllUsersOptions &
|
||||
PaginationRequestOptions<P> &
|
||||
Sudo &
|
||||
ShowExpanded<E> & { withCustomAttributes: true },
|
||||
ShowExpanded<E>,
|
||||
): Promise<
|
||||
GitlabAPIResponse<
|
||||
(ExpandedUserSchema & { custom_attributes: CustomAttributeSchema[] })[],
|
||||
((A extends false ? SimpleUserSchema : AdminUserSchema) & {
|
||||
custom_attributes: CustomAttributeSchema[];
|
||||
})[],
|
||||
C,
|
||||
E,
|
||||
P
|
||||
>
|
||||
>;
|
||||
|
||||
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
options?: AllUsersOptions & PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<ExpandedUserSchema[], C, E, P>>;
|
||||
all<A extends boolean = false, E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
options?: AllUsersOptions & AsAdmin<A> & PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<(A extends false ? SimpleUserSchema : AdminUserSchema)[], C, E, P>>;
|
||||
|
||||
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
options?: AllUsersOptions & PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<ExpandedUserSchema[], C, E, P>> {
|
||||
return RequestHelper.get<ExpandedUserSchema[]>()(this, 'users', options);
|
||||
all<A extends boolean = false, E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
options?: AllUsersOptions & AsAdmin<A> & PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<(A extends false ? SimpleUserSchema : AdminUserSchema)[], C, E, P>> {
|
||||
return RequestHelper.get<(A extends false ? SimpleUserSchema : AdminUserSchema)[]>()(
|
||||
this,
|
||||
'users',
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
allActivities<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
@ -259,15 +282,23 @@ export class Users<C extends boolean = false> extends BaseResource<C> {
|
||||
allFollowers<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
userId: number,
|
||||
options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<UserSchema[], C, E, P>> {
|
||||
return RequestHelper.get<UserSchema[]>()(this, endpoint`users/${userId}/followers`, options);
|
||||
): Promise<GitlabAPIResponse<SimpleUserSchema[], C, E, P>> {
|
||||
return RequestHelper.get<SimpleUserSchema[]>()(
|
||||
this,
|
||||
endpoint`users/${userId}/followers`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
allFollowing<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
userId: number,
|
||||
options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<UserSchema[], C, E, P>> {
|
||||
return RequestHelper.get<UserSchema[]>()(this, endpoint`users/${userId}/following`, options);
|
||||
): Promise<GitlabAPIResponse<SimpleUserSchema[], C, E, P>> {
|
||||
return RequestHelper.get<SimpleUserSchema[]>()(
|
||||
this,
|
||||
endpoint`users/${userId}/following`,
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
allMemberships<E extends boolean = false, P extends PaginationTypes = 'offset'>(
|
||||
@ -409,8 +440,8 @@ export class Users<C extends boolean = false> extends BaseResource<C> {
|
||||
|
||||
create<E extends boolean = false>(
|
||||
options?: CreateUserOptions & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<UserSchema | ExpandedUserSchema, C, E, void>> {
|
||||
return RequestHelper.post<UserSchema>()(this, 'users', options);
|
||||
): Promise<GitlabAPIResponse<ExpandedUserSchema, C, E, void>> {
|
||||
return RequestHelper.post<ExpandedUserSchema>()(this, 'users', options);
|
||||
}
|
||||
|
||||
createPersonalAccessToken<E extends boolean = false>(
|
||||
@ -458,7 +489,7 @@ export class Users<C extends boolean = false> extends BaseResource<C> {
|
||||
userId: number,
|
||||
options?: EditUserOptions & Sudo & ShowExpanded<E>,
|
||||
) {
|
||||
return RequestHelper.put<UserSchema>()(this, endpoint`users/${userId}`, options);
|
||||
return RequestHelper.put<ExpandedUserSchema>()(this, endpoint`users/${userId}`, options);
|
||||
}
|
||||
|
||||
editStatus<E extends boolean = false>(
|
||||
@ -494,8 +525,8 @@ export class Users<C extends boolean = false> extends BaseResource<C> {
|
||||
follow<E extends boolean = false>(
|
||||
userId: number,
|
||||
options?: Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<UserSchema, C, E, void>> {
|
||||
return RequestHelper.post<UserSchema>()(this, endpoint`users/${userId}/follow`, options);
|
||||
): Promise<GitlabAPIResponse<SimpleUserSchema, C, E, void>> {
|
||||
return RequestHelper.post<SimpleUserSchema>()(this, endpoint`users/${userId}/follow`, options);
|
||||
}
|
||||
|
||||
reject<E extends boolean = false>(
|
||||
@ -509,11 +540,11 @@ export class Users<C extends boolean = false> extends BaseResource<C> {
|
||||
);
|
||||
}
|
||||
|
||||
show<E extends boolean = false>(
|
||||
show<A extends boolean = false, E extends boolean = false>(
|
||||
userId: number,
|
||||
options?: Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<UserSchema | ExpandedUserSchema, C, E, void>> {
|
||||
return RequestHelper.get<UserSchema | ExpandedUserSchema>()(
|
||||
options?: AsAdmin<A> & Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<A extends false ? UserSchema : AdminUserSchema, C, E, void>> {
|
||||
return RequestHelper.get<A extends false ? UserSchema : AdminUserSchema>()(
|
||||
this,
|
||||
endpoint`users/${userId}`,
|
||||
options,
|
||||
@ -537,10 +568,16 @@ export class Users<C extends boolean = false> extends BaseResource<C> {
|
||||
);
|
||||
}
|
||||
|
||||
showCurrentUser<E extends boolean = false>(
|
||||
options?: Sudo & ShowExpanded<E>,
|
||||
): Promise<GitlabAPIResponse<ExpandedUserSchema, C, E, void>> {
|
||||
return RequestHelper.get<ExpandedUserSchema>()(this, 'user', options);
|
||||
showCurrentUser<A extends boolean = false, E extends boolean = false>(
|
||||
options?: AsAdmin<A> & Sudo & ShowExpanded<E>,
|
||||
): Promise<
|
||||
GitlabAPIResponse<A extends false ? ExpandedUserSchema : AdminUserSchema, C, E, void>
|
||||
> {
|
||||
return RequestHelper.get<A extends false ? ExpandedUserSchema : AdminUserSchema>()(
|
||||
this,
|
||||
'user',
|
||||
options,
|
||||
);
|
||||
}
|
||||
|
||||
showCurrentUserPreferences<E extends boolean = false>(
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import type { MappedOmit } from '../infrastructure';
|
||||
import type { UserSchema } from './Users';
|
||||
import type { SimpleUserSchema } from './Users';
|
||||
|
||||
// Sub / Base Schemas
|
||||
export interface WebhookRepositorySchema {
|
||||
@ -67,7 +67,7 @@ export interface BaseWebhookEventSchema {
|
||||
object_kind: string;
|
||||
event_name: string;
|
||||
project: WebhookProjectSchema;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
}
|
||||
|
||||
export interface WebhookBaseNoteEventSchema extends BaseWebhookEventSchema {
|
||||
@ -191,8 +191,8 @@ export interface WebhookIssueEventSchema extends BaseWebhookEventSchema {
|
||||
description: string;
|
||||
homepage: string;
|
||||
};
|
||||
assignees: Pick<UserSchema, 'name' | 'username' | 'avatar_url'>[] | null;
|
||||
assignee: Pick<UserSchema, 'name' | 'username' | 'avatar_url'> | null;
|
||||
assignees: Pick<SimpleUserSchema, 'name' | 'username' | 'avatar_url'>[] | null;
|
||||
assignee: Pick<SimpleUserSchema, 'name' | 'username' | 'avatar_url'> | null;
|
||||
labels: WebhookLabelSchema[] | null;
|
||||
changes: {
|
||||
updated_by_id: {
|
||||
@ -256,7 +256,7 @@ export interface WebhookMergeRequestNoteEventSchema extends WebhookBaseNoteEvent
|
||||
};
|
||||
work_in_progress: boolean;
|
||||
draft: boolean;
|
||||
assignee: Pick<UserSchema, 'name' | 'username' | 'avatar_url'> | null;
|
||||
assignee: Pick<SimpleUserSchema, 'name' | 'username' | 'avatar_url'> | null;
|
||||
detailed_merge_status: string;
|
||||
};
|
||||
}
|
||||
@ -377,7 +377,7 @@ export interface WebhookMergeRequestEventSchema extends BaseWebhookEventSchema {
|
||||
current: number | null;
|
||||
};
|
||||
};
|
||||
assignees: Pick<UserSchema, 'name' | 'username' | 'avatar_url'>[] | null;
|
||||
assignees: Pick<SimpleUserSchema, 'name' | 'username' | 'avatar_url'>[] | null;
|
||||
reviewers: WebhookLabelSchema[] | null;
|
||||
}
|
||||
|
||||
@ -466,7 +466,7 @@ export interface WebhookPipelineEventSchema
|
||||
when: string;
|
||||
manual: boolean;
|
||||
allow_failure: boolean;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
runner: {
|
||||
id: number;
|
||||
description: string;
|
||||
|
||||
@ -8,12 +8,12 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from '../resources/Users';
|
||||
import type { SimpleUserSchema } from '../resources/Users';
|
||||
|
||||
export interface AwardEmojiSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
name: string;
|
||||
user: UserSchema;
|
||||
user: SimpleUserSchema;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
awardable_id: number;
|
||||
|
||||
@ -10,7 +10,7 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from '../resources/Users';
|
||||
import type { SimpleUserSchema } from '../resources/Users';
|
||||
|
||||
export interface DiscussionNotePositionBaseSchema extends Record<string, unknown> {
|
||||
base_sha: string;
|
||||
@ -57,7 +57,7 @@ export interface DiscussionNoteSchema extends Record<string, unknown> {
|
||||
type: 'DiffNote' | 'DiscussionNote' | null;
|
||||
body: string;
|
||||
attachment: string | null;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
system: boolean;
|
||||
|
||||
@ -9,12 +9,12 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from '../resources/Users';
|
||||
import type { SimpleUserSchema } from '../resources/Users';
|
||||
import type { IterationSchema } from './ResourceIterations';
|
||||
|
||||
export interface IterationEventSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
created_at: string;
|
||||
resource_type: 'Issue';
|
||||
resource_id: number;
|
||||
|
||||
@ -9,12 +9,12 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from '../resources/Users';
|
||||
import type { SimpleUserSchema } from '../resources/Users';
|
||||
import type { LabelSchema } from './ResourceLabels';
|
||||
|
||||
export interface LabelEventSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
created_at: string;
|
||||
resource_type: 'Issue' | 'Epic' | 'MergeRequest';
|
||||
resource_id: number;
|
||||
|
||||
@ -9,12 +9,12 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from '../resources/Users';
|
||||
import type { SimpleUserSchema } from '../resources/Users';
|
||||
import type { MilestoneSchema } from './ResourceMilestones';
|
||||
|
||||
export interface MilestoneEventSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
created_at: string;
|
||||
resource_type: 'Issue' | 'MergeRequest';
|
||||
resource_id: number;
|
||||
|
||||
@ -9,13 +9,13 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import { UserSchema } from '../resources/Users';
|
||||
import { SimpleUserSchema } from '../resources/Users';
|
||||
|
||||
export interface NoteSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
body: string;
|
||||
attachment: string | null;
|
||||
author: MappedOmit<UserSchema, 'created_at'>;
|
||||
author: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
system: boolean;
|
||||
|
||||
@ -9,11 +9,11 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from '../resources/Users';
|
||||
import type { SimpleUserSchema } from '../resources/Users';
|
||||
|
||||
export interface StateEventSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
created_at: string;
|
||||
resource_type: 'Issue';
|
||||
resource_id: number;
|
||||
|
||||
@ -9,11 +9,11 @@ import type {
|
||||
ShowExpanded,
|
||||
Sudo,
|
||||
} from '../infrastructure';
|
||||
import type { UserSchema } from '../resources/Users';
|
||||
import type { SimpleUserSchema } from '../resources/Users';
|
||||
|
||||
export interface WeightEventSchema extends Record<string, unknown> {
|
||||
id: number;
|
||||
user: MappedOmit<UserSchema, 'created_at'>;
|
||||
user: MappedOmit<SimpleUserSchema, 'created_at'>;
|
||||
created_at: string;
|
||||
issue_id: number;
|
||||
weight: number;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user