2019-05-11 12:21:34 +02:00
|
|
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
|
|
|
// Copyright 2019 The Gitea Authors. All rights reserved.
|
2022-11-27 19:20:29 +01:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-05-11 12:21:34 +02:00
|
|
|
|
|
|
|
package structs
|
|
|
|
|
|
|
|
import (
|
2020-02-29 07:19:32 +01:00
|
|
|
"time"
|
2019-05-11 12:21:34 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// AccessToken represents an API access token.
|
|
|
|
// swagger:response AccessToken
|
|
|
|
type AccessToken struct {
|
2023-02-20 22:28:44 +01:00
|
|
|
ID int64 `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
Token string `json:"sha1"`
|
|
|
|
TokenLastEight string `json:"token_last_eight"`
|
|
|
|
Scopes []string `json:"scopes"`
|
2019-05-11 12:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// AccessTokenList represents a list of API access token.
|
|
|
|
// swagger:response AccessTokenList
|
|
|
|
type AccessTokenList []*AccessToken
|
|
|
|
|
|
|
|
// CreateAccessTokenOption options when create access token
|
|
|
|
type CreateAccessTokenOption struct {
|
2023-02-20 22:28:44 +01:00
|
|
|
// required: true
|
|
|
|
Name string `json:"name" binding:"Required"`
|
|
|
|
Scopes []string `json:"scopes"`
|
2019-05-11 12:21:34 +02:00
|
|
|
}
|
2020-02-29 07:19:32 +01:00
|
|
|
|
|
|
|
// CreateOAuth2ApplicationOptions holds options to create an oauth2 application
|
|
|
|
type CreateOAuth2ApplicationOptions struct {
|
2022-10-24 09:59:24 +02:00
|
|
|
Name string `json:"name" binding:"Required"`
|
|
|
|
ConfidentialClient bool `json:"confidential_client"`
|
|
|
|
RedirectURIs []string `json:"redirect_uris" binding:"Required"`
|
2020-02-29 07:19:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// OAuth2Application represents an OAuth2 application.
|
|
|
|
// swagger:response OAuth2Application
|
|
|
|
type OAuth2Application struct {
|
2022-10-24 09:59:24 +02:00
|
|
|
ID int64 `json:"id"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
ClientID string `json:"client_id"`
|
|
|
|
ClientSecret string `json:"client_secret"`
|
|
|
|
ConfidentialClient bool `json:"confidential_client"`
|
|
|
|
RedirectURIs []string `json:"redirect_uris"`
|
|
|
|
Created time.Time `json:"created"`
|
2020-02-29 07:19:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// OAuth2ApplicationList represents a list of OAuth2 applications.
|
|
|
|
// swagger:response OAuth2ApplicationList
|
|
|
|
type OAuth2ApplicationList []*OAuth2Application
|