2023-12-01 18:33:04 +01:00
|
|
|
package googleapi
|
|
|
|
|
2023-12-04 13:48:11 +01:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2023-12-01 18:33:04 +01:00
|
|
|
type GoogleClient interface {
|
2023-12-04 13:48:11 +01:00
|
|
|
SendMail(ctx context.Context, from string, recipients []string, cc []string, bcc []string, subject string, body MailBody, attachments []MailAttachment) (MailRef, error)
|
2023-12-01 18:33:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
type client struct {
|
|
|
|
oauth GoogleOAuth
|
2023-12-04 13:48:11 +01:00
|
|
|
http http.Client
|
2023-12-01 18:33:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewGoogleClient(oauth GoogleOAuth) GoogleClient {
|
|
|
|
return &client{
|
|
|
|
oauth: oauth,
|
2023-12-04 13:48:11 +01:00
|
|
|
http: http.Client{},
|
2023-12-01 18:33:04 +01:00
|
|
|
}
|
|
|
|
}
|