admin-gen.go 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. // Package admin provides access to the Admin Data Transfer API.
  2. //
  3. // See https://developers.google.com/admin-sdk/data-transfer/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/admin/datatransfer/v1"
  8. // ...
  9. // adminService, err := admin.New(oauthHttpClient)
  10. package admin // import "google.golang.org/api/admin/datatransfer/v1"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "admin:datatransfer_v1"
  41. const apiName = "admin"
  42. const apiVersion = "datatransfer_v1"
  43. const basePath = "https://www.googleapis.com/admin/datatransfer/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage data transfers between users in your organization
  47. AdminDatatransferScope = "https://www.googleapis.com/auth/admin.datatransfer"
  48. // View data transfers between users in your organization
  49. AdminDatatransferReadonlyScope = "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.Applications = NewApplicationsService(s)
  57. s.Transfers = NewTransfersService(s)
  58. return s, nil
  59. }
  60. type Service struct {
  61. client *http.Client
  62. BasePath string // API endpoint base URL
  63. UserAgent string // optional additional User-Agent fragment
  64. Applications *ApplicationsService
  65. Transfers *TransfersService
  66. }
  67. func (s *Service) userAgent() string {
  68. if s.UserAgent == "" {
  69. return googleapi.UserAgent
  70. }
  71. return googleapi.UserAgent + " " + s.UserAgent
  72. }
  73. func NewApplicationsService(s *Service) *ApplicationsService {
  74. rs := &ApplicationsService{s: s}
  75. return rs
  76. }
  77. type ApplicationsService struct {
  78. s *Service
  79. }
  80. func NewTransfersService(s *Service) *TransfersService {
  81. rs := &TransfersService{s: s}
  82. return rs
  83. }
  84. type TransfersService struct {
  85. s *Service
  86. }
  87. // Application: The JSON template for an Application resource.
  88. type Application struct {
  89. // Etag: Etag of the resource.
  90. Etag string `json:"etag,omitempty"`
  91. // Id: The application's ID.
  92. Id int64 `json:"id,omitempty,string"`
  93. // Kind: Identifies the resource as a DataTransfer Application Resource.
  94. Kind string `json:"kind,omitempty"`
  95. // Name: The application's name.
  96. Name string `json:"name,omitempty"`
  97. // TransferParams: The list of all possible transfer parameters for this
  98. // application. These parameters can be used to select the data of the
  99. // user in this application to be transfered.
  100. TransferParams []*ApplicationTransferParam `json:"transferParams,omitempty"`
  101. // ServerResponse contains the HTTP response code and headers from the
  102. // server.
  103. googleapi.ServerResponse `json:"-"`
  104. // ForceSendFields is a list of field names (e.g. "Etag") to
  105. // unconditionally include in API requests. By default, fields with
  106. // empty values are omitted from API requests. However, any non-pointer,
  107. // non-interface field appearing in ForceSendFields will be sent to the
  108. // server regardless of whether the field is empty or not. This may be
  109. // used to include empty fields in Patch requests.
  110. ForceSendFields []string `json:"-"`
  111. }
  112. func (s *Application) MarshalJSON() ([]byte, error) {
  113. type noMethod Application
  114. raw := noMethod(*s)
  115. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  116. }
  117. // ApplicationDataTransfer: Template to map fields of
  118. // ApplicationDataTransfer resource.
  119. type ApplicationDataTransfer struct {
  120. // ApplicationId: The application's ID.
  121. ApplicationId int64 `json:"applicationId,omitempty,string"`
  122. // ApplicationTransferParams: The transfer parameters for the
  123. // application. These parameters are used to select the data which will
  124. // get transfered in context of this application.
  125. ApplicationTransferParams []*ApplicationTransferParam `json:"applicationTransferParams,omitempty"`
  126. // ApplicationTransferStatus: Current status of transfer for this
  127. // application. (Read-only)
  128. ApplicationTransferStatus string `json:"applicationTransferStatus,omitempty"`
  129. // ForceSendFields is a list of field names (e.g. "ApplicationId") to
  130. // unconditionally include in API requests. By default, fields with
  131. // empty values are omitted from API requests. However, any non-pointer,
  132. // non-interface field appearing in ForceSendFields will be sent to the
  133. // server regardless of whether the field is empty or not. This may be
  134. // used to include empty fields in Patch requests.
  135. ForceSendFields []string `json:"-"`
  136. }
  137. func (s *ApplicationDataTransfer) MarshalJSON() ([]byte, error) {
  138. type noMethod ApplicationDataTransfer
  139. raw := noMethod(*s)
  140. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  141. }
  142. // ApplicationTransferParam: Template for application transfer
  143. // parameters.
  144. type ApplicationTransferParam struct {
  145. // Key: The type of the transfer parameter. eg: 'PRIVACY_LEVEL'
  146. Key string `json:"key,omitempty"`
  147. // Value: The value of the coressponding transfer parameter. eg:
  148. // 'PRIVATE' or 'SHARED'
  149. Value []string `json:"value,omitempty"`
  150. // ForceSendFields is a list of field names (e.g. "Key") to
  151. // unconditionally include in API requests. By default, fields with
  152. // empty values are omitted from API requests. However, any non-pointer,
  153. // non-interface field appearing in ForceSendFields will be sent to the
  154. // server regardless of whether the field is empty or not. This may be
  155. // used to include empty fields in Patch requests.
  156. ForceSendFields []string `json:"-"`
  157. }
  158. func (s *ApplicationTransferParam) MarshalJSON() ([]byte, error) {
  159. type noMethod ApplicationTransferParam
  160. raw := noMethod(*s)
  161. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  162. }
  163. // ApplicationsListResponse: Template for a collection of Applications.
  164. type ApplicationsListResponse struct {
  165. // Applications: List of applications that support data transfer and are
  166. // also installed for the customer.
  167. Applications []*Application `json:"applications,omitempty"`
  168. // Etag: ETag of the resource.
  169. Etag string `json:"etag,omitempty"`
  170. // Kind: Identifies the resource as a collection of Applications.
  171. Kind string `json:"kind,omitempty"`
  172. // NextPageToken: Continuation token which will be used to specify next
  173. // page in list API.
  174. NextPageToken string `json:"nextPageToken,omitempty"`
  175. // ServerResponse contains the HTTP response code and headers from the
  176. // server.
  177. googleapi.ServerResponse `json:"-"`
  178. // ForceSendFields is a list of field names (e.g. "Applications") to
  179. // unconditionally include in API requests. By default, fields with
  180. // empty values are omitted from API requests. However, any non-pointer,
  181. // non-interface field appearing in ForceSendFields will be sent to the
  182. // server regardless of whether the field is empty or not. This may be
  183. // used to include empty fields in Patch requests.
  184. ForceSendFields []string `json:"-"`
  185. }
  186. func (s *ApplicationsListResponse) MarshalJSON() ([]byte, error) {
  187. type noMethod ApplicationsListResponse
  188. raw := noMethod(*s)
  189. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  190. }
  191. // DataTransfer: The JSON template for a DataTransfer resource.
  192. type DataTransfer struct {
  193. // ApplicationDataTransfers: List of per application data transfer
  194. // resources. It contains data transfer details of the applications
  195. // associated with this transfer resource. Note that this list is also
  196. // used to specify the applications for which data transfer has to be
  197. // done at the time of the transfer resource creation.
  198. ApplicationDataTransfers []*ApplicationDataTransfer `json:"applicationDataTransfers,omitempty"`
  199. // Etag: ETag of the resource.
  200. Etag string `json:"etag,omitempty"`
  201. // Id: The transfer's ID (Read-only).
  202. Id string `json:"id,omitempty"`
  203. // Kind: Identifies the resource as a DataTransfer request.
  204. Kind string `json:"kind,omitempty"`
  205. // NewOwnerUserId: ID of the user to whom the data is being transfered.
  206. NewOwnerUserId string `json:"newOwnerUserId,omitempty"`
  207. // OldOwnerUserId: ID of the user whose data is being transfered.
  208. OldOwnerUserId string `json:"oldOwnerUserId,omitempty"`
  209. // OverallTransferStatusCode: Overall transfer status (Read-only).
  210. OverallTransferStatusCode string `json:"overallTransferStatusCode,omitempty"`
  211. // RequestTime: The time at which the data transfer was requested
  212. // (Read-only).
  213. RequestTime string `json:"requestTime,omitempty"`
  214. // ServerResponse contains the HTTP response code and headers from the
  215. // server.
  216. googleapi.ServerResponse `json:"-"`
  217. // ForceSendFields is a list of field names (e.g.
  218. // "ApplicationDataTransfers") to unconditionally include in API
  219. // requests. By default, fields with empty values are omitted from API
  220. // requests. However, any non-pointer, non-interface field appearing in
  221. // ForceSendFields will be sent to the server regardless of whether the
  222. // field is empty or not. This may be used to include empty fields in
  223. // Patch requests.
  224. ForceSendFields []string `json:"-"`
  225. }
  226. func (s *DataTransfer) MarshalJSON() ([]byte, error) {
  227. type noMethod DataTransfer
  228. raw := noMethod(*s)
  229. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  230. }
  231. // DataTransfersListResponse: Template for a collection of DataTransfer
  232. // resources.
  233. type DataTransfersListResponse struct {
  234. // DataTransfers: List of data transfer requests.
  235. DataTransfers []*DataTransfer `json:"dataTransfers,omitempty"`
  236. // Etag: ETag of the resource.
  237. Etag string `json:"etag,omitempty"`
  238. // Kind: Identifies the resource as a collection of data transfer
  239. // requests.
  240. Kind string `json:"kind,omitempty"`
  241. // NextPageToken: Continuation token which will be used to specify next
  242. // page in list API.
  243. NextPageToken string `json:"nextPageToken,omitempty"`
  244. // ServerResponse contains the HTTP response code and headers from the
  245. // server.
  246. googleapi.ServerResponse `json:"-"`
  247. // ForceSendFields is a list of field names (e.g. "DataTransfers") to
  248. // unconditionally include in API requests. By default, fields with
  249. // empty values are omitted from API requests. However, any non-pointer,
  250. // non-interface field appearing in ForceSendFields will be sent to the
  251. // server regardless of whether the field is empty or not. This may be
  252. // used to include empty fields in Patch requests.
  253. ForceSendFields []string `json:"-"`
  254. }
  255. func (s *DataTransfersListResponse) MarshalJSON() ([]byte, error) {
  256. type noMethod DataTransfersListResponse
  257. raw := noMethod(*s)
  258. return gensupport.MarshalJSON(raw, s.ForceSendFields)
  259. }
  260. // method id "datatransfer.applications.get":
  261. type ApplicationsGetCall struct {
  262. s *Service
  263. applicationId int64
  264. urlParams_ gensupport.URLParams
  265. ifNoneMatch_ string
  266. ctx_ context.Context
  267. }
  268. // Get: Retrieves information about an application for the given
  269. // application ID.
  270. func (r *ApplicationsService) Get(applicationId int64) *ApplicationsGetCall {
  271. c := &ApplicationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  272. c.applicationId = applicationId
  273. return c
  274. }
  275. // Fields allows partial responses to be retrieved. See
  276. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  277. // for more information.
  278. func (c *ApplicationsGetCall) Fields(s ...googleapi.Field) *ApplicationsGetCall {
  279. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  280. return c
  281. }
  282. // IfNoneMatch sets the optional parameter which makes the operation
  283. // fail if the object's ETag matches the given value. This is useful for
  284. // getting updates only after the object has changed since the last
  285. // request. Use googleapi.IsNotModified to check whether the response
  286. // error from Do is the result of In-None-Match.
  287. func (c *ApplicationsGetCall) IfNoneMatch(entityTag string) *ApplicationsGetCall {
  288. c.ifNoneMatch_ = entityTag
  289. return c
  290. }
  291. // Context sets the context to be used in this call's Do method. Any
  292. // pending HTTP request will be aborted if the provided context is
  293. // canceled.
  294. func (c *ApplicationsGetCall) Context(ctx context.Context) *ApplicationsGetCall {
  295. c.ctx_ = ctx
  296. return c
  297. }
  298. func (c *ApplicationsGetCall) doRequest(alt string) (*http.Response, error) {
  299. var body io.Reader = nil
  300. c.urlParams_.Set("alt", alt)
  301. urls := googleapi.ResolveRelative(c.s.BasePath, "applications/{applicationId}")
  302. urls += "?" + c.urlParams_.Encode()
  303. req, _ := http.NewRequest("GET", urls, body)
  304. googleapi.Expand(req.URL, map[string]string{
  305. "applicationId": strconv.FormatInt(c.applicationId, 10),
  306. })
  307. req.Header.Set("User-Agent", c.s.userAgent())
  308. if c.ifNoneMatch_ != "" {
  309. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  310. }
  311. if c.ctx_ != nil {
  312. return ctxhttp.Do(c.ctx_, c.s.client, req)
  313. }
  314. return c.s.client.Do(req)
  315. }
  316. // Do executes the "datatransfer.applications.get" call.
  317. // Exactly one of *Application or error will be non-nil. Any non-2xx
  318. // status code is an error. Response headers are in either
  319. // *Application.ServerResponse.Header or (if a response was returned at
  320. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  321. // to check whether the returned error was because
  322. // http.StatusNotModified was returned.
  323. func (c *ApplicationsGetCall) Do(opts ...googleapi.CallOption) (*Application, error) {
  324. gensupport.SetOptions(c.urlParams_, opts...)
  325. res, err := c.doRequest("json")
  326. if res != nil && res.StatusCode == http.StatusNotModified {
  327. if res.Body != nil {
  328. res.Body.Close()
  329. }
  330. return nil, &googleapi.Error{
  331. Code: res.StatusCode,
  332. Header: res.Header,
  333. }
  334. }
  335. if err != nil {
  336. return nil, err
  337. }
  338. defer googleapi.CloseBody(res)
  339. if err := googleapi.CheckResponse(res); err != nil {
  340. return nil, err
  341. }
  342. ret := &Application{
  343. ServerResponse: googleapi.ServerResponse{
  344. Header: res.Header,
  345. HTTPStatusCode: res.StatusCode,
  346. },
  347. }
  348. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  349. return nil, err
  350. }
  351. return ret, nil
  352. // {
  353. // "description": "Retrieves information about an application for the given application ID.",
  354. // "httpMethod": "GET",
  355. // "id": "datatransfer.applications.get",
  356. // "parameterOrder": [
  357. // "applicationId"
  358. // ],
  359. // "parameters": {
  360. // "applicationId": {
  361. // "description": "ID of the application resource to be retrieved.",
  362. // "format": "int64",
  363. // "location": "path",
  364. // "required": true,
  365. // "type": "string"
  366. // }
  367. // },
  368. // "path": "applications/{applicationId}",
  369. // "response": {
  370. // "$ref": "Application"
  371. // },
  372. // "scopes": [
  373. // "https://www.googleapis.com/auth/admin.datatransfer",
  374. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  375. // ]
  376. // }
  377. }
  378. // method id "datatransfer.applications.list":
  379. type ApplicationsListCall struct {
  380. s *Service
  381. urlParams_ gensupport.URLParams
  382. ifNoneMatch_ string
  383. ctx_ context.Context
  384. }
  385. // List: Lists the applications available for data transfer for a
  386. // customer.
  387. func (r *ApplicationsService) List() *ApplicationsListCall {
  388. c := &ApplicationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  389. return c
  390. }
  391. // CustomerId sets the optional parameter "customerId": Immutable ID of
  392. // the Google Apps account.
  393. func (c *ApplicationsListCall) CustomerId(customerId string) *ApplicationsListCall {
  394. c.urlParams_.Set("customerId", customerId)
  395. return c
  396. }
  397. // MaxResults sets the optional parameter "maxResults": Maximum number
  398. // of results to return. Default is 100.
  399. func (c *ApplicationsListCall) MaxResults(maxResults int64) *ApplicationsListCall {
  400. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  401. return c
  402. }
  403. // PageToken sets the optional parameter "pageToken": Token to specify
  404. // next page in the list.
  405. func (c *ApplicationsListCall) PageToken(pageToken string) *ApplicationsListCall {
  406. c.urlParams_.Set("pageToken", pageToken)
  407. return c
  408. }
  409. // Fields allows partial responses to be retrieved. See
  410. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  411. // for more information.
  412. func (c *ApplicationsListCall) Fields(s ...googleapi.Field) *ApplicationsListCall {
  413. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  414. return c
  415. }
  416. // IfNoneMatch sets the optional parameter which makes the operation
  417. // fail if the object's ETag matches the given value. This is useful for
  418. // getting updates only after the object has changed since the last
  419. // request. Use googleapi.IsNotModified to check whether the response
  420. // error from Do is the result of In-None-Match.
  421. func (c *ApplicationsListCall) IfNoneMatch(entityTag string) *ApplicationsListCall {
  422. c.ifNoneMatch_ = entityTag
  423. return c
  424. }
  425. // Context sets the context to be used in this call's Do method. Any
  426. // pending HTTP request will be aborted if the provided context is
  427. // canceled.
  428. func (c *ApplicationsListCall) Context(ctx context.Context) *ApplicationsListCall {
  429. c.ctx_ = ctx
  430. return c
  431. }
  432. func (c *ApplicationsListCall) doRequest(alt string) (*http.Response, error) {
  433. var body io.Reader = nil
  434. c.urlParams_.Set("alt", alt)
  435. urls := googleapi.ResolveRelative(c.s.BasePath, "applications")
  436. urls += "?" + c.urlParams_.Encode()
  437. req, _ := http.NewRequest("GET", urls, body)
  438. googleapi.SetOpaque(req.URL)
  439. req.Header.Set("User-Agent", c.s.userAgent())
  440. if c.ifNoneMatch_ != "" {
  441. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  442. }
  443. if c.ctx_ != nil {
  444. return ctxhttp.Do(c.ctx_, c.s.client, req)
  445. }
  446. return c.s.client.Do(req)
  447. }
  448. // Do executes the "datatransfer.applications.list" call.
  449. // Exactly one of *ApplicationsListResponse or error will be non-nil.
  450. // Any non-2xx status code is an error. Response headers are in either
  451. // *ApplicationsListResponse.ServerResponse.Header or (if a response was
  452. // returned at all) in error.(*googleapi.Error).Header. Use
  453. // googleapi.IsNotModified to check whether the returned error was
  454. // because http.StatusNotModified was returned.
  455. func (c *ApplicationsListCall) Do(opts ...googleapi.CallOption) (*ApplicationsListResponse, error) {
  456. gensupport.SetOptions(c.urlParams_, opts...)
  457. res, err := c.doRequest("json")
  458. if res != nil && res.StatusCode == http.StatusNotModified {
  459. if res.Body != nil {
  460. res.Body.Close()
  461. }
  462. return nil, &googleapi.Error{
  463. Code: res.StatusCode,
  464. Header: res.Header,
  465. }
  466. }
  467. if err != nil {
  468. return nil, err
  469. }
  470. defer googleapi.CloseBody(res)
  471. if err := googleapi.CheckResponse(res); err != nil {
  472. return nil, err
  473. }
  474. ret := &ApplicationsListResponse{
  475. ServerResponse: googleapi.ServerResponse{
  476. Header: res.Header,
  477. HTTPStatusCode: res.StatusCode,
  478. },
  479. }
  480. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  481. return nil, err
  482. }
  483. return ret, nil
  484. // {
  485. // "description": "Lists the applications available for data transfer for a customer.",
  486. // "httpMethod": "GET",
  487. // "id": "datatransfer.applications.list",
  488. // "parameters": {
  489. // "customerId": {
  490. // "description": "Immutable ID of the Google Apps account.",
  491. // "location": "query",
  492. // "type": "string"
  493. // },
  494. // "maxResults": {
  495. // "description": "Maximum number of results to return. Default is 100.",
  496. // "format": "int32",
  497. // "location": "query",
  498. // "maximum": "500",
  499. // "minimum": "1",
  500. // "type": "integer"
  501. // },
  502. // "pageToken": {
  503. // "description": "Token to specify next page in the list.",
  504. // "location": "query",
  505. // "type": "string"
  506. // }
  507. // },
  508. // "path": "applications",
  509. // "response": {
  510. // "$ref": "ApplicationsListResponse"
  511. // },
  512. // "scopes": [
  513. // "https://www.googleapis.com/auth/admin.datatransfer",
  514. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  515. // ]
  516. // }
  517. }
  518. // Pages invokes f for each page of results.
  519. // A non-nil error returned from f will halt the iteration.
  520. // The provided context supersedes any context provided to the Context method.
  521. func (c *ApplicationsListCall) Pages(ctx context.Context, f func(*ApplicationsListResponse) error) error {
  522. c.ctx_ = ctx
  523. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  524. for {
  525. x, err := c.Do()
  526. if err != nil {
  527. return err
  528. }
  529. if err := f(x); err != nil {
  530. return err
  531. }
  532. if x.NextPageToken == "" {
  533. return nil
  534. }
  535. c.PageToken(x.NextPageToken)
  536. }
  537. }
  538. // method id "datatransfer.transfers.get":
  539. type TransfersGetCall struct {
  540. s *Service
  541. dataTransferId string
  542. urlParams_ gensupport.URLParams
  543. ifNoneMatch_ string
  544. ctx_ context.Context
  545. }
  546. // Get: Retrieves a data transfer request by its resource ID.
  547. func (r *TransfersService) Get(dataTransferId string) *TransfersGetCall {
  548. c := &TransfersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  549. c.dataTransferId = dataTransferId
  550. return c
  551. }
  552. // Fields allows partial responses to be retrieved. See
  553. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  554. // for more information.
  555. func (c *TransfersGetCall) Fields(s ...googleapi.Field) *TransfersGetCall {
  556. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  557. return c
  558. }
  559. // IfNoneMatch sets the optional parameter which makes the operation
  560. // fail if the object's ETag matches the given value. This is useful for
  561. // getting updates only after the object has changed since the last
  562. // request. Use googleapi.IsNotModified to check whether the response
  563. // error from Do is the result of In-None-Match.
  564. func (c *TransfersGetCall) IfNoneMatch(entityTag string) *TransfersGetCall {
  565. c.ifNoneMatch_ = entityTag
  566. return c
  567. }
  568. // Context sets the context to be used in this call's Do method. Any
  569. // pending HTTP request will be aborted if the provided context is
  570. // canceled.
  571. func (c *TransfersGetCall) Context(ctx context.Context) *TransfersGetCall {
  572. c.ctx_ = ctx
  573. return c
  574. }
  575. func (c *TransfersGetCall) doRequest(alt string) (*http.Response, error) {
  576. var body io.Reader = nil
  577. c.urlParams_.Set("alt", alt)
  578. urls := googleapi.ResolveRelative(c.s.BasePath, "transfers/{dataTransferId}")
  579. urls += "?" + c.urlParams_.Encode()
  580. req, _ := http.NewRequest("GET", urls, body)
  581. googleapi.Expand(req.URL, map[string]string{
  582. "dataTransferId": c.dataTransferId,
  583. })
  584. req.Header.Set("User-Agent", c.s.userAgent())
  585. if c.ifNoneMatch_ != "" {
  586. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  587. }
  588. if c.ctx_ != nil {
  589. return ctxhttp.Do(c.ctx_, c.s.client, req)
  590. }
  591. return c.s.client.Do(req)
  592. }
  593. // Do executes the "datatransfer.transfers.get" call.
  594. // Exactly one of *DataTransfer or error will be non-nil. Any non-2xx
  595. // status code is an error. Response headers are in either
  596. // *DataTransfer.ServerResponse.Header or (if a response was returned at
  597. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  598. // to check whether the returned error was because
  599. // http.StatusNotModified was returned.
  600. func (c *TransfersGetCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
  601. gensupport.SetOptions(c.urlParams_, opts...)
  602. res, err := c.doRequest("json")
  603. if res != nil && res.StatusCode == http.StatusNotModified {
  604. if res.Body != nil {
  605. res.Body.Close()
  606. }
  607. return nil, &googleapi.Error{
  608. Code: res.StatusCode,
  609. Header: res.Header,
  610. }
  611. }
  612. if err != nil {
  613. return nil, err
  614. }
  615. defer googleapi.CloseBody(res)
  616. if err := googleapi.CheckResponse(res); err != nil {
  617. return nil, err
  618. }
  619. ret := &DataTransfer{
  620. ServerResponse: googleapi.ServerResponse{
  621. Header: res.Header,
  622. HTTPStatusCode: res.StatusCode,
  623. },
  624. }
  625. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  626. return nil, err
  627. }
  628. return ret, nil
  629. // {
  630. // "description": "Retrieves a data transfer request by its resource ID.",
  631. // "httpMethod": "GET",
  632. // "id": "datatransfer.transfers.get",
  633. // "parameterOrder": [
  634. // "dataTransferId"
  635. // ],
  636. // "parameters": {
  637. // "dataTransferId": {
  638. // "description": "ID of the resource to be retrieved. This is returned in the response from the insert method.",
  639. // "location": "path",
  640. // "required": true,
  641. // "type": "string"
  642. // }
  643. // },
  644. // "path": "transfers/{dataTransferId}",
  645. // "response": {
  646. // "$ref": "DataTransfer"
  647. // },
  648. // "scopes": [
  649. // "https://www.googleapis.com/auth/admin.datatransfer",
  650. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  651. // ]
  652. // }
  653. }
  654. // method id "datatransfer.transfers.insert":
  655. type TransfersInsertCall struct {
  656. s *Service
  657. datatransfer *DataTransfer
  658. urlParams_ gensupport.URLParams
  659. ctx_ context.Context
  660. }
  661. // Insert: Inserts a data transfer request.
  662. func (r *TransfersService) Insert(datatransfer *DataTransfer) *TransfersInsertCall {
  663. c := &TransfersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  664. c.datatransfer = datatransfer
  665. return c
  666. }
  667. // Fields allows partial responses to be retrieved. See
  668. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  669. // for more information.
  670. func (c *TransfersInsertCall) Fields(s ...googleapi.Field) *TransfersInsertCall {
  671. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  672. return c
  673. }
  674. // Context sets the context to be used in this call's Do method. Any
  675. // pending HTTP request will be aborted if the provided context is
  676. // canceled.
  677. func (c *TransfersInsertCall) Context(ctx context.Context) *TransfersInsertCall {
  678. c.ctx_ = ctx
  679. return c
  680. }
  681. func (c *TransfersInsertCall) doRequest(alt string) (*http.Response, error) {
  682. var body io.Reader = nil
  683. body, err := googleapi.WithoutDataWrapper.JSONReader(c.datatransfer)
  684. if err != nil {
  685. return nil, err
  686. }
  687. ctype := "application/json"
  688. c.urlParams_.Set("alt", alt)
  689. urls := googleapi.ResolveRelative(c.s.BasePath, "transfers")
  690. urls += "?" + c.urlParams_.Encode()
  691. req, _ := http.NewRequest("POST", urls, body)
  692. googleapi.SetOpaque(req.URL)
  693. req.Header.Set("Content-Type", ctype)
  694. req.Header.Set("User-Agent", c.s.userAgent())
  695. if c.ctx_ != nil {
  696. return ctxhttp.Do(c.ctx_, c.s.client, req)
  697. }
  698. return c.s.client.Do(req)
  699. }
  700. // Do executes the "datatransfer.transfers.insert" call.
  701. // Exactly one of *DataTransfer or error will be non-nil. Any non-2xx
  702. // status code is an error. Response headers are in either
  703. // *DataTransfer.ServerResponse.Header or (if a response was returned at
  704. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  705. // to check whether the returned error was because
  706. // http.StatusNotModified was returned.
  707. func (c *TransfersInsertCall) Do(opts ...googleapi.CallOption) (*DataTransfer, error) {
  708. gensupport.SetOptions(c.urlParams_, opts...)
  709. res, err := c.doRequest("json")
  710. if res != nil && res.StatusCode == http.StatusNotModified {
  711. if res.Body != nil {
  712. res.Body.Close()
  713. }
  714. return nil, &googleapi.Error{
  715. Code: res.StatusCode,
  716. Header: res.Header,
  717. }
  718. }
  719. if err != nil {
  720. return nil, err
  721. }
  722. defer googleapi.CloseBody(res)
  723. if err := googleapi.CheckResponse(res); err != nil {
  724. return nil, err
  725. }
  726. ret := &DataTransfer{
  727. ServerResponse: googleapi.ServerResponse{
  728. Header: res.Header,
  729. HTTPStatusCode: res.StatusCode,
  730. },
  731. }
  732. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  733. return nil, err
  734. }
  735. return ret, nil
  736. // {
  737. // "description": "Inserts a data transfer request.",
  738. // "httpMethod": "POST",
  739. // "id": "datatransfer.transfers.insert",
  740. // "path": "transfers",
  741. // "request": {
  742. // "$ref": "DataTransfer"
  743. // },
  744. // "response": {
  745. // "$ref": "DataTransfer"
  746. // },
  747. // "scopes": [
  748. // "https://www.googleapis.com/auth/admin.datatransfer"
  749. // ]
  750. // }
  751. }
  752. // method id "datatransfer.transfers.list":
  753. type TransfersListCall struct {
  754. s *Service
  755. urlParams_ gensupport.URLParams
  756. ifNoneMatch_ string
  757. ctx_ context.Context
  758. }
  759. // List: Lists the transfers for a customer by source user, destination
  760. // user, or status.
  761. func (r *TransfersService) List() *TransfersListCall {
  762. c := &TransfersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  763. return c
  764. }
  765. // CustomerId sets the optional parameter "customerId": Immutable ID of
  766. // the Google Apps account.
  767. func (c *TransfersListCall) CustomerId(customerId string) *TransfersListCall {
  768. c.urlParams_.Set("customerId", customerId)
  769. return c
  770. }
  771. // MaxResults sets the optional parameter "maxResults": Maximum number
  772. // of results to return. Default is 100.
  773. func (c *TransfersListCall) MaxResults(maxResults int64) *TransfersListCall {
  774. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  775. return c
  776. }
  777. // NewOwnerUserId sets the optional parameter "newOwnerUserId":
  778. // Destination user's profile ID.
  779. func (c *TransfersListCall) NewOwnerUserId(newOwnerUserId string) *TransfersListCall {
  780. c.urlParams_.Set("newOwnerUserId", newOwnerUserId)
  781. return c
  782. }
  783. // OldOwnerUserId sets the optional parameter "oldOwnerUserId": Source
  784. // user's profile ID.
  785. func (c *TransfersListCall) OldOwnerUserId(oldOwnerUserId string) *TransfersListCall {
  786. c.urlParams_.Set("oldOwnerUserId", oldOwnerUserId)
  787. return c
  788. }
  789. // PageToken sets the optional parameter "pageToken": Token to specify
  790. // the next page in the list.
  791. func (c *TransfersListCall) PageToken(pageToken string) *TransfersListCall {
  792. c.urlParams_.Set("pageToken", pageToken)
  793. return c
  794. }
  795. // Status sets the optional parameter "status": Status of the transfer.
  796. func (c *TransfersListCall) Status(status string) *TransfersListCall {
  797. c.urlParams_.Set("status", status)
  798. return c
  799. }
  800. // Fields allows partial responses to be retrieved. See
  801. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  802. // for more information.
  803. func (c *TransfersListCall) Fields(s ...googleapi.Field) *TransfersListCall {
  804. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  805. return c
  806. }
  807. // IfNoneMatch sets the optional parameter which makes the operation
  808. // fail if the object's ETag matches the given value. This is useful for
  809. // getting updates only after the object has changed since the last
  810. // request. Use googleapi.IsNotModified to check whether the response
  811. // error from Do is the result of In-None-Match.
  812. func (c *TransfersListCall) IfNoneMatch(entityTag string) *TransfersListCall {
  813. c.ifNoneMatch_ = entityTag
  814. return c
  815. }
  816. // Context sets the context to be used in this call's Do method. Any
  817. // pending HTTP request will be aborted if the provided context is
  818. // canceled.
  819. func (c *TransfersListCall) Context(ctx context.Context) *TransfersListCall {
  820. c.ctx_ = ctx
  821. return c
  822. }
  823. func (c *TransfersListCall) doRequest(alt string) (*http.Response, error) {
  824. var body io.Reader = nil
  825. c.urlParams_.Set("alt", alt)
  826. urls := googleapi.ResolveRelative(c.s.BasePath, "transfers")
  827. urls += "?" + c.urlParams_.Encode()
  828. req, _ := http.NewRequest("GET", urls, body)
  829. googleapi.SetOpaque(req.URL)
  830. req.Header.Set("User-Agent", c.s.userAgent())
  831. if c.ifNoneMatch_ != "" {
  832. req.Header.Set("If-None-Match", c.ifNoneMatch_)
  833. }
  834. if c.ctx_ != nil {
  835. return ctxhttp.Do(c.ctx_, c.s.client, req)
  836. }
  837. return c.s.client.Do(req)
  838. }
  839. // Do executes the "datatransfer.transfers.list" call.
  840. // Exactly one of *DataTransfersListResponse or error will be non-nil.
  841. // Any non-2xx status code is an error. Response headers are in either
  842. // *DataTransfersListResponse.ServerResponse.Header or (if a response
  843. // was returned at all) in error.(*googleapi.Error).Header. Use
  844. // googleapi.IsNotModified to check whether the returned error was
  845. // because http.StatusNotModified was returned.
  846. func (c *TransfersListCall) Do(opts ...googleapi.CallOption) (*DataTransfersListResponse, error) {
  847. gensupport.SetOptions(c.urlParams_, opts...)
  848. res, err := c.doRequest("json")
  849. if res != nil && res.StatusCode == http.StatusNotModified {
  850. if res.Body != nil {
  851. res.Body.Close()
  852. }
  853. return nil, &googleapi.Error{
  854. Code: res.StatusCode,
  855. Header: res.Header,
  856. }
  857. }
  858. if err != nil {
  859. return nil, err
  860. }
  861. defer googleapi.CloseBody(res)
  862. if err := googleapi.CheckResponse(res); err != nil {
  863. return nil, err
  864. }
  865. ret := &DataTransfersListResponse{
  866. ServerResponse: googleapi.ServerResponse{
  867. Header: res.Header,
  868. HTTPStatusCode: res.StatusCode,
  869. },
  870. }
  871. if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  872. return nil, err
  873. }
  874. return ret, nil
  875. // {
  876. // "description": "Lists the transfers for a customer by source user, destination user, or status.",
  877. // "httpMethod": "GET",
  878. // "id": "datatransfer.transfers.list",
  879. // "parameters": {
  880. // "customerId": {
  881. // "description": "Immutable ID of the Google Apps account.",
  882. // "location": "query",
  883. // "type": "string"
  884. // },
  885. // "maxResults": {
  886. // "description": "Maximum number of results to return. Default is 100.",
  887. // "format": "int32",
  888. // "location": "query",
  889. // "maximum": "500",
  890. // "minimum": "1",
  891. // "type": "integer"
  892. // },
  893. // "newOwnerUserId": {
  894. // "description": "Destination user's profile ID.",
  895. // "location": "query",
  896. // "type": "string"
  897. // },
  898. // "oldOwnerUserId": {
  899. // "description": "Source user's profile ID.",
  900. // "location": "query",
  901. // "type": "string"
  902. // },
  903. // "pageToken": {
  904. // "description": "Token to specify the next page in the list.",
  905. // "location": "query",
  906. // "type": "string"
  907. // },
  908. // "status": {
  909. // "description": "Status of the transfer.",
  910. // "location": "query",
  911. // "type": "string"
  912. // }
  913. // },
  914. // "path": "transfers",
  915. // "response": {
  916. // "$ref": "DataTransfersListResponse"
  917. // },
  918. // "scopes": [
  919. // "https://www.googleapis.com/auth/admin.datatransfer",
  920. // "https://www.googleapis.com/auth/admin.datatransfer.readonly"
  921. // ]
  922. // }
  923. }
  924. // Pages invokes f for each page of results.
  925. // A non-nil error returned from f will halt the iteration.
  926. // The provided context supersedes any context provided to the Context method.
  927. func (c *TransfersListCall) Pages(ctx context.Context, f func(*DataTransfersListResponse) error) error {
  928. c.ctx_ = ctx
  929. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  930. for {
  931. x, err := c.Do()
  932. if err != nil {
  933. return err
  934. }
  935. if err := f(x); err != nil {
  936. return err
  937. }
  938. if x.NextPageToken == "" {
  939. return nil
  940. }
  941. c.PageToken(x.NextPageToken)
  942. }
  943. }