@@ -228,136 +228,3 @@ func getGitlabClient(url, token string) (*gitlab.Client, error) {
228228 }
229229 return client , nil
230230}
231-
232- type APIClientFactory interface {
233- Init (url , token string ) error
234- GetJobClient () Job
235- GetIssueClient () Issue
236- GetMergeRequestClient () MergeRequest
237- GetProjectVariableClient () ProjectVariable
238- GetRepositoryClient () Repository
239- GetPipelineClient () Pipeline
240- GetNoteClient () Note
241- GetProjectClient () Project
242- GetUserClient () User
243- GetLintClient () Lint
244- }
245-
246- type GitlabClientFactory struct {
247- gitlabClient * gitlab.Client
248- }
249-
250- func NewGitlabClientFactory (url , token string ) (APIClientFactory , error ) {
251- gitlabClient , err := getGitlabClient (url , token )
252- if err != nil {
253- return nil , err
254- }
255- factory := & GitlabClientFactory {gitlabClient : gitlabClient }
256- return factory , nil
257- }
258-
259- func (f * GitlabClientFactory ) Init (url , token string ) error {
260- gitlabClient , err := getGitlabClient (url , token )
261- if err != nil {
262- return err
263- }
264- f .gitlabClient = gitlabClient
265- return nil
266- }
267-
268- func (f * GitlabClientFactory ) GetJobClient () Job {
269- return NewJobClient (f .gitlabClient )
270- }
271-
272- func (f * GitlabClientFactory ) GetIssueClient () Issue {
273- return NewIssueClient (f .gitlabClient )
274- }
275-
276- func (f * GitlabClientFactory ) GetMergeRequestClient () MergeRequest {
277- return NewMergeRequestClient (f .gitlabClient )
278- }
279-
280- func (f * GitlabClientFactory ) GetProjectVariableClient () ProjectVariable {
281- return NewProjectVariableClient (f .gitlabClient )
282- }
283-
284- func (f * GitlabClientFactory ) GetRepositoryClient () Repository {
285- return NewRepositoryClient (f .gitlabClient )
286- }
287-
288- func (f * GitlabClientFactory ) GetNoteClient () Note {
289- return NewNoteClient (f .gitlabClient )
290- }
291-
292- func (f * GitlabClientFactory ) GetPipelineClient () Pipeline {
293- return NewPipelineClient (f .gitlabClient )
294- }
295-
296- func (f * GitlabClientFactory ) GetProjectClient () Project {
297- return NewProjectClient (f .gitlabClient )
298- }
299-
300- func (f * GitlabClientFactory ) GetUserClient () User {
301- return NewUserClient (f .gitlabClient )
302- }
303-
304- func (f * GitlabClientFactory ) GetLintClient () Lint {
305- return NewLintClient (f .gitlabClient )
306- }
307-
308- type MockAPIClientFactory struct {
309- MockGetJobClient func () Job
310- MockGetIssueClient func () Issue
311- MockGetMergeRequestClient func () MergeRequest
312- MockGetProjectVariableClient func () ProjectVariable
313- MockGetRepositoryClient func () Repository
314- MockGetNoteClient func () Note
315- MockGetPipelineClient func () Pipeline
316- MockGetProjectClient func () Project
317- MockGetUserClient func () User
318- MockGetLintClient func () Lint
319- }
320-
321- func (m * MockAPIClientFactory ) Init (url , token string ) error {
322- return nil
323- }
324-
325- func (m * MockAPIClientFactory ) GetJobClient () Job {
326- return m .MockGetJobClient ()
327- }
328-
329- func (m * MockAPIClientFactory ) GetIssueClient () Issue {
330- return m .MockGetIssueClient ()
331- }
332-
333- func (m * MockAPIClientFactory ) GetMergeRequestClient () MergeRequest {
334- return m .MockGetMergeRequestClient ()
335- }
336-
337- func (m * MockAPIClientFactory ) GetProjectVariableClient () ProjectVariable {
338- return m .MockGetProjectVariableClient ()
339- }
340-
341- func (m * MockAPIClientFactory ) GetRepositoryClient () Repository {
342- return m .MockGetRepositoryClient ()
343- }
344-
345- func (m * MockAPIClientFactory ) GetPipelineClient () Pipeline {
346- return m .MockGetPipelineClient ()
347- }
348-
349- func (m * MockAPIClientFactory ) GetNoteClient () Note {
350- return m .MockGetNoteClient ()
351- }
352-
353- func (m * MockAPIClientFactory ) GetProjectClient () Project {
354- return m .MockGetProjectClient ()
355- }
356-
357- func (m * MockAPIClientFactory ) GetUserClient () User {
358- return m .MockGetUserClient ()
359- }
360-
361- func (m * MockAPIClientFactory ) GetLintClient () Lint {
362- return m .MockGetLintClient ()
363- }
0 commit comments