api_github

package
v1.2.37 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CreateGistUrl = "https://api.github.com/gists"
View Source
var GetAccessTokenUrl = "https://github.com/login/oauth/access_token"
View Source
var GetGistsUrl = "https://api.github.com/gists"
View Source
var GetUserUrl = "https://api.github.com/user"

Functions

This section is empty.

Types

type CreateGistFile

type CreateGistFile struct {
	Content string `json:"content"`
}

type CreateGistRequest

type CreateGistRequest struct {
	Description string                     `json:"description"`
	Files       map[string]*CreateGistFile `json:"files"`
	Public      bool                       `json:"public"`
}

type CreateGistResponse

type CreateGistResponse Gist

func CreateGist

func CreateGist(accessToken string, request *CreateGistRequest) (res *CreateGistResponse, err error)

type GetAccessTokenResponse

type GetAccessTokenResponse struct {
	AccessToken           string `json:"access_token"`
	ExpiresIn             int    `json:"expires_in"`
	RefreshToken          string `json:"refresh_token"`
	RefreshTokenExpiresIn int    `json:"refresh_token_expires_in"`
	Scope                 string `json:"scope"`
	TokenType             string `json:"token_type"`
	Error                 string `json:"error"`
	ErrorDescription      string `json:"error_description"`
}

func GetAccessToken

func GetAccessToken(clientId string, clientSecret string, code string) (res *GetAccessTokenResponse, err error)

type GetGistsRequest

type GetGistsRequest struct {
	Since   string `json:"since"`    // 仅显示在给定时间后最后更新的结果。这是ISO 8601格式的时间戳:YYYY-MM-DDTHH:MM:SSZ
	PerPage int    `json:"per_page"` // 每页数量 默认 30
	Page    int    `json:"page"`     // 页码 默认 1
}

type GetGistsResponse

type GetGistsResponse []*Gist

func GetGists

func GetGists(accessToken string, request *GetGistsRequest) (res *GetGistsResponse, err error)

type GetUserResponse

type GetUserResponse struct {
	Login           string `json:"login"`
	Id              int    `json:"id"`
	Name            string `json:"name"`
	AvatarUrl       string `json:"avatar_url"`
	Email           string `json:"email"`
	HtmlUrl         string `json:"html_url"`
	Blob            string `json:"blob"`
	TwitterUsername string `json:"twitter_username"`
	Company         string `json:"company"`
	Location        string `json:"location"`
	Hireable        bool   `json:"hireable"`
	Bil             string `json:"bil"`
}

GetUserResponse *

{
	"login": "toccata",
	"id": 1,
	"node_id": "MDQ6VXNlcjE=",
	"avatar_url": "https://github.com/images/error/octocat_happy.gif",
	"gravatar_id": "",
	"url": "https://api.github.com/users/octocat",
	"html_url": "https://github.com/octocat",
	"followers_url": "https://api.github.com/users/octocat/followers",
	"following_url": "https://api.github.com/users/octocat/following{/other_user}",
	"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
	"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
	"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
	"organizations_url": "https://api.github.com/users/octocat/orgs",
	"repos_url": "https://api.github.com/users/octocat/repos",
	"events_url": "https://api.github.com/users/octocat/events{/privacy}",
	"received_events_url": "https://api.github.com/users/octocat/received_events",
	"type": "User",
	"site_admin": false,
	"name": "monalisa octocat",
	"company": "GitHub",
	"blog": "https://github.com/blog",
	"location": "San Francisco",
	"email": "octocat@github.com",
	"hireable": false,
	"bio": "There once was...",
	"twitter_username": "monatheoctocat",
	"public_repos": 2,
	"public_gists": 1,
	"followers": 20,
	"following": 0,
	"created_at": "2008-01-14T04:33:35Z",
	"updated_at": "2008-01-14T04:33:35Z",
	"private_gists": 81,
	"total_private_repos": 100,
	"owned_private_repos": 100,
	"disk_usage": 10000,
	"collaborators": 8,
	"two_factor_authentication": true,
	"plan": {
		"name": "Medium",
		"space": 400,
		"private_repos": 20,
		"collaborators": 0
	}
}

func GetUser

func GetUser(accessToken string) (res *GetUserResponse, err error)

type Gist

type Gist struct {
	Url         string               `json:"url"`
	ForksUrl    string               `json:"forks_url"`
	CommitsUrl  string               `json:"commits_url"`
	Id          string               `json:"id"`
	NodeId      string               `json:"node_id"`
	GitPullUrl  string               `json:"git_pull_url"`
	GitPushUrl  string               `json:"git_push_url"`
	HtmlUrl     string               `json:"html_url"`
	Files       map[string]*GistFile `json:"files"`
	Public      bool                 `json:"public"`
	CreatedAt   time.Time            `json:"created_at"`
	UpdatedAt   time.Time            `json:"updated_at"`
	Description string               `json:"description"`
	Comments    int                  `json:"comments"`
	CommentsUrl string               `json:"comments_url"`
	Truncated   bool                 `json:"truncated"`
}

type GistFile

type GistFile struct {
	Filename string `json:"filename"`
	Type     string `json:"type"`
	Language string `json:"language"`
	RawUrl   string `json:"raw_url"`
	Size     int64  `json:"size"`
}

Jump to

Keyboard shortcuts

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