提交 6a52f3b1 编写于 作者: F freesky-edward

Add gitee email api support

上级 c5866a72
......@@ -5820,6 +5820,35 @@ paths:
description: "执行成功"
403:
description: "没有权限"
/v5/emails:
get:
tags:
- "Emails"
summary: "获取授权用户的所有邮箱"
description: "获取授权用户的所有邮箱"
operationId: "getV5Emails"
consumes:
- "application/json"
- "multipart/form-data"
produces:
- "application/json"
parameters:
- name: "access_token"
in: "query"
description: "用户授权码"
required: false
type: "string"
x-exportParamName: "AccessToken"
x-optionalDataType: "String"
responses:
200:
description: "返回格式"
schema:
type: "array"
items:
$ref: "#/definitions/Email"
404:
description: "没有相关数据"
/v5/user/keys:
get:
tags:
......@@ -13698,6 +13727,27 @@ definitions:
site_admin: "site_admin"
id: 5
organizations_url: "organizations_url"
Email:
type: "object"
properties:
email:
type: "string"
state:
type: "string"
scope:
type: "array"
items:
type: "string"
description: "获取授权用户的邮件地址"
example:
email: "xxx@xx.com"
state: "confirmed"
scope:
- "primary"
- "secure"
- "notified"
- "commited"
- "public"
Milestone:
type: "object"
properties:
......
# Email
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Email** | **string** | | [optional] [default to null]
**State** | **string** | | [optional] [default to null]
**Scope** | **[]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)
# \EmailsApi
All URIs are relative to *https://gitee.com/api*
Method | HTTP request | Description
------------- | ------------- | -------------
[**GetV5Emails**](EmailsApi.md#GetV5Emails) | **Get** /v5/emails | 获取授权用户的所有邮箱
# **GetV5Emails**
> []Email GetV5Emails(ctx, optional)
获取授权用户的所有邮箱
获取授权用户的所有邮箱
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***GetV5EmailsOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a GetV5EmailsOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**accessToken** | **optional.String**| 用户授权码 |
### Return type
[**[]Email**](Email.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json, multipart/form-data
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
/*
* 码云 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"
"github.com/antihax/optional"
"io/ioutil"
"net/http"
"net/url"
"strings"
)
// Linger please
var (
_ context.Context
)
type EmailsApiService service
/*
EmailsApiService 获取授权用户的所有邮箱
获取授权用户的所有邮箱
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *GetV5EmailsOpts - Optional Parameters:
* @param "AccessToken" (optional.String) - 用户授权码
@return []Email
*/
type GetV5EmailsOpts struct {
AccessToken optional.String
}
func (a *EmailsApiService) GetV5Emails(ctx context.Context, localVarOptionals *GetV5EmailsOpts) ([]Email, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []Email
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/v5/emails"
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 []Email
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
}
......@@ -12,13 +12,11 @@ package gitee
import (
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"net/http"
"net/url"
neturl "net/url"
"strings"
"github.com/antihax/optional"
)
// Linger please
......@@ -371,8 +369,8 @@ func (a *WebhooksApiService) PatchV5ReposOwnerRepoHooksId(ctx context.Context, o
localVarPath = strings.Replace(localVarPath, "{"+"id"+"}", fmt.Sprintf("%v", id), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := neturl.Values{}
localVarFormParams := neturl.Values{}
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
......@@ -504,8 +502,8 @@ func (a *WebhooksApiService) PostV5ReposOwnerRepoHooks(ctx context.Context, owne
localVarPath = strings.Replace(localVarPath, "{"+"repo"+"}", fmt.Sprintf("%v", repo), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := neturl.Values{}
localVarFormParams := neturl.Values{}
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{"application/json", "multipart/form-data"}
......
......@@ -47,6 +47,8 @@ type APIClient struct {
ActivityApi *ActivityApiService
EmailsApi *EmailsApiService
EnterprisesApi *EnterprisesApiService
GistsApi *GistsApiService
......@@ -91,6 +93,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
// API Services
c.ActivityApi = (*ActivityApiService)(&c.common)
c.EmailsApi = (*EmailsApiService)(&c.common)
c.EnterprisesApi = (*EnterprisesApiService)(&c.common)
c.GistsApi = (*GistsApiService)(&c.common)
c.GitDataApi = (*GitDataApiService)(&c.common)
......
/*
* 码云 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 Email struct {
Email string `json:"email,omitempty"`
State string `json:"state,omitempty"`
Scope []string `json:"scope,omitempty"`
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册