jdalrymple / gitbeaker

🦊🧪 A comprehensive and typed Gitlab SDK for Node.js, Browsers, Deno and CLI
Other
1.55k stars 295 forks source link

Groups not on par with Projects regarding visibility #3442

Closed dsebastien closed 5 months ago

dsebastien commented 11 months ago

Description

1) For projects, it is possible to directly pass the "visibility" option in order to by visibility (public/internal/private). It is not possible for groups, although the GitLab API supports it.

2) Side question: why is the visibility property of GroupSchema and ProjectSchema a string and not something like 'public' | 'internal' | 'private'?

Possible solutions

jdalrymple commented 11 months ago
  1. The inclusion of a parameter is primarily dependant on what i see in the docs. If their docs dont include it, i didnt include it. So for visibility, it isnt located in this list as far as i can see.

  2. I overlooked that. Its like that for the Project schema, just not the group one.

dsebastien commented 11 months ago

Hello Justin,

For visibility, I thought it was supported, but you're right, it doesn't seem to be yet. Bummer :p

dsebastien commented 11 months ago

I have introduced an issue to request this: https://gitlab.com/gitlab-org/gitlab/-/issues/429314

dsebastien commented 11 months ago

For now I'll continue doing it on the client side:

import { GroupSchema, Camelize, Gitlab } from 'https://esm.sh/@gitbeaker/rest?dts';

export async function getInternalGroups(gitLabClient: InstanceType<typeof Gitlab>): Promise<(GroupSchema | Camelize<GroupSchema>)[]> {
  // TODO refactor once improved upstream: https://github.com/jdalrymple/gitbeaker/issues/3442
  const allGroups = await gitLabClient.Groups.all();

  return allGroups.filter(group => "internal" === group.visibility);
}
jdalrymple commented 11 months ago

Also note, if it works ill add it, all im saying is that it isnt documented. Have you tested this filter in an api call?

jdalrymple commented 2 months ago

:rocket: Issue was released in 40.1.0 :rocket: