Documentation
¶
Overview ¶
Package copilot provides GitHub Copilot integration.
Index ¶
- Constants
- Variables
- func Headers() map[string]string
- func NewClient(isSubAgent, debug bool) *http.Client
- func PollForToken(ctx context.Context, dc *DeviceCode) (*oauth.Token, error)
- func RefreshToken(ctx context.Context, githubToken string) (*oauth.Token, error)
- func RefreshTokenFromDisk() (string, bool)
- type DeviceCode
Constants ¶
View Source
const ( SignupURL = "https://github.com/github-copilot/signup?editor=seshat" FreeURL = "https://docs.github.com/en/copilot/how-tos/manage-your-account/get-free-access-to-copilot-pro" )
Variables ¶
View Source
var ErrNotAvailable = errors.New("github copilot not available")
Functions ¶
func NewClient ¶
NewClient creates a new HTTP client with a custom transport that adds the X-Initiator header based on message history in the request body.
func PollForToken ¶
PollForToken polls GitHub for the access token after user authorization.
func RefreshToken ¶
RefreshToken refreshes the Copilot token using the GitHub token.
func RefreshTokenFromDisk ¶
Types ¶
type DeviceCode ¶
type DeviceCode struct {
DeviceCode string `json:"device_code"`
UserCode string `json:"user_code"`
VerificationURI string `json:"verification_uri"`
ExpiresIn int `json:"expires_in"`
Interval int `json:"interval"`
}
func RequestDeviceCode ¶
func RequestDeviceCode(ctx context.Context) (*DeviceCode, error)
RequestDeviceCode initiates the device code flow with GitHub.
Click to show internal directories.
Click to hide internal directories.