1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- package gitlab
- import (
- "fmt"
- )
- type LicenseTemplate struct {
- Key string `json:"key"`
- Name string `json:"name"`
- Nickname string `json:"nickname"`
- Featured bool `json:"featured"`
- HTMLURL string `json:"html_url"`
- SourceURL string `json:"source_url"`
- Description string `json:"description"`
- Conditions []string `json:"conditions"`
- Permissions []string `json:"permissions"`
- Limitations []string `json:"limitations"`
- Content string `json:"content"`
- }
- type LicenseTemplatesService struct {
- client *Client
- }
- type ListLicenseTemplatesOptions struct {
- ListOptions
- Popular *bool `url:"popular,omitempty" json:"popular,omitempty"`
- }
- func (s *LicenseTemplatesService) ListLicenseTemplates(opt *ListLicenseTemplatesOptions, options ...OptionFunc) ([]*LicenseTemplate, *Response, error) {
- req, err := s.client.NewRequest("GET", "templates/licenses", opt, options)
- if err != nil {
- return nil, nil, err
- }
- var lts []*LicenseTemplate
- resp, err := s.client.Do(req, <s)
- if err != nil {
- return nil, resp, err
- }
- return lts, resp, err
- }
- type GetLicenseTemplateOptions struct {
- Project *string `url:"project,omitempty" json:"project,omitempty"`
- Fullname *string `url:"fullname,omitempty" json:"fullname,omitempty"`
- }
- func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...OptionFunc) (*LicenseTemplate, *Response, error) {
- u := fmt.Sprintf("templates/licenses/%s", template)
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
- lt := new(LicenseTemplate)
- resp, err := s.client.Do(req, lt)
- if err != nil {
- return nil, resp, err
- }
- return lt, resp, err
- }
|