forgejohttp

package
v0.0.0-...-a33ddeb Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentResponseTypeFile = "file"
	ContentResponseTypeDir  = "dir"
)
View Source
const (
	ErrInvalidURL = erorr.Error("forgejo: invalid URL")
)
View Source
const (
	FileEncodingBase64 = "base64"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentRequest

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

ContentRequest represents a request to the Forgejo "/api/v1/repos/{owner}/{repo}/contents" and "/api/v1/repos/{owner}/{repo}/contents/{filepath}" API end-points.

You can create a ContentRequest with ConstructContentRequest.

The response associated with ContentRequest is ContentResponse.

See also: https://codeberg.org/api/swagger#/repository/repoGetContentsList https://codeberg.org/api/swagger#/repository/repoGetContents

func ConstructContentRequest

func ConstructContentRequest(host string, username string, reponame string, filepath string) ContentRequest

ConstructContentRequest creates a ContentRequest.

func (ContentRequest) HTTPGet

func (receiver ContentRequest) HTTPGet(response *ContentResponse) error

func (ContentRequest) String

func (receiver ContentRequest) String() string

type ContentResponse

type ContentResponse struct {
	Type string
	File File
	Dir  []File
}

ContentResponse represents a response from the Forgejo "/api/v1/repos/{owner}/{repo}/contents" and "/api/v1/repos/{owner}/{repo}/contents/{filepath}" API end-points.

You can load a ContentResponse using ContentRequest.HTTPGet.

The request associated with ContentResponse is ContentRequest.

See also: https://codeberg.org/api/swagger#/repository/repoGetContentsList https://codeberg.org/api/swagger#/repository/repoGetContents

type File

type File struct {
	Content        opt.Optional[string] `json:"content"`
	DownloadURL    opt.Optional[string] `json:"download_url"`
	Encoding       opt.Optional[string] `json:"encoding"`
	GitURL         opt.Optional[string] `json:"git_url"`
	HTMLURL        opt.Optional[string] `json:"html_url"`
	LastCommitSHA  opt.Optional[string] `json:"last_commit_sha"`
	LastCommitWhen opt.Optional[string] `json:"last_commit_when"`
	Links          struct {
		Self opt.Optional[string] `json:"self"`
		Git  opt.Optional[string] `json:"git"`
		HTML opt.Optional[string] `json:"html"`
	} `json:"_links"`
	Name            opt.Optional[string] `json:"name"`
	Path            opt.Optional[string] `json:"path"`
	SHA             opt.Optional[string] `json:"sha"`
	Size            opt.Optional[uint64] `json:"size"`
	SubmoduleGitURL opt.Optional[string] `json:"submodule_git_url"`
	Target          opt.Optional[string] `json:"target"`
	Type            opt.Optional[string] `json:"type"`
	URL             opt.Optional[string] `json:"url"`
}

func (*File) DecodeContent

func (receiver *File) DecodeContent() ([]byte, error)

func (*File) DirEntry

func (receiver *File) DirEntry() fs.DirEntry

func (*File) ParseLastCommitWhen

func (receiver *File) ParseLastCommitWhen() (time.Time, error)

type RepoRequest

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

RepoRequest represents a request to the Forgejo "/api/v1/repos/{owner}/{repo}" API end-point.

You can create a RepoRequest with ConstructRepoRequest.

The response associated with RepoRequest is RepoResponse.

See also: https://codeberg.org/api/swagger#/repository/repoGet

func ConstructRepoRequest

func ConstructRepoRequest(host string, username string, reponame string) RepoRequest

ConstructRepoRequest creates a RepoRequest.

func (RepoRequest) HTTPGet

func (receiver RepoRequest) HTTPGet(response *RepoResponse) error

func (RepoRequest) String

func (receiver RepoRequest) String() string

type RepoResponse

type RepoResponse struct {
	AllowFastForwardOnlyMerge     opt.Optional[bool]   `json:"allow_fast_forward_only_merge"`
	AllowMergeCommits             opt.Optional[bool]   `json:"allow_merge_commits"`
	AllowRebase                   opt.Optional[bool]   `json:"allow_rebase"`
	AllowRebaseExplicit           opt.Optional[bool]   `json:"allow_rebase_explicit"`
	AllowRebaseUpdate             opt.Optional[bool]   `json:"allow_rebase_update"`
	AllowSquashMerge              opt.Optional[bool]   `json:"allow_squash_merge"`
	Archived                      opt.Optional[bool]   `json:"archived"`
	ArchivedAt                    opt.Optional[string] `json:"archived_at"`
	AvatarURL                     opt.Optional[string] `json:"avatar_url"`
	CloneURL                      opt.Optional[string] `json:"clone_url"`
	CreatedAt                     opt.Optional[string] `json:"created_at"`
	DefaultAllowMaintainerEdit    opt.Optional[bool]   `json:"default_allow_maintainer_edit"`
	DefaultBranch                 opt.Optional[string] `json:"default_branch"`
	DefaultDeleteBranchAfterMerge opt.Optional[bool]   `json:"default_delete_branch_after_merge"`
	DefaultMergeStyle             opt.Optional[string] `json:"default_merge_style"`
	DefaultUpdateStyle            opt.Optional[string] `json:"default_update_style"`
	Description                   opt.Optional[string] `json:"description"`
	Empty                         opt.Optional[bool]   `json:"empty"`
	Fork                          opt.Optional[bool]   `json:"fork"`
	ForksCount                    opt.Optional[uint64] `json:"forks_count"`
	FullName                      opt.Optional[string] `json:"full_name"`
	GloballyEditableWiki          opt.Optional[bool]   `json:"globally_editable_wiki"`
	HasActions                    opt.Optional[bool]   `json:"has_actions"`
	HasIssues                     opt.Optional[bool]   `json:"has_issues"`
	HasPackages                   opt.Optional[bool]   `json:"has_packages"`
	HasProjects                   opt.Optional[bool]   `json:"has_projects"`
	HasPullRequests               opt.Optional[bool]   `json:"has_pull_requests"`
	HasReleases                   opt.Optional[bool]   `json:"has_releases"`
	HasWiki                       opt.Optional[bool]   `json:"has_wiki"`
	HTMLURL                       opt.Optional[string] `json:"html_url"`
	ID                            opt.Optional[uint64] `json:"id"`
	IgnoreWhiteSpaceConflicts     opt.Optional[bool]   `json:"ignore_whitespace_conflicts"`
	Internal                      opt.Optional[bool]   `json:"internal"`
	InternalTracker               struct {
		EnableTimeTracker                opt.Optional[bool] `json:"enable_time_tracker"`
		AllowOnlyContributorsToTrackTime opt.Optional[bool] `json:"allow_only_contributors_to_track_time"`
		EnableIssueDependencies          opt.Optional[bool] `json:"enable_issue_dependencies"`
	} `json:"internal_tracker"`
	Language         opt.Optional[string] `json:"language"`
	LanguagesURL     opt.Optional[string] `json:"languages_url"`
	Link             opt.Optional[string] `json:"link"`
	Mirror           opt.Optional[bool]   `json:"mirror"`
	MirrorInterval   opt.Optional[string] `json:"mirror_interval"`
	MirrorUpdated    opt.Optional[string] `json:"mirror_updated"`
	Name             opt.Optional[string] `json:"name"`
	ObjectFormatName opt.Optional[string] `json:"object_format_name"`
	OpenIssuesCount  opt.Optional[uint64] `json:"open_issues_count"`
	OpenPRCounter    opt.Optional[uint64] `json:"open_pr_counter"`
	OriginalURL      opt.Optional[string] `json:"original_url"`
	Owner            UserResponse         `json:"owner"`
	Parent           struct {
		CloneURL opt.Optional[string] `json:"clone_url"`
		FullName opt.Optional[string] `json:"full_name"`
		HTMLURL  opt.Optional[string] `json:"html_url"`
		Name     opt.Optional[string] `json:"name"`
		SSHURL   opt.Optional[string] `json:"ssh_url"`
		URL      opt.Optional[string] `json:"url"`
	} `json:"parent"`
	Permissions struct {
		Admin opt.Optional[bool] `json:"admin"`
		Push  opt.Optional[bool] `json:"push"`
		Pull  opt.Optional[bool] `json:"pull"`
	} `json:"permissions"`
	Private        opt.Optional[bool]   `json:"private"`
	ReleaseCounter opt.Optional[uint64] `json:"release_counter"`
	// "repo_transfer": null,
	SSHURL        opt.Optional[string] `json:"ssh_url"`
	Size          opt.Optional[uint64] `json:"size"`
	StarsCount    opt.Optional[uint64] `json:"stars_count"`
	Template      opt.Optional[bool]   `json:"template"`
	Topics        Strings              `json:"topics"`
	URL           opt.Optional[string] `json:"url"`
	UpdatedAt     opt.Optional[string] `json:"updated_at"`
	WatchersCount opt.Optional[uint64] `json:"watchers_count"`
	WebSite       opt.Optional[string] `json:"website"`
	WikiBranch    opt.Optional[string] `json:"wiki_branch"`
}

RepoResponse represents a response from the Forgejo "/api/v1/repos/{owner}/{repo}" API end-point.

You can load a RepoResponse using RepoRequest.HTTPGet.

The request associated with RepoResponse is RepoRequest.

See also: https://codeberg.org/api/swagger#/repository/repoGet

type ReposRequest

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

ReposRequest represents a request to the Forgejo "/api/v1/users/{username}/repos" API end-point.

You can create a ReposRequest with ConstructReposRequest.

The response associated with ReposRequest is ReposResponse.

See also: https://codeberg.org/api/swagger#/user/userListRepos

func ConstructReposRequest

func ConstructReposRequest(host string, username string) ReposRequest

ConstructReposRequest creates a ReposRequest.

func (ReposRequest) HTTPGet

func (receiver ReposRequest) HTTPGet(response *ReposResponse) error

func (ReposRequest) String

func (receiver ReposRequest) String() string

type ReposResponse

type ReposResponse []RepoResponse

ReposResponse represents a response from the Forgejo "/api/v1/users/{username}/repos" API end-point.

You can load a ReposResponse using ReposRequest.HTTPGet.

The request associated with ReposResponse is ReposRequest.

See also: https://codeberg.org/api/swagger#/user/userListRepos

type Strings

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

func NoStrings

func NoStrings() Strings

func SomeString

func SomeString(value string) Strings

func SomeStrings

func SomeStrings(values ...string) Strings

func (Strings) MarshalJSON

func (receiver Strings) MarshalJSON() ([]byte, error)

MarshalJSON makes Strings fit the [json.Marshaler] interface.

func (Strings) Strings

func (receiver Strings) Strings() []string

func (*Strings) UnmarshalJSON

func (receiver *Strings) UnmarshalJSON(bytes []byte) error

UnmarshalJSON makes Strings fit the [json.Unmarshaler] interface.

type UserRequest

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

UserRequest represents a request to the Forgejo "/api/v1/users/{username}" API end-point.

You can create a UserRequest with ConstructUserRequest.

The response associated with UserRequest is UserResponse.

See also: https://codeberg.org/api/swagger#/user/userGet

func ConstructUserRequest

func ConstructUserRequest(host string, username string) UserRequest

ConstructUserRequest creates a UserRequest.

func (UserRequest) HTTPGet

func (receiver UserRequest) HTTPGet(response *UserResponse) error

func (UserRequest) String

func (receiver UserRequest) String() string

type UserResponse

type UserResponse struct {
	Active            opt.Optional[bool]   `json:"active"`
	AvatarURL         opt.Optional[string] `json:"avatar_url"`
	Created           opt.Optional[string] `json:"created"`
	Description       opt.Optional[string] `json:"description"`
	EMail             opt.Optional[string] `json:"email"`
	FollowersCount    opt.Optional[uint64] `json:"followers_count"`
	FollowingCount    opt.Optional[uint64] `json:"following_count"`
	FullName          opt.Optional[string] `json:"full_name"`
	HTMLURL           opt.Optional[string] `json:"html_url"`
	ID                opt.Optional[uint64] `json:"id"`
	IsAdmin           opt.Optional[bool]   `json:"is_admin"`
	Language          opt.Optional[string] `json:"language"`
	LastLogin         opt.Optional[string] `json:"last_login"`
	Location          opt.Optional[string] `json:"location"`
	Login             opt.Optional[string] `json:"login"`
	LoginName         opt.Optional[string] `json:"login_name"`
	ProhibitLogin     opt.Optional[bool]   `json:"prohibit_login"`
	Pronouns          opt.Optional[string] `json:"pronouns"`
	Restricted        opt.Optional[bool]   `json:"restricted"`
	SourceID          opt.Optional[uint64] `json:"source_id"`
	StarredReposCount opt.Optional[uint64] `json:"starred_repos_count"`
	UserName          opt.Optional[string] `json:"username"`
	Visibility        opt.Optional[string] `json:"visibility"`
	WebSite           opt.Optional[string] `json:"website"`
}

UserResponse represents a response from the Forgejo "/api/v1/users/{username}" API end-point.

You can load a UserResponse using UserRequest.HTTPGet.

The request associated with UserResponse is UserRequest.

See also: https://codeberg.org/api/swagger#/user/userGet

type VersionRequest

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

VersionRequest represents a request to the Forgejo "/api/v1/version" API end-point.

You can create a VersionRequest with ConstructVersionRequest.

The response associated with VersionRequest is VersionResponse.

See also: https://codeberg.org/api/swagger#/miscellaneous/getVersion

func ConstructVersionRequest

func ConstructVersionRequest(host string) VersionRequest

ConstructVersionRequest creates a VersionRequest.

func (VersionRequest) HTTPGet

func (receiver VersionRequest) HTTPGet(response *VersionResponse) error

func (VersionRequest) String

func (receiver VersionRequest) String() string

type VersionResponse

type VersionResponse struct {
	Version string `json:"version"`
}

VersionResponse represents a response from the Forgejo "/api/v1/version" API end-point.

You can load a VersionResponse using VersionRequest.HTTPGet.

The request associated with VersionResponse is VersionRequest.

See also: https://codeberg.org/api/swagger#/miscellaneous/getVersion

Jump to

Keyboard shortcuts

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