-
Notifications
You must be signed in to change notification settings - Fork 0
/
Service.go
49 lines (38 loc) · 1.04 KB
/
Service.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
package googlecalendar
import (
"fmt"
errortools "github.com/leapforce-libraries/go_errortools"
google "github.com/leapforce-libraries/go_google"
)
const (
apiName string = "GoogleCalendar"
apiUrl string = "https://www.googleapis.com/calendar/v3"
)
type Service struct {
googleService *google.Service
}
func NewServiceWithOAuth2(cfg *google.ServiceWithOAuth2Config) (*Service, *errortools.Error) {
googleService, e := google.NewServiceWithOAuth2(cfg)
if e != nil {
return nil, e
}
return &Service{googleService}, nil
}
func (service *Service) url(path string) string {
return fmt.Sprintf("%s/%s", apiUrl, path)
}
func (service *Service) ApiName() string {
return apiName
}
func (service *Service) ApiKey() string {
return service.googleService.ApiKey()
}
func (service *Service) ApiCallCount() int64 {
return service.googleService.ApiCallCount()
}
func (service *Service) ApiReset() {
service.googleService.ApiReset()
}
func (service *Service) ErrorResponse() *google.ErrorResponse {
return service.googleService.ErrorResponse()
}