(ctx context.Context)
| 32 | } |
| 33 | |
| 34 | func (d *Gitee) Init(ctx context.Context) error { |
| 35 | d.RootFolderPath = utils.FixAndCleanPath(d.RootFolderPath) |
| 36 | d.Endpoint = strings.TrimSpace(d.Endpoint) |
| 37 | if d.Endpoint == "" { |
| 38 | d.Endpoint = "https://gitee.com/api/v5" |
| 39 | } |
| 40 | d.Endpoint = strings.TrimSuffix(d.Endpoint, "/") |
| 41 | d.Owner = strings.TrimSpace(d.Owner) |
| 42 | d.Repo = strings.TrimSpace(d.Repo) |
| 43 | d.Token = strings.TrimSpace(d.Token) |
| 44 | d.DownloadProxy = strings.TrimSpace(d.DownloadProxy) |
| 45 | if d.Owner == "" || d.Repo == "" { |
| 46 | return errors.New("owner and repo are required") |
| 47 | } |
| 48 | d.client = base.NewRestyClient(). |
| 49 | SetBaseURL(d.Endpoint). |
| 50 | SetHeader("Accept", "application/json") |
| 51 | repo, err := d.getRepo() |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | d.Ref = strings.TrimSpace(d.Ref) |
| 56 | if d.Ref == "" { |
| 57 | d.Ref = repo.DefaultBranch |
| 58 | } |
| 59 | return nil |
| 60 | } |
| 61 | |
| 62 | func (d *Gitee) Drop(ctx context.Context) error { |
| 63 | return nil |
nothing calls this directly
no test coverage detected