summaryrefslogtreecommitdiffstats
path: root/vendor/code.gitea.io/sdk
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2017-05-02 15:35:59 +0200
committerKim "BKC" Carlbäcker <kim.carlbacker@gmail.com>2017-05-02 15:35:59 +0200
commit3edb0c58943c003ed3f209b2197d1f43484a3432 (patch)
treee5849cead5053ab505a2c5dc1342111c6bcf0816 /vendor/code.gitea.io/sdk
parentbb5f694fc57c3ade9c13e841b9a237f4e192da22 (diff)
downloadgitea-3edb0c58943c003ed3f209b2197d1f43484a3432.tar.gz
gitea-3edb0c58943c003ed3f209b2197d1f43484a3432.zip
Generate swagger json (#1402)
- Generate swagger.json into public/ - Add swagger-ui auto-installation - Add footer link to local swagger-ui - Add /swagger url for using app url. - Fix Swagger-UI version via git tag
Diffstat (limited to 'vendor/code.gitea.io/sdk')
-rw-r--r--vendor/code.gitea.io/sdk/gitea/miscellaneous.go38
-rw-r--r--vendor/code.gitea.io/sdk/gitea/repo.go40
-rw-r--r--vendor/code.gitea.io/sdk/gitea/repo_key.go13
-rw-r--r--vendor/code.gitea.io/sdk/gitea/repo_watch.go1
-rw-r--r--vendor/code.gitea.io/sdk/gitea/user.go5
-rw-r--r--vendor/code.gitea.io/sdk/gitea/user_app.go6
-rw-r--r--vendor/code.gitea.io/sdk/gitea/user_gpgkey.go12
-rw-r--r--vendor/code.gitea.io/sdk/gitea/user_key.go5
8 files changed, 110 insertions, 10 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/miscellaneous.go b/vendor/code.gitea.io/sdk/gitea/miscellaneous.go
index dc56177ca6..be1aa5e8b0 100644
--- a/vendor/code.gitea.io/sdk/gitea/miscellaneous.go
+++ b/vendor/code.gitea.io/sdk/gitea/miscellaneous.go
@@ -4,15 +4,47 @@
package gitea
+// SearchResults results of search
+// swagger:response SearchResults
+type SearchResults struct {
+ OK bool `json:"ok"`
+ Data []*Repository `json:"data"`
+}
+
+// SearchError error of failing search
+// swagger:response SearchError
+type SearchError struct {
+ OK bool `json:"ok"`
+ Error string `json:"error"`
+}
+
// MarkdownOption markdown options
+// swagger:parameters renderMarkdown
type MarkdownOption struct {
- Text string
- Mode string
+ // Text markdown to render
+ //
+ // in: body
+ Text string
+ // Mode to render
+ //
+ // in: body
+ Mode string
+ // Context to render
+ //
+ // in: body
Context string
- Wiki bool
+ // Is it a wiki page ?
+ //
+ // in: body
+ Wiki bool
}
+// MarkdownRender is a rendered markdown document
+// swagger:response MarkdownRender
+type MarkdownRender string
+
// ServerVersion wraps the version of the server
+// swagger:response ServerVersion
type ServerVersion struct {
Version string
}
diff --git a/vendor/code.gitea.io/sdk/gitea/repo.go b/vendor/code.gitea.io/sdk/gitea/repo.go
index 9399ca2ee3..acacb0ec44 100644
--- a/vendor/code.gitea.io/sdk/gitea/repo.go
+++ b/vendor/code.gitea.io/sdk/gitea/repo.go
@@ -19,6 +19,7 @@ type Permission struct {
}
// Repository represents a API repository.
+// swagger:response Repository
type Repository struct {
ID int64 `json:"id"`
Owner *User `json:"owner"`
@@ -42,6 +43,10 @@ type Repository struct {
Permissions *Permission `json:"permissions,omitempty"`
}
+// RepositoryList represents a list of API repository.
+// swagger:response RepositoryList
+type RepositoryList []*Repository
+
// ListMyRepos lists all repositories for the authenticated user that has access to.
func (c *Client) ListMyRepos() ([]*Repository, error) {
repos := make([]*Repository, 0, 10)
@@ -61,14 +66,37 @@ func (c *Client) ListOrgRepos(org string) ([]*Repository, error) {
}
// CreateRepoOption options when creating repository
+//swagger:parameters createOrgRepo
type CreateRepoOption struct {
- Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
+ // Name of the repository to create
+ //
+ // in: body
+ // unique: true
+ Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
+ // Description of the repository to create
+ //
+ // in: body
Description string `json:"description" binding:"MaxSize(255)"`
- Private bool `json:"private"`
- AutoInit bool `json:"auto_init"`
- Gitignores string `json:"gitignores"`
- License string `json:"license"`
- Readme string `json:"readme"`
+ // Is the repository to create private ?
+ //
+ // in: body
+ Private bool `json:"private"`
+ // Init the repository to create ?
+ //
+ // in: body
+ AutoInit bool `json:"auto_init"`
+ // Gitignores to use
+ //
+ // in: body
+ Gitignores string `json:"gitignores"`
+ // License to use
+ //
+ // in: body
+ License string `json:"license"`
+ // Readme of the repository to create
+ //
+ // in: body
+ Readme string `json:"readme"`
}
// CreateRepo creates a repository for authenticated user.
diff --git a/vendor/code.gitea.io/sdk/gitea/repo_key.go b/vendor/code.gitea.io/sdk/gitea/repo_key.go
index a0dbf0a58a..24d29a2095 100644
--- a/vendor/code.gitea.io/sdk/gitea/repo_key.go
+++ b/vendor/code.gitea.io/sdk/gitea/repo_key.go
@@ -34,9 +34,20 @@ func (c *Client) GetDeployKey(user, repo string, keyID int64) (*DeployKey, error
}
// CreateKeyOption options when create deploy key
+// swagger:parameters userCurrentPostKey
type CreateKeyOption struct {
+ // Title of the key to add
+ //
+ // in: body
+ // required: true
+ // unique: true
Title string `json:"title" binding:"Required"`
- Key string `json:"key" binding:"Required"`
+ // An armored SSH key to add
+ //
+ // in: body
+ // required: true
+ // unique: true
+ Key string `json:"key" binding:"Required"`
}
// CreateDeployKey options when create one deploy key
diff --git a/vendor/code.gitea.io/sdk/gitea/repo_watch.go b/vendor/code.gitea.io/sdk/gitea/repo_watch.go
index ffc3e2d2c5..02c5d9b0d3 100644
--- a/vendor/code.gitea.io/sdk/gitea/repo_watch.go
+++ b/vendor/code.gitea.io/sdk/gitea/repo_watch.go
@@ -11,6 +11,7 @@ import (
)
// WatchInfo represents a API watch status of one repository
+// swagger:response WatchInfo
type WatchInfo struct {
Subscribed bool `json:"subscribed"`
Ignored bool `json:"ignored"`
diff --git a/vendor/code.gitea.io/sdk/gitea/user.go b/vendor/code.gitea.io/sdk/gitea/user.go
index 967d8b5154..9fe2edcbf2 100644
--- a/vendor/code.gitea.io/sdk/gitea/user.go
+++ b/vendor/code.gitea.io/sdk/gitea/user.go
@@ -10,6 +10,7 @@ import (
)
// User represents a API user.
+// swagger:response User
type User struct {
ID int64 `json:"id"`
UserName string `json:"login"`
@@ -18,6 +19,10 @@ type User struct {
AvatarURL string `json:"avatar_url"`
}
+// UserList represents a list of API user.
+// swagger:response UserList
+type UserList []*User
+
// MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility
func (u User) MarshalJSON() ([]byte, error) {
// Re-declaring User to avoid recursion
diff --git a/vendor/code.gitea.io/sdk/gitea/user_app.go b/vendor/code.gitea.io/sdk/gitea/user_app.go
index 7fbb35dc3e..82d2a40462 100644
--- a/vendor/code.gitea.io/sdk/gitea/user_app.go
+++ b/vendor/code.gitea.io/sdk/gitea/user_app.go
@@ -18,11 +18,16 @@ func BasicAuthEncode(user, pass string) string {
}
// AccessToken represents a API access token.
+// swagger:response AccessToken
type AccessToken struct {
Name string `json:"name"`
Sha1 string `json:"sha1"`
}
+// AccessTokenList represents a list of API access token.
+// swagger:response AccessTokenList
+type AccessTokenList []*AccessToken
+
// ListAccessTokens lista all the access tokens of user
func (c *Client) ListAccessTokens(user, pass string) ([]*AccessToken, error) {
tokens := make([]*AccessToken, 0, 10)
@@ -31,6 +36,7 @@ func (c *Client) ListAccessTokens(user, pass string) ([]*AccessToken, error) {
}
// CreateAccessTokenOption options when create access token
+// swagger:parameters userCreateToken
type CreateAccessTokenOption struct {
Name string `json:"name" binding:"Required"`
}
diff --git a/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go b/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
index c8afe92c92..942478b9f1 100644
--- a/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
+++ b/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
@@ -11,7 +11,12 @@ import (
"time"
)
+// GPGKeyList represents a list of GPGKey
+// swagger:response GPGKeyList
+type GPGKeyList []*GPGKey
+
// GPGKey a user GPG key to sign commit and tag in repository
+// swagger:response GPGKey
type GPGKey struct {
ID int64 `json:"id"`
PrimaryKeyID string `json:"primary_key_id"`
@@ -28,13 +33,20 @@ type GPGKey struct {
}
// GPGKeyEmail a email attache to a GPGKey
+// swagger:model GPGKeyEmail
type GPGKeyEmail struct {
Email string `json:"email"`
Verified bool `json:"verified"`
}
// CreateGPGKeyOption options create user GPG key
+// swagger:parameters userCurrentPostGPGKey
type CreateGPGKeyOption struct {
+ // An armored GPG key to add
+ //
+ // in: body
+ // required: true
+ // unique: true
ArmoredKey string `json:"armored_public_key" binding:"Required"`
}
diff --git a/vendor/code.gitea.io/sdk/gitea/user_key.go b/vendor/code.gitea.io/sdk/gitea/user_key.go
index 3135b33a3d..397c6d17ac 100644
--- a/vendor/code.gitea.io/sdk/gitea/user_key.go
+++ b/vendor/code.gitea.io/sdk/gitea/user_key.go
@@ -11,7 +11,12 @@ import (
"time"
)
+// PublicKeyList represents a list of PublicKey
+// swagger:response PublicKeyList
+type PublicKeyList []*PublicKey
+
// PublicKey publickey is a user key to push code to repository
+// swagger:response PublicKey
type PublicKey struct {
ID int64 `json:"id"`
Key string `json:"key"`