代码拉取完成,页面将自动刷新
同步操作将从 openEuler/go-gitee 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/*
* 码云 Open API
*
* No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
*
* API version: 5.3.2
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package gitee
import (
"context"
"fmt"
"io/ioutil"
"net/http"
"net/url"
neturl "net/url"
"strings"
"github.com/antihax/optional"
)
// Linger please
var (
_ context.Context
)
type WebhooksApiService service
/*
WebhooksApiService 删除一个仓库WebHook
删除一个仓库WebHook
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param id Webhook的ID
* @param optional nil or *DeleteV5ReposOwnerRepoHooksIdOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
*/
type DeleteV5ReposOwnerRepoHooksIdOpts struct {
AccessToken optional.String
}
func (a *WebhooksApiService) DeleteV5ReposOwnerRepoHooksId(ctx context.Context, owner string, repo string, id int32, localVarOptionals *DeleteV5ReposOwnerRepoHooksIdOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/hooks/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
return localVarHttpResponse, newErr
}
return localVarHttpResponse, nil
}
/*
WebhooksApiService 列出仓库的WebHooks
列出仓库的WebHooks
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param optional nil or *GetV5ReposOwnerRepoHooksOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Page" (optional.Int32) - 当前的页码
* @param "PerPage" (optional.Int32) - 每页的数量,最大为 100
@return []Hook
*/
type GetV5ReposOwnerRepoHooksOpts struct {
AccessToken optional.String
Page optional.Int32
PerPage optional.Int32
}
func (a *WebhooksApiService) GetV5ReposOwnerRepoHooks(ctx context.Context, owner string, repo string, localVarOptionals *GetV5ReposOwnerRepoHooksOpts) ([]Hook, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Hook
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/hooks"
localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.Page.IsSet() {
localVarQueryParams.Add("page", parameterToString(localVarOptionals.Page.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.PerPage.IsSet() {
localVarQueryParams.Add("per_page", parameterToString(localVarOptionals.PerPage.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []Hook
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
WebhooksApiService 获取仓库单个WebHook
获取仓库单个WebHook
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param id Webhook的ID
* @param optional nil or *GetV5ReposOwnerRepoHooksIdOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
@return Hook
*/
type GetV5ReposOwnerRepoHooksIdOpts struct {
AccessToken optional.String
}
func (a *WebhooksApiService) GetV5ReposOwnerRepoHooksId(ctx context.Context, owner string, repo string, id int32, localVarOptionals *GetV5ReposOwnerRepoHooksIdOpts) (Hook, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Hook
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/hooks/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarQueryParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v Hook
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
WebhooksApiService 更新一个仓库WebHook
更新一个仓库WebHook
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param id Webhook的ID
* @param url 远程HTTP URL
* @param optional nil or *PatchV5ReposOwnerRepoHooksIdOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Password" (optional.String) - 请求URL时会带上该密码,防止URL被恶意请求
* @param "PushEvents" (optional.Bool) - Push代码到仓库
* @param "TagPushEvents" (optional.Bool) - 提交Tag到仓库
* @param "IssuesEvents" (optional.Bool) - 创建/关闭Issue
* @param "NoteEvents" (optional.Bool) - 评论了Issue/代码等等
* @param "MergeRequestsEvents" (optional.Bool) - 合并请求和合并后
@return Hook
*/
type PatchV5ReposOwnerRepoHooksIdOpts struct {
AccessToken optional.String
Password optional.String
PushEvents optional.Bool
TagPushEvents optional.Bool
IssuesEvents optional.Bool
NoteEvents optional.Bool
MergeRequestsEvents optional.Bool
}
func (a *WebhooksApiService) PatchV5ReposOwnerRepoHooksId(ctx context.Context, owner string, repo string, id int32, url string, localVarOptionals *PatchV5ReposOwnerRepoHooksIdOpts) (Hook, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Patch")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Hook
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/hooks/{id}"
localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := neturl.Values{}
localVarFormParams := neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
localVarFormParams.Add("url", parameterToString(url, ""))
if localVarOptionals != nil && localVarOptionals.Password.IsSet() {
localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.PushEvents.IsSet() {
localVarFormParams.Add("push_events", parameterToString(localVarOptionals.PushEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.TagPushEvents.IsSet() {
localVarFormParams.Add("tag_push_events", parameterToString(localVarOptionals.TagPushEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.IssuesEvents.IsSet() {
localVarFormParams.Add("issues_events", parameterToString(localVarOptionals.IssuesEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.NoteEvents.IsSet() {
localVarFormParams.Add("note_events", parameterToString(localVarOptionals.NoteEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.MergeRequestsEvents.IsSet() {
localVarFormParams.Add("merge_requests_events", parameterToString(localVarOptionals.MergeRequestsEvents.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v Hook
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
WebhooksApiService 创建一个仓库WebHook
创建一个仓库WebHook
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param url 远程HTTP URL
* @param optional nil or *PostV5ReposOwnerRepoHooksOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
* @param "Password" (optional.String) - 请求URL时会带上该密码,防止URL被恶意请求
* @param "PushEvents" (optional.Bool) - Push代码到仓库
* @param "TagPushEvents" (optional.Bool) - 提交Tag到仓库
* @param "IssuesEvents" (optional.Bool) - 创建/关闭Issue
* @param "NoteEvents" (optional.Bool) - 评论了Issue/代码等等
* @param "MergeRequestsEvents" (optional.Bool) - 合并请求和合并后
@return Hook
*/
type PostV5ReposOwnerRepoHooksOpts struct {
AccessToken optional.String
Password optional.String
PushEvents optional.Bool
TagPushEvents optional.Bool
IssuesEvents optional.Bool
NoteEvents optional.Bool
MergeRequestsEvents optional.Bool
}
func (a *WebhooksApiService) PostV5ReposOwnerRepoHooks(ctx context.Context, owner string, repo string, url string, localVarOptionals *PostV5ReposOwnerRepoHooksOpts) (Hook, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue Hook
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/hooks"
localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := neturl.Values{}
localVarFormParams := neturl.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
localVarFormParams.Add("url", parameterToString(url, ""))
if localVarOptionals != nil && localVarOptionals.Password.IsSet() {
localVarFormParams.Add("password", parameterToString(localVarOptionals.Password.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.PushEvents.IsSet() {
localVarFormParams.Add("push_events", parameterToString(localVarOptionals.PushEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.TagPushEvents.IsSet() {
localVarFormParams.Add("tag_push_events", parameterToString(localVarOptionals.TagPushEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.IssuesEvents.IsSet() {
localVarFormParams.Add("issues_events", parameterToString(localVarOptionals.IssuesEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.NoteEvents.IsSet() {
localVarFormParams.Add("note_events", parameterToString(localVarOptionals.NoteEvents.Value(), ""))
}
if localVarOptionals != nil && localVarOptionals.MergeRequestsEvents.IsSet() {
localVarFormParams.Add("merge_requests_events", parameterToString(localVarOptionals.MergeRequestsEvents.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 201 {
var v Hook
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
WebhooksApiService 测试WebHook是否发送成功
测试WebHook是否发送成功
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param owner 仓库所属空间地址(企业、组织或个人的地址path)
* @param repo 仓库路径(path)
* @param id Webhook的ID
* @param optional nil or *PostV5ReposOwnerRepoHooksIdTestsOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
*/
type PostV5ReposOwnerRepoHooksIdTestsOpts struct {
AccessToken optional.String
}
func (a *WebhooksApiService) PostV5ReposOwnerRepoHooksIdTests(ctx context.Context, owner string, repo string, id int32, localVarOptionals *PostV5ReposOwnerRepoHooksIdTestsOpts) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/hooks/{id}/tests"
localVarPath = strings.Replace(localVarPath, "{"+"owner"+"}", fmt.Sprintf("%v", owner), -1)
localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
if localVarOptionals != nil && localVarOptionals.AccessToken.IsSet() {
localVarFormParams.Add("access_token", parameterToString(localVarOptionals.AccessToken.Value(), ""))
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
return localVarHttpResponse, newErr
}
return localVarHttpResponse, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。