...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package gitlab
18
19 import (
20 "fmt"
21 "net/http"
22 "time"
23 )
24
25
26
27
28
29 type RepositorySubmodulesService struct {
30 client *Client
31 }
32
33
34
35
36 type SubmoduleCommit struct {
37 ID string `json:"id"`
38 ShortID string `json:"short_id"`
39 Title string `json:"title"`
40 AuthorName string `json:"author_name"`
41 AuthorEmail string `json:"author_email"`
42 CommitterName string `json:"committer_name"`
43 CommitterEmail string `json:"committer_email"`
44 CreatedAt *time.Time `json:"created_at"`
45 Message string `json:"message"`
46 ParentIDs []string `json:"parent_ids"`
47 CommittedDate *time.Time `json:"committed_date"`
48 AuthoredDate *time.Time `json:"authored_date"`
49 Status *BuildStateValue `json:"status"`
50 }
51
52 func (r SubmoduleCommit) String() string {
53 return Stringify(r)
54 }
55
56
57
58
59
60 type UpdateSubmoduleOptions struct {
61 Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
62 CommitSHA *string `url:"commit_sha,omitempty" json:"commit_sha,omitempty"`
63 CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
64 }
65
66
67
68
69
70 func (s *RepositorySubmodulesService) UpdateSubmodule(pid interface{}, submodule string, opt *UpdateSubmoduleOptions, options ...RequestOptionFunc) (*SubmoduleCommit, *Response, error) {
71 project, err := parseID(pid)
72 if err != nil {
73 return nil, nil, err
74 }
75 u := fmt.Sprintf(
76 "projects/%s/repository/submodules/%s",
77 PathEscape(project),
78 PathEscape(submodule),
79 )
80
81 req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
82 if err != nil {
83 return nil, nil, err
84 }
85
86 sc := new(SubmoduleCommit)
87 resp, err := s.client.Do(req, sc)
88 if err != nil {
89 return nil, resp, err
90 }
91
92 return sc, resp, nil
93 }
94
View as plain text