This repository has been archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
api.go
53 lines (49 loc) · 2.39 KB
/
api.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package zuora
// V1 All the available REST endpoints in Zuora
type V1 struct {
ActionsService *actionsService
AccountsService *accountsService
CatalogService *catalogService
SubscriptionsService *subscriptionsService
DescribeService *describeService
PaymentMethods *paymentMethods
Invoices *invoices
RefundService *refundService
}
//API is a container struct with access to all underlying services
type API struct {
V1 V1
ObjectModel ObjectModel
}
//NewAPI helper function to create all required services to interact with Zuora
func NewAPI(httpClient Doer, authHeaderProvider AuthHeaderProvider, baseURL string) *API {
return &API{
V1: V1{
AccountsService: newAccountsService(httpClient, authHeaderProvider, baseURL),
CatalogService: newCatalogService(httpClient, authHeaderProvider, baseURL),
SubscriptionsService: newSubscriptionsService(httpClient, authHeaderProvider, baseURL),
DescribeService: newDescribeService(httpClient, authHeaderProvider, baseURL),
ActionsService: newActionsService(httpClient, authHeaderProvider, baseURL, false),
PaymentMethods: newPaymentMethods(httpClient, authHeaderProvider, baseURL, false),
Invoices: newInvoices(httpClient, authHeaderProvider, baseURL, false),
RefundService: newRefundService(httpClient, authHeaderProvider, baseURL, false),
},
ObjectModel: newObjectModel(),
}
}
//NewPCEAPI helper function to create all required services to interact with Zuora Production Copy Environment (PCE)
func NewPCEAPI(httpClient Doer, authHeaderProvider AuthHeaderProvider, baseURL string) *API {
return &API{
V1: V1{
AccountsService: newAccountsService(httpClient, authHeaderProvider, baseURL),
CatalogService: newCatalogService(httpClient, authHeaderProvider, baseURL),
SubscriptionsService: newSubscriptionsService(httpClient, authHeaderProvider, baseURL),
DescribeService: newDescribeService(httpClient, authHeaderProvider, baseURL),
ActionsService: newActionsService(httpClient, authHeaderProvider, baseURL, true),
PaymentMethods: newPaymentMethods(httpClient, authHeaderProvider, baseURL, true),
Invoices: newInvoices(httpClient, authHeaderProvider, baseURL, true),
RefundService: newRefundService(httpClient, authHeaderProvider, baseURL, true),
},
ObjectModel: newObjectModel(),
}
}