MCPcopy Index your code
hub / github.com/git-bug/git-bug / validateProjectURL

Function validateProjectURL

bridge/gitlab/config.go:277–294  ·  view source on GitHub ↗
(baseUrl, url string, token *auth.Token)

Source from the content-addressed store, hash-verified

275}
276
277func validateProjectURL(baseUrl, url string, token *auth.Token) (int, error) {
278 projectPath, err := getProjectPath(baseUrl, url)
279 if err != nil {
280 return 0, err
281 }
282
283 client, err := buildClient(baseUrl, token)
284 if err != nil {
285 return 0, err
286 }
287
288 project, _, err := client.Projects.GetProject(projectPath, &gitlab.GetProjectOptions{})
289 if err != nil {
290 return 0, errors.Wrap(err, "wrong token scope ou non-existent project")
291 }
292
293 return project.ID, nil
294}
295
296func getLoginFromToken(baseUrl string, token *auth.Token) (string, error) {
297 client, err := buildClient(baseUrl, token)

Callers 1

ConfigureMethod · 0.85

Calls 3

getProjectPathFunction · 0.85
GetProjectMethod · 0.80
buildClientFunction · 0.70

Tested by

no test coverage detected