apiclient

package
v4.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

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

func NewClient

func NewClient() APIClient

func (APIClient) Get

func (clt APIClient) Get(url string) (*http.Response, error)

func (APIClient) GetPublishers

func (clt APIClient) GetPublishers() ([]common.Publisher, error)

GetPublishers returns a slice with all the publishers from the API and any error encountered.

func (APIClient) GetSoftwareByURL

func (clt APIClient) GetSoftwareByURL(url string) (*Software, error)

GetSoftwareByURL returns the software matching the given repo URL and any error encountered. In case no software is found and no error occours, (nil, nil) is returned.

func (APIClient) Patch

func (clt APIClient) Patch(url string, body []byte) (*http.Response, error)

func (APIClient) PatchSoftware

func (clt APIClient) PatchSoftware(
	id string, url string, aliases []string, publiccodeYml string,
) (*http.Response, error)

PatchSoftware updates a software resource with the given fields and returns an http.Response and any error encountered.

func (APIClient) Post

func (clt APIClient) Post(url string, body []byte) (*http.Response, error)

func (APIClient) PostLog

func (clt APIClient) PostLog(message string) (*http.Response, error)

PostLog creates a new log with the given message and returns an http.Response and any error encountered.

func (APIClient) PostSoftware

func (clt APIClient) PostSoftware(url string, aliases []string, publiccodeYml string, active bool) (*Software, error)

PostSoftware creates a new software resource with the given fields and returns a Software struct or any error encountered.

func (APIClient) PostSoftwareLog

func (clt APIClient) PostSoftwareLog(softwareID string, message string) (*http.Response, error)

PostSoftwareLog creates a new software log with the given fields and returns an http.Response and any error encountered.

type CodeHosting

type CodeHosting struct {
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
	Group     bool      `json:"group"`
	URL       string    `json:"url"`
}
type Links struct {
	Prev string `json:"prev"`
	Next string `json:"next"`
}

type Publisher

type Publisher struct {
	ID            string        `json:"id"`
	AlternativeID string        `json:"alternativeId"`
	Email         string        `json:"email"`
	Description   string        `json:"description"`
	CodeHostings  []CodeHosting `json:"codeHosting"`
	Active        bool          `json:"active"`
	CreatedAt     time.Time     `json:"createdAt"`
	UpdatedAt     time.Time     `json:"updatedAt"`
}

type PublishersPaginated

type PublishersPaginated struct {
	Data  []Publisher `json:"data"`
	Links Links       `json:"links"`
}

type Software

type Software struct {
	ID            string    `json:"id"`
	URL           string    `json:"url"`
	Aliases       []string  `json:"aliases"`
	PubliccodeYml string    `json:"publiccodeYml"`
	Active        bool      `json:"active"`
	CreatedAt     time.Time `json:"createdAt"`
	UpdatedAt     time.Time `json:"updatedAt"`
}

type SoftwarePaginated

type SoftwarePaginated struct {
	Data  []Software `json:"data"`
	Links Links      `json:"links"`
}

Jump to

Keyboard shortcuts

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