1
0
Fork 0
forked from forgejo/forgejo

Vendor Update (#14696)

* github.com/yuin/goldmark v1.3.1 -> v1.3.2

* github.com/xanzy/go-gitlab v0.42.0 -> v0.44.0

* github.com/prometheus/client_golang v1.8.0 -> v1.9.0

* github.com/minio/minio-go v7.0.7 -> v7.0.9

* github.com/lafriks/xormstore v1.3.2 -> v1.4.0

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
6543 2021-02-17 04:47:24 +01:00 committed by GitHub
parent dc707aea09
commit fe628d8406
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
137 changed files with 3348 additions and 1312 deletions

View file

@ -1,4 +1,5 @@
// Copyright 2017, Stany MARCEL
//
// Copyright 2021, Stany MARCEL
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -16,6 +17,7 @@ package gitlab
import (
"fmt"
"net/http"
"net/url"
)
@ -27,26 +29,14 @@ type WikisService struct {
client *Client
}
// WikiFormat represents the available wiki formats.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
type WikiFormat string
// The available wiki formats.
const (
WikiFormatMarkdown WikiFormat = "markdown"
WikiFormatRFoc WikiFormat = "rdoc"
WikiFormatASCIIDoc WikiFormat = "asciidoc"
)
// Wiki represents a GitLab wiki.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
type Wiki struct {
Content string `json:"content"`
Format WikiFormat `json:"format"`
Slug string `json:"slug"`
Title string `json:"title"`
Content string `json:"content"`
Format WikiFormatValue `json:"format"`
Slug string `json:"slug"`
Title string `json:"title"`
}
func (w Wiki) String() string {
@ -73,18 +63,18 @@ func (s *WikisService) ListWikis(pid interface{}, opt *ListWikisOptions, options
}
u := fmt.Sprintf("projects/%s/wikis", pathEscape(project))
req, err := s.client.NewRequest("GET", u, opt, options)
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
if err != nil {
return nil, nil, err
}
var w []*Wiki
resp, err := s.client.Do(req, &w)
var ws []*Wiki
resp, err := s.client.Do(req, &ws)
if err != nil {
return nil, resp, err
}
return w, resp, err
return ws, resp, err
}
// GetWikiPage gets a wiki page for a given project.
@ -98,13 +88,13 @@ func (s *WikisService) GetWikiPage(pid interface{}, slug string, options ...Requ
}
u := fmt.Sprintf("projects/%s/wikis/%s", pathEscape(project), url.PathEscape(slug))
req, err := s.client.NewRequest("GET", u, nil, options)
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
if err != nil {
return nil, nil, err
}
var w *Wiki
resp, err := s.client.Do(req, &w)
w := new(Wiki)
resp, err := s.client.Do(req, w)
if err != nil {
return nil, resp, err
}
@ -117,9 +107,9 @@ func (s *WikisService) GetWikiPage(pid interface{}, slug string, options ...Requ
// GitLab API docs:
// https://docs.gitlab.com/ce/api/wikis.html#create-a-new-wiki-page
type CreateWikiPageOptions struct {
Content *string `url:"content" json:"content"`
Title *string `url:"title" json:"title"`
Format *string `url:"format,omitempty" json:"format,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
Format *WikiFormatValue `url:"format,omitempty" json:"format,omitempty"`
}
// CreateWikiPage creates a new wiki page for the given repository with
@ -134,7 +124,7 @@ func (s *WikisService) CreateWikiPage(pid interface{}, opt *CreateWikiPageOption
}
u := fmt.Sprintf("projects/%s/wikis", pathEscape(project))
req, err := s.client.NewRequest("POST", u, opt, options)
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -153,9 +143,9 @@ func (s *WikisService) CreateWikiPage(pid interface{}, opt *CreateWikiPageOption
// GitLab API docs:
// https://docs.gitlab.com/ce/api/wikis.html#edit-an-existing-wiki-page
type EditWikiPageOptions struct {
Content *string `url:"content" json:"content"`
Title *string `url:"title" json:"title"`
Format *string `url:"format,omitempty" json:"format,omitempty"`
Content *string `url:"content,omitempty" json:"content,omitempty"`
Title *string `url:"title,omitempty" json:"title,omitempty"`
Format *WikiFormatValue `url:"format,omitempty" json:"format,omitempty"`
}
// EditWikiPage Updates an existing wiki page. At least one parameter is
@ -170,7 +160,7 @@ func (s *WikisService) EditWikiPage(pid interface{}, slug string, opt *EditWikiP
}
u := fmt.Sprintf("projects/%s/wikis/%s", pathEscape(project), url.PathEscape(slug))
req, err := s.client.NewRequest("PUT", u, opt, options)
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
if err != nil {
return nil, nil, err
}
@ -195,7 +185,7 @@ func (s *WikisService) DeleteWikiPage(pid interface{}, slug string, options ...R
}
u := fmt.Sprintf("projects/%s/wikis/%s", pathEscape(project), url.PathEscape(slug))
req, err := s.client.NewRequest("DELETE", u, nil, options)
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
if err != nil {
return nil, err
}