Skip to content

Commit 3cd3b5d

Browse files
committed
More updates
# Conflicts: # packages/core/src/resources/Jobs.ts
1 parent 8eecc25 commit 3cd3b5d

23 files changed

Lines changed: 457 additions & 135 deletions

packages/core/src/resources/Helm.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BaseResource } from '@gitbeaker/requester-utils';
2-
import { RequestHelper, endpoint } from '../infrastructure';
2+
import { RequestHelper, createFormData, endpoint } from '../infrastructure';
33
import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure';
44

55
export class Helm<C extends boolean = false> extends BaseResource<C> {
@@ -8,10 +8,12 @@ export class Helm<C extends boolean = false> extends BaseResource<C> {
88
channel: string,
99
options?: Sudo & ShowExpanded<E>,
1010
): Promise<GitlabAPIResponse<Blob, void, E, void>> {
11+
const { sudo, showExpanded } = options || {};
12+
1113
return RequestHelper.get<Blob>()(
1214
this,
1315
endpoint`projects/${projectId}/packages/helm/${channel}/index.yaml`,
14-
options,
16+
{ sudo, showExpanded },
1517
);
1618
}
1719

@@ -21,10 +23,12 @@ export class Helm<C extends boolean = false> extends BaseResource<C> {
2123
filename: string,
2224
options?: Sudo & ShowExpanded<E>,
2325
): Promise<GitlabAPIResponse<Blob, void, E, void>> {
26+
const { sudo, showExpanded } = options || {};
27+
2428
return RequestHelper.get<Blob>()(
2529
this,
2630
endpoint`projects/${projectId}/packages/helm/${channel}/charts/${filename}.tgz`,
27-
options,
31+
{ sudo, showExpanded },
2832
);
2933
}
3034

@@ -34,13 +38,15 @@ export class Helm<C extends boolean = false> extends BaseResource<C> {
3438
chart: { content: Blob; filename: string },
3539
options?: Sudo & ShowExpanded<E>,
3640
): Promise<GitlabAPIResponse<void, C, E, void>> {
41+
const { sudo, showExpanded, ...body } = options || {};
42+
3743
return RequestHelper.post<void>()(
3844
this,
3945
endpoint`projects/${projectId}/packages/helm/api/${channel}/charts`,
4046
{
41-
isForm: true,
42-
...options,
43-
chart: [chart.content, chart.filename],
47+
sudo,
48+
showExpanded,
49+
body: createFormData({ ...body, chart: [chart.content, chart.filename] }),
4450
},
4551
);
4652
}

packages/core/src/resources/Import.ts

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,43 @@ export class Import<C extends boolean = false> extends BaseResource<C> {
2828
} & Sudo &
2929
ShowExpanded<E>,
3030
): Promise<GitlabAPIResponse<RepositoryImportStatusSchema, C, E, void>> {
31+
const { sudo, showExpanded, ...body } = options || {};
32+
3133
return RequestHelper.post<RepositoryImportStatusSchema>()(this, 'import/github', {
32-
personalAccessToken,
33-
repoId: repositoryId,
34-
targetNamespace,
35-
...options,
34+
sudo,
35+
showExpanded,
36+
body: {
37+
...body,
38+
personalAccessToken,
39+
repoId: repositoryId,
40+
targetNamespace,
41+
},
3642
});
3743
}
3844

3945
cancelGithubRepositoryImport<E extends boolean = false>(
4046
projectId: number,
4147
options?: Sudo & ShowExpanded<E>,
4248
): Promise<GitlabAPIResponse<RepositoryImportStatusSchema, C, E, void>> {
49+
const { sudo, showExpanded, ...body } = options || {};
50+
4351
return RequestHelper.post<RepositoryImportStatusSchema>()(this, 'import/github/cancel', {
44-
projectId,
45-
...options,
52+
sudo,
53+
showExpanded,
54+
body: { ...body, projectId },
4655
});
4756
}
4857

4958
importGithubGists<E extends boolean = false>(
5059
personalAccessToken: string,
5160
options?: Sudo & ShowExpanded<E>,
5261
): Promise<GitlabAPIResponse<void, C, E, void>> {
62+
const { sudo, showExpanded, ...body } = options || {};
63+
5364
return RequestHelper.post<void>()(this, 'import/github/gists', {
54-
personalAccessToken,
55-
...options,
65+
sudo,
66+
showExpanded,
67+
body: { ...body, personalAccessToken },
5668
});
5769
}
5870

@@ -64,13 +76,19 @@ export class Import<C extends boolean = false> extends BaseResource<C> {
6476
bitbucketServerRepository: string,
6577
options?: { newName?: string; targetNamespace?: string } & Sudo & ShowExpanded<E>,
6678
): Promise<GitlabAPIResponse<RepositoryImportStatusSchema, C, E, void>> {
79+
const { sudo, showExpanded, ...body } = options || {};
80+
6781
return RequestHelper.post<RepositoryImportStatusSchema>()(this, 'import/bitbucket_server', {
68-
bitbucketServerUrl,
69-
bitbucketServerUsername,
70-
personalAccessToken,
71-
bitbucketServerProject,
72-
bitbucketServerRepo: bitbucketServerRepository,
73-
...options,
82+
sudo,
83+
showExpanded,
84+
body: {
85+
...body,
86+
bitbucketServerUrl,
87+
bitbucketServerUsername,
88+
personalAccessToken,
89+
bitbucketServerProject,
90+
bitbucketServerRepo: bitbucketServerRepository,
91+
},
7492
});
7593
}
7694
}

packages/core/src/resources/InstanceLevelCICDVariables.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export class InstanceLevelCICDVariables<C extends boolean = false> extends BaseR
1515
all<E extends boolean = false>(
1616
options?: Sudo & ShowExpanded<E>,
1717
): Promise<GitlabAPIResponse<CICDVariableSchema[], C, E, void>> {
18-
return RequestHelper.get<CICDVariableSchema[]>()(this, 'admin/ci/variables', options);
18+
const { sudo, showExpanded } = options || {};
19+
20+
return RequestHelper.get<CICDVariableSchema[]>()(this, 'admin/ci/variables', { sudo, showExpanded });
1921
}
2022

2123
create<E extends boolean = false>(
@@ -29,10 +31,12 @@ export class InstanceLevelCICDVariables<C extends boolean = false> extends BaseR
2931
} & Sudo &
3032
ShowExpanded<E>,
3133
): Promise<GitlabAPIResponse<CICDVariableSchema, C, E, void>> {
34+
const { sudo, showExpanded, ...body } = options || {};
35+
3236
return RequestHelper.post<CICDVariableSchema>()(this, 'admin/ci/variables', {
33-
key,
34-
value,
35-
...options,
37+
sudo,
38+
showExpanded,
39+
body: { ...body, key, value },
3640
});
3741
}
3842

@@ -47,27 +51,34 @@ export class InstanceLevelCICDVariables<C extends boolean = false> extends BaseR
4751
} & Sudo &
4852
ShowExpanded<E>,
4953
): Promise<GitlabAPIResponse<CICDVariableSchema, C, E, void>> {
54+
const { sudo, showExpanded, ...body } = options || {};
55+
5056
return RequestHelper.put<CICDVariableSchema>()(this, endpoint`admin/ci/variables/${keyId}`, {
51-
value,
52-
...options,
57+
sudo,
58+
showExpanded,
59+
body: { ...body, value },
5360
});
5461
}
5562

5663
show<E extends boolean = false>(
5764
keyId: string,
5865
options?: Sudo & ShowExpanded<E>,
5966
): Promise<GitlabAPIResponse<CICDVariableSchema, C, E, void>> {
67+
const { sudo, showExpanded } = options || {};
68+
6069
return RequestHelper.get<CICDVariableSchema>()(
6170
this,
6271
endpoint`admin/ci/variables/${keyId}`,
63-
options,
72+
{ sudo, showExpanded },
6473
);
6574
}
6675

6776
remove<E extends boolean = false>(
6877
keyId: string,
6978
options?: Sudo & ShowExpanded<E>,
7079
): Promise<GitlabAPIResponse<void, C, E, void>> {
71-
return RequestHelper.get<void>()(this, endpoint`admin/ci/variables/${keyId}`, options);
80+
const { sudo, showExpanded } = options || {};
81+
82+
return RequestHelper.del<void>()(this, endpoint`admin/ci/variables/${keyId}`, { sudo, showExpanded });
7283
}
7384
}

packages/core/src/resources/Integrations.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ export class Integrations<C extends boolean = false> extends BaseResource<C> {
6262
projectId: string | number,
6363
options?: Sudo & ShowExpanded<E>,
6464
): Promise<GitlabAPIResponse<IntegrationSchema[], C, E, void>> {
65+
const { sudo, showExpanded } = options || {};
66+
6567
return RequestHelper.get<IntegrationSchema[]>()(
6668
this,
6769
endpoint`projects/${projectId}/integrations`,
68-
options,
70+
{ sudo, showExpanded },
6971
);
7072
}
7173

@@ -74,10 +76,12 @@ export class Integrations<C extends boolean = false> extends BaseResource<C> {
7476
integrationName: SupportedIntegration,
7577
options?: BaseRequestOptions<E>,
7678
): Promise<GitlabAPIResponse<IntegrationSchema, C, E, void>> {
79+
const { sudo, showExpanded, ...body } = options || {};
80+
7781
return RequestHelper.put<IntegrationSchema>()(
7882
this,
7983
endpoint`projects/${projectId}/integrations/${integrationName}`,
80-
options,
84+
{ sudo, showExpanded, body },
8185
);
8286
}
8387

@@ -86,10 +90,12 @@ export class Integrations<C extends boolean = false> extends BaseResource<C> {
8690
integrationName: SupportedIntegration,
8791
options?: Sudo & ShowExpanded<E>,
8892
): Promise<GitlabAPIResponse<void, C, E, void>> {
93+
const { sudo, showExpanded } = options || {};
94+
8995
return RequestHelper.del()(
9096
this,
9197
endpoint`projects/${projectId}/integrations/${integrationName}`,
92-
options,
98+
{ sudo, showExpanded },
9399
);
94100
}
95101

@@ -98,10 +104,12 @@ export class Integrations<C extends boolean = false> extends BaseResource<C> {
98104
integrationName: SupportedIntegration,
99105
options?: Sudo & ShowExpanded<E>,
100106
): Promise<GitlabAPIResponse<IntegrationSchema, C, E, void>> {
107+
const { sudo, showExpanded } = options || {};
108+
101109
return RequestHelper.get<IntegrationSchema>()(
102110
this,
103111
endpoint`projects/${projectId}/integrations/${integrationName}`,
104-
options,
112+
{ sudo, showExpanded },
105113
);
106114
}
107115
}

packages/core/src/resources/IssueAwardEmojis.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { BaseResourceOptions } from '@gitbeaker/requester-utils';
22
import { ResourceAwardEmojis } from '../templates';
33
import type { AwardEmojiSchema } from '../templates/ResourceAwardEmojis';
44
import type {
5+
BaseRequestSearchParams,
56
GitlabAPIResponse,
67
PaginationRequestOptions,
78
PaginationTypes,
@@ -13,7 +14,7 @@ export interface IssueAwardEmojis<C extends boolean = false> extends ResourceAwa
1314
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
1415
projectId: string | number,
1516
issueIId: number,
16-
options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
17+
options?: PaginationRequestOptions<P> & BaseRequestSearchParams & Sudo & ShowExpanded<E>,
1718
): Promise<GitlabAPIResponse<AwardEmojiSchema[], C, E, P>>;
1819

1920
award<E extends boolean = false>(

packages/core/src/resources/IssueDiscussions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { BaseResourceOptions } from '@gitbeaker/requester-utils';
22
import { ResourceDiscussions } from '../templates';
33
import type { DiscussionNoteSchema, DiscussionSchema } from '../templates/ResourceDiscussions';
44
import type {
5+
BaseRequestSearchParams,
56
GitlabAPIResponse,
67
PaginationRequestOptions,
78
PaginationTypes,
@@ -21,7 +22,7 @@ export interface IssueDiscussions<C extends boolean = false> extends ResourceDis
2122
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
2223
projectId: string | number,
2324
issueIId: number,
24-
options?: PaginationRequestOptions<P> & Sudo & ShowExpanded<E>,
25+
options?: PaginationRequestOptions<P> & BaseRequestSearchParams & Sudo & ShowExpanded<E>,
2526
): Promise<GitlabAPIResponse<DiscussionSchema[], C, E, P>>;
2627

2728
create<E extends boolean = false>(

packages/core/src/resources/IssueIterationEvents.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { BaseResourceOptions } from '@gitbeaker/requester-utils';
22
import { ResourceIterationEvents } from '../templates';
33
import type { IterationEventSchema } from '../templates/ResourceIterationEvents';
44
import type {
5+
BaseRequestSearchParams,
56
GitlabAPIResponse,
67
PaginationRequestOptions,
78
PaginationTypes,
@@ -13,7 +14,7 @@ export interface IssueIterationEvents<C extends boolean = false> {
1314
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
1415
projectId: string | number,
1516
issueIId: number,
16-
options?: Sudo & ShowExpanded<E> & PaginationRequestOptions<P>,
17+
options?: Sudo & ShowExpanded<E> & PaginationRequestOptions<P> & BaseRequestSearchParams,
1718
): Promise<GitlabAPIResponse<IterationEventSchema[], C, E, P>>;
1819

1920
show<E extends boolean = false>(

packages/core/src/resources/IssueLabelEvents.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { BaseResourceOptions } from '@gitbeaker/requester-utils';
22
import { ResourceLabelEvents } from '../templates';
33
import type { LabelEventSchema } from '../templates/ResourceLabelEvents';
44
import type {
5+
BaseRequestSearchParams,
56
GitlabAPIResponse,
67
PaginationRequestOptions,
78
PaginationTypes,
@@ -13,7 +14,7 @@ export interface IssueLabelEvents<C extends boolean = false> {
1314
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
1415
projectId: string | number,
1516
issueIId: number,
16-
options?: Sudo & ShowExpanded<E> & PaginationRequestOptions<P>,
17+
options?: Sudo & ShowExpanded<E> & PaginationRequestOptions<P> & BaseRequestSearchParams,
1718
): Promise<GitlabAPIResponse<LabelEventSchema[], C, E, P>>;
1819

1920
show<E extends boolean = false>(

packages/core/src/resources/IssueLinks.ts

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { BaseResource } from '@gitbeaker/requester-utils';
22
import { RequestHelper, endpoint } from '../infrastructure';
33
import type {
4+
BaseRequestSearchParams,
45
GitlabAPIResponse,
56
MappedOmit,
67
PaginationRequestOptions,
8+
PaginationRequestSearchParams,
79
PaginationTypes,
810
ShowExpanded,
911
Sudo,
@@ -50,12 +52,19 @@ export class IssueLinks<C extends boolean = false> extends BaseResource<C> {
5052
all<E extends boolean = false, P extends PaginationTypes = 'offset'>(
5153
projectId: string | number,
5254
issueIId: number,
53-
options?: Sudo & ShowExpanded<E> & PaginationRequestOptions<P>,
55+
options?: Sudo & ShowExpanded<E> & PaginationRequestOptions<P> & BaseRequestSearchParams,
5456
): Promise<GitlabAPIResponse<IssueLinkSchema[], C, E, P>> {
57+
const { sudo, showExpanded, maxPages, ...searchParams } = options || {};
58+
5559
return RequestHelper.get<IssueLinkSchema[]>()(
5660
this,
5761
endpoint`projects/${projectId}/issues/${issueIId}/links`,
58-
options,
62+
{
63+
sudo,
64+
showExpanded,
65+
maxPages,
66+
searchParams: searchParams as PaginationRequestSearchParams<P> & BaseRequestSearchParams,
67+
},
5968
);
6069
}
6170

@@ -66,13 +75,19 @@ export class IssueLinks<C extends boolean = false> extends BaseResource<C> {
6675
targetIssueIId: number,
6776
options?: { linkType?: 'relates_to' | 'blocks' | 'is_blocked_by' } & Sudo & ShowExpanded<E>,
6877
): Promise<GitlabAPIResponse<ExpandedIssueLinkSchema, C, E, void>> {
78+
const { sudo, showExpanded, ...body } = options || {};
79+
6980
return RequestHelper.post<ExpandedIssueLinkSchema>()(
7081
this,
7182
endpoint`projects/${projectId}/issues/${issueIId}/links`,
7283
{
73-
targetProjectId,
74-
targetIssueIid: targetIssueIId,
75-
...options,
84+
sudo,
85+
showExpanded,
86+
body: {
87+
...body,
88+
targetProjectId,
89+
targetIssueIid: targetIssueIId,
90+
},
7691
},
7792
);
7893
}
@@ -83,10 +98,12 @@ export class IssueLinks<C extends boolean = false> extends BaseResource<C> {
8398
issueLinkId: number,
8499
options?: { linkType?: 'relates_to' | 'blocks' | 'is_blocked_by' } & Sudo & ShowExpanded<E>,
85100
): Promise<GitlabAPIResponse<ExpandedIssueLinkSchema, C, E, void>> {
101+
const { sudo, showExpanded, ...body } = options || {};
102+
86103
return RequestHelper.del<ExpandedIssueLinkSchema>()(
87104
this,
88105
endpoint`projects/${projectId}/issues/${issueIId}/links/${issueLinkId}`,
89-
options,
106+
{ sudo, showExpanded, body },
90107
);
91108
}
92109
}

0 commit comments

Comments
 (0)