github

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright © 2025 KubeRocketAI Team

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const DefaultBaseURL = "https://api.github.com"
View Source
const DefaultUserAgent = "krci-ai/v1.0.0"

Variables

View Source
var DefaultTimeout = 10 * time.Second

Functions

func GetFallbackMessage

func GetFallbackMessage(owner, repo string) string

GetFallbackMessage returns a user-friendly error message with manual check instructions

func GetKuberocketaiFallbackMessage

func GetKuberocketaiFallbackMessage() string

GetKuberocketaiFallbackMessage returns the fallback message for KubeRocketAI

func GetKuberocketaiReleasesURL

func GetKuberocketaiReleasesURL() string

GetKuberocketaiReleasesURL returns the specific KubeRocketAI releases URL

func GetReleasesURL

func GetReleasesURL(owner, repo string) string

GetReleasesURL returns the GitHub releases page URL for manual checking

Types

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	UserAgent  string
}

Client represents a GitHub API client

func NewClient

func NewClient() *Client

NewClient creates a new GitHub API client

func NewClientWith added in v0.26.0

func NewClientWith(baseURL, userAgent string, httpClient *http.Client) *Client

NewClientWith allows constructing a client with custom parameters

func NewDefaultClient added in v0.26.0

func NewDefaultClient() *Client

NewDefaultClient returns a client configured with defaults from config.go

func (*Client) GetLatestRelease

func (c *Client) GetLatestRelease(owner, repo string) (*Release, error)

GetLatestRelease fetches the latest release for a repository

func (*Client) GetReleases

func (c *Client) GetReleases(owner, repo string, page, perPage int) ([]Release, error)

GetReleases fetches releases for a repository with pagination

type Release

type Release struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	Body        string    `json:"body"`
	HTMLURL     string    `json:"html_url"`
	PublishedAt time.Time `json:"published_at"`
	Draft       bool      `json:"draft"`
	Prerelease  bool      `json:"prerelease"`
	TarballURL  string    `json:"tarball_url"`
	ZipballURL  string    `json:"zipball_url"`
}

Release represents a GitHub release

func (*Release) GetVersion

func (r *Release) GetVersion() string

GetVersion returns the version string, removing 'v' prefix if present

func (*Release) IsStable

func (r *Release) IsStable() bool

IsStable returns true if the release is stable (not draft or prerelease)

func (*Release) ToReleaseInfo

func (r *Release) ToReleaseInfo() *ReleaseInfo

ToReleaseInfo converts a Release to ReleaseInfo

func (*Release) UnmarshalJSON

func (r *Release) UnmarshalJSON(data []byte) error

UnmarshalJSON custom unmarshaling to handle various date formats

type ReleaseInfo

type ReleaseInfo struct {
	Version     string    `json:"version"`
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	Body        string    `json:"body"`
	URL         string    `json:"url"`
	PublishedAt time.Time `json:"published_at"`
	IsStable    bool      `json:"is_stable"`
}

ReleaseInfo contains processed release information

Jump to

Keyboard shortcuts

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