gitlab

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DummyProject = ProjectInfo{
	PathWithNamespace: "group/project",
	Name:              "group/project",
	ID:                42,
	Archived:          false,
}

DummyProject is a Gitlab project usable in various tests

Functions

func TestMockup

func TestMockup() *httptest.Server

TestMockup spins an Gitlab API httptest server

Types

type OAuthResponse

type OAuthResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
}

OAuthResponse allows easy parsing of /oauth/token Gitlab response

func RequestNewTokens

func RequestNewTokens(c *conf.OAuthConf, callbackCode string) (*OAuthResponse, error)

RequestNewTokens uses Gitlab OAuth to generate new access tokens

type ProjectInfo

type ProjectInfo struct {
	Name              string            `json:"name"`
	ID                int               `json:"id"`
	Archived          bool              `json:"archived"`
	PathWithNamespace string            `json:"path_with_namespace"`
	Permissions       projectPermission `json:"permissions"`
}

ProjectInfo struct contains all the required data about a Gitlab Project

func FetchProject

func FetchProject(token string, gitlabDomain string, requestedProject string) (*ProjectInfo, error)

FetchProject will try to fetch requested project by impersonating gitlab user using the access token

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL