(ctx context.Context, credentials params.ForgeCredentials)
| 607 | } |
| 608 | |
| 609 | func NewRateLimitClient(ctx context.Context, credentials params.ForgeCredentials) (common.RateLimitClient, error) { |
| 610 | httpClient, err := credentials.GetHTTPClient(ctx) |
| 611 | if err != nil { |
| 612 | return nil, fmt.Errorf("error fetching http client: %w", err) |
| 613 | } |
| 614 | |
| 615 | slog.DebugContext( |
| 616 | ctx, "creating rate limit client", |
| 617 | "base_url", credentials.APIBaseURL, |
| 618 | "upload_url", credentials.UploadBaseURL) |
| 619 | |
| 620 | ghClient, err := github.NewClient(httpClient).WithEnterpriseURLs( |
| 621 | credentials.APIBaseURL, credentials.UploadBaseURL) |
| 622 | if err != nil { |
| 623 | return nil, fmt.Errorf("error fetching github client: %w", err) |
| 624 | } |
| 625 | cli := &githubClient{ |
| 626 | rateLimit: ghClient.RateLimit, |
| 627 | cli: ghClient, |
| 628 | } |
| 629 | |
| 630 | return cli, nil |
| 631 | } |
| 632 | |
| 633 | func withGiteaURLs(client *github.Client, apiBaseURL string) (*github.Client, error) { |
| 634 | if client == nil { |
no test coverage detected