code.gitea.io/gitea@v1.19.3/modules/structs/user_app.go (about)

     1  // Copyright 2014 The Gogs Authors. All rights reserved.
     2  // Copyright 2019 The Gitea Authors. All rights reserved.
     3  // SPDX-License-Identifier: MIT
     4  
     5  package structs
     6  
     7  import (
     8  	"time"
     9  )
    10  
    11  // AccessToken represents an API access token.
    12  // swagger:response AccessToken
    13  type AccessToken struct {
    14  	ID             int64    `json:"id"`
    15  	Name           string   `json:"name"`
    16  	Token          string   `json:"sha1"`
    17  	TokenLastEight string   `json:"token_last_eight"`
    18  	Scopes         []string `json:"scopes"`
    19  }
    20  
    21  // AccessTokenList represents a list of API access token.
    22  // swagger:response AccessTokenList
    23  type AccessTokenList []*AccessToken
    24  
    25  // CreateAccessTokenOption options when create access token
    26  type CreateAccessTokenOption struct {
    27  	// required: true
    28  	Name   string   `json:"name" binding:"Required"`
    29  	Scopes []string `json:"scopes"`
    30  }
    31  
    32  // CreateOAuth2ApplicationOptions holds options to create an oauth2 application
    33  type CreateOAuth2ApplicationOptions struct {
    34  	Name               string   `json:"name" binding:"Required"`
    35  	ConfidentialClient bool     `json:"confidential_client"`
    36  	RedirectURIs       []string `json:"redirect_uris" binding:"Required"`
    37  }
    38  
    39  // OAuth2Application represents an OAuth2 application.
    40  // swagger:response OAuth2Application
    41  type OAuth2Application struct {
    42  	ID                 int64     `json:"id"`
    43  	Name               string    `json:"name"`
    44  	ClientID           string    `json:"client_id"`
    45  	ClientSecret       string    `json:"client_secret"`
    46  	ConfidentialClient bool      `json:"confidential_client"`
    47  	RedirectURIs       []string  `json:"redirect_uris"`
    48  	Created            time.Time `json:"created"`
    49  }
    50  
    51  // OAuth2ApplicationList represents a list of OAuth2 applications.
    52  // swagger:response OAuth2ApplicationList
    53  type OAuth2ApplicationList []*OAuth2Application