Skip to content

Commit

Permalink
generate codes of project_labels by swagger-codegen and build success…
Browse files Browse the repository at this point in the history
… by bazel (#12)

* gen by swagger-codegen and build success by bazel

* fix: fmt code in model_project_label.go

Co-authored-by: wanghaosq <[email protected]>
  • Loading branch information
wanghao75 and wanghaosq authored Jan 18, 2022
1 parent effa553 commit 0c41490
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 0 deletions.
93 changes: 93 additions & 0 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,84 @@ paths:
type: "array"
items:
$ref: "#/definitions/OperateLog"
/v5/repos/{owner}/{repo}/project_labels:
post:
tags:
- "Labels"
summary: "添加仓库标签"
description: "添加仓库标签"
operationId: "postV5ReposOwnerRepoProjectLabels"
consumes:
- "application/json"
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "owner"
in: "path"
description: "仓库所属空间地址(企业、组织或个人的地址path)"
required: true
type: "string"
x-exportParamName: "Owner"
- name: "repo"
in: "path"
description: "仓库路径(path)"
required: true
type: "string"
x-exportParamName: "Repo"
- in: "body"
name: "body"
description: "必选,标签的内容"
required: true
schema:
$ref: "#/definitions/PullRequestLabelPostParam"
x-exportParamName: "Body"
responses:
201:
description: "返回格式"
schema:
type: "array"
items:
$ref: "#/definitions/ProjectLabel"
put:
tags:
- "Labels"
summary: "替换所有仓库标签"
description: "替换所有仓库标签\n 需要在请求的body里填上数组,元素为标签的名字。如: [\"feat\", \"\
bug\"]"
operationId: "putV5ReposOwnerRepoProjectLabels"
consumes:
- "application/json"
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "owner"
in: "path"
description: "仓库所属空间地址(企业、组织或个人的地址path)"
required: true
type: "string"
x-exportParamName: "Owner"
- name: "repo"
in: "path"
description: "仓库路径(path)"
required: true
type: "string"
x-exportParamName: "Repo"
- in: "body"
name: "body"
description: "必选,标签的内容"
required: true
schema:
$ref: "#/definitions/PullRequestLabelPostParam"
x-exportParamName: "Body"
responses:
200:
description: "返回格式"
schema:
type: "array"
items:
$ref: "#/definitions/ProjectLabel"
/v5/repos/{owner}/{repo}/labels:
get:
tags:
Expand Down Expand Up @@ -14242,6 +14320,21 @@ definitions:
example:
name: "name"
commit: "commit"
ProjectLabel:
type: "object"
properties:
id:
type: "integer"
format: "int32"
name:
type: "string"
ident:
type: "string"
description: "创建仓库标签"
example:
id: 0
name: "name"
ident: "ident"
ProjectMember:
type: "object"
properties:
Expand Down
12 changes: 12 additions & 0 deletions docs/ProjectLabel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ProjectLabel

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **int32** | | [optional] [default to null]
**Name** | **string** | | [optional] [default to null]
**Ident** | **string** | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


1 change: 1 addition & 0 deletions gitee/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ go_library(
"model_program_basic.go",
"model_project.go",
"model_project_basic.go",
"model_project_label.go",
"model_project_member.go",
"model_project_member_permission.go",
"model_project_member_permission_detail.go",
Expand Down
188 changes: 188 additions & 0 deletions gitee/api_labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,100 @@ func (a *LabelsApiService) PostV5ReposOwnerRepoLabels(ctx context.Context, owner
return localVarReturnValue, localVarHttpResponse, nil
}

/*
LabelsApiService 添加仓库标签
添加仓库标签
* @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 body 必选,标签的内容
@return []ProjectLabel
*/
func (a *LabelsApiService) PostV5ReposOwnerRepoProjectLabels(ctx context.Context, owner string, repo string, body PullRequestLabelPostParam) ([]ProjectLabel, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []ProjectLabel
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/project_labels"
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{}

// 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
}
// body params
localVarPostBody = &body.Body
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 []ProjectLabel
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
}

/*
LabelsApiService 替换Issue所有标签
替换Issue所有标签 需要在请求的body里填上数组,元素为标签的名字。如: [\&quot;performance\&quot;, \&quot;bug\&quot;]
Expand Down Expand Up @@ -1183,3 +1277,97 @@ func (a *LabelsApiService) PutV5ReposOwnerRepoIssuesNumberLabels(ctx context.Con

return localVarReturnValue, localVarHttpResponse, nil
}

/*
LabelsApiService 替换所有仓库标签
替换所有仓库标签 需要在请求的body里填上数组,元素为标签的名字。如: [\&quot;feat\&quot;, \&quot;bug\&quot;]
* @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 body 必选,标签的内容
@return []ProjectLabel
*/
func (a *LabelsApiService) PutV5ReposOwnerRepoProjectLabels(ctx context.Context, owner string, repo string, body PullRequestLabelPostParam) ([]ProjectLabel, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []ProjectLabel
)

// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/repos/{owner}/{repo}/project_labels"
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{}

// 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
}
// body params
localVarPostBody = &body.Body
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 []ProjectLabel
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
}
17 changes: 17 additions & 0 deletions gitee/model_project_label.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* 码云 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

// 创建仓库标签
type ProjectLabel struct {
Id int32 `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Ident string `json:"ident,omitempty"`
}

0 comments on commit 0c41490

Please sign in to comment.