当前位置: 首页>>代码示例>>Golang>>正文


Golang Client.Do方法代码示例

本文整理汇总了Golang中github.com/google/go-github/github.Client.Do方法的典型用法代码示例。如果您正苦于以下问题:Golang Client.Do方法的具体用法?Golang Client.Do怎么用?Golang Client.Do使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/google/go-github/github.Client的用法示例。


在下文中一共展示了Client.Do方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GetHookSchemas

func GetHookSchemas(c *github.Client) ([]HookSchema, *github.Response, error) {
	req, err := c.NewRequest("GET", "hooks", nil)
	if err != nil {
		return nil, nil, err
	}
	hookSchemas := new([]HookSchema)
	resp, err := c.Do(req, hookSchemas)
	if err != nil {
		return nil, resp, err
	}

	return *hookSchemas, resp, err
}
开发者ID:soh335,项目名称:ghh,代码行数:13,代码来源:hook_schema.go

示例2: GetHookSchema

func GetHookSchema(c *github.Client, name string) (*HookSchema, *github.Response, error) {
	req, err := c.NewRequest("GET", fmt.Sprintf("hooks/%v", name), nil)
	if err != nil {
		return nil, nil, err
	}
	hookSchema := new(HookSchema)
	resp, err := c.Do(req, hookSchema)
	if err != nil {
		return nil, resp, err
	}

	return hookSchema, resp, err
}
开发者ID:soh335,项目名称:ghh,代码行数:13,代码来源:hook_schema.go

示例3: GitCommitStatuses

func GitCommitStatuses(client *github.Client, owner, repo, sha string) (interface{}, *github.Response, error) {

	u := fmt.Sprintf("repos/%v/%v/commits/%v/statuses", owner, repo, sha)
	req, err := client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	var c interface{}
	resp, err := client.Do(req, &c)
	if err != nil {
		return nil, resp, err
	}
	return c, resp, err
}
开发者ID:astronoka,项目名称:gh,代码行数:15,代码来源:main.go

示例4: PutGitCommitStatus

func PutGitCommitStatus(client *github.Client, owner, repo, sha string, body *CommitStatus) (interface{}, *github.Response, error) {

	u := fmt.Sprintf("repos/%v/%v/statuses/%v", owner, repo, sha)

	if body == nil {
		body = &CommitStatus{}
	}

	req, err := client.NewRequest("POST", u, body)
	if err != nil {
		return nil, nil, err
	}

	var c interface{}
	resp, err := client.Do(req, c)
	if err != nil {
		return nil, resp, err
	}

	return c, resp, err
}
开发者ID:astronoka,项目名称:gh,代码行数:21,代码来源:main.go

示例5: DownloadAsset

func DownloadAsset(client *github.Client, asset *github.ReleaseAsset) error {
	req, _ := client.NewRequest("GET", *asset.URL, nil)
	req.Header.Set("Accept", "application/octet-stream")

	apiResponse, err := client.Do(req, nil)

	assetResponse, err := http.Get(apiResponse.Response.Request.URL.String())

	if err != nil {
		return err
	}

	f, err := os.Create(flags.Output)

	if err != nil {
		return err
	}

	defer f.Close()
	io.Copy(f, assetResponse.Body)

	return nil
}
开发者ID:upfluence,项目名称:gh-downloader,代码行数:23,代码来源:main.go


注:本文中的github.com/google/go-github/github.Client.Do方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。