hgsrht

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL struct {
	Id         int32          `json:"id"`
	Created    gqlclient.Time `json:"created"`
	Repository *Repository    `json:"repository"`
	Entity     *Entity        `json:"entity"`
	Mode       *AccessMode    `json:"mode,omitempty"`
}

type ACLCursor

type ACLCursor struct {
	Results []*ACL  `json:"results"`
	Cursor  *Cursor `json:"cursor,omitempty"`
}

A cursor for enumerating access control list entries

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type AccessKind

type AccessKind string
const (
	AccessKindRo AccessKind = "RO"
	AccessKindRw AccessKind = "RW"
)

type AccessMode

type AccessMode string
const (
	// Read-only
	AccessModeRo AccessMode = "RO"
	// Read/write
	AccessModeRw AccessMode = "RW"
)

type AccessScope

type AccessScope string
const (
	AccessScopeProfile      AccessScope = "PROFILE"
	AccessScopeRepositories AccessScope = "REPOSITORIES"
	AccessScopeRevisions    AccessScope = "REVISIONS"
	AccessScopeAcls         AccessScope = "ACLS"
)

type Cursor

type Cursor string

type Entity

type Entity struct {
	Id      int32          `json:"id"`
	Created gqlclient.Time `json:"created"`
	Updated gqlclient.Time `json:"updated"`
	// The canonical name of this entity. For users, this is their username
	// prefixed with '~'. Additional entity types will be supported in the future.
	CanonicalName string `json:"canonicalName"`
	// Returns a specific repository owned by the entity.
	Repository *Repository `json:"repository,omitempty"`
	// Returns a list of repositories owned by the entity.
	Repositories *RepositoryCursor `json:"repositories"`

	// Underlying value of the GraphQL interface
	Value EntityValue `json:"-"`
}

func (*Entity) UnmarshalJSON added in v0.4.0

func (base *Entity) UnmarshalJSON(b []byte) error

type EntityValue added in v0.4.0

type EntityValue interface {
	// contains filtered or unexported methods
}

EntityValue is one of: User

type Features

type Features struct {
	Artifacts bool `json:"artifacts"`
}

Describes the status of optional features

type NamedRevision

type NamedRevision struct {
	Name string `json:"name"`
	Id   string `json:"id"`
}

type NamedRevisionCursor

type NamedRevisionCursor struct {
	Results []*NamedRevision `json:"results"`
	Cursor  *Cursor          `json:"cursor,omitempty"`
}

A cursor for enumerating bookmarks, tags, and branches

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type OAuthClient added in v0.2.0

type OAuthClient struct {
	Uuid string `json:"uuid"`
}

type RepoInput

type RepoInput struct {
	// Omit these fields to leave them unchanged, or set them to null to clear
	// their value.
	Name        *string     `json:"name,omitempty"`
	Description *string     `json:"description,omitempty"`
	Visibility  *Visibility `json:"visibility,omitempty"`
	// Updates the custom README associated with this repository. Note that the
	// provided HTML will be sanitized when displayed on the web; see
	// https://man.sr.ht/markdown/#post-processing
	Readme *string `json:"readme,omitempty"`
	// Controls whether this repository is a non-publishing repository.
	NonPublishing *bool `json:"nonPublishing,omitempty"`
}

type Repository

type Repository struct {
	Id          int32          `json:"id"`
	Created     gqlclient.Time `json:"created"`
	Updated     gqlclient.Time `json:"updated"`
	Owner       *Entity        `json:"owner"`
	Name        string         `json:"name"`
	Description *string        `json:"description,omitempty"`
	Visibility  Visibility     `json:"visibility"`
	// The repository's custom README, if set.
	//
	// NOTICE: This returns unsanitized HTML. It is the client's responsibility to
	// sanitize this for display on the web, if so desired.
	Readme *string `json:"readme,omitempty"`
	// Whether or not this repository is a non-publishing repository.
	NonPublishing     bool       `json:"nonPublishing"`
	AccessControlList *ACLCursor `json:"accessControlList"`
	// The tip reference for this repository (latest commit)
	Tip *Revision `json:"tip,omitempty"`
	// Returns the list of open heads in the repository (like `hg heads`)
	// If `rev` is specified, return only open heads on the branch associated with
	// the given revision (like `hg heads REV`)
	Heads *RevisionCursor `json:"heads"`
	// Returns a list of commits (like `hg log`)
	// If `rev` is specified, only show the given commit (like `hg log --rev REV`)
	Log *RevisionCursor `json:"log"`
	// Returns a list of bookmarks
	Bookmarks *NamedRevisionCursor `json:"bookmarks"`
	// Returns a list of branches
	Branches *NamedRevisionCursor `json:"branches"`
	// Returns a list of tags
	Tags *NamedRevisionCursor `json:"tags"`
}

func CreateRepository added in v0.2.0

func CreateRepository(client *gqlclient.Client, ctx context.Context, name string, visibility Visibility, description string) (createRepository *Repository, err error)

func DeleteRepository added in v0.2.0

func DeleteRepository(client *gqlclient.Client, ctx context.Context, id int32) (deleteRepository *Repository, err error)

type RepositoryCursor

type RepositoryCursor struct {
	Results []*Repository `json:"results"`
	Cursor  *Cursor       `json:"cursor,omitempty"`
}

A cursor for enumerating a list of repositories

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

func Repositories

func Repositories(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (repositories *RepositoryCursor, err error)

type RepositoryEvent added in v0.2.0

type RepositoryEvent struct {
	Uuid       string         `json:"uuid"`
	Event      WebhookEvent   `json:"event"`
	Date       gqlclient.Time `json:"date"`
	Repository *Repository    `json:"repository"`
}

type Revision

type Revision struct {
	Id          string    `json:"id"`
	Branch      string    `json:"branch"`
	Tags        []*string `json:"tags"`
	Author      string    `json:"author"`
	Description string    `json:"description"`
}

type RevisionCursor

type RevisionCursor struct {
	Results []*Revision `json:"results"`
	Cursor  *Cursor     `json:"cursor,omitempty"`
}

A cursor for enumerating revisions

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type Settings added in v0.3.0

type Settings struct {
	SshUser string `json:"sshUser"`
}

Instance specific settings

type Tag

type Tag struct {
	Name string `json:"name"`
	Id   string `json:"id"`
}

type User

type User struct {
	Id            int32             `json:"id"`
	Created       gqlclient.Time    `json:"created"`
	Updated       gqlclient.Time    `json:"updated"`
	CanonicalName string            `json:"canonicalName"`
	Username      string            `json:"username"`
	Email         string            `json:"email"`
	Url           *string           `json:"url,omitempty"`
	Location      *string           `json:"location,omitempty"`
	Bio           *string           `json:"bio,omitempty"`
	Repository    *Repository       `json:"repository,omitempty"`
	Repositories  *RepositoryCursor `json:"repositories"`
}

func RepositoriesByUser

func RepositoriesByUser(client *gqlclient.Client, ctx context.Context, username string, cursor *Cursor) (user *User, err error)

func RepositoryIDByName added in v0.2.0

func RepositoryIDByName(client *gqlclient.Client, ctx context.Context, name string) (me *User, err error)

func RepositoryIDByUser added in v0.2.0

func RepositoryIDByUser(client *gqlclient.Client, ctx context.Context, username string, name string) (user *User, err error)

type UserWebhookInput added in v0.2.0

type UserWebhookInput struct {
	Url    string         `json:"url"`
	Events []WebhookEvent `json:"events"`
	Query  string         `json:"query"`
}

type UserWebhookSubscription added in v0.2.0

type UserWebhookSubscription struct {
	Id         int32                  `json:"id"`
	Events     []WebhookEvent         `json:"events"`
	Query      string                 `json:"query"`
	Url        string                 `json:"url"`
	Client     *OAuthClient           `json:"client,omitempty"`
	Deliveries *WebhookDeliveryCursor `json:"deliveries"`
	Sample     string                 `json:"sample"`
}

type Version

type Version struct {
	Major int32 `json:"major"`
	Minor int32 `json:"minor"`
	Patch int32 `json:"patch"`
	// If this API version is scheduled for deprecation, this is the date on which
	// it will stop working; or null if this API version is not scheduled for
	// deprecation.
	DeprecationDate gqlclient.Time `json:"deprecationDate,omitempty"`
	// Optional features
	Features *Features `json:"features"`
	// Config settings
	Settings *Settings `json:"settings"`
}

type Visibility

type Visibility string
const (
	// Visible to everyone, listed on your profile
	VisibilityPublic Visibility = "PUBLIC"
	// Visible to everyone (if they know the URL), not listed on your profile
	VisibilityUnlisted Visibility = "UNLISTED"
	// Not visible to anyone except those explicitly added to the access list
	VisibilityPrivate Visibility = "PRIVATE"
)

func ParseVisibility added in v0.2.0

func ParseVisibility(s string) (Visibility, error)

func (Visibility) TermString

func (visibility Visibility) TermString() string

type WebhookDelivery added in v0.2.0

type WebhookDelivery struct {
	Uuid         string               `json:"uuid"`
	Date         gqlclient.Time       `json:"date"`
	Event        WebhookEvent         `json:"event"`
	Subscription *WebhookSubscription `json:"subscription"`
	RequestBody  string               `json:"requestBody"`
	// These details are provided only after a response is received from the
	// remote server. If a response is sent whose Content-Type is not text/*, or
	// cannot be decoded as UTF-8, the response body will be null. It will be
	// truncated after 64 KiB.
	ResponseBody    *string `json:"responseBody,omitempty"`
	ResponseHeaders *string `json:"responseHeaders,omitempty"`
	ResponseStatus  *int32  `json:"responseStatus,omitempty"`
}

type WebhookDeliveryCursor added in v0.2.0

type WebhookDeliveryCursor struct {
	Results []WebhookDelivery `json:"results"`
	Cursor  *Cursor           `json:"cursor,omitempty"`
}

A cursor for enumerating a list of webhook deliveries

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

type WebhookEvent added in v0.2.0

type WebhookEvent string
const (
	WebhookEventRepoCreated WebhookEvent = "REPO_CREATED"
	WebhookEventRepoUpdate  WebhookEvent = "REPO_UPDATE"
	WebhookEventRepoDeleted WebhookEvent = "REPO_DELETED"
)

func ParseUserEvents added in v0.2.0

func ParseUserEvents(events []string) ([]WebhookEvent, error)

type WebhookPayload added in v0.2.0

type WebhookPayload struct {
	Uuid  string         `json:"uuid"`
	Event WebhookEvent   `json:"event"`
	Date  gqlclient.Time `json:"date"`

	// Underlying value of the GraphQL interface
	Value WebhookPayloadValue `json:"-"`
}

func (*WebhookPayload) UnmarshalJSON added in v0.4.0

func (base *WebhookPayload) UnmarshalJSON(b []byte) error

type WebhookPayloadValue added in v0.4.0

type WebhookPayloadValue interface {
	// contains filtered or unexported methods
}

WebhookPayloadValue is one of: RepositoryEvent

type WebhookSubscription added in v0.2.0

type WebhookSubscription struct {
	Id     int32          `json:"id"`
	Events []WebhookEvent `json:"events"`
	Query  string         `json:"query"`
	Url    string         `json:"url"`
	// If this webhook was registered by an authorized OAuth 2.0 client, this
	// field is non-null.
	Client *OAuthClient `json:"client,omitempty"`
	// All deliveries which have been sent to this webhook.
	Deliveries *WebhookDeliveryCursor `json:"deliveries"`
	// Returns a sample payload for this subscription, for testing purposes
	Sample string `json:"sample"`

	// Underlying value of the GraphQL interface
	Value WebhookSubscriptionValue `json:"-"`
}

func CreateUserWebhook added in v0.2.0

func CreateUserWebhook(client *gqlclient.Client, ctx context.Context, config UserWebhookInput) (createUserWebhook *WebhookSubscription, err error)

func DeleteUserWebhook added in v0.2.0

func DeleteUserWebhook(client *gqlclient.Client, ctx context.Context, id int32) (deleteUserWebhook *WebhookSubscription, err error)

func (*WebhookSubscription) UnmarshalJSON added in v0.4.0

func (base *WebhookSubscription) UnmarshalJSON(b []byte) error

type WebhookSubscriptionCursor added in v0.2.0

type WebhookSubscriptionCursor struct {
	Results []WebhookSubscription `json:"results"`
	Cursor  *Cursor               `json:"cursor,omitempty"`
}

A cursor for enumerating a list of webhook subscriptions

If there are additional results available, the cursor object may be passed back into the same endpoint to retrieve another page. If the cursor is null, there are no remaining results to return.

func UserWebhooks added in v0.2.0

func UserWebhooks(client *gqlclient.Client, ctx context.Context, cursor *Cursor) (userWebhooks *WebhookSubscriptionCursor, err error)

type WebhookSubscriptionValue added in v0.4.0

type WebhookSubscriptionValue interface {
	// contains filtered or unexported methods
}

WebhookSubscriptionValue is one of: UserWebhookSubscription

Jump to

Keyboard shortcuts

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