Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating ProjectSchema to include marked_for_deletion_on and adding includeHidden and includePendingDelete to AllProjectOptions #3583

Merged
merged 3 commits into from
May 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 99 additions & 71 deletions packages/core/src/resources/Projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,92 +77,108 @@ export interface SimpleProjectSchema extends CondensedProjectSchema {
}

export interface ProjectSchema extends SimpleProjectSchema {
issues_template?: string;
description_html: string;
visibility: 'public' | 'internal' | 'private';
merge_requests_template?: string;
mirror_trigger_builds?: boolean;
container_registry_image_prefix: string;
_links: {
self: string;
issues: string;
merge_requests: string;
repo_branches: string;
labels: string;
events: string;
members: string;
cluster_agents: string;
};
packages_enabled: boolean;
empty_repo: boolean;
archived: boolean;
visibility: 'public' | 'internal' | 'private';
issues_template?: string;
owner: Pick<UserSchema, 'id' | 'name' | 'created_at'>;
resolve_outdated_diff_discussions: boolean;
container_expiration_policy: {
cadence: string;
enabled: boolean;
keep_n: number;
older_than: string;
name_regex: string;
name_regex_keep?: null;
next_run_at: string;
};
issues_enabled: boolean;
open_issues_count: number;
merge_requests_enabled: boolean;
wiki_enabled: boolean;
jobs_enabled: boolean;
wiki_enabled: boolean;
snippets_enabled: boolean;
container_registry_enabled: boolean;
service_desk_enabled: boolean;
can_create_merge_request_in: boolean;
issues_access_level: string;
repository_access_level: string;
merge_requests_access_level: string;
forking_access_level: string;
wiki_access_level: string;
builds_access_level: string;
snippets_access_level: string;
pages_access_level: string;
analytics_access_level: string;
resolve_outdated_diff_discussions: boolean;
container_registry_access_level: string;
security_and_compliance_access_level: string;
releases_access_level: string;
environments_access_level: string;
feature_flags_access_level: string;
infrastructure_access_level: string;
monitor_access_level: string;
emails_disabled?: boolean;
shared_runners_enabled: boolean;
lfs_enabled: boolean;
container_expiration_policy: {
cadence: string;
enabled: boolean;
keep_n: number | null;
older_than: string | null;
name_regex_delete: string | null;
name_regex_keep: string | null;
next_run_at: string;
};
updated_at: string;
creator_id: number;
import_url: string | null;
import_type: string | null;
import_status: string;
open_issues_count: number;
description_html: string;
updated_at: string;
ci_config_path: string;
import_error: string | null;
permissions: {
project_access: {
access_level: number;
notification_level: number;
};
group_access: {
access_level: number;
notification_level: number;
};
};
archived: boolean;
license_url: string;
license: ProjectLicenseSchema;
shared_runners_enabled: boolean;
group_runners_enabled: boolean;
runners_token: string;
ci_default_git_depth: number;
ci_forward_deployment_enabled: boolean;
ci_forward_deployment_rollback_allowed: boolean;
ci_allow_fork_pipelines_to_run_in_parent_project: boolean;
ci_separated_caches: boolean;
ci_restrict_pipeline_cancellation_role: string;
public_jobs: boolean;
shared_with_groups?: string[];
shared_with_groups:
| {
group_id: number;
group_name: string;
group_full_path: string;
group_access_level: number;
}[]
| null;
repository_storage: string;
only_allow_merge_if_pipeline_succeeds: boolean;
allow_merge_on_skipped_pipeline?: boolean;
request_access_enabled: boolean;
allow_merge_on_skipped_pipeline: boolean;
restrict_user_defined_variables: boolean;
only_allow_merge_if_all_discussions_are_resolved: boolean;
remove_source_branch_after_merge: boolean;
printing_merge_request_link_enabled: boolean;
printing_merge_requests_link_enabled: boolean;
request_access_enabled: boolean;
merge_method: string;
squash_option: string;
enforce_auth_checks_on_uploads: boolean;
suggestion_commit_message?: string;
merge_commit_template?: string;
squash_commit_template?: string;
issue_branch_template?: string;
auto_devops_enabled: boolean;
auto_devops_deploy_strategy: string;
mirror: boolean;
mirror_user_id: number;
mirror_trigger_builds: boolean;
only_mirror_protected_branches: boolean;
mirror_overwrites_diverged_branches: boolean;
external_authorization_classification_label: string | null;
packages_enabled: boolean;
service_desk_enabled: boolean;
service_desk_address: string | null;
autoclose_referenced_issues: boolean;
external_authorization_classification_label: string;
requirements_enabled: boolean;
requirements_access_level: string;
security_and_compliance_enabled: boolean;
compliance_frameworks?: string[];
permissions: {
project_access?: null;
group_access?: null;
suggestion_commit_message: string | null;
enforce_auth_checks_on_uploads: boolean;
merge_commit_template: string | null;
squash_commit_template: string | null;
issue_branch_template: string;
marked_for_deletion_on: string;
compliance_frameworks: string[] | null;
warn_about_potentially_unwanted_characters: boolean;
container_registry_image_prefix: string;
_links: {
self: string;
issues: string;
merge_requests: string;
repo_branches: string;
labels: string;
events: string;
members: string;
cluster_agents: string;
};
}

Expand All @@ -174,15 +190,29 @@ export interface ProjectFileUploadSchema extends Record<string, unknown> {
}

export type AllProjectsOptions = {
userId?: string;
archived?: boolean;
idAfter?: number;
idBefore?: number;
imported?: boolean;
includeHidden?: boolean;
includePendingDelete?: boolean;
lastActivityAfter?: string;
lastActivityBefore?: string;
membership?: boolean;
minAccessLevel?: Exclude<AccessLevel, AccessLevel.ADMIN>;
orderBy?: 'id' | 'name' | 'path' | 'created_at' | 'updated_at' | 'last_activity_at';
orderBy?:
| 'id'
| 'name'
| 'path'
| 'created_at'
| 'updated_at'
| 'last_activity_at'
| 'similarity'
| 'repository_size'
| 'storage_size'
| 'packages_size'
| 'wiki_size';
owned?: boolean;
repositoryChecksumFailed?: boolean;
repositoryStorage?: string;
Expand Down Expand Up @@ -428,9 +458,7 @@ export class Projects<C extends boolean = false> extends BaseResource<C> {
userId,
starredOnly,
...options
}: { userId?: number; starredOnly?: boolean } & AllProjectsOptions &
PaginationRequestOptions<P> &
BaseRequestOptions<E> = {} as any,
}: AllProjectsOptions & PaginationRequestOptions<P> & BaseRequestOptions<E> = {} as any,
): Promise<GitlabAPIResponse<Record<string, unknown>[], C, E, P>> {
let uri: string;

Expand Down