@apiclient.xyz/gitlab 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist_ts/gitlab.classes.branch.d.ts +7 -0
  2. package/dist_ts/gitlab.classes.branch.js +13 -0
  3. package/dist_ts/gitlab.classes.gitlabclient.d.ts +112 -81
  4. package/dist_ts/gitlab.classes.gitlabclient.js +236 -156
  5. package/dist_ts/gitlab.classes.group.d.ts +47 -0
  6. package/dist_ts/gitlab.classes.group.js +97 -0
  7. package/dist_ts/gitlab.classes.job.d.ts +29 -0
  8. package/dist_ts/gitlab.classes.job.js +74 -0
  9. package/dist_ts/gitlab.classes.pipeline.d.ts +32 -0
  10. package/dist_ts/gitlab.classes.pipeline.js +87 -0
  11. package/dist_ts/gitlab.classes.project.d.ts +63 -0
  12. package/dist_ts/gitlab.classes.project.js +122 -0
  13. package/dist_ts/gitlab.classes.protectedbranch.d.ts +8 -0
  14. package/dist_ts/gitlab.classes.protectedbranch.js +15 -0
  15. package/dist_ts/gitlab.classes.tag.d.ts +7 -0
  16. package/dist_ts/gitlab.classes.tag.js +13 -0
  17. package/dist_ts/gitlab.classes.testreport.d.ts +34 -0
  18. package/dist_ts/gitlab.classes.testreport.js +67 -0
  19. package/dist_ts/gitlab.classes.variable.d.ts +18 -0
  20. package/dist_ts/gitlab.classes.variable.js +35 -0
  21. package/dist_ts/gitlab.helpers.d.ts +8 -0
  22. package/dist_ts/gitlab.helpers.js +23 -0
  23. package/dist_ts/index.d.ts +10 -0
  24. package/dist_ts/index.js +15 -1
  25. package/package.json +1 -1
  26. package/readme.md +468 -163
  27. package/ts/gitlab.classes.branch.ts +18 -0
  28. package/ts/gitlab.classes.gitlabclient.ts +297 -196
  29. package/ts/gitlab.classes.group.ts +137 -0
  30. package/ts/gitlab.classes.job.ts +104 -0
  31. package/ts/gitlab.classes.pipeline.ts +122 -0
  32. package/ts/gitlab.classes.project.ts +177 -0
  33. package/ts/gitlab.classes.protectedbranch.ts +21 -0
  34. package/ts/gitlab.classes.tag.ts +18 -0
  35. package/ts/gitlab.classes.testreport.ts +97 -0
  36. package/ts/gitlab.classes.variable.ts +50 -0
  37. package/ts/gitlab.helpers.ts +26 -0
  38. package/ts/index.ts +19 -0
@@ -0,0 +1,7 @@
1
+ import type { IGitLabBranch } from './gitlab.interfaces.js';
2
+ export declare class GitLabBranch {
3
+ readonly name: string;
4
+ readonly commitSha: string;
5
+ constructor(raw: IGitLabBranch);
6
+ toJSON(): IGitLabBranch;
7
+ }
@@ -0,0 +1,13 @@
1
+ export class GitLabBranch {
2
+ constructor(raw) {
3
+ this.name = raw.name || '';
4
+ this.commitSha = raw.commit?.id || '';
5
+ }
6
+ toJSON() {
7
+ return {
8
+ name: this.name,
9
+ commit: { id: this.commitSha },
10
+ };
11
+ }
12
+ }
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2l0bGFiLmNsYXNzZXMuYnJhbmNoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvZ2l0bGFiLmNsYXNzZXMuYnJhbmNoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE1BQU0sT0FBTyxZQUFZO0lBSXZCLFlBQVksR0FBa0I7UUFDNUIsSUFBSSxDQUFDLElBQUksR0FBRyxHQUFHLENBQUMsSUFBSSxJQUFJLEVBQUUsQ0FBQztRQUMzQixJQUFJLENBQUMsU0FBUyxHQUFHLEdBQUcsQ0FBQyxNQUFNLEVBQUUsRUFBRSxJQUFJLEVBQUUsQ0FBQztJQUN4QyxDQUFDO0lBRUQsTUFBTTtRQUNKLE9BQU87WUFDTCxJQUFJLEVBQUUsSUFBSSxDQUFDLElBQUk7WUFDZixNQUFNLEVBQUUsRUFBRSxFQUFFLEVBQUUsSUFBSSxDQUFDLFNBQVMsRUFBRTtTQUMvQixDQUFDO0lBQ0osQ0FBQztDQUNGIn0=
@@ -1,108 +1,139 @@
1
1
  import type { IGitLabProject, IGitLabGroup, IGitLabVariable, IVariableOptions, IGitLabProtectedBranch, IGitLabBranch, IGitLabTag, IGitLabPipeline, IGitLabPipelineVariable, IGitLabTestReport, IGitLabJob, ITestConnectionResult, IListOptions, IPipelineListOptions, IJobListOptions } from './gitlab.interfaces.js';
2
+ import { GitLabGroup } from './gitlab.classes.group.js';
3
+ import { GitLabProject } from './gitlab.classes.project.js';
2
4
  export declare class GitLabClient {
3
5
  private baseUrl;
4
6
  private token;
5
7
  constructor(baseUrl: string, token: string);
6
- private request;
7
- private requestText;
8
+ /** @internal */
9
+ request<T = any>(method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string, data?: any, customHeaders?: Record<string, string>): Promise<T>;
10
+ /** @internal */
11
+ requestText(method: 'GET' | 'POST' | 'PUT' | 'DELETE', path: string): Promise<string>;
12
+ /** @internal — multipart form upload (for avatars) */
13
+ requestMultipart<T = any>(method: 'PUT' | 'POST', path: string, formData: FormData): Promise<T>;
14
+ /** @internal — fetch binary data (e.g. avatar images) */
15
+ requestBinary(url: string): Promise<Uint8Array>;
8
16
  testConnection(): Promise<ITestConnectionResult>;
9
17
  /**
10
- * Get a single group by its full path (e.g. "foss.global" or "foss.global/push.rocks")
18
+ * Get all groups (auto-paginated).
11
19
  */
12
- getGroupByPath(fullPath: string): Promise<IGitLabGroup>;
20
+ getGroups(opts?: IListOptions): Promise<GitLabGroup[]>;
13
21
  /**
14
- * List projects within a group (includes subgroups when include_subgroups=true)
22
+ * Get a single group by full path.
15
23
  */
16
- getGroupProjects(groupId: number | string, opts?: IListOptions): Promise<IGitLabProject[]>;
24
+ getGroup(fullPath: string): Promise<GitLabGroup>;
17
25
  /**
18
- * List all descendant groups (recursive subgroups) within a group
26
+ * Create a new group.
19
27
  */
20
- getDescendantGroups(groupId: number | string, opts?: IListOptions): Promise<IGitLabGroup[]>;
28
+ createGroup(name: string, path: string, parentId?: number): Promise<GitLabGroup>;
21
29
  /**
22
- * Create a new group. Optionally nested under a parent group.
30
+ * Get all projects (auto-paginated, membership=true).
23
31
  */
24
- createGroup(name: string, path: string, parentId?: number): Promise<IGitLabGroup>;
32
+ getProjects(opts?: IListOptions): Promise<GitLabProject[]>;
25
33
  /**
26
- * Create a new project (repository).
34
+ * Get a single project by ID or path.
35
+ */
36
+ getProject(idOrPath: number | string): Promise<GitLabProject>;
37
+ /**
38
+ * Create a new project.
27
39
  */
28
40
  createProject(name: string, opts?: {
29
41
  path?: string;
30
42
  namespaceId?: number;
31
43
  visibility?: string;
32
44
  description?: string;
45
+ }): Promise<GitLabProject>;
46
+ /** @internal */
47
+ requestGetGroups(opts?: IListOptions): Promise<IGitLabGroup[]>;
48
+ /** @internal */
49
+ requestGetGroupByPath(fullPath: string): Promise<IGitLabGroup>;
50
+ /** @internal */
51
+ requestGetGroupProjects(groupId: number | string, opts?: IListOptions): Promise<IGitLabProject[]>;
52
+ /** @internal */
53
+ requestGetDescendantGroups(groupId: number | string, opts?: IListOptions): Promise<IGitLabGroup[]>;
54
+ /** @internal */
55
+ requestCreateGroup(name: string, path: string, parentId?: number): Promise<IGitLabGroup>;
56
+ /** @internal */
57
+ requestUpdateGroup(groupId: number | string, data: Record<string, any>): Promise<void>;
58
+ /** @internal */
59
+ requestSetGroupAvatar(groupId: number | string, imageData: Uint8Array, filename: string): Promise<void>;
60
+ /** @internal */
61
+ requestTransferGroup(groupId: number | string, parentGroupId: number): Promise<void>;
62
+ /** @internal */
63
+ requestDeleteGroup(groupId: number | string): Promise<void>;
64
+ /** @internal */
65
+ requestGetProjects(opts?: IListOptions): Promise<IGitLabProject[]>;
66
+ /** @internal */
67
+ requestGetProject(idOrPath: number | string): Promise<IGitLabProject>;
68
+ /** @internal */
69
+ requestCreateProject(name: string, opts?: {
70
+ path?: string;
71
+ namespaceId?: number;
72
+ visibility?: string;
73
+ description?: string;
33
74
  }): Promise<IGitLabProject>;
34
- getProjects(opts?: IListOptions): Promise<IGitLabProject[]>;
35
- getGroups(opts?: IListOptions): Promise<IGitLabGroup[]>;
36
- getProjectVariables(projectId: number | string): Promise<IGitLabVariable[]>;
37
- createProjectVariable(projectId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
38
- updateProjectVariable(projectId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
39
- deleteProjectVariable(projectId: number | string, key: string): Promise<void>;
40
- getGroupVariables(groupId: number | string): Promise<IGitLabVariable[]>;
41
- createGroupVariable(groupId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
42
- updateGroupVariable(groupId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
43
- deleteGroupVariable(groupId: number | string, key: string): Promise<void>;
44
- /**
45
- * List pipelines for a project with optional filters.
46
- * Supports status, ref, source, scope, username, date range, ordering.
47
- */
48
- getPipelines(projectId: number | string, opts?: IPipelineListOptions): Promise<IGitLabPipeline[]>;
49
- /**
50
- * Get a single pipeline's full details.
51
- */
52
- getPipeline(projectId: number | string, pipelineId: number): Promise<IGitLabPipeline>;
53
- /**
54
- * Trigger a new pipeline on the given ref, optionally with variables.
55
- */
56
- triggerPipeline(projectId: number | string, ref: string, variables?: {
75
+ /** @internal */
76
+ requestUpdateProject(projectId: number | string, data: Record<string, any>): Promise<void>;
77
+ /** @internal */
78
+ requestSetProjectAvatar(projectId: number | string, imageData: Uint8Array, filename: string): Promise<void>;
79
+ /** @internal */
80
+ requestTransferProject(projectId: number | string, namespaceId: number): Promise<void>;
81
+ /** @internal */
82
+ requestDeleteProject(projectId: number | string): Promise<void>;
83
+ /** @internal */
84
+ requestGetRepoBranches(projectId: number | string, opts?: IListOptions): Promise<IGitLabBranch[]>;
85
+ /** @internal */
86
+ requestGetRepoTags(projectId: number | string, opts?: IListOptions): Promise<IGitLabTag[]>;
87
+ /** @internal */
88
+ requestGetProtectedBranches(projectId: number | string): Promise<IGitLabProtectedBranch[]>;
89
+ /** @internal */
90
+ requestUnprotectBranch(projectId: number | string, branchName: string): Promise<void>;
91
+ /** @internal */
92
+ requestGetProjectVariables(projectId: number | string): Promise<IGitLabVariable[]>;
93
+ /** @internal */
94
+ requestCreateProjectVariable(projectId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
95
+ /** @internal */
96
+ requestUpdateProjectVariable(projectId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
97
+ /** @internal */
98
+ requestDeleteProjectVariable(projectId: number | string, key: string): Promise<void>;
99
+ /** @internal */
100
+ requestGetGroupVariables(groupId: number | string): Promise<IGitLabVariable[]>;
101
+ /** @internal */
102
+ requestCreateGroupVariable(groupId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
103
+ /** @internal */
104
+ requestUpdateGroupVariable(groupId: number | string, key: string, value: string, opts?: IVariableOptions): Promise<IGitLabVariable>;
105
+ /** @internal */
106
+ requestDeleteGroupVariable(groupId: number | string, key: string): Promise<void>;
107
+ /** @internal */
108
+ requestGetPipelines(projectId: number | string, opts?: IPipelineListOptions): Promise<IGitLabPipeline[]>;
109
+ /** @internal */
110
+ requestGetPipeline(projectId: number | string, pipelineId: number): Promise<IGitLabPipeline>;
111
+ /** @internal */
112
+ requestTriggerPipeline(projectId: number | string, ref: string, variables?: {
57
113
  key: string;
58
114
  value: string;
59
115
  variable_type?: string;
60
116
  }[]): Promise<IGitLabPipeline>;
61
- /**
62
- * Delete a pipeline and all its jobs.
63
- */
64
- deletePipeline(projectId: number | string, pipelineId: number): Promise<void>;
65
- /**
66
- * Get variables used in a specific pipeline run.
67
- */
68
- getPipelineVariables(projectId: number | string, pipelineId: number): Promise<IGitLabPipelineVariable[]>;
69
- /**
70
- * Get the test report for a pipeline.
71
- */
72
- getPipelineTestReport(projectId: number | string, pipelineId: number): Promise<IGitLabTestReport>;
73
- retryPipeline(projectId: number | string, pipelineId: number): Promise<IGitLabPipeline>;
74
- cancelPipeline(projectId: number | string, pipelineId: number): Promise<IGitLabPipeline>;
75
- /**
76
- * List jobs for a pipeline with optional scope filter and pagination.
77
- */
78
- getPipelineJobs(projectId: number | string, pipelineId: number, opts?: IJobListOptions): Promise<IGitLabJob[]>;
79
- /**
80
- * Get a single job's full details.
81
- */
82
- getJob(projectId: number | string, jobId: number): Promise<IGitLabJob>;
83
- /**
84
- * Get a job's raw log (trace) output.
85
- */
86
- getJobLog(projectId: number | string, jobId: number): Promise<string>;
87
- /**
88
- * Retry a single job.
89
- */
90
- retryJob(projectId: number | string, jobId: number): Promise<IGitLabJob>;
91
- /**
92
- * Cancel a running job.
93
- */
94
- cancelJob(projectId: number | string, jobId: number): Promise<IGitLabJob>;
95
- /**
96
- * Trigger a manual job (play action).
97
- */
98
- playJob(projectId: number | string, jobId: number): Promise<IGitLabJob>;
99
- /**
100
- * Erase a job's trace and artifacts.
101
- */
102
- eraseJob(projectId: number | string, jobId: number): Promise<void>;
103
- getRepoBranches(projectId: number | string, opts?: IListOptions): Promise<IGitLabBranch[]>;
104
- getRepoTags(projectId: number | string, opts?: IListOptions): Promise<IGitLabTag[]>;
105
- getProtectedBranches(projectId: number | string): Promise<IGitLabProtectedBranch[]>;
106
- unprotectBranch(projectId: number | string, branchName: string): Promise<void>;
107
- deleteProject(projectId: number | string): Promise<void>;
117
+ /** @internal */
118
+ requestRetryPipeline(projectId: number | string, pipelineId: number): Promise<IGitLabPipeline>;
119
+ /** @internal */
120
+ requestCancelPipeline(projectId: number | string, pipelineId: number): Promise<IGitLabPipeline>;
121
+ /** @internal */
122
+ requestDeletePipeline(projectId: number | string, pipelineId: number): Promise<void>;
123
+ /** @internal */
124
+ requestGetPipelineVariables(projectId: number | string, pipelineId: number): Promise<IGitLabPipelineVariable[]>;
125
+ /** @internal */
126
+ requestGetPipelineTestReport(projectId: number | string, pipelineId: number): Promise<IGitLabTestReport>;
127
+ /** @internal */
128
+ requestGetPipelineJobs(projectId: number | string, pipelineId: number, opts?: IJobListOptions): Promise<IGitLabJob[]>;
129
+ /** @internal */
130
+ requestGetJobLog(projectId: number | string, jobId: number): Promise<string>;
131
+ /** @internal */
132
+ requestRetryJob(projectId: number | string, jobId: number): Promise<IGitLabJob>;
133
+ /** @internal */
134
+ requestCancelJob(projectId: number | string, jobId: number): Promise<IGitLabJob>;
135
+ /** @internal */
136
+ requestPlayJob(projectId: number | string, jobId: number): Promise<IGitLabJob>;
137
+ /** @internal */
138
+ requestEraseJob(projectId: number | string, jobId: number): Promise<void>;
108
139
  }