go-github: github.com/google/go-github/scrape Index | Files

package scrape

import "github.com/google/go-github/scrape"

Package scrape provides a client for interacting with GitHub using screen scraping.

This is intended to be used as a supplement to the standard go-github library to access data that is not currently exposed by either the official REST or GraphQL APIs.

Because of the nature of screen scraping, this package should be treated as HIGHLY EXPERIMENTAL, and potentially unstable. We make no promises relating to compatibility or stability of the exported API. Even though this package is distributed as part of the go-github library, it is explicitly exempt from any stability promises that my be implied by the library version number.


Package Files

apps.go forms.go payment.go scrape.go

type AppManifest Uses

type AppManifest struct {
    // The name of the GitHub App.
    Name *string `json:"name,omitempty"`
    //Required. The homepage of your GitHub App.
    URL *string `json:"url,omitempty"`
    // Required. The configuration of the GitHub App's webhook.
    HookAttributes map[string]string `json:"hook_attributes,omitempty"`
    // The full URL to redirect to after the person installs the GitHub App.
    RedirectURL *string `json:"redirect_url,omitempty"`
    // A description of the GitHub App.
    Description *string `json:"description,omitempty"`
    // Set to true when your GitHub App is available to the public or false when
    // it is only accessible to the owner of the app.
    Public *bool `json:"public,omitempty"`
    // The list of events the GitHub App subscribes to.
    DefaultEvents []string `json:"default_events,omitempty"`
    // The set of permissions needed by the GitHub App.
    DefaultPermissions *github.InstallationPermissions `json:"default_permissions,omitempty"`

AppManifest represents a GitHub App manifest, used for preconfiguring GitHub App configuration.

type Client Uses

type Client struct {
    // contains filtered or unexported fields

Client is a GitHub scraping client.

func NewClient Uses

func NewClient(transport http.RoundTripper) *Client

NewClient constructs a new Client. If transport is nil, a default transport is used.

func (*Client) AppRestrictionsEnabled Uses

func (c *Client) AppRestrictionsEnabled(org string) (bool, error)

AppRestrictionsEnabled returns whether the specified organization has restricted third-party application access.

func (*Client) Authenticate Uses

func (c *Client) Authenticate(username, password, otpseed string) error

Authenticate client to GitHub with the provided username, password, and if two-factor auth is enabled for the account, otpseed.

otpseed is the OTP Secret provided from GitHub as part of two-factor application enrollment. When registering the application, click the "enter this text code" link on the QR Code page to see the raw OTP Secret.

func (*Client) CreateApp Uses

func (c *Client) CreateApp(m *AppManifest) (*http.Response, error)

CreateApp creates a new GitHub App with the given manifest configuration.

func (*Client) ListOAuthApps Uses

func (c *Client) ListOAuthApps(org string) ([]OAuthApp, error)

ListOAuthApps lists the reviewed OAuth Applications for the specified organization (whether approved or denied).

func (*Client) LoadCookies Uses

func (c *Client) LoadCookies(v []byte) error

LoadCookies loads the provided cookies for github.com.

func (*Client) OrgPaymentInformation Uses

func (c *Client) OrgPaymentInformation(org string) (PaymentInformation, error)

OrgPaymentInformation returns payment information for the specified org.

func (*Client) SaveCookies Uses

func (c *Client) SaveCookies() ([]byte, error)

SaveCookies returns an encoded form of the github.com cookies set on this client. If Authenticate() has been called, this should include the github.com session cookie. These cookies can be loaded onto a new client by calling LoadCookies.

GitHub session cookies are bearer tokens that are not tied to any particular client, so should be treated with the same sensitivity as the account credentials.

type OAuthApp Uses

type OAuthApp struct {
    ID          int
    Name        string
    Description string
    State       OAuthAppReviewState
    RequestedBy string

OAuthApp represents an OAuth application that has been reviewed for access to organization data.

type OAuthAppReviewState Uses

type OAuthAppReviewState int

OAuthAppReviewState indicates the current state of a requested OAuth Application.

const (
    // OAuthAppRequested indicates access has been requested, but not reviewed
    OAuthAppRequested OAuthAppReviewState = iota + 1
    // OAuthAppApproved indicates access has been approved
    // OAuthAppDenied indicates access has been denied

type PaymentInformation Uses

type PaymentInformation struct {
    PaymentMethod    string
    LastPayment      string
    Coupon           string
    ExtraInformation string

PaymentInformation for an organization on a paid plan.

Package scrape imports 16 packages (graph). Updated 2020-03-04. Refresh now. Tools for package owners.