blih

package
v0.0.0-...-20d8366 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultApiBaseURL = "https://blih.epitech.eu/"
	DefaultUserAgent  = "go-blih"
)
View Source
const (
	DefaultRepositoryType = "git"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiMessageResponse

type ApiMessageResponse struct {
	Message string `json:"message"`
}

type BoolString

type BoolString bool

func (BoolString) UnmarshalJSON

func (bs BoolString) UnmarshalJSON(b []byte) error

type DateTime

type DateTime struct {
	time.Time
}

func (*DateTime) UnmarshalJSON

func (d *DateTime) UnmarshalJSON(b []byte) error

type KeyListResponse

type KeyListResponse map[string]string

type Repository

type Repository struct {
	// The repository name
	Name string `json:"name"`

	// The repository type (usually "git")
	Type string `json:"type"`

	// An optional description
	Description string `json:"description,omitempty"`
}

A structure which represents a Blih repository.

type RepositoryACL

type RepositoryACL struct {
	User string `json:"user"`
	ACL  string `json:"acl"`
}

func (*RepositoryACL) Validate

func (a *RepositoryACL) Validate() bool

type RepositoryACLResponse

type RepositoryACLResponse map[string]string

type RepositoryInfosResponse

type RepositoryInfosResponse struct {
	Message struct {
		URL          string     `json:"url"`
		UUID         string     `json:"uuid"`
		Public       BoolString `json:"public,string"`
		Description  string     `json:"description"`
		CreationTime DateTime   `json:"creation_time,string"`
	}
}

type RepositoryListEntry

type RepositoryListEntry struct {
	UUID string `json:"uuid"`
	URL  string `json:"url"`
}

type RepositoryListResponse

type RepositoryListResponse struct {
	Message      string                         `json:"message"`
	Repositories map[string]RepositoryListEntry `json:"repositories"`
}

type RepositoryService

type RepositoryService struct {
	// contains filtered or unexported fields
}

func NewRepositoryService

func NewRepositoryService(s *Service) *RepositoryService

func (*RepositoryService) Create

func (*RepositoryService) Delete

func (s *RepositoryService) Delete(name string) (*ApiMessageResponse, error)

func (*RepositoryService) GetACL

func (*RepositoryService) Infos

func (*RepositoryService) List

func (*RepositoryService) SetACL

type SSHKey

type SSHKey struct {
	SSHKey string `json:"sshkey"`
}

type SSHKeyService

type SSHKeyService struct {
	// contains filtered or unexported fields
}

func NewSSHKeyService

func NewSSHKeyService(s *Service) *SSHKeyService

func (*SSHKeyService) Create

func (s *SSHKeyService) Create(key *SSHKey) (*ApiMessageResponse, error)

func (*SSHKeyService) Delete

func (s *SSHKeyService) Delete(name string) (*ApiMessageResponse, error)

func (*SSHKeyService) List

func (s *SSHKeyService) List() (*KeyListResponse, error)

type Service

type Service struct {
	User string

	BaseURL   string
	UserAgent string

	Utils      *UtilsService
	Repository *RepositoryService
	SSHKey     *SSHKeyService
	// contains filtered or unexported fields
}

func New

func New(user, token string, ctx context.Context) *Service

func (*Service) NewRequest

func (c *Service) NewRequest(endpoint, method string, body interface{}) (*http.Request, error)

func (*Service) SendRequest

func (c *Service) SendRequest(endpoint, method string, body interface{}) (*http.Response, error)

func (*Service) SignData

func (c *Service) SignData(data interface{}) (io.Reader, error)

type SignedData

type SignedData struct {
	User      string      `json:"user"`
	Signature string      `json:"signature"`
	Data      interface{} `json:"data,omitempty"`
}

type UtilsService

type UtilsService struct {
	// contains filtered or unexported fields
}

func NewUtilsService

func NewUtilsService(s *Service) *UtilsService

func (*UtilsService) Ping

func (s *UtilsService) Ping() (time.Duration, error)

func (*UtilsService) WhoAmI

func (s *UtilsService) WhoAmI() (*ApiMessageResponse, error)

Jump to

Keyboard shortcuts

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