-
Notifications
You must be signed in to change notification settings - Fork 6
/
reportingclientfactory.go
35 lines (28 loc) · 1.08 KB
/
reportingclientfactory.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
// This is licensed software from AccelByte Inc, for limitations
// and restrictions contact your company contract manager.
// Code generated. DO NOT EDIT.
package factory
import (
"strings"
"github.com/AccelByte/accelbyte-go-sdk/reporting-sdk/pkg/reportingclient"
"github.com/AccelByte/accelbyte-go-sdk/services-api/pkg/repository"
)
var reportingClientInstance *reportingclient.JusticeReportingService
func NewReportingClient(configRepository repository.ConfigRepository) *reportingclient.JusticeReportingService {
if reportingClientInstance == nil {
baseURL := configRepository.GetJusticeBaseUrl()
if len(baseURL) > 0 {
baseURLSplit := strings.Split(baseURL, "://")
httpClientConfig := &reportingclient.TransportConfig{
Host: baseURLSplit[1],
BasePath: "",
Schemes: []string{baseURLSplit[0]},
}
reportingClientInstance = reportingclient.NewHTTPClientWithConfig(nil, httpClientConfig)
} else {
reportingClientInstance = reportingclient.NewHTTPClient(nil)
}
}
return reportingClientInstance
}