@@ -11,8 +11,9 @@ import (
1111)
1212
1313type Client struct {
14- ctx context.Context
15- api * openapi_client.APIClient
14+ ctx context.Context
15+ api * openapi_client.APIClient
16+ time Time
1617}
1718
1819type Configuration struct {
@@ -35,10 +36,11 @@ func (c Configuration) GetApiUrl() *url.URL {
3536}
3637
3738// For use in tests
38- func NewClientWithCustomApi (ctx context.Context , opts Configuration , api * openapi_client.APIClient ) * Client {
39+ func NewClientWithCustomDeps (ctx context.Context , opts Configuration , api * openapi_client.APIClient , time Time ) * Client {
3940 return & Client {
40- ctx : context .WithValue (ctx , openapi_client .ContextAccessToken , opts .Token ),
41- api : api ,
41+ ctx : context .WithValue (ctx , openapi_client .ContextAccessToken , opts .Token ),
42+ api : api ,
43+ time : time ,
4244 }
4345}
4446
@@ -47,7 +49,7 @@ func NewClient(ctx context.Context, opts Configuration) *Client {
4749 cfg .Servers = []openapi_client.ServerConfiguration {{
4850 URL : opts .BaseUrl .String (),
4951 }}
50- return NewClientWithCustomApi (ctx , opts , openapi_client .NewAPIClient (cfg ))
52+ return NewClientWithCustomDeps (ctx , opts , openapi_client .NewAPIClient (cfg ), & RealTime {} )
5153}
5254
5355func (c * Client ) ListDataCenters () ([]DataCenter , error ) {
0 commit comments