feat: add user retrieval functions and schemas for GitLab API integration

This commit is contained in:
Martim Pimentel
2025-05-21 22:18:06 +01:00
parent 808c34d0ee
commit 005b46a1a6
2 changed files with 105 additions and 8 deletions

View File

@ -7,6 +7,30 @@ export const GitLabAuthorSchema = z.object({
date: z.string(),
});
// User schemas
export const GitLabUserSchema = z.object({
username: z.string(), // Changed from login to match GitLab API
id: z.number(),
name: z.string(),
avatar_url: z.string(),
web_url: z.string(), // Changed from html_url to match GitLab API
});
export const GetUsersSchema = z.object({
usernames: z.array(z.string()).describe("Array of usernames to search for"),
});
export const GitLabUsersResponseSchema = z.record(
z.string(),
z.object({
id: z.number(),
username: z.string(),
name: z.string(),
avatar_url: z.string(),
web_url: z.string(),
}).nullable()
);
// Namespace related schemas
// Base schema for project-related operations
@ -283,14 +307,6 @@ export const GitLabLabelSchema = z.object({
is_project_label: z.boolean().optional(),
});
export const GitLabUserSchema = z.object({
username: z.string(), // Changed from login to match GitLab API
id: z.number(),
name: z.string(),
avatar_url: z.string(),
web_url: z.string(), // Changed from html_url to match GitLab API
});
export const GitLabMilestoneSchema = z.object({
id: z.number(),
iid: z.number(), // Added to match GitLab API
@ -1103,3 +1119,5 @@ export type GetRepositoryTreeOptions = z.infer<typeof GetRepositoryTreeSchema>;
export type MergeRequestThreadPosition = z.infer<typeof MergeRequestThreadPositionSchema>;
export type CreateMergeRequestThreadOptions = z.infer<typeof CreateMergeRequestThreadSchema>;
export type CreateMergeRequestNoteOptions = z.infer<typeof CreateMergeRequestNoteSchema>;
export type GitLabUser = z.infer<typeof GitLabUserSchema>;
export type GitLabUsersResponse = z.infer<typeof GitLabUsersResponseSchema>;