1
// Package groupsmigration provides access to the Groups Migration API.
3
// See https://developers.google.com/google-apps/groups-migration/
7
// import "google.golang.org/api/groupsmigration/v1"
9
// groupsmigrationService, err := groupsmigration.New(oauthHttpClient)
10
package groupsmigration
17
"google.golang.org/api/googleapi"
25
// Always reference these packages, just in case the auto-generated code
27
var _ = bytes.NewBuffer
30
var _ = json.NewDecoder
33
var _ = googleapi.Version
35
var _ = strings.Replace
37
const apiId = "groupsmigration:v1"
38
const apiName = "groupsmigration"
39
const apiVersion = "v1"
40
const basePath = "https://www.googleapis.com/groups/v1/groups/"
42
func New(client *http.Client) (*Service, error) {
44
return nil, errors.New("client is nil")
46
s := &Service{client: client, BasePath: basePath}
47
s.Archive = NewArchiveService(s)
53
BasePath string // API endpoint base URL
55
Archive *ArchiveService
58
func NewArchiveService(s *Service) *ArchiveService {
59
rs := &ArchiveService{s: s}
63
type ArchiveService struct {
68
// Kind: The kind of insert resource this is.
69
Kind string `json:"kind,omitempty"`
71
// ResponseCode: The status of the insert request.
72
ResponseCode string `json:"responseCode,omitempty"`
75
// method id "groupsmigration.archive.insert":
77
type ArchiveInsertCall struct {
80
opt_ map[string]interface{}
84
// Insert: Inserts a new mail into the archive of the Google group.
85
func (r *ArchiveService) Insert(groupId string) *ArchiveInsertCall {
86
c := &ArchiveInsertCall{s: r.s, opt_: make(map[string]interface{})}
90
func (c *ArchiveInsertCall) Media(r io.Reader) *ArchiveInsertCall {
95
// Fields allows partial responses to be retrieved.
96
// See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
97
// for more information.
98
func (c *ArchiveInsertCall) Fields(s ...googleapi.Field) *ArchiveInsertCall {
99
c.opt_["fields"] = googleapi.CombineFields(s)
103
func (c *ArchiveInsertCall) Do() (*Groups, error) {
104
var body io.Reader = nil
105
params := make(url.Values)
106
params.Set("alt", "json")
107
if v, ok := c.opt_["fields"]; ok {
108
params.Set("fields", fmt.Sprintf("%v", v))
110
urls := googleapi.ResolveRelative(c.s.BasePath, "{groupId}/archive")
112
urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
113
params.Set("uploadType", "multipart")
115
urls += "?" + params.Encode()
116
body = new(bytes.Buffer)
117
ctype := "application/json"
118
contentLength_, hasMedia_ := googleapi.ConditionallyIncludeMedia(c.media_, &body, &ctype)
119
req, _ := http.NewRequest("POST", urls, body)
120
googleapi.Expand(req.URL, map[string]string{
121
"groupId": c.groupId,
124
req.ContentLength = contentLength_
126
req.Header.Set("Content-Type", ctype)
127
req.Header.Set("User-Agent", "google-api-go-client/0.5")
128
res, err := c.s.client.Do(req)
132
defer googleapi.CloseBody(res)
133
if err := googleapi.CheckResponse(res); err != nil {
137
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
142
// "description": "Inserts a new mail into the archive of the Google group.",
143
// "httpMethod": "POST",
144
// "id": "groupsmigration.archive.insert",
149
// "maxSize": "16MB",
152
// "multipart": true,
153
// "path": "/resumable/upload/groups/v1/groups/{groupId}/archive"
156
// "multipart": true,
157
// "path": "/upload/groups/v1/groups/{groupId}/archive"
161
// "parameterOrder": [
166
// "description": "The group ID",
167
// "location": "path",
172
// "path": "{groupId}/archive",
176
// "supportsMediaUpload": true