forked from drone/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package fake | ||
|
||
import ( | ||
"net/url" | ||
|
||
"github.com/jenkins-x/go-scm/scm" | ||
) | ||
|
||
type fakeClient struct { | ||
} | ||
|
||
// NewDefault returns a new GitHub API client using the | ||
// default api.github.com address. | ||
func NewDefault() (*scm.Client, *Data) { | ||
data := NewData() | ||
client := &wrapper{new(scm.Client)} | ||
client.BaseURL = &url.URL{ | ||
Host: "fake.com", | ||
Path: "/", | ||
} | ||
// initialize services | ||
client.Driver = scm.DriverFake | ||
|
||
client.Repositories = &repositoryService{client: client, data: data} | ||
client.Issues = &issueService{client: client, data: data} | ||
|
||
// TODO | ||
/* | ||
client.Contents = &contentService{client} | ||
client.Git = &gitService{client} | ||
client.Organizations = &organizationService{client} | ||
client.PullRequests = &pullService{&issueService{client}} | ||
client.Reviews = &reviewService{client} | ||
client.Users = &userService{client} | ||
client.Webhooks = &webhookService{client} | ||
*/ | ||
return client.Client, data | ||
} | ||
|
||
// wraper wraps the Client to provide high level helper functions | ||
// for making http requests and unmarshaling the response. | ||
type wrapper struct { | ||
*scm.Client | ||
} |