25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

3224 satır
118 KiB

  1. // Package reseller provides access to the Enterprise Apps Reseller API.
  2. //
  3. // See https://developers.google.com/google-apps/reseller/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/reseller/v1"
  8. // ...
  9. // resellerService, err := reseller.New(oauthHttpClient)
  10. package reseller // import "google.golang.org/api/reseller/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 = "reseller:v1"
  41. const apiName = "reseller"
  42. const apiVersion = "v1"
  43. const basePath = "https://www.googleapis.com/apps/reseller/v1/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Manage users on your domain
  47. AppsOrderScope = "https://www.googleapis.com/auth/apps.order"
  48. // Manage users on your domain
  49. AppsOrderReadonlyScope = "https://www.googleapis.com/auth/apps.order.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.Customers = NewCustomersService(s)
  57. s.Resellernotify = NewResellernotifyService(s)
  58. s.Subscriptions = NewSubscriptionsService(s)
  59. return s, nil
  60. }
  61. type Service struct {
  62. client *http.Client
  63. BasePath string // API endpoint base URL
  64. UserAgent string // optional additional User-Agent fragment
  65. Customers *CustomersService
  66. Resellernotify *ResellernotifyService
  67. Subscriptions *SubscriptionsService
  68. }
  69. func (s *Service) userAgent() string {
  70. if s.UserAgent == "" {
  71. return googleapi.UserAgent
  72. }
  73. return googleapi.UserAgent + " " + s.UserAgent
  74. }
  75. func NewCustomersService(s *Service) *CustomersService {
  76. rs := &CustomersService{s: s}
  77. return rs
  78. }
  79. type CustomersService struct {
  80. s *Service
  81. }
  82. func NewResellernotifyService(s *Service) *ResellernotifyService {
  83. rs := &ResellernotifyService{s: s}
  84. return rs
  85. }
  86. type ResellernotifyService struct {
  87. s *Service
  88. }
  89. func NewSubscriptionsService(s *Service) *SubscriptionsService {
  90. rs := &SubscriptionsService{s: s}
  91. return rs
  92. }
  93. type SubscriptionsService struct {
  94. s *Service
  95. }
  96. // Address: JSON template for address of a customer.
  97. type Address struct {
  98. // AddressLine1: A customer's physical address. An address can be
  99. // composed of one to three lines. The addressline2 and addressLine3 are
  100. // optional.
  101. AddressLine1 string `json:"addressLine1,omitempty"`
  102. // AddressLine2: Line 2 of the address.
  103. AddressLine2 string `json:"addressLine2,omitempty"`
  104. // AddressLine3: Line 3 of the address.
  105. AddressLine3 string `json:"addressLine3,omitempty"`
  106. // ContactName: The customer contact's name. This is required.
  107. ContactName string `json:"contactName,omitempty"`
  108. // CountryCode: For countryCode information, see the ISO 3166 country
  109. // code elements. Verify that country is approved for resale of Google
  110. // products. This property is required when creating a new customer.
  111. CountryCode string `json:"countryCode,omitempty"`
  112. // Kind: Identifies the resource as a customer address. Value:
  113. // customers#address
  114. Kind string `json:"kind,omitempty"`
  115. // Locality: An example of a locality value is the city of San
  116. // Francisco.
  117. Locality string `json:"locality,omitempty"`
  118. // OrganizationName: The company or company division name. This is
  119. // required.
  120. OrganizationName string `json:"organizationName,omitempty"`
  121. // PostalCode: A postalCode example is a postal zip code such as 94043.
  122. // This property is required when creating a new customer.
  123. PostalCode string `json:"postalCode,omitempty"`
  124. // Region: An example of a region value is CA for the state of
  125. // California.
  126. Region string `json:"region,omitempty"`
  127. // ForceSendFields is a list of field names (e.g. "AddressLine1") to
  128. // unconditionally include in API requests. By default, fields with
  129. // empty values are omitted from API requests. However, any non-pointer,
  130. // non-interface field appearing in ForceSendFields will be sent to the
  131. // server regardless of whether the field is empty or not. This may be
  132. // used to include empty fields in Patch requests.
  133. ForceSendFields []string `json:"-"`
  134. // NullFields is a list of field names (e.g. "AddressLine1") to include
  135. // in API requests with the JSON null value. By default, fields with
  136. // empty values are omitted from API requests. However, any field with
  137. // an empty value appearing in NullFields will be sent to the server as
  138. // null. It is an error if a field in this list has a non-empty value.
  139. // This may be used to include null fields in Patch requests.
  140. NullFields []string `json:"-"`
  141. }
  142. func (s *Address) MarshalJSON() ([]byte, error) {
  143. type NoMethod Address
  144. raw := NoMethod(*s)
  145. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  146. }
  147. // ChangePlanRequest: JSON template for the ChangePlan rpc request.
  148. type ChangePlanRequest struct {
  149. // DealCode: Google-issued code (100 char max) for discounted pricing on
  150. // subscription plans. Deal code must be included in changePlan request
  151. // in order to receive discounted rate. This property is optional. If a
  152. // deal code has already been added to a subscription, this property may
  153. // be left empty and the existing discounted rate will still apply (if
  154. // not empty, only provide the deal code that is already present on the
  155. // subscription). If a deal code has never been added to a subscription
  156. // and this property is left blank, regular pricing will apply.
  157. DealCode string `json:"dealCode,omitempty"`
  158. // Kind: Identifies the resource as a subscription change plan request.
  159. // Value: subscriptions#changePlanRequest
  160. Kind string `json:"kind,omitempty"`
  161. // PlanName: The planName property is required. This is the name of the
  162. // subscription's payment plan. For more information about the Google
  163. // payment plans, see API concepts.
  164. //
  165. // Possible values are:
  166. // - ANNUAL_MONTHLY_PAY - The annual commitment plan with monthly
  167. // payments
  168. // - ANNUAL_YEARLY_PAY - The annual commitment plan with yearly payments
  169. //
  170. // - FLEXIBLE - The flexible plan
  171. // - TRIAL - The 30-day free trial plan
  172. PlanName string `json:"planName,omitempty"`
  173. // PurchaseOrderId: This is an optional property. This purchase order
  174. // (PO) information is for resellers to use for their company tracking
  175. // usage. If a purchaseOrderId value is given it appears in the API
  176. // responses and shows up in the invoice. The property accepts up to 80
  177. // plain text characters.
  178. PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
  179. // Seats: This is a required property. The seats property is the number
  180. // of user seat licenses.
  181. Seats *Seats `json:"seats,omitempty"`
  182. // ForceSendFields is a list of field names (e.g. "DealCode") to
  183. // unconditionally include in API requests. By default, fields with
  184. // empty values are omitted from API requests. However, any non-pointer,
  185. // non-interface field appearing in ForceSendFields will be sent to the
  186. // server regardless of whether the field is empty or not. This may be
  187. // used to include empty fields in Patch requests.
  188. ForceSendFields []string `json:"-"`
  189. // NullFields is a list of field names (e.g. "DealCode") to include in
  190. // API requests with the JSON null value. By default, fields with empty
  191. // values are omitted from API requests. However, any field with an
  192. // empty value appearing in NullFields will be sent to the server as
  193. // null. It is an error if a field in this list has a non-empty value.
  194. // This may be used to include null fields in Patch requests.
  195. NullFields []string `json:"-"`
  196. }
  197. func (s *ChangePlanRequest) MarshalJSON() ([]byte, error) {
  198. type NoMethod ChangePlanRequest
  199. raw := NoMethod(*s)
  200. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  201. }
  202. // Customer: JSON template for a customer.
  203. type Customer struct {
  204. // AlternateEmail: Like the "Customer email" in the reseller tools, this
  205. // email is the secondary contact used if something happens to the
  206. // customer's service such as service outage or a security issue. This
  207. // property is required when creating a new customer and should not use
  208. // the same domain as customerDomain.
  209. AlternateEmail string `json:"alternateEmail,omitempty"`
  210. // CustomerDomain: The customer's primary domain name string.
  211. // customerDomain is required when creating a new customer. Do not
  212. // include the www prefix in the domain when adding a customer.
  213. CustomerDomain string `json:"customerDomain,omitempty"`
  214. // CustomerDomainVerified: Whether the customer's primary domain has
  215. // been verified.
  216. CustomerDomainVerified bool `json:"customerDomainVerified,omitempty"`
  217. // CustomerId: This property will always be returned in a response as
  218. // the unique identifier generated by Google. In a request, this
  219. // property can be either the primary domain or the unique identifier
  220. // generated by Google.
  221. CustomerId string `json:"customerId,omitempty"`
  222. // Kind: Identifies the resource as a customer. Value: reseller#customer
  223. Kind string `json:"kind,omitempty"`
  224. // PhoneNumber: Customer contact phone number. This can be continuous
  225. // numbers, with spaces, etc. But it must be a real phone number and
  226. // not, for example, "123". See phone local format conventions.
  227. PhoneNumber string `json:"phoneNumber,omitempty"`
  228. // PostalAddress: A customer's address information. Each field has a
  229. // limit of 255 charcters.
  230. PostalAddress *Address `json:"postalAddress,omitempty"`
  231. // ResourceUiUrl: URL to customer's Admin console dashboard. The
  232. // read-only URL is generated by the API service. This is used if your
  233. // client application requires the customer to complete a task in the
  234. // Admin console.
  235. ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
  236. // ServerResponse contains the HTTP response code and headers from the
  237. // server.
  238. googleapi.ServerResponse `json:"-"`
  239. // ForceSendFields is a list of field names (e.g. "AlternateEmail") to
  240. // unconditionally include in API requests. By default, fields with
  241. // empty values are omitted from API requests. However, any non-pointer,
  242. // non-interface field appearing in ForceSendFields will be sent to the
  243. // server regardless of whether the field is empty or not. This may be
  244. // used to include empty fields in Patch requests.
  245. ForceSendFields []string `json:"-"`
  246. // NullFields is a list of field names (e.g. "AlternateEmail") to
  247. // include in API requests with the JSON null value. By default, fields
  248. // with empty values are omitted from API requests. However, any field
  249. // with an empty value appearing in NullFields will be sent to the
  250. // server as null. It is an error if a field in this list has a
  251. // non-empty value. This may be used to include null fields in Patch
  252. // requests.
  253. NullFields []string `json:"-"`
  254. }
  255. func (s *Customer) MarshalJSON() ([]byte, error) {
  256. type NoMethod Customer
  257. raw := NoMethod(*s)
  258. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  259. }
  260. // RenewalSettings: JSON template for a subscription renewal settings.
  261. type RenewalSettings struct {
  262. // Kind: Identifies the resource as a subscription renewal setting.
  263. // Value: subscriptions#renewalSettings
  264. Kind string `json:"kind,omitempty"`
  265. // RenewalType: Renewal settings for the annual commitment plan. For
  266. // more detailed information, see renewal options in the administrator
  267. // help center. When renewing a subscription, the renewalType is a
  268. // required property.
  269. RenewalType string `json:"renewalType,omitempty"`
  270. // ForceSendFields is a list of field names (e.g. "Kind") to
  271. // unconditionally include in API requests. By default, fields with
  272. // empty values are omitted from API requests. However, any non-pointer,
  273. // non-interface field appearing in ForceSendFields will be sent to the
  274. // server regardless of whether the field is empty or not. This may be
  275. // used to include empty fields in Patch requests.
  276. ForceSendFields []string `json:"-"`
  277. // NullFields is a list of field names (e.g. "Kind") to include in API
  278. // requests with the JSON null value. By default, fields with empty
  279. // values are omitted from API requests. However, any field with an
  280. // empty value appearing in NullFields will be sent to the server as
  281. // null. It is an error if a field in this list has a non-empty value.
  282. // This may be used to include null fields in Patch requests.
  283. NullFields []string `json:"-"`
  284. }
  285. func (s *RenewalSettings) MarshalJSON() ([]byte, error) {
  286. type NoMethod RenewalSettings
  287. raw := NoMethod(*s)
  288. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  289. }
  290. // ResellernotifyGetwatchdetailsResponse: JSON template for
  291. // resellernotify getwatchdetails response.
  292. type ResellernotifyGetwatchdetailsResponse struct {
  293. // ServiceAccountEmailAddresses: List of registered service accounts.
  294. ServiceAccountEmailAddresses []string `json:"serviceAccountEmailAddresses,omitempty"`
  295. // TopicName: Topic name of the PubSub
  296. TopicName string `json:"topicName,omitempty"`
  297. // ServerResponse contains the HTTP response code and headers from the
  298. // server.
  299. googleapi.ServerResponse `json:"-"`
  300. // ForceSendFields is a list of field names (e.g.
  301. // "ServiceAccountEmailAddresses") to unconditionally include in API
  302. // requests. By default, fields with empty values are omitted from API
  303. // requests. However, any non-pointer, non-interface field appearing in
  304. // ForceSendFields will be sent to the server regardless of whether the
  305. // field is empty or not. This may be used to include empty fields in
  306. // Patch requests.
  307. ForceSendFields []string `json:"-"`
  308. // NullFields is a list of field names (e.g.
  309. // "ServiceAccountEmailAddresses") to include in API requests with the
  310. // JSON null value. By default, fields with empty values are omitted
  311. // from API requests. However, any field with an empty value appearing
  312. // in NullFields will be sent to the server as null. It is an error if a
  313. // field in this list has a non-empty value. This may be used to include
  314. // null fields in Patch requests.
  315. NullFields []string `json:"-"`
  316. }
  317. func (s *ResellernotifyGetwatchdetailsResponse) MarshalJSON() ([]byte, error) {
  318. type NoMethod ResellernotifyGetwatchdetailsResponse
  319. raw := NoMethod(*s)
  320. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  321. }
  322. // ResellernotifyResource: JSON template for resellernotify response.
  323. type ResellernotifyResource struct {
  324. // TopicName: Topic name of the PubSub
  325. TopicName string `json:"topicName,omitempty"`
  326. // ServerResponse contains the HTTP response code and headers from the
  327. // server.
  328. googleapi.ServerResponse `json:"-"`
  329. // ForceSendFields is a list of field names (e.g. "TopicName") to
  330. // unconditionally include in API requests. By default, fields with
  331. // empty values are omitted from API requests. However, any non-pointer,
  332. // non-interface field appearing in ForceSendFields will be sent to the
  333. // server regardless of whether the field is empty or not. This may be
  334. // used to include empty fields in Patch requests.
  335. ForceSendFields []string `json:"-"`
  336. // NullFields is a list of field names (e.g. "TopicName") to include in
  337. // API requests with the JSON null value. By default, fields with empty
  338. // values are omitted from API requests. However, any field with an
  339. // empty value appearing in NullFields will be sent to the server as
  340. // null. It is an error if a field in this list has a non-empty value.
  341. // This may be used to include null fields in Patch requests.
  342. NullFields []string `json:"-"`
  343. }
  344. func (s *ResellernotifyResource) MarshalJSON() ([]byte, error) {
  345. type NoMethod ResellernotifyResource
  346. raw := NoMethod(*s)
  347. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  348. }
  349. // Seats: JSON template for subscription seats.
  350. type Seats struct {
  351. // Kind: Identifies the resource as a subscription change plan request.
  352. // Value: subscriptions#seats
  353. Kind string `json:"kind,omitempty"`
  354. // LicensedNumberOfSeats: Read-only field containing the current number
  355. // of licensed seats for FLEXIBLE Google-Apps subscriptions and
  356. // secondary subscriptions such as Google-Vault and Drive-storage.
  357. LicensedNumberOfSeats int64 `json:"licensedNumberOfSeats,omitempty"`
  358. // MaximumNumberOfSeats: The maximumNumberOfSeats property is the
  359. // maximum number of licenses that the customer can purchase. This
  360. // property applies to plans other than the annual commitment plan. How
  361. // a user's licenses are managed depends on the subscription's payment
  362. // plan:
  363. // - annual commitment plan (with monthly or yearly payments) — For
  364. // this plan, a reseller is invoiced on the number of user licenses in
  365. // the numberOfSeats property. The maximumNumberOfSeats property is a
  366. // read-only property in the API's response.
  367. // - flexible plan — For this plan, a reseller is invoiced on the
  368. // actual number of users which is capped by the maximumNumberOfSeats.
  369. // This is the maximum number of user licenses a customer has for user
  370. // license provisioning. This quantity can be increased up to the
  371. // maximum limit defined in the reseller's contract. And the minimum
  372. // quantity is the current number of users in the customer account.
  373. // - 30-day free trial plan — A subscription in a 30-day free trial is
  374. // restricted to maximum 10 seats.
  375. MaximumNumberOfSeats int64 `json:"maximumNumberOfSeats,omitempty"`
  376. // NumberOfSeats: The numberOfSeats property holds the customer's number
  377. // of user licenses. How a user's licenses are managed depends on the
  378. // subscription's plan:
  379. // - annual commitment plan (with monthly or yearly pay) — For this
  380. // plan, a reseller is invoiced on the number of user licenses in the
  381. // numberOfSeats property. This is the maximum number of user licenses
  382. // that a reseller's customer can create. The reseller can add more
  383. // licenses, but once set, the numberOfSeats can not be reduced until
  384. // renewal. The reseller is invoiced based on the numberOfSeats value
  385. // regardless of how many of these user licenses are provisioned users.
  386. //
  387. // - flexible plan — For this plan, a reseller is invoiced on the
  388. // actual number of users which is capped by the maximumNumberOfSeats.
  389. // The numberOfSeats property is not used in the request or response for
  390. // flexible plan customers.
  391. // - 30-day free trial plan — The numberOfSeats property is not used
  392. // in the request or response for an account in a 30-day trial.
  393. NumberOfSeats int64 `json:"numberOfSeats,omitempty"`
  394. // ForceSendFields is a list of field names (e.g. "Kind") to
  395. // unconditionally include in API requests. By default, fields with
  396. // empty values are omitted from API requests. However, any non-pointer,
  397. // non-interface field appearing in ForceSendFields will be sent to the
  398. // server regardless of whether the field is empty or not. This may be
  399. // used to include empty fields in Patch requests.
  400. ForceSendFields []string `json:"-"`
  401. // NullFields is a list of field names (e.g. "Kind") to include in API
  402. // requests with the JSON null value. By default, fields with empty
  403. // values are omitted from API requests. However, any field with an
  404. // empty value appearing in NullFields will be sent to the server as
  405. // null. It is an error if a field in this list has a non-empty value.
  406. // This may be used to include null fields in Patch requests.
  407. NullFields []string `json:"-"`
  408. }
  409. func (s *Seats) MarshalJSON() ([]byte, error) {
  410. type NoMethod Seats
  411. raw := NoMethod(*s)
  412. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  413. }
  414. // Subscription: JSON template for a subscription.
  415. type Subscription struct {
  416. // BillingMethod: Read-only field that returns the current billing
  417. // method for a subscription.
  418. BillingMethod string `json:"billingMethod,omitempty"`
  419. // CreationTime: The creationTime property is the date when subscription
  420. // was created. It is in milliseconds using the Epoch format. See an
  421. // example Epoch converter.
  422. CreationTime int64 `json:"creationTime,omitempty,string"`
  423. // CustomerDomain: Primary domain name of the customer
  424. CustomerDomain string `json:"customerDomain,omitempty"`
  425. // CustomerId: This property will always be returned in a response as
  426. // the unique identifier generated by Google. In a request, this
  427. // property can be either the primary domain or the unique identifier
  428. // generated by Google.
  429. CustomerId string `json:"customerId,omitempty"`
  430. // DealCode: Google-issued code (100 char max) for discounted pricing on
  431. // subscription plans. Deal code must be included in insert requests in
  432. // order to receive discounted rate. This property is optional, regular
  433. // pricing applies if left empty.
  434. DealCode string `json:"dealCode,omitempty"`
  435. // Kind: Identifies the resource as a Subscription. Value:
  436. // reseller#subscription
  437. Kind string `json:"kind,omitempty"`
  438. // Plan: The plan property is required. In this version of the API, the
  439. // G Suite plans are the flexible plan, annual commitment plan, and the
  440. // 30-day free trial plan. For more information about the API"s payment
  441. // plans, see the API concepts.
  442. Plan *SubscriptionPlan `json:"plan,omitempty"`
  443. // PurchaseOrderId: This is an optional property. This purchase order
  444. // (PO) information is for resellers to use for their company tracking
  445. // usage. If a purchaseOrderId value is given it appears in the API
  446. // responses and shows up in the invoice. The property accepts up to 80
  447. // plain text characters.
  448. PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
  449. // RenewalSettings: Renewal settings for the annual commitment plan. For
  450. // more detailed information, see renewal options in the administrator
  451. // help center.
  452. RenewalSettings *RenewalSettings `json:"renewalSettings,omitempty"`
  453. // ResourceUiUrl: URL to customer's Subscriptions page in the Admin
  454. // console. The read-only URL is generated by the API service. This is
  455. // used if your client application requires the customer to complete a
  456. // task using the Subscriptions page in the Admin console.
  457. ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
  458. // Seats: This is a required property. The number and limit of user seat
  459. // licenses in the plan.
  460. Seats *Seats `json:"seats,omitempty"`
  461. // SkuId: A required property. The skuId is a unique system identifier
  462. // for a product's SKU assigned to a customer in the subscription. For
  463. // products and SKUs available in this version of the API, see Product
  464. // and SKU IDs.
  465. SkuId string `json:"skuId,omitempty"`
  466. // SkuName: Read-only external display name for a product's SKU assigned
  467. // to a customer in the subscription. SKU names are subject to change at
  468. // Google's discretion. For products and SKUs available in this version
  469. // of the API, see Product and SKU IDs.
  470. SkuName string `json:"skuName,omitempty"`
  471. // Status: This is an optional property.
  472. Status string `json:"status,omitempty"`
  473. // SubscriptionId: The subscriptionId is the subscription identifier and
  474. // is unique for each customer. This is a required property. Since a
  475. // subscriptionId changes when a subscription is updated, we recommend
  476. // not using this ID as a key for persistent data. Use the
  477. // subscriptionId as described in retrieve all reseller subscriptions.
  478. SubscriptionId string `json:"subscriptionId,omitempty"`
  479. // SuspensionReasons: Read-only field containing an enumerable of all
  480. // the current suspension reasons for a subscription. It is possible for
  481. // a subscription to have many concurrent, overlapping suspension
  482. // reasons. A subscription's STATUS is SUSPENDED until all pending
  483. // suspensions are removed.
  484. //
  485. // Possible options include:
  486. // - PENDING_TOS_ACCEPTANCE - The customer has not logged in and
  487. // accepted the G Suite Resold Terms of Services.
  488. // - RENEWAL_WITH_TYPE_CANCEL - The customer's commitment ended and
  489. // their service was cancelled at the end of their term.
  490. // - RESELLER_INITIATED - A manual suspension invoked by a Reseller.
  491. // - TRIAL_ENDED - The customer's trial expired without a plan selected.
  492. //
  493. // - OTHER - The customer is suspended for an internal Google reason
  494. // (e.g. abuse or otherwise).
  495. SuspensionReasons []string `json:"suspensionReasons,omitempty"`
  496. // TransferInfo: Read-only transfer related information for the
  497. // subscription. For more information, see retrieve transferable
  498. // subscriptions for a customer.
  499. TransferInfo *SubscriptionTransferInfo `json:"transferInfo,omitempty"`
  500. // TrialSettings: The G Suite annual commitment and flexible payment
  501. // plans can be in a 30-day free trial. For more information, see the
  502. // API concepts.
  503. TrialSettings *SubscriptionTrialSettings `json:"trialSettings,omitempty"`
  504. // ServerResponse contains the HTTP response code and headers from the
  505. // server.
  506. googleapi.ServerResponse `json:"-"`
  507. // ForceSendFields is a list of field names (e.g. "BillingMethod") to
  508. // unconditionally include in API requests. By default, fields with
  509. // empty values are omitted from API requests. However, any non-pointer,
  510. // non-interface field appearing in ForceSendFields will be sent to the
  511. // server regardless of whether the field is empty or not. This may be
  512. // used to include empty fields in Patch requests.
  513. ForceSendFields []string `json:"-"`
  514. // NullFields is a list of field names (e.g. "BillingMethod") to include
  515. // in API requests with the JSON null value. By default, fields with
  516. // empty values are omitted from API requests. However, any field with
  517. // an empty value appearing in NullFields will be sent to the server as
  518. // null. It is an error if a field in this list has a non-empty value.
  519. // This may be used to include null fields in Patch requests.
  520. NullFields []string `json:"-"`
  521. }
  522. func (s *Subscription) MarshalJSON() ([]byte, error) {
  523. type NoMethod Subscription
  524. raw := NoMethod(*s)
  525. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  526. }
  527. // SubscriptionPlan: The plan property is required. In this version of
  528. // the API, the G Suite plans are the flexible plan, annual commitment
  529. // plan, and the 30-day free trial plan. For more information about the
  530. // API"s payment plans, see the API concepts.
  531. type SubscriptionPlan struct {
  532. // CommitmentInterval: In this version of the API, annual commitment
  533. // plan's interval is one year.
  534. CommitmentInterval *SubscriptionPlanCommitmentInterval `json:"commitmentInterval,omitempty"`
  535. // IsCommitmentPlan: The isCommitmentPlan property's boolean value
  536. // identifies the plan as an annual commitment plan:
  537. // - true — The subscription's plan is an annual commitment plan.
  538. // - false — The plan is not an annual commitment plan.
  539. IsCommitmentPlan bool `json:"isCommitmentPlan,omitempty"`
  540. // PlanName: The planName property is required. This is the name of the
  541. // subscription's plan. For more information about the Google payment
  542. // plans, see the API concepts.
  543. //
  544. // Possible values are:
  545. // - ANNUAL_MONTHLY_PAY — The annual commitment plan with monthly
  546. // payments
  547. // - ANNUAL_YEARLY_PAY — The annual commitment plan with yearly
  548. // payments
  549. // - FLEXIBLE — The flexible plan
  550. // - TRIAL — The 30-day free trial plan. A subscription in trial will
  551. // be suspended after the 30th free day if no payment plan is assigned.
  552. // Calling changePlan will assign a payment plan to a trial but will not
  553. // activate the plan. A trial will automatically begin its assigned
  554. // payment plan after its 30th free day or immediately after calling
  555. // startPaidService.
  556. PlanName string `json:"planName,omitempty"`
  557. // ForceSendFields is a list of field names (e.g. "CommitmentInterval")
  558. // to unconditionally include in API requests. By default, fields with
  559. // empty values are omitted from API requests. However, any non-pointer,
  560. // non-interface field appearing in ForceSendFields will be sent to the
  561. // server regardless of whether the field is empty or not. This may be
  562. // used to include empty fields in Patch requests.
  563. ForceSendFields []string `json:"-"`
  564. // NullFields is a list of field names (e.g. "CommitmentInterval") to
  565. // include in API requests with the JSON null value. By default, fields
  566. // with empty values are omitted from API requests. However, any field
  567. // with an empty value appearing in NullFields will be sent to the
  568. // server as null. It is an error if a field in this list has a
  569. // non-empty value. This may be used to include null fields in Patch
  570. // requests.
  571. NullFields []string `json:"-"`
  572. }
  573. func (s *SubscriptionPlan) MarshalJSON() ([]byte, error) {
  574. type NoMethod SubscriptionPlan
  575. raw := NoMethod(*s)
  576. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  577. }
  578. // SubscriptionPlanCommitmentInterval: In this version of the API,
  579. // annual commitment plan's interval is one year.
  580. type SubscriptionPlanCommitmentInterval struct {
  581. // EndTime: An annual commitment plan's interval's endTime in
  582. // milliseconds using the UNIX Epoch format. See an example Epoch
  583. // converter.
  584. EndTime int64 `json:"endTime,omitempty,string"`
  585. // StartTime: An annual commitment plan's interval's startTime in
  586. // milliseconds using UNIX Epoch format. See an example Epoch converter.
  587. StartTime int64 `json:"startTime,omitempty,string"`
  588. // ForceSendFields is a list of field names (e.g. "EndTime") to
  589. // unconditionally include in API requests. By default, fields with
  590. // empty values are omitted from API requests. However, any non-pointer,
  591. // non-interface field appearing in ForceSendFields will be sent to the
  592. // server regardless of whether the field is empty or not. This may be
  593. // used to include empty fields in Patch requests.
  594. ForceSendFields []string `json:"-"`
  595. // NullFields is a list of field names (e.g. "EndTime") to include in
  596. // API requests with the JSON null value. By default, fields with empty
  597. // values are omitted from API requests. However, any field with an
  598. // empty value appearing in NullFields will be sent to the server as
  599. // null. It is an error if a field in this list has a non-empty value.
  600. // This may be used to include null fields in Patch requests.
  601. NullFields []string `json:"-"`
  602. }
  603. func (s *SubscriptionPlanCommitmentInterval) MarshalJSON() ([]byte, error) {
  604. type NoMethod SubscriptionPlanCommitmentInterval
  605. raw := NoMethod(*s)
  606. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  607. }
  608. // SubscriptionTransferInfo: Read-only transfer related information for
  609. // the subscription. For more information, see retrieve transferable
  610. // subscriptions for a customer.
  611. type SubscriptionTransferInfo struct {
  612. // MinimumTransferableSeats: When inserting a subscription, this is the
  613. // minimum number of seats listed in the transfer order for this
  614. // product. For example, if the customer has 20 users, the reseller
  615. // cannot place a transfer order of 15 seats. The minimum is 20 seats.
  616. MinimumTransferableSeats int64 `json:"minimumTransferableSeats,omitempty"`
  617. // TransferabilityExpirationTime: The time when transfer token or intent
  618. // to transfer will expire. The time is in milliseconds using UNIX Epoch
  619. // format.
  620. TransferabilityExpirationTime int64 `json:"transferabilityExpirationTime,omitempty,string"`
  621. // ForceSendFields is a list of field names (e.g.
  622. // "MinimumTransferableSeats") to unconditionally include in API
  623. // requests. By default, fields with empty values are omitted from API
  624. // requests. However, any non-pointer, non-interface field appearing in
  625. // ForceSendFields will be sent to the server regardless of whether the
  626. // field is empty or not. This may be used to include empty fields in
  627. // Patch requests.
  628. ForceSendFields []string `json:"-"`
  629. // NullFields is a list of field names (e.g. "MinimumTransferableSeats")
  630. // to include in API requests with the JSON null value. By default,
  631. // fields with empty values are omitted from API requests. However, any
  632. // field with an empty value appearing in NullFields will be sent to the
  633. // server as null. It is an error if a field in this list has a
  634. // non-empty value. This may be used to include null fields in Patch
  635. // requests.
  636. NullFields []string `json:"-"`
  637. }
  638. func (s *SubscriptionTransferInfo) MarshalJSON() ([]byte, error) {
  639. type NoMethod SubscriptionTransferInfo
  640. raw := NoMethod(*s)
  641. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  642. }
  643. // SubscriptionTrialSettings: The G Suite annual commitment and flexible
  644. // payment plans can be in a 30-day free trial. For more information,
  645. // see the API concepts.
  646. type SubscriptionTrialSettings struct {
  647. // IsInTrial: Determines if a subscription's plan is in a 30-day free
  648. // trial or not:
  649. // - true — The plan is in trial.
  650. // - false — The plan is not in trial.
  651. IsInTrial bool `json:"isInTrial,omitempty"`
  652. // TrialEndTime: Date when the trial ends. The value is in milliseconds
  653. // using the UNIX Epoch format. See an example Epoch converter.
  654. TrialEndTime int64 `json:"trialEndTime,omitempty,string"`
  655. // ForceSendFields is a list of field names (e.g. "IsInTrial") to
  656. // unconditionally include in API requests. By default, fields with
  657. // empty values are omitted from API requests. However, any non-pointer,
  658. // non-interface field appearing in ForceSendFields will be sent to the
  659. // server regardless of whether the field is empty or not. This may be
  660. // used to include empty fields in Patch requests.
  661. ForceSendFields []string `json:"-"`
  662. // NullFields is a list of field names (e.g. "IsInTrial") to include in
  663. // API requests with the JSON null value. By default, fields with empty
  664. // values are omitted from API requests. However, any field with an
  665. // empty value appearing in NullFields will be sent to the server as
  666. // null. It is an error if a field in this list has a non-empty value.
  667. // This may be used to include null fields in Patch requests.
  668. NullFields []string `json:"-"`
  669. }
  670. func (s *SubscriptionTrialSettings) MarshalJSON() ([]byte, error) {
  671. type NoMethod SubscriptionTrialSettings
  672. raw := NoMethod(*s)
  673. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  674. }
  675. // Subscriptions: JSON template for a subscription list.
  676. type Subscriptions struct {
  677. // Kind: Identifies the resource as a collection of subscriptions.
  678. // Value: reseller#subscriptions
  679. Kind string `json:"kind,omitempty"`
  680. // NextPageToken: The continuation token, used to page through large
  681. // result sets. Provide this value in a subsequent request to return the
  682. // next page of results.
  683. NextPageToken string `json:"nextPageToken,omitempty"`
  684. // Subscriptions: The subscriptions in this page of results.
  685. Subscriptions []*Subscription `json:"subscriptions,omitempty"`
  686. // ServerResponse contains the HTTP response code and headers from the
  687. // server.
  688. googleapi.ServerResponse `json:"-"`
  689. // ForceSendFields is a list of field names (e.g. "Kind") to
  690. // unconditionally include in API requests. By default, fields with
  691. // empty values are omitted from API requests. However, any non-pointer,
  692. // non-interface field appearing in ForceSendFields will be sent to the
  693. // server regardless of whether the field is empty or not. This may be
  694. // used to include empty fields in Patch requests.
  695. ForceSendFields []string `json:"-"`
  696. // NullFields is a list of field names (e.g. "Kind") to include in API
  697. // requests with the JSON null value. By default, fields with empty
  698. // values are omitted from API requests. However, any field with an
  699. // empty value appearing in NullFields will be sent to the server as
  700. // null. It is an error if a field in this list has a non-empty value.
  701. // This may be used to include null fields in Patch requests.
  702. NullFields []string `json:"-"`
  703. }
  704. func (s *Subscriptions) MarshalJSON() ([]byte, error) {
  705. type NoMethod Subscriptions
  706. raw := NoMethod(*s)
  707. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  708. }
  709. // method id "reseller.customers.get":
  710. type CustomersGetCall struct {
  711. s *Service
  712. customerId string
  713. urlParams_ gensupport.URLParams
  714. ifNoneMatch_ string
  715. ctx_ context.Context
  716. header_ http.Header
  717. }
  718. // Get: Get a customer account.
  719. func (r *CustomersService) Get(customerId string) *CustomersGetCall {
  720. c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  721. c.customerId = customerId
  722. return c
  723. }
  724. // Fields allows partial responses to be retrieved. See
  725. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  726. // for more information.
  727. func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
  728. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  729. return c
  730. }
  731. // IfNoneMatch sets the optional parameter which makes the operation
  732. // fail if the object's ETag matches the given value. This is useful for
  733. // getting updates only after the object has changed since the last
  734. // request. Use googleapi.IsNotModified to check whether the response
  735. // error from Do is the result of In-None-Match.
  736. func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
  737. c.ifNoneMatch_ = entityTag
  738. return c
  739. }
  740. // Context sets the context to be used in this call's Do method. Any
  741. // pending HTTP request will be aborted if the provided context is
  742. // canceled.
  743. func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
  744. c.ctx_ = ctx
  745. return c
  746. }
  747. // Header returns an http.Header that can be modified by the caller to
  748. // add HTTP headers to the request.
  749. func (c *CustomersGetCall) Header() http.Header {
  750. if c.header_ == nil {
  751. c.header_ = make(http.Header)
  752. }
  753. return c.header_
  754. }
  755. func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
  756. reqHeaders := make(http.Header)
  757. for k, v := range c.header_ {
  758. reqHeaders[k] = v
  759. }
  760. reqHeaders.Set("User-Agent", c.s.userAgent())
  761. if c.ifNoneMatch_ != "" {
  762. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  763. }
  764. var body io.Reader = nil
  765. c.urlParams_.Set("alt", alt)
  766. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
  767. urls += "?" + c.urlParams_.Encode()
  768. req, _ := http.NewRequest("GET", urls, body)
  769. req.Header = reqHeaders
  770. googleapi.Expand(req.URL, map[string]string{
  771. "customerId": c.customerId,
  772. })
  773. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  774. }
  775. // Do executes the "reseller.customers.get" call.
  776. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  777. // code is an error. Response headers are in either
  778. // *Customer.ServerResponse.Header or (if a response was returned at
  779. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  780. // to check whether the returned error was because
  781. // http.StatusNotModified was returned.
  782. func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  783. gensupport.SetOptions(c.urlParams_, opts...)
  784. res, err := c.doRequest("json")
  785. if res != nil && res.StatusCode == http.StatusNotModified {
  786. if res.Body != nil {
  787. res.Body.Close()
  788. }
  789. return nil, &googleapi.Error{
  790. Code: res.StatusCode,
  791. Header: res.Header,
  792. }
  793. }
  794. if err != nil {
  795. return nil, err
  796. }
  797. defer googleapi.CloseBody(res)
  798. if err := googleapi.CheckResponse(res); err != nil {
  799. return nil, err
  800. }
  801. ret := &Customer{
  802. ServerResponse: googleapi.ServerResponse{
  803. Header: res.Header,
  804. HTTPStatusCode: res.StatusCode,
  805. },
  806. }
  807. target := &ret
  808. if err := gensupport.DecodeResponse(target, res); err != nil {
  809. return nil, err
  810. }
  811. return ret, nil
  812. // {
  813. // "description": "Get a customer account.",
  814. // "httpMethod": "GET",
  815. // "id": "reseller.customers.get",
  816. // "parameterOrder": [
  817. // "customerId"
  818. // ],
  819. // "parameters": {
  820. // "customerId": {
  821. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  822. // "location": "path",
  823. // "required": true,
  824. // "type": "string"
  825. // }
  826. // },
  827. // "path": "customers/{customerId}",
  828. // "response": {
  829. // "$ref": "Customer"
  830. // },
  831. // "scopes": [
  832. // "https://www.googleapis.com/auth/apps.order",
  833. // "https://www.googleapis.com/auth/apps.order.readonly"
  834. // ]
  835. // }
  836. }
  837. // method id "reseller.customers.insert":
  838. type CustomersInsertCall struct {
  839. s *Service
  840. customer *Customer
  841. urlParams_ gensupport.URLParams
  842. ctx_ context.Context
  843. header_ http.Header
  844. }
  845. // Insert: Order a new customer's account.
  846. func (r *CustomersService) Insert(customer *Customer) *CustomersInsertCall {
  847. c := &CustomersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  848. c.customer = customer
  849. return c
  850. }
  851. // CustomerAuthToken sets the optional parameter "customerAuthToken":
  852. // The customerAuthToken query string is required when creating a resold
  853. // account that transfers a direct customer's subscription or transfers
  854. // another reseller customer's subscription to your reseller management.
  855. // This is a hexadecimal authentication token needed to complete the
  856. // subscription transfer. For more information, see the administrator
  857. // help center.
  858. func (c *CustomersInsertCall) CustomerAuthToken(customerAuthToken string) *CustomersInsertCall {
  859. c.urlParams_.Set("customerAuthToken", customerAuthToken)
  860. return c
  861. }
  862. // Fields allows partial responses to be retrieved. See
  863. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  864. // for more information.
  865. func (c *CustomersInsertCall) Fields(s ...googleapi.Field) *CustomersInsertCall {
  866. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  867. return c
  868. }
  869. // Context sets the context to be used in this call's Do method. Any
  870. // pending HTTP request will be aborted if the provided context is
  871. // canceled.
  872. func (c *CustomersInsertCall) Context(ctx context.Context) *CustomersInsertCall {
  873. c.ctx_ = ctx
  874. return c
  875. }
  876. // Header returns an http.Header that can be modified by the caller to
  877. // add HTTP headers to the request.
  878. func (c *CustomersInsertCall) Header() http.Header {
  879. if c.header_ == nil {
  880. c.header_ = make(http.Header)
  881. }
  882. return c.header_
  883. }
  884. func (c *CustomersInsertCall) doRequest(alt string) (*http.Response, error) {
  885. reqHeaders := make(http.Header)
  886. for k, v := range c.header_ {
  887. reqHeaders[k] = v
  888. }
  889. reqHeaders.Set("User-Agent", c.s.userAgent())
  890. var body io.Reader = nil
  891. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  892. if err != nil {
  893. return nil, err
  894. }
  895. reqHeaders.Set("Content-Type", "application/json")
  896. c.urlParams_.Set("alt", alt)
  897. urls := googleapi.ResolveRelative(c.s.BasePath, "customers")
  898. urls += "?" + c.urlParams_.Encode()
  899. req, _ := http.NewRequest("POST", urls, body)
  900. req.Header = reqHeaders
  901. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  902. }
  903. // Do executes the "reseller.customers.insert" call.
  904. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  905. // code is an error. Response headers are in either
  906. // *Customer.ServerResponse.Header or (if a response was returned at
  907. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  908. // to check whether the returned error was because
  909. // http.StatusNotModified was returned.
  910. func (c *CustomersInsertCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  911. gensupport.SetOptions(c.urlParams_, opts...)
  912. res, err := c.doRequest("json")
  913. if res != nil && res.StatusCode == http.StatusNotModified {
  914. if res.Body != nil {
  915. res.Body.Close()
  916. }
  917. return nil, &googleapi.Error{
  918. Code: res.StatusCode,
  919. Header: res.Header,
  920. }
  921. }
  922. if err != nil {
  923. return nil, err
  924. }
  925. defer googleapi.CloseBody(res)
  926. if err := googleapi.CheckResponse(res); err != nil {
  927. return nil, err
  928. }
  929. ret := &Customer{
  930. ServerResponse: googleapi.ServerResponse{
  931. Header: res.Header,
  932. HTTPStatusCode: res.StatusCode,
  933. },
  934. }
  935. target := &ret
  936. if err := gensupport.DecodeResponse(target, res); err != nil {
  937. return nil, err
  938. }
  939. return ret, nil
  940. // {
  941. // "description": "Order a new customer's account.",
  942. // "httpMethod": "POST",
  943. // "id": "reseller.customers.insert",
  944. // "parameters": {
  945. // "customerAuthToken": {
  946. // "description": "The customerAuthToken query string is required when creating a resold account that transfers a direct customer's subscription or transfers another reseller customer's subscription to your reseller management. This is a hexadecimal authentication token needed to complete the subscription transfer. For more information, see the administrator help center.",
  947. // "location": "query",
  948. // "type": "string"
  949. // }
  950. // },
  951. // "path": "customers",
  952. // "request": {
  953. // "$ref": "Customer"
  954. // },
  955. // "response": {
  956. // "$ref": "Customer"
  957. // },
  958. // "scopes": [
  959. // "https://www.googleapis.com/auth/apps.order"
  960. // ]
  961. // }
  962. }
  963. // method id "reseller.customers.patch":
  964. type CustomersPatchCall struct {
  965. s *Service
  966. customerId string
  967. customer *Customer
  968. urlParams_ gensupport.URLParams
  969. ctx_ context.Context
  970. header_ http.Header
  971. }
  972. // Patch: Update a customer account's settings. This method supports
  973. // patch semantics.
  974. func (r *CustomersService) Patch(customerId string, customer *Customer) *CustomersPatchCall {
  975. c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  976. c.customerId = customerId
  977. c.customer = customer
  978. return c
  979. }
  980. // Fields allows partial responses to be retrieved. See
  981. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  982. // for more information.
  983. func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
  984. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  985. return c
  986. }
  987. // Context sets the context to be used in this call's Do method. Any
  988. // pending HTTP request will be aborted if the provided context is
  989. // canceled.
  990. func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
  991. c.ctx_ = ctx
  992. return c
  993. }
  994. // Header returns an http.Header that can be modified by the caller to
  995. // add HTTP headers to the request.
  996. func (c *CustomersPatchCall) Header() http.Header {
  997. if c.header_ == nil {
  998. c.header_ = make(http.Header)
  999. }
  1000. return c.header_
  1001. }
  1002. func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
  1003. reqHeaders := make(http.Header)
  1004. for k, v := range c.header_ {
  1005. reqHeaders[k] = v
  1006. }
  1007. reqHeaders.Set("User-Agent", c.s.userAgent())
  1008. var body io.Reader = nil
  1009. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  1010. if err != nil {
  1011. return nil, err
  1012. }
  1013. reqHeaders.Set("Content-Type", "application/json")
  1014. c.urlParams_.Set("alt", alt)
  1015. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
  1016. urls += "?" + c.urlParams_.Encode()
  1017. req, _ := http.NewRequest("PATCH", urls, body)
  1018. req.Header = reqHeaders
  1019. googleapi.Expand(req.URL, map[string]string{
  1020. "customerId": c.customerId,
  1021. })
  1022. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1023. }
  1024. // Do executes the "reseller.customers.patch" call.
  1025. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  1026. // code is an error. Response headers are in either
  1027. // *Customer.ServerResponse.Header or (if a response was returned at
  1028. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1029. // to check whether the returned error was because
  1030. // http.StatusNotModified was returned.
  1031. func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  1032. gensupport.SetOptions(c.urlParams_, opts...)
  1033. res, err := c.doRequest("json")
  1034. if res != nil && res.StatusCode == http.StatusNotModified {
  1035. if res.Body != nil {
  1036. res.Body.Close()
  1037. }
  1038. return nil, &googleapi.Error{
  1039. Code: res.StatusCode,
  1040. Header: res.Header,
  1041. }
  1042. }
  1043. if err != nil {
  1044. return nil, err
  1045. }
  1046. defer googleapi.CloseBody(res)
  1047. if err := googleapi.CheckResponse(res); err != nil {
  1048. return nil, err
  1049. }
  1050. ret := &Customer{
  1051. ServerResponse: googleapi.ServerResponse{
  1052. Header: res.Header,
  1053. HTTPStatusCode: res.StatusCode,
  1054. },
  1055. }
  1056. target := &ret
  1057. if err := gensupport.DecodeResponse(target, res); err != nil {
  1058. return nil, err
  1059. }
  1060. return ret, nil
  1061. // {
  1062. // "description": "Update a customer account's settings. This method supports patch semantics.",
  1063. // "httpMethod": "PATCH",
  1064. // "id": "reseller.customers.patch",
  1065. // "parameterOrder": [
  1066. // "customerId"
  1067. // ],
  1068. // "parameters": {
  1069. // "customerId": {
  1070. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  1071. // "location": "path",
  1072. // "required": true,
  1073. // "type": "string"
  1074. // }
  1075. // },
  1076. // "path": "customers/{customerId}",
  1077. // "request": {
  1078. // "$ref": "Customer"
  1079. // },
  1080. // "response": {
  1081. // "$ref": "Customer"
  1082. // },
  1083. // "scopes": [
  1084. // "https://www.googleapis.com/auth/apps.order"
  1085. // ]
  1086. // }
  1087. }
  1088. // method id "reseller.customers.update":
  1089. type CustomersUpdateCall struct {
  1090. s *Service
  1091. customerId string
  1092. customer *Customer
  1093. urlParams_ gensupport.URLParams
  1094. ctx_ context.Context
  1095. header_ http.Header
  1096. }
  1097. // Update: Update a customer account's settings.
  1098. func (r *CustomersService) Update(customerId string, customer *Customer) *CustomersUpdateCall {
  1099. c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1100. c.customerId = customerId
  1101. c.customer = customer
  1102. return c
  1103. }
  1104. // Fields allows partial responses to be retrieved. See
  1105. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1106. // for more information.
  1107. func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
  1108. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1109. return c
  1110. }
  1111. // Context sets the context to be used in this call's Do method. Any
  1112. // pending HTTP request will be aborted if the provided context is
  1113. // canceled.
  1114. func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
  1115. c.ctx_ = ctx
  1116. return c
  1117. }
  1118. // Header returns an http.Header that can be modified by the caller to
  1119. // add HTTP headers to the request.
  1120. func (c *CustomersUpdateCall) Header() http.Header {
  1121. if c.header_ == nil {
  1122. c.header_ = make(http.Header)
  1123. }
  1124. return c.header_
  1125. }
  1126. func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
  1127. reqHeaders := make(http.Header)
  1128. for k, v := range c.header_ {
  1129. reqHeaders[k] = v
  1130. }
  1131. reqHeaders.Set("User-Agent", c.s.userAgent())
  1132. var body io.Reader = nil
  1133. body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
  1134. if err != nil {
  1135. return nil, err
  1136. }
  1137. reqHeaders.Set("Content-Type", "application/json")
  1138. c.urlParams_.Set("alt", alt)
  1139. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
  1140. urls += "?" + c.urlParams_.Encode()
  1141. req, _ := http.NewRequest("PUT", urls, body)
  1142. req.Header = reqHeaders
  1143. googleapi.Expand(req.URL, map[string]string{
  1144. "customerId": c.customerId,
  1145. })
  1146. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1147. }
  1148. // Do executes the "reseller.customers.update" call.
  1149. // Exactly one of *Customer or error will be non-nil. Any non-2xx status
  1150. // code is an error. Response headers are in either
  1151. // *Customer.ServerResponse.Header or (if a response was returned at
  1152. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1153. // to check whether the returned error was because
  1154. // http.StatusNotModified was returned.
  1155. func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
  1156. gensupport.SetOptions(c.urlParams_, opts...)
  1157. res, err := c.doRequest("json")
  1158. if res != nil && res.StatusCode == http.StatusNotModified {
  1159. if res.Body != nil {
  1160. res.Body.Close()
  1161. }
  1162. return nil, &googleapi.Error{
  1163. Code: res.StatusCode,
  1164. Header: res.Header,
  1165. }
  1166. }
  1167. if err != nil {
  1168. return nil, err
  1169. }
  1170. defer googleapi.CloseBody(res)
  1171. if err := googleapi.CheckResponse(res); err != nil {
  1172. return nil, err
  1173. }
  1174. ret := &Customer{
  1175. ServerResponse: googleapi.ServerResponse{
  1176. Header: res.Header,
  1177. HTTPStatusCode: res.StatusCode,
  1178. },
  1179. }
  1180. target := &ret
  1181. if err := gensupport.DecodeResponse(target, res); err != nil {
  1182. return nil, err
  1183. }
  1184. return ret, nil
  1185. // {
  1186. // "description": "Update a customer account's settings.",
  1187. // "httpMethod": "PUT",
  1188. // "id": "reseller.customers.update",
  1189. // "parameterOrder": [
  1190. // "customerId"
  1191. // ],
  1192. // "parameters": {
  1193. // "customerId": {
  1194. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  1195. // "location": "path",
  1196. // "required": true,
  1197. // "type": "string"
  1198. // }
  1199. // },
  1200. // "path": "customers/{customerId}",
  1201. // "request": {
  1202. // "$ref": "Customer"
  1203. // },
  1204. // "response": {
  1205. // "$ref": "Customer"
  1206. // },
  1207. // "scopes": [
  1208. // "https://www.googleapis.com/auth/apps.order"
  1209. // ]
  1210. // }
  1211. }
  1212. // method id "reseller.resellernotify.getwatchdetails":
  1213. type ResellernotifyGetwatchdetailsCall struct {
  1214. s *Service
  1215. urlParams_ gensupport.URLParams
  1216. ifNoneMatch_ string
  1217. ctx_ context.Context
  1218. header_ http.Header
  1219. }
  1220. // Getwatchdetails: Returns all the details of the watch corresponding
  1221. // to the reseller.
  1222. func (r *ResellernotifyService) Getwatchdetails() *ResellernotifyGetwatchdetailsCall {
  1223. c := &ResellernotifyGetwatchdetailsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1224. return c
  1225. }
  1226. // Fields allows partial responses to be retrieved. See
  1227. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1228. // for more information.
  1229. func (c *ResellernotifyGetwatchdetailsCall) Fields(s ...googleapi.Field) *ResellernotifyGetwatchdetailsCall {
  1230. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1231. return c
  1232. }
  1233. // IfNoneMatch sets the optional parameter which makes the operation
  1234. // fail if the object's ETag matches the given value. This is useful for
  1235. // getting updates only after the object has changed since the last
  1236. // request. Use googleapi.IsNotModified to check whether the response
  1237. // error from Do is the result of In-None-Match.
  1238. func (c *ResellernotifyGetwatchdetailsCall) IfNoneMatch(entityTag string) *ResellernotifyGetwatchdetailsCall {
  1239. c.ifNoneMatch_ = entityTag
  1240. return c
  1241. }
  1242. // Context sets the context to be used in this call's Do method. Any
  1243. // pending HTTP request will be aborted if the provided context is
  1244. // canceled.
  1245. func (c *ResellernotifyGetwatchdetailsCall) Context(ctx context.Context) *ResellernotifyGetwatchdetailsCall {
  1246. c.ctx_ = ctx
  1247. return c
  1248. }
  1249. // Header returns an http.Header that can be modified by the caller to
  1250. // add HTTP headers to the request.
  1251. func (c *ResellernotifyGetwatchdetailsCall) Header() http.Header {
  1252. if c.header_ == nil {
  1253. c.header_ = make(http.Header)
  1254. }
  1255. return c.header_
  1256. }
  1257. func (c *ResellernotifyGetwatchdetailsCall) doRequest(alt string) (*http.Response, error) {
  1258. reqHeaders := make(http.Header)
  1259. for k, v := range c.header_ {
  1260. reqHeaders[k] = v
  1261. }
  1262. reqHeaders.Set("User-Agent", c.s.userAgent())
  1263. if c.ifNoneMatch_ != "" {
  1264. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1265. }
  1266. var body io.Reader = nil
  1267. c.urlParams_.Set("alt", alt)
  1268. urls := googleapi.ResolveRelative(c.s.BasePath, "resellernotify/getwatchdetails")
  1269. urls += "?" + c.urlParams_.Encode()
  1270. req, _ := http.NewRequest("GET", urls, body)
  1271. req.Header = reqHeaders
  1272. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1273. }
  1274. // Do executes the "reseller.resellernotify.getwatchdetails" call.
  1275. // Exactly one of *ResellernotifyGetwatchdetailsResponse or error will
  1276. // be non-nil. Any non-2xx status code is an error. Response headers are
  1277. // in either
  1278. // *ResellernotifyGetwatchdetailsResponse.ServerResponse.Header or (if a
  1279. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1280. // googleapi.IsNotModified to check whether the returned error was
  1281. // because http.StatusNotModified was returned.
  1282. func (c *ResellernotifyGetwatchdetailsCall) Do(opts ...googleapi.CallOption) (*ResellernotifyGetwatchdetailsResponse, error) {
  1283. gensupport.SetOptions(c.urlParams_, opts...)
  1284. res, err := c.doRequest("json")
  1285. if res != nil && res.StatusCode == http.StatusNotModified {
  1286. if res.Body != nil {
  1287. res.Body.Close()
  1288. }
  1289. return nil, &googleapi.Error{
  1290. Code: res.StatusCode,
  1291. Header: res.Header,
  1292. }
  1293. }
  1294. if err != nil {
  1295. return nil, err
  1296. }
  1297. defer googleapi.CloseBody(res)
  1298. if err := googleapi.CheckResponse(res); err != nil {
  1299. return nil, err
  1300. }
  1301. ret := &ResellernotifyGetwatchdetailsResponse{
  1302. ServerResponse: googleapi.ServerResponse{
  1303. Header: res.Header,
  1304. HTTPStatusCode: res.StatusCode,
  1305. },
  1306. }
  1307. target := &ret
  1308. if err := gensupport.DecodeResponse(target, res); err != nil {
  1309. return nil, err
  1310. }
  1311. return ret, nil
  1312. // {
  1313. // "description": "Returns all the details of the watch corresponding to the reseller.",
  1314. // "httpMethod": "GET",
  1315. // "id": "reseller.resellernotify.getwatchdetails",
  1316. // "path": "resellernotify/getwatchdetails",
  1317. // "response": {
  1318. // "$ref": "ResellernotifyGetwatchdetailsResponse"
  1319. // },
  1320. // "scopes": [
  1321. // "https://www.googleapis.com/auth/apps.order",
  1322. // "https://www.googleapis.com/auth/apps.order.readonly"
  1323. // ]
  1324. // }
  1325. }
  1326. // method id "reseller.resellernotify.register":
  1327. type ResellernotifyRegisterCall struct {
  1328. s *Service
  1329. urlParams_ gensupport.URLParams
  1330. ctx_ context.Context
  1331. header_ http.Header
  1332. }
  1333. // Register: Registers a Reseller for receiving notifications.
  1334. func (r *ResellernotifyService) Register() *ResellernotifyRegisterCall {
  1335. c := &ResellernotifyRegisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1336. return c
  1337. }
  1338. // ServiceAccountEmailAddress sets the optional parameter
  1339. // "serviceAccountEmailAddress": The service account which will own the
  1340. // created Cloud-PubSub topic.
  1341. func (c *ResellernotifyRegisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyRegisterCall {
  1342. c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
  1343. return c
  1344. }
  1345. // Fields allows partial responses to be retrieved. See
  1346. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1347. // for more information.
  1348. func (c *ResellernotifyRegisterCall) Fields(s ...googleapi.Field) *ResellernotifyRegisterCall {
  1349. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1350. return c
  1351. }
  1352. // Context sets the context to be used in this call's Do method. Any
  1353. // pending HTTP request will be aborted if the provided context is
  1354. // canceled.
  1355. func (c *ResellernotifyRegisterCall) Context(ctx context.Context) *ResellernotifyRegisterCall {
  1356. c.ctx_ = ctx
  1357. return c
  1358. }
  1359. // Header returns an http.Header that can be modified by the caller to
  1360. // add HTTP headers to the request.
  1361. func (c *ResellernotifyRegisterCall) Header() http.Header {
  1362. if c.header_ == nil {
  1363. c.header_ = make(http.Header)
  1364. }
  1365. return c.header_
  1366. }
  1367. func (c *ResellernotifyRegisterCall) doRequest(alt string) (*http.Response, error) {
  1368. reqHeaders := make(http.Header)
  1369. for k, v := range c.header_ {
  1370. reqHeaders[k] = v
  1371. }
  1372. reqHeaders.Set("User-Agent", c.s.userAgent())
  1373. var body io.Reader = nil
  1374. c.urlParams_.Set("alt", alt)
  1375. urls := googleapi.ResolveRelative(c.s.BasePath, "resellernotify/register")
  1376. urls += "?" + c.urlParams_.Encode()
  1377. req, _ := http.NewRequest("POST", urls, body)
  1378. req.Header = reqHeaders
  1379. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1380. }
  1381. // Do executes the "reseller.resellernotify.register" call.
  1382. // Exactly one of *ResellernotifyResource or error will be non-nil. Any
  1383. // non-2xx status code is an error. Response headers are in either
  1384. // *ResellernotifyResource.ServerResponse.Header or (if a response was
  1385. // returned at all) in error.(*googleapi.Error).Header. Use
  1386. // googleapi.IsNotModified to check whether the returned error was
  1387. // because http.StatusNotModified was returned.
  1388. func (c *ResellernotifyRegisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
  1389. gensupport.SetOptions(c.urlParams_, opts...)
  1390. res, err := c.doRequest("json")
  1391. if res != nil && res.StatusCode == http.StatusNotModified {
  1392. if res.Body != nil {
  1393. res.Body.Close()
  1394. }
  1395. return nil, &googleapi.Error{
  1396. Code: res.StatusCode,
  1397. Header: res.Header,
  1398. }
  1399. }
  1400. if err != nil {
  1401. return nil, err
  1402. }
  1403. defer googleapi.CloseBody(res)
  1404. if err := googleapi.CheckResponse(res); err != nil {
  1405. return nil, err
  1406. }
  1407. ret := &ResellernotifyResource{
  1408. ServerResponse: googleapi.ServerResponse{
  1409. Header: res.Header,
  1410. HTTPStatusCode: res.StatusCode,
  1411. },
  1412. }
  1413. target := &ret
  1414. if err := gensupport.DecodeResponse(target, res); err != nil {
  1415. return nil, err
  1416. }
  1417. return ret, nil
  1418. // {
  1419. // "description": "Registers a Reseller for receiving notifications.",
  1420. // "httpMethod": "POST",
  1421. // "id": "reseller.resellernotify.register",
  1422. // "parameters": {
  1423. // "serviceAccountEmailAddress": {
  1424. // "description": "The service account which will own the created Cloud-PubSub topic.",
  1425. // "location": "query",
  1426. // "type": "string"
  1427. // }
  1428. // },
  1429. // "path": "resellernotify/register",
  1430. // "response": {
  1431. // "$ref": "ResellernotifyResource"
  1432. // },
  1433. // "scopes": [
  1434. // "https://www.googleapis.com/auth/apps.order"
  1435. // ]
  1436. // }
  1437. }
  1438. // method id "reseller.resellernotify.unregister":
  1439. type ResellernotifyUnregisterCall struct {
  1440. s *Service
  1441. urlParams_ gensupport.URLParams
  1442. ctx_ context.Context
  1443. header_ http.Header
  1444. }
  1445. // Unregister: Unregisters a Reseller for receiving notifications.
  1446. func (r *ResellernotifyService) Unregister() *ResellernotifyUnregisterCall {
  1447. c := &ResellernotifyUnregisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1448. return c
  1449. }
  1450. // ServiceAccountEmailAddress sets the optional parameter
  1451. // "serviceAccountEmailAddress": The service account which owns the
  1452. // Cloud-PubSub topic.
  1453. func (c *ResellernotifyUnregisterCall) ServiceAccountEmailAddress(serviceAccountEmailAddress string) *ResellernotifyUnregisterCall {
  1454. c.urlParams_.Set("serviceAccountEmailAddress", serviceAccountEmailAddress)
  1455. return c
  1456. }
  1457. // Fields allows partial responses to be retrieved. See
  1458. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1459. // for more information.
  1460. func (c *ResellernotifyUnregisterCall) Fields(s ...googleapi.Field) *ResellernotifyUnregisterCall {
  1461. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1462. return c
  1463. }
  1464. // Context sets the context to be used in this call's Do method. Any
  1465. // pending HTTP request will be aborted if the provided context is
  1466. // canceled.
  1467. func (c *ResellernotifyUnregisterCall) Context(ctx context.Context) *ResellernotifyUnregisterCall {
  1468. c.ctx_ = ctx
  1469. return c
  1470. }
  1471. // Header returns an http.Header that can be modified by the caller to
  1472. // add HTTP headers to the request.
  1473. func (c *ResellernotifyUnregisterCall) Header() http.Header {
  1474. if c.header_ == nil {
  1475. c.header_ = make(http.Header)
  1476. }
  1477. return c.header_
  1478. }
  1479. func (c *ResellernotifyUnregisterCall) doRequest(alt string) (*http.Response, error) {
  1480. reqHeaders := make(http.Header)
  1481. for k, v := range c.header_ {
  1482. reqHeaders[k] = v
  1483. }
  1484. reqHeaders.Set("User-Agent", c.s.userAgent())
  1485. var body io.Reader = nil
  1486. c.urlParams_.Set("alt", alt)
  1487. urls := googleapi.ResolveRelative(c.s.BasePath, "resellernotify/unregister")
  1488. urls += "?" + c.urlParams_.Encode()
  1489. req, _ := http.NewRequest("POST", urls, body)
  1490. req.Header = reqHeaders
  1491. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1492. }
  1493. // Do executes the "reseller.resellernotify.unregister" call.
  1494. // Exactly one of *ResellernotifyResource or error will be non-nil. Any
  1495. // non-2xx status code is an error. Response headers are in either
  1496. // *ResellernotifyResource.ServerResponse.Header or (if a response was
  1497. // returned at all) in error.(*googleapi.Error).Header. Use
  1498. // googleapi.IsNotModified to check whether the returned error was
  1499. // because http.StatusNotModified was returned.
  1500. func (c *ResellernotifyUnregisterCall) Do(opts ...googleapi.CallOption) (*ResellernotifyResource, error) {
  1501. gensupport.SetOptions(c.urlParams_, opts...)
  1502. res, err := c.doRequest("json")
  1503. if res != nil && res.StatusCode == http.StatusNotModified {
  1504. if res.Body != nil {
  1505. res.Body.Close()
  1506. }
  1507. return nil, &googleapi.Error{
  1508. Code: res.StatusCode,
  1509. Header: res.Header,
  1510. }
  1511. }
  1512. if err != nil {
  1513. return nil, err
  1514. }
  1515. defer googleapi.CloseBody(res)
  1516. if err := googleapi.CheckResponse(res); err != nil {
  1517. return nil, err
  1518. }
  1519. ret := &ResellernotifyResource{
  1520. ServerResponse: googleapi.ServerResponse{
  1521. Header: res.Header,
  1522. HTTPStatusCode: res.StatusCode,
  1523. },
  1524. }
  1525. target := &ret
  1526. if err := gensupport.DecodeResponse(target, res); err != nil {
  1527. return nil, err
  1528. }
  1529. return ret, nil
  1530. // {
  1531. // "description": "Unregisters a Reseller for receiving notifications.",
  1532. // "httpMethod": "POST",
  1533. // "id": "reseller.resellernotify.unregister",
  1534. // "parameters": {
  1535. // "serviceAccountEmailAddress": {
  1536. // "description": "The service account which owns the Cloud-PubSub topic.",
  1537. // "location": "query",
  1538. // "type": "string"
  1539. // }
  1540. // },
  1541. // "path": "resellernotify/unregister",
  1542. // "response": {
  1543. // "$ref": "ResellernotifyResource"
  1544. // },
  1545. // "scopes": [
  1546. // "https://www.googleapis.com/auth/apps.order"
  1547. // ]
  1548. // }
  1549. }
  1550. // method id "reseller.subscriptions.activate":
  1551. type SubscriptionsActivateCall struct {
  1552. s *Service
  1553. customerId string
  1554. subscriptionId string
  1555. urlParams_ gensupport.URLParams
  1556. ctx_ context.Context
  1557. header_ http.Header
  1558. }
  1559. // Activate: Activates a subscription previously suspended by the
  1560. // reseller
  1561. func (r *SubscriptionsService) Activate(customerId string, subscriptionId string) *SubscriptionsActivateCall {
  1562. c := &SubscriptionsActivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1563. c.customerId = customerId
  1564. c.subscriptionId = subscriptionId
  1565. return c
  1566. }
  1567. // Fields allows partial responses to be retrieved. See
  1568. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1569. // for more information.
  1570. func (c *SubscriptionsActivateCall) Fields(s ...googleapi.Field) *SubscriptionsActivateCall {
  1571. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1572. return c
  1573. }
  1574. // Context sets the context to be used in this call's Do method. Any
  1575. // pending HTTP request will be aborted if the provided context is
  1576. // canceled.
  1577. func (c *SubscriptionsActivateCall) Context(ctx context.Context) *SubscriptionsActivateCall {
  1578. c.ctx_ = ctx
  1579. return c
  1580. }
  1581. // Header returns an http.Header that can be modified by the caller to
  1582. // add HTTP headers to the request.
  1583. func (c *SubscriptionsActivateCall) Header() http.Header {
  1584. if c.header_ == nil {
  1585. c.header_ = make(http.Header)
  1586. }
  1587. return c.header_
  1588. }
  1589. func (c *SubscriptionsActivateCall) doRequest(alt string) (*http.Response, error) {
  1590. reqHeaders := make(http.Header)
  1591. for k, v := range c.header_ {
  1592. reqHeaders[k] = v
  1593. }
  1594. reqHeaders.Set("User-Agent", c.s.userAgent())
  1595. var body io.Reader = nil
  1596. c.urlParams_.Set("alt", alt)
  1597. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/activate")
  1598. urls += "?" + c.urlParams_.Encode()
  1599. req, _ := http.NewRequest("POST", urls, body)
  1600. req.Header = reqHeaders
  1601. googleapi.Expand(req.URL, map[string]string{
  1602. "customerId": c.customerId,
  1603. "subscriptionId": c.subscriptionId,
  1604. })
  1605. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1606. }
  1607. // Do executes the "reseller.subscriptions.activate" call.
  1608. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  1609. // status code is an error. Response headers are in either
  1610. // *Subscription.ServerResponse.Header or (if a response was returned at
  1611. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1612. // to check whether the returned error was because
  1613. // http.StatusNotModified was returned.
  1614. func (c *SubscriptionsActivateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1615. gensupport.SetOptions(c.urlParams_, opts...)
  1616. res, err := c.doRequest("json")
  1617. if res != nil && res.StatusCode == http.StatusNotModified {
  1618. if res.Body != nil {
  1619. res.Body.Close()
  1620. }
  1621. return nil, &googleapi.Error{
  1622. Code: res.StatusCode,
  1623. Header: res.Header,
  1624. }
  1625. }
  1626. if err != nil {
  1627. return nil, err
  1628. }
  1629. defer googleapi.CloseBody(res)
  1630. if err := googleapi.CheckResponse(res); err != nil {
  1631. return nil, err
  1632. }
  1633. ret := &Subscription{
  1634. ServerResponse: googleapi.ServerResponse{
  1635. Header: res.Header,
  1636. HTTPStatusCode: res.StatusCode,
  1637. },
  1638. }
  1639. target := &ret
  1640. if err := gensupport.DecodeResponse(target, res); err != nil {
  1641. return nil, err
  1642. }
  1643. return ret, nil
  1644. // {
  1645. // "description": "Activates a subscription previously suspended by the reseller",
  1646. // "httpMethod": "POST",
  1647. // "id": "reseller.subscriptions.activate",
  1648. // "parameterOrder": [
  1649. // "customerId",
  1650. // "subscriptionId"
  1651. // ],
  1652. // "parameters": {
  1653. // "customerId": {
  1654. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  1655. // "location": "path",
  1656. // "required": true,
  1657. // "type": "string"
  1658. // },
  1659. // "subscriptionId": {
  1660. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  1661. // "location": "path",
  1662. // "required": true,
  1663. // "type": "string"
  1664. // }
  1665. // },
  1666. // "path": "customers/{customerId}/subscriptions/{subscriptionId}/activate",
  1667. // "response": {
  1668. // "$ref": "Subscription"
  1669. // },
  1670. // "scopes": [
  1671. // "https://www.googleapis.com/auth/apps.order"
  1672. // ]
  1673. // }
  1674. }
  1675. // method id "reseller.subscriptions.changePlan":
  1676. type SubscriptionsChangePlanCall struct {
  1677. s *Service
  1678. customerId string
  1679. subscriptionId string
  1680. changeplanrequest *ChangePlanRequest
  1681. urlParams_ gensupport.URLParams
  1682. ctx_ context.Context
  1683. header_ http.Header
  1684. }
  1685. // ChangePlan: Update a subscription plan. Use this method to update a
  1686. // plan for a 30-day trial or a flexible plan subscription to an annual
  1687. // commitment plan with monthly or yearly payments.
  1688. func (r *SubscriptionsService) ChangePlan(customerId string, subscriptionId string, changeplanrequest *ChangePlanRequest) *SubscriptionsChangePlanCall {
  1689. c := &SubscriptionsChangePlanCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1690. c.customerId = customerId
  1691. c.subscriptionId = subscriptionId
  1692. c.changeplanrequest = changeplanrequest
  1693. return c
  1694. }
  1695. // Fields allows partial responses to be retrieved. See
  1696. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1697. // for more information.
  1698. func (c *SubscriptionsChangePlanCall) Fields(s ...googleapi.Field) *SubscriptionsChangePlanCall {
  1699. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1700. return c
  1701. }
  1702. // Context sets the context to be used in this call's Do method. Any
  1703. // pending HTTP request will be aborted if the provided context is
  1704. // canceled.
  1705. func (c *SubscriptionsChangePlanCall) Context(ctx context.Context) *SubscriptionsChangePlanCall {
  1706. c.ctx_ = ctx
  1707. return c
  1708. }
  1709. // Header returns an http.Header that can be modified by the caller to
  1710. // add HTTP headers to the request.
  1711. func (c *SubscriptionsChangePlanCall) Header() http.Header {
  1712. if c.header_ == nil {
  1713. c.header_ = make(http.Header)
  1714. }
  1715. return c.header_
  1716. }
  1717. func (c *SubscriptionsChangePlanCall) doRequest(alt string) (*http.Response, error) {
  1718. reqHeaders := make(http.Header)
  1719. for k, v := range c.header_ {
  1720. reqHeaders[k] = v
  1721. }
  1722. reqHeaders.Set("User-Agent", c.s.userAgent())
  1723. var body io.Reader = nil
  1724. body, err := googleapi.WithoutDataWrapper.JSONReader(c.changeplanrequest)
  1725. if err != nil {
  1726. return nil, err
  1727. }
  1728. reqHeaders.Set("Content-Type", "application/json")
  1729. c.urlParams_.Set("alt", alt)
  1730. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changePlan")
  1731. urls += "?" + c.urlParams_.Encode()
  1732. req, _ := http.NewRequest("POST", urls, body)
  1733. req.Header = reqHeaders
  1734. googleapi.Expand(req.URL, map[string]string{
  1735. "customerId": c.customerId,
  1736. "subscriptionId": c.subscriptionId,
  1737. })
  1738. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1739. }
  1740. // Do executes the "reseller.subscriptions.changePlan" call.
  1741. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  1742. // status code is an error. Response headers are in either
  1743. // *Subscription.ServerResponse.Header or (if a response was returned at
  1744. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1745. // to check whether the returned error was because
  1746. // http.StatusNotModified was returned.
  1747. func (c *SubscriptionsChangePlanCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1748. gensupport.SetOptions(c.urlParams_, opts...)
  1749. res, err := c.doRequest("json")
  1750. if res != nil && res.StatusCode == http.StatusNotModified {
  1751. if res.Body != nil {
  1752. res.Body.Close()
  1753. }
  1754. return nil, &googleapi.Error{
  1755. Code: res.StatusCode,
  1756. Header: res.Header,
  1757. }
  1758. }
  1759. if err != nil {
  1760. return nil, err
  1761. }
  1762. defer googleapi.CloseBody(res)
  1763. if err := googleapi.CheckResponse(res); err != nil {
  1764. return nil, err
  1765. }
  1766. ret := &Subscription{
  1767. ServerResponse: googleapi.ServerResponse{
  1768. Header: res.Header,
  1769. HTTPStatusCode: res.StatusCode,
  1770. },
  1771. }
  1772. target := &ret
  1773. if err := gensupport.DecodeResponse(target, res); err != nil {
  1774. return nil, err
  1775. }
  1776. return ret, nil
  1777. // {
  1778. // "description": "Update a subscription plan. Use this method to update a plan for a 30-day trial or a flexible plan subscription to an annual commitment plan with monthly or yearly payments.",
  1779. // "httpMethod": "POST",
  1780. // "id": "reseller.subscriptions.changePlan",
  1781. // "parameterOrder": [
  1782. // "customerId",
  1783. // "subscriptionId"
  1784. // ],
  1785. // "parameters": {
  1786. // "customerId": {
  1787. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  1788. // "location": "path",
  1789. // "required": true,
  1790. // "type": "string"
  1791. // },
  1792. // "subscriptionId": {
  1793. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  1794. // "location": "path",
  1795. // "required": true,
  1796. // "type": "string"
  1797. // }
  1798. // },
  1799. // "path": "customers/{customerId}/subscriptions/{subscriptionId}/changePlan",
  1800. // "request": {
  1801. // "$ref": "ChangePlanRequest"
  1802. // },
  1803. // "response": {
  1804. // "$ref": "Subscription"
  1805. // },
  1806. // "scopes": [
  1807. // "https://www.googleapis.com/auth/apps.order"
  1808. // ]
  1809. // }
  1810. }
  1811. // method id "reseller.subscriptions.changeRenewalSettings":
  1812. type SubscriptionsChangeRenewalSettingsCall struct {
  1813. s *Service
  1814. customerId string
  1815. subscriptionId string
  1816. renewalsettings *RenewalSettings
  1817. urlParams_ gensupport.URLParams
  1818. ctx_ context.Context
  1819. header_ http.Header
  1820. }
  1821. // ChangeRenewalSettings: Update a user license's renewal settings. This
  1822. // is applicable for accounts with annual commitment plans only.
  1823. func (r *SubscriptionsService) ChangeRenewalSettings(customerId string, subscriptionId string, renewalsettings *RenewalSettings) *SubscriptionsChangeRenewalSettingsCall {
  1824. c := &SubscriptionsChangeRenewalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1825. c.customerId = customerId
  1826. c.subscriptionId = subscriptionId
  1827. c.renewalsettings = renewalsettings
  1828. return c
  1829. }
  1830. // Fields allows partial responses to be retrieved. See
  1831. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1832. // for more information.
  1833. func (c *SubscriptionsChangeRenewalSettingsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeRenewalSettingsCall {
  1834. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1835. return c
  1836. }
  1837. // Context sets the context to be used in this call's Do method. Any
  1838. // pending HTTP request will be aborted if the provided context is
  1839. // canceled.
  1840. func (c *SubscriptionsChangeRenewalSettingsCall) Context(ctx context.Context) *SubscriptionsChangeRenewalSettingsCall {
  1841. c.ctx_ = ctx
  1842. return c
  1843. }
  1844. // Header returns an http.Header that can be modified by the caller to
  1845. // add HTTP headers to the request.
  1846. func (c *SubscriptionsChangeRenewalSettingsCall) Header() http.Header {
  1847. if c.header_ == nil {
  1848. c.header_ = make(http.Header)
  1849. }
  1850. return c.header_
  1851. }
  1852. func (c *SubscriptionsChangeRenewalSettingsCall) doRequest(alt string) (*http.Response, error) {
  1853. reqHeaders := make(http.Header)
  1854. for k, v := range c.header_ {
  1855. reqHeaders[k] = v
  1856. }
  1857. reqHeaders.Set("User-Agent", c.s.userAgent())
  1858. var body io.Reader = nil
  1859. body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewalsettings)
  1860. if err != nil {
  1861. return nil, err
  1862. }
  1863. reqHeaders.Set("Content-Type", "application/json")
  1864. c.urlParams_.Set("alt", alt)
  1865. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings")
  1866. urls += "?" + c.urlParams_.Encode()
  1867. req, _ := http.NewRequest("POST", urls, body)
  1868. req.Header = reqHeaders
  1869. googleapi.Expand(req.URL, map[string]string{
  1870. "customerId": c.customerId,
  1871. "subscriptionId": c.subscriptionId,
  1872. })
  1873. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1874. }
  1875. // Do executes the "reseller.subscriptions.changeRenewalSettings" call.
  1876. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  1877. // status code is an error. Response headers are in either
  1878. // *Subscription.ServerResponse.Header or (if a response was returned at
  1879. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1880. // to check whether the returned error was because
  1881. // http.StatusNotModified was returned.
  1882. func (c *SubscriptionsChangeRenewalSettingsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  1883. gensupport.SetOptions(c.urlParams_, opts...)
  1884. res, err := c.doRequest("json")
  1885. if res != nil && res.StatusCode == http.StatusNotModified {
  1886. if res.Body != nil {
  1887. res.Body.Close()
  1888. }
  1889. return nil, &googleapi.Error{
  1890. Code: res.StatusCode,
  1891. Header: res.Header,
  1892. }
  1893. }
  1894. if err != nil {
  1895. return nil, err
  1896. }
  1897. defer googleapi.CloseBody(res)
  1898. if err := googleapi.CheckResponse(res); err != nil {
  1899. return nil, err
  1900. }
  1901. ret := &Subscription{
  1902. ServerResponse: googleapi.ServerResponse{
  1903. Header: res.Header,
  1904. HTTPStatusCode: res.StatusCode,
  1905. },
  1906. }
  1907. target := &ret
  1908. if err := gensupport.DecodeResponse(target, res); err != nil {
  1909. return nil, err
  1910. }
  1911. return ret, nil
  1912. // {
  1913. // "description": "Update a user license's renewal settings. This is applicable for accounts with annual commitment plans only.",
  1914. // "httpMethod": "POST",
  1915. // "id": "reseller.subscriptions.changeRenewalSettings",
  1916. // "parameterOrder": [
  1917. // "customerId",
  1918. // "subscriptionId"
  1919. // ],
  1920. // "parameters": {
  1921. // "customerId": {
  1922. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  1923. // "location": "path",
  1924. // "required": true,
  1925. // "type": "string"
  1926. // },
  1927. // "subscriptionId": {
  1928. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  1929. // "location": "path",
  1930. // "required": true,
  1931. // "type": "string"
  1932. // }
  1933. // },
  1934. // "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings",
  1935. // "request": {
  1936. // "$ref": "RenewalSettings"
  1937. // },
  1938. // "response": {
  1939. // "$ref": "Subscription"
  1940. // },
  1941. // "scopes": [
  1942. // "https://www.googleapis.com/auth/apps.order"
  1943. // ]
  1944. // }
  1945. }
  1946. // method id "reseller.subscriptions.changeSeats":
  1947. type SubscriptionsChangeSeatsCall struct {
  1948. s *Service
  1949. customerId string
  1950. subscriptionId string
  1951. seats *Seats
  1952. urlParams_ gensupport.URLParams
  1953. ctx_ context.Context
  1954. header_ http.Header
  1955. }
  1956. // ChangeSeats: Update a subscription's user license settings.
  1957. func (r *SubscriptionsService) ChangeSeats(customerId string, subscriptionId string, seats *Seats) *SubscriptionsChangeSeatsCall {
  1958. c := &SubscriptionsChangeSeatsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1959. c.customerId = customerId
  1960. c.subscriptionId = subscriptionId
  1961. c.seats = seats
  1962. return c
  1963. }
  1964. // Fields allows partial responses to be retrieved. See
  1965. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1966. // for more information.
  1967. func (c *SubscriptionsChangeSeatsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeSeatsCall {
  1968. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1969. return c
  1970. }
  1971. // Context sets the context to be used in this call's Do method. Any
  1972. // pending HTTP request will be aborted if the provided context is
  1973. // canceled.
  1974. func (c *SubscriptionsChangeSeatsCall) Context(ctx context.Context) *SubscriptionsChangeSeatsCall {
  1975. c.ctx_ = ctx
  1976. return c
  1977. }
  1978. // Header returns an http.Header that can be modified by the caller to
  1979. // add HTTP headers to the request.
  1980. func (c *SubscriptionsChangeSeatsCall) Header() http.Header {
  1981. if c.header_ == nil {
  1982. c.header_ = make(http.Header)
  1983. }
  1984. return c.header_
  1985. }
  1986. func (c *SubscriptionsChangeSeatsCall) doRequest(alt string) (*http.Response, error) {
  1987. reqHeaders := make(http.Header)
  1988. for k, v := range c.header_ {
  1989. reqHeaders[k] = v
  1990. }
  1991. reqHeaders.Set("User-Agent", c.s.userAgent())
  1992. var body io.Reader = nil
  1993. body, err := googleapi.WithoutDataWrapper.JSONReader(c.seats)
  1994. if err != nil {
  1995. return nil, err
  1996. }
  1997. reqHeaders.Set("Content-Type", "application/json")
  1998. c.urlParams_.Set("alt", alt)
  1999. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changeSeats")
  2000. urls += "?" + c.urlParams_.Encode()
  2001. req, _ := http.NewRequest("POST", urls, body)
  2002. req.Header = reqHeaders
  2003. googleapi.Expand(req.URL, map[string]string{
  2004. "customerId": c.customerId,
  2005. "subscriptionId": c.subscriptionId,
  2006. })
  2007. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2008. }
  2009. // Do executes the "reseller.subscriptions.changeSeats" call.
  2010. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2011. // status code is an error. Response headers are in either
  2012. // *Subscription.ServerResponse.Header or (if a response was returned at
  2013. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2014. // to check whether the returned error was because
  2015. // http.StatusNotModified was returned.
  2016. func (c *SubscriptionsChangeSeatsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2017. gensupport.SetOptions(c.urlParams_, opts...)
  2018. res, err := c.doRequest("json")
  2019. if res != nil && res.StatusCode == http.StatusNotModified {
  2020. if res.Body != nil {
  2021. res.Body.Close()
  2022. }
  2023. return nil, &googleapi.Error{
  2024. Code: res.StatusCode,
  2025. Header: res.Header,
  2026. }
  2027. }
  2028. if err != nil {
  2029. return nil, err
  2030. }
  2031. defer googleapi.CloseBody(res)
  2032. if err := googleapi.CheckResponse(res); err != nil {
  2033. return nil, err
  2034. }
  2035. ret := &Subscription{
  2036. ServerResponse: googleapi.ServerResponse{
  2037. Header: res.Header,
  2038. HTTPStatusCode: res.StatusCode,
  2039. },
  2040. }
  2041. target := &ret
  2042. if err := gensupport.DecodeResponse(target, res); err != nil {
  2043. return nil, err
  2044. }
  2045. return ret, nil
  2046. // {
  2047. // "description": "Update a subscription's user license settings.",
  2048. // "httpMethod": "POST",
  2049. // "id": "reseller.subscriptions.changeSeats",
  2050. // "parameterOrder": [
  2051. // "customerId",
  2052. // "subscriptionId"
  2053. // ],
  2054. // "parameters": {
  2055. // "customerId": {
  2056. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  2057. // "location": "path",
  2058. // "required": true,
  2059. // "type": "string"
  2060. // },
  2061. // "subscriptionId": {
  2062. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  2063. // "location": "path",
  2064. // "required": true,
  2065. // "type": "string"
  2066. // }
  2067. // },
  2068. // "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeSeats",
  2069. // "request": {
  2070. // "$ref": "Seats"
  2071. // },
  2072. // "response": {
  2073. // "$ref": "Subscription"
  2074. // },
  2075. // "scopes": [
  2076. // "https://www.googleapis.com/auth/apps.order"
  2077. // ]
  2078. // }
  2079. }
  2080. // method id "reseller.subscriptions.delete":
  2081. type SubscriptionsDeleteCall struct {
  2082. s *Service
  2083. customerId string
  2084. subscriptionId string
  2085. urlParams_ gensupport.URLParams
  2086. ctx_ context.Context
  2087. header_ http.Header
  2088. }
  2089. // Delete: Cancel, suspend or transfer a subscription to direct.
  2090. func (r *SubscriptionsService) Delete(customerId string, subscriptionId string, deletionType string) *SubscriptionsDeleteCall {
  2091. c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2092. c.customerId = customerId
  2093. c.subscriptionId = subscriptionId
  2094. c.urlParams_.Set("deletionType", deletionType)
  2095. return c
  2096. }
  2097. // Fields allows partial responses to be retrieved. See
  2098. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2099. // for more information.
  2100. func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
  2101. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2102. return c
  2103. }
  2104. // Context sets the context to be used in this call's Do method. Any
  2105. // pending HTTP request will be aborted if the provided context is
  2106. // canceled.
  2107. func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
  2108. c.ctx_ = ctx
  2109. return c
  2110. }
  2111. // Header returns an http.Header that can be modified by the caller to
  2112. // add HTTP headers to the request.
  2113. func (c *SubscriptionsDeleteCall) Header() http.Header {
  2114. if c.header_ == nil {
  2115. c.header_ = make(http.Header)
  2116. }
  2117. return c.header_
  2118. }
  2119. func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2120. reqHeaders := make(http.Header)
  2121. for k, v := range c.header_ {
  2122. reqHeaders[k] = v
  2123. }
  2124. reqHeaders.Set("User-Agent", c.s.userAgent())
  2125. var body io.Reader = nil
  2126. c.urlParams_.Set("alt", alt)
  2127. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}")
  2128. urls += "?" + c.urlParams_.Encode()
  2129. req, _ := http.NewRequest("DELETE", urls, body)
  2130. req.Header = reqHeaders
  2131. googleapi.Expand(req.URL, map[string]string{
  2132. "customerId": c.customerId,
  2133. "subscriptionId": c.subscriptionId,
  2134. })
  2135. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2136. }
  2137. // Do executes the "reseller.subscriptions.delete" call.
  2138. func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2139. gensupport.SetOptions(c.urlParams_, opts...)
  2140. res, err := c.doRequest("json")
  2141. if err != nil {
  2142. return err
  2143. }
  2144. defer googleapi.CloseBody(res)
  2145. if err := googleapi.CheckResponse(res); err != nil {
  2146. return err
  2147. }
  2148. return nil
  2149. // {
  2150. // "description": "Cancel, suspend or transfer a subscription to direct.",
  2151. // "httpMethod": "DELETE",
  2152. // "id": "reseller.subscriptions.delete",
  2153. // "parameterOrder": [
  2154. // "customerId",
  2155. // "subscriptionId",
  2156. // "deletionType"
  2157. // ],
  2158. // "parameters": {
  2159. // "customerId": {
  2160. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  2161. // "location": "path",
  2162. // "required": true,
  2163. // "type": "string"
  2164. // },
  2165. // "deletionType": {
  2166. // "description": "The deletionType query string enables the cancellation, downgrade, or suspension of a subscription.",
  2167. // "enum": [
  2168. // "cancel",
  2169. // "downgrade",
  2170. // "suspend",
  2171. // "transfer_to_direct"
  2172. // ],
  2173. // "enumDescriptions": [
  2174. // "Cancels the subscription immediately. This does not apply to a G Suite subscription.",
  2175. // "Downgrades a G Suite subscription to a Google Apps Free edition subscription only if the customer was initially subscribed to a Google Apps Free edition (also known as the Standard edition). Once downgraded, the customer no longer has access to the previous G Suite subscription and is no longer managed by the reseller.\n\nA G Suite subscription's downgrade cannot be invoked if an active or suspended Google Drive or Google Vault subscription is present. The Google Drive or Google Vault subscription must be cancelled before the G Suite subscription's downgrade is invoked.\n\nThe downgrade deletionType does not apply to other products or G Suite SKUs.",
  2176. // "(DEPRECATED) The G Suite account is suspended for four days and then cancelled. Once suspended, an administrator has access to the suspended account, but the account users can not access their services. A suspension can be lifted, using the reseller tools.\n\nA G Suite subscription's suspension can not be invoked if an active or suspended Google Drive or Google Vault subscription is present. The Google Drive or Google Vault subscription must be cancelled before the G Suite subscription's suspension is invoked.",
  2177. // "Transfers a subscription directly to Google.  The customer is immediately transferred to a direct billing relationship with Google and is given a short amount of time with no service interruption. The customer can then choose to set up billing directly with Google by using a credit card, or they can transfer to another reseller."
  2178. // ],
  2179. // "location": "query",
  2180. // "required": true,
  2181. // "type": "string"
  2182. // },
  2183. // "subscriptionId": {
  2184. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  2185. // "location": "path",
  2186. // "required": true,
  2187. // "type": "string"
  2188. // }
  2189. // },
  2190. // "path": "customers/{customerId}/subscriptions/{subscriptionId}",
  2191. // "scopes": [
  2192. // "https://www.googleapis.com/auth/apps.order"
  2193. // ]
  2194. // }
  2195. }
  2196. // method id "reseller.subscriptions.get":
  2197. type SubscriptionsGetCall struct {
  2198. s *Service
  2199. customerId string
  2200. subscriptionId string
  2201. urlParams_ gensupport.URLParams
  2202. ifNoneMatch_ string
  2203. ctx_ context.Context
  2204. header_ http.Header
  2205. }
  2206. // Get: Get a specific subscription.
  2207. func (r *SubscriptionsService) Get(customerId string, subscriptionId string) *SubscriptionsGetCall {
  2208. c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2209. c.customerId = customerId
  2210. c.subscriptionId = subscriptionId
  2211. return c
  2212. }
  2213. // Fields allows partial responses to be retrieved. See
  2214. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2215. // for more information.
  2216. func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
  2217. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2218. return c
  2219. }
  2220. // IfNoneMatch sets the optional parameter which makes the operation
  2221. // fail if the object's ETag matches the given value. This is useful for
  2222. // getting updates only after the object has changed since the last
  2223. // request. Use googleapi.IsNotModified to check whether the response
  2224. // error from Do is the result of In-None-Match.
  2225. func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
  2226. c.ifNoneMatch_ = entityTag
  2227. return c
  2228. }
  2229. // Context sets the context to be used in this call's Do method. Any
  2230. // pending HTTP request will be aborted if the provided context is
  2231. // canceled.
  2232. func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
  2233. c.ctx_ = ctx
  2234. return c
  2235. }
  2236. // Header returns an http.Header that can be modified by the caller to
  2237. // add HTTP headers to the request.
  2238. func (c *SubscriptionsGetCall) Header() http.Header {
  2239. if c.header_ == nil {
  2240. c.header_ = make(http.Header)
  2241. }
  2242. return c.header_
  2243. }
  2244. func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
  2245. reqHeaders := make(http.Header)
  2246. for k, v := range c.header_ {
  2247. reqHeaders[k] = v
  2248. }
  2249. reqHeaders.Set("User-Agent", c.s.userAgent())
  2250. if c.ifNoneMatch_ != "" {
  2251. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2252. }
  2253. var body io.Reader = nil
  2254. c.urlParams_.Set("alt", alt)
  2255. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}")
  2256. urls += "?" + c.urlParams_.Encode()
  2257. req, _ := http.NewRequest("GET", urls, body)
  2258. req.Header = reqHeaders
  2259. googleapi.Expand(req.URL, map[string]string{
  2260. "customerId": c.customerId,
  2261. "subscriptionId": c.subscriptionId,
  2262. })
  2263. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2264. }
  2265. // Do executes the "reseller.subscriptions.get" call.
  2266. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2267. // status code is an error. Response headers are in either
  2268. // *Subscription.ServerResponse.Header or (if a response was returned at
  2269. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2270. // to check whether the returned error was because
  2271. // http.StatusNotModified was returned.
  2272. func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2273. gensupport.SetOptions(c.urlParams_, opts...)
  2274. res, err := c.doRequest("json")
  2275. if res != nil && res.StatusCode == http.StatusNotModified {
  2276. if res.Body != nil {
  2277. res.Body.Close()
  2278. }
  2279. return nil, &googleapi.Error{
  2280. Code: res.StatusCode,
  2281. Header: res.Header,
  2282. }
  2283. }
  2284. if err != nil {
  2285. return nil, err
  2286. }
  2287. defer googleapi.CloseBody(res)
  2288. if err := googleapi.CheckResponse(res); err != nil {
  2289. return nil, err
  2290. }
  2291. ret := &Subscription{
  2292. ServerResponse: googleapi.ServerResponse{
  2293. Header: res.Header,
  2294. HTTPStatusCode: res.StatusCode,
  2295. },
  2296. }
  2297. target := &ret
  2298. if err := gensupport.DecodeResponse(target, res); err != nil {
  2299. return nil, err
  2300. }
  2301. return ret, nil
  2302. // {
  2303. // "description": "Get a specific subscription.",
  2304. // "httpMethod": "GET",
  2305. // "id": "reseller.subscriptions.get",
  2306. // "parameterOrder": [
  2307. // "customerId",
  2308. // "subscriptionId"
  2309. // ],
  2310. // "parameters": {
  2311. // "customerId": {
  2312. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  2313. // "location": "path",
  2314. // "required": true,
  2315. // "type": "string"
  2316. // },
  2317. // "subscriptionId": {
  2318. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  2319. // "location": "path",
  2320. // "required": true,
  2321. // "type": "string"
  2322. // }
  2323. // },
  2324. // "path": "customers/{customerId}/subscriptions/{subscriptionId}",
  2325. // "response": {
  2326. // "$ref": "Subscription"
  2327. // },
  2328. // "scopes": [
  2329. // "https://www.googleapis.com/auth/apps.order",
  2330. // "https://www.googleapis.com/auth/apps.order.readonly"
  2331. // ]
  2332. // }
  2333. }
  2334. // method id "reseller.subscriptions.insert":
  2335. type SubscriptionsInsertCall struct {
  2336. s *Service
  2337. customerId string
  2338. subscription *Subscription
  2339. urlParams_ gensupport.URLParams
  2340. ctx_ context.Context
  2341. header_ http.Header
  2342. }
  2343. // Insert: Create or transfer a subscription.
  2344. func (r *SubscriptionsService) Insert(customerId string, subscription *Subscription) *SubscriptionsInsertCall {
  2345. c := &SubscriptionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2346. c.customerId = customerId
  2347. c.subscription = subscription
  2348. return c
  2349. }
  2350. // CustomerAuthToken sets the optional parameter "customerAuthToken":
  2351. // The customerAuthToken query string is required when creating a resold
  2352. // account that transfers a direct customer's subscription or transfers
  2353. // another reseller customer's subscription to your reseller management.
  2354. // This is a hexadecimal authentication token needed to complete the
  2355. // subscription transfer. For more information, see the administrator
  2356. // help center.
  2357. func (c *SubscriptionsInsertCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsInsertCall {
  2358. c.urlParams_.Set("customerAuthToken", customerAuthToken)
  2359. return c
  2360. }
  2361. // Fields allows partial responses to be retrieved. See
  2362. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2363. // for more information.
  2364. func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
  2365. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2366. return c
  2367. }
  2368. // Context sets the context to be used in this call's Do method. Any
  2369. // pending HTTP request will be aborted if the provided context is
  2370. // canceled.
  2371. func (c *SubscriptionsInsertCall) Context(ctx context.Context) *SubscriptionsInsertCall {
  2372. c.ctx_ = ctx
  2373. return c
  2374. }
  2375. // Header returns an http.Header that can be modified by the caller to
  2376. // add HTTP headers to the request.
  2377. func (c *SubscriptionsInsertCall) Header() http.Header {
  2378. if c.header_ == nil {
  2379. c.header_ = make(http.Header)
  2380. }
  2381. return c.header_
  2382. }
  2383. func (c *SubscriptionsInsertCall) doRequest(alt string) (*http.Response, error) {
  2384. reqHeaders := make(http.Header)
  2385. for k, v := range c.header_ {
  2386. reqHeaders[k] = v
  2387. }
  2388. reqHeaders.Set("User-Agent", c.s.userAgent())
  2389. var body io.Reader = nil
  2390. body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
  2391. if err != nil {
  2392. return nil, err
  2393. }
  2394. reqHeaders.Set("Content-Type", "application/json")
  2395. c.urlParams_.Set("alt", alt)
  2396. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions")
  2397. urls += "?" + c.urlParams_.Encode()
  2398. req, _ := http.NewRequest("POST", urls, body)
  2399. req.Header = reqHeaders
  2400. googleapi.Expand(req.URL, map[string]string{
  2401. "customerId": c.customerId,
  2402. })
  2403. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2404. }
  2405. // Do executes the "reseller.subscriptions.insert" call.
  2406. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2407. // status code is an error. Response headers are in either
  2408. // *Subscription.ServerResponse.Header or (if a response was returned at
  2409. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2410. // to check whether the returned error was because
  2411. // http.StatusNotModified was returned.
  2412. func (c *SubscriptionsInsertCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2413. gensupport.SetOptions(c.urlParams_, opts...)
  2414. res, err := c.doRequest("json")
  2415. if res != nil && res.StatusCode == http.StatusNotModified {
  2416. if res.Body != nil {
  2417. res.Body.Close()
  2418. }
  2419. return nil, &googleapi.Error{
  2420. Code: res.StatusCode,
  2421. Header: res.Header,
  2422. }
  2423. }
  2424. if err != nil {
  2425. return nil, err
  2426. }
  2427. defer googleapi.CloseBody(res)
  2428. if err := googleapi.CheckResponse(res); err != nil {
  2429. return nil, err
  2430. }
  2431. ret := &Subscription{
  2432. ServerResponse: googleapi.ServerResponse{
  2433. Header: res.Header,
  2434. HTTPStatusCode: res.StatusCode,
  2435. },
  2436. }
  2437. target := &ret
  2438. if err := gensupport.DecodeResponse(target, res); err != nil {
  2439. return nil, err
  2440. }
  2441. return ret, nil
  2442. // {
  2443. // "description": "Create or transfer a subscription.",
  2444. // "httpMethod": "POST",
  2445. // "id": "reseller.subscriptions.insert",
  2446. // "parameterOrder": [
  2447. // "customerId"
  2448. // ],
  2449. // "parameters": {
  2450. // "customerAuthToken": {
  2451. // "description": "The customerAuthToken query string is required when creating a resold account that transfers a direct customer's subscription or transfers another reseller customer's subscription to your reseller management. This is a hexadecimal authentication token needed to complete the subscription transfer. For more information, see the administrator help center.",
  2452. // "location": "query",
  2453. // "type": "string"
  2454. // },
  2455. // "customerId": {
  2456. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  2457. // "location": "path",
  2458. // "required": true,
  2459. // "type": "string"
  2460. // }
  2461. // },
  2462. // "path": "customers/{customerId}/subscriptions",
  2463. // "request": {
  2464. // "$ref": "Subscription"
  2465. // },
  2466. // "response": {
  2467. // "$ref": "Subscription"
  2468. // },
  2469. // "scopes": [
  2470. // "https://www.googleapis.com/auth/apps.order"
  2471. // ]
  2472. // }
  2473. }
  2474. // method id "reseller.subscriptions.list":
  2475. type SubscriptionsListCall struct {
  2476. s *Service
  2477. urlParams_ gensupport.URLParams
  2478. ifNoneMatch_ string
  2479. ctx_ context.Context
  2480. header_ http.Header
  2481. }
  2482. // List: List of subscriptions managed by the reseller. The list can be
  2483. // all subscriptions, all of a customer's subscriptions, or all of a
  2484. // customer's transferable subscriptions.
  2485. func (r *SubscriptionsService) List() *SubscriptionsListCall {
  2486. c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2487. return c
  2488. }
  2489. // CustomerAuthToken sets the optional parameter "customerAuthToken":
  2490. // The customerAuthToken query string is required when creating a resold
  2491. // account that transfers a direct customer's subscription or transfers
  2492. // another reseller customer's subscription to your reseller management.
  2493. // This is a hexadecimal authentication token needed to complete the
  2494. // subscription transfer. For more information, see the administrator
  2495. // help center.
  2496. func (c *SubscriptionsListCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsListCall {
  2497. c.urlParams_.Set("customerAuthToken", customerAuthToken)
  2498. return c
  2499. }
  2500. // CustomerId sets the optional parameter "customerId": Either the
  2501. // customer's primary domain name or the customer's unique identifier.
  2502. // If using the domain name, we do not recommend using a customerId as a
  2503. // key for persistent data. If the domain name for a customerId is
  2504. // changed, the Google system automatically updates.
  2505. func (c *SubscriptionsListCall) CustomerId(customerId string) *SubscriptionsListCall {
  2506. c.urlParams_.Set("customerId", customerId)
  2507. return c
  2508. }
  2509. // CustomerNamePrefix sets the optional parameter "customerNamePrefix":
  2510. // When retrieving all of your subscriptions and filtering for specific
  2511. // customers, you can enter a prefix for a customer name. Using an
  2512. // example customer group that includes exam.com, example20.com and
  2513. // example.com:
  2514. // - exa -- Returns all customer names that start with 'exa' which could
  2515. // include exam.com, example20.com, and example.com. A name prefix is
  2516. // similar to using a regular expression's asterisk, exa*.
  2517. // - example -- Returns example20.com and example.com.
  2518. func (c *SubscriptionsListCall) CustomerNamePrefix(customerNamePrefix string) *SubscriptionsListCall {
  2519. c.urlParams_.Set("customerNamePrefix", customerNamePrefix)
  2520. return c
  2521. }
  2522. // MaxResults sets the optional parameter "maxResults": When retrieving
  2523. // a large list, the maxResults is the maximum number of results per
  2524. // page. The nextPageToken value takes you to the next page. The default
  2525. // is 20.
  2526. func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
  2527. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2528. return c
  2529. }
  2530. // PageToken sets the optional parameter "pageToken": Token to specify
  2531. // next page in the list
  2532. func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
  2533. c.urlParams_.Set("pageToken", pageToken)
  2534. return c
  2535. }
  2536. // Fields allows partial responses to be retrieved. See
  2537. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2538. // for more information.
  2539. func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
  2540. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2541. return c
  2542. }
  2543. // IfNoneMatch sets the optional parameter which makes the operation
  2544. // fail if the object's ETag matches the given value. This is useful for
  2545. // getting updates only after the object has changed since the last
  2546. // request. Use googleapi.IsNotModified to check whether the response
  2547. // error from Do is the result of In-None-Match.
  2548. func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
  2549. c.ifNoneMatch_ = entityTag
  2550. return c
  2551. }
  2552. // Context sets the context to be used in this call's Do method. Any
  2553. // pending HTTP request will be aborted if the provided context is
  2554. // canceled.
  2555. func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
  2556. c.ctx_ = ctx
  2557. return c
  2558. }
  2559. // Header returns an http.Header that can be modified by the caller to
  2560. // add HTTP headers to the request.
  2561. func (c *SubscriptionsListCall) Header() http.Header {
  2562. if c.header_ == nil {
  2563. c.header_ = make(http.Header)
  2564. }
  2565. return c.header_
  2566. }
  2567. func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  2568. reqHeaders := make(http.Header)
  2569. for k, v := range c.header_ {
  2570. reqHeaders[k] = v
  2571. }
  2572. reqHeaders.Set("User-Agent", c.s.userAgent())
  2573. if c.ifNoneMatch_ != "" {
  2574. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2575. }
  2576. var body io.Reader = nil
  2577. c.urlParams_.Set("alt", alt)
  2578. urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
  2579. urls += "?" + c.urlParams_.Encode()
  2580. req, _ := http.NewRequest("GET", urls, body)
  2581. req.Header = reqHeaders
  2582. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2583. }
  2584. // Do executes the "reseller.subscriptions.list" call.
  2585. // Exactly one of *Subscriptions or error will be non-nil. Any non-2xx
  2586. // status code is an error. Response headers are in either
  2587. // *Subscriptions.ServerResponse.Header or (if a response was returned
  2588. // at all) in error.(*googleapi.Error).Header. Use
  2589. // googleapi.IsNotModified to check whether the returned error was
  2590. // because http.StatusNotModified was returned.
  2591. func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*Subscriptions, error) {
  2592. gensupport.SetOptions(c.urlParams_, opts...)
  2593. res, err := c.doRequest("json")
  2594. if res != nil && res.StatusCode == http.StatusNotModified {
  2595. if res.Body != nil {
  2596. res.Body.Close()
  2597. }
  2598. return nil, &googleapi.Error{
  2599. Code: res.StatusCode,
  2600. Header: res.Header,
  2601. }
  2602. }
  2603. if err != nil {
  2604. return nil, err
  2605. }
  2606. defer googleapi.CloseBody(res)
  2607. if err := googleapi.CheckResponse(res); err != nil {
  2608. return nil, err
  2609. }
  2610. ret := &Subscriptions{
  2611. ServerResponse: googleapi.ServerResponse{
  2612. Header: res.Header,
  2613. HTTPStatusCode: res.StatusCode,
  2614. },
  2615. }
  2616. target := &ret
  2617. if err := gensupport.DecodeResponse(target, res); err != nil {
  2618. return nil, err
  2619. }
  2620. return ret, nil
  2621. // {
  2622. // "description": "List of subscriptions managed by the reseller. The list can be all subscriptions, all of a customer's subscriptions, or all of a customer's transferable subscriptions.",
  2623. // "httpMethod": "GET",
  2624. // "id": "reseller.subscriptions.list",
  2625. // "parameters": {
  2626. // "customerAuthToken": {
  2627. // "description": "The customerAuthToken query string is required when creating a resold account that transfers a direct customer's subscription or transfers another reseller customer's subscription to your reseller management. This is a hexadecimal authentication token needed to complete the subscription transfer. For more information, see the administrator help center.",
  2628. // "location": "query",
  2629. // "type": "string"
  2630. // },
  2631. // "customerId": {
  2632. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  2633. // "location": "query",
  2634. // "type": "string"
  2635. // },
  2636. // "customerNamePrefix": {
  2637. // "description": "When retrieving all of your subscriptions and filtering for specific customers, you can enter a prefix for a customer name. Using an example customer group that includes exam.com, example20.com and example.com: \n- exa -- Returns all customer names that start with 'exa' which could include exam.com, example20.com, and example.com. A name prefix is similar to using a regular expression's asterisk, exa*. \n- example -- Returns example20.com and example.com.",
  2638. // "location": "query",
  2639. // "type": "string"
  2640. // },
  2641. // "maxResults": {
  2642. // "description": "When retrieving a large list, the maxResults is the maximum number of results per page. The nextPageToken value takes you to the next page. The default is 20.",
  2643. // "format": "uint32",
  2644. // "location": "query",
  2645. // "maximum": "100",
  2646. // "minimum": "1",
  2647. // "type": "integer"
  2648. // },
  2649. // "pageToken": {
  2650. // "description": "Token to specify next page in the list",
  2651. // "location": "query",
  2652. // "type": "string"
  2653. // }
  2654. // },
  2655. // "path": "subscriptions",
  2656. // "response": {
  2657. // "$ref": "Subscriptions"
  2658. // },
  2659. // "scopes": [
  2660. // "https://www.googleapis.com/auth/apps.order",
  2661. // "https://www.googleapis.com/auth/apps.order.readonly"
  2662. // ]
  2663. // }
  2664. }
  2665. // Pages invokes f for each page of results.
  2666. // A non-nil error returned from f will halt the iteration.
  2667. // The provided context supersedes any context provided to the Context method.
  2668. func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*Subscriptions) error) error {
  2669. c.ctx_ = ctx
  2670. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2671. for {
  2672. x, err := c.Do()
  2673. if err != nil {
  2674. return err
  2675. }
  2676. if err := f(x); err != nil {
  2677. return err
  2678. }
  2679. if x.NextPageToken == "" {
  2680. return nil
  2681. }
  2682. c.PageToken(x.NextPageToken)
  2683. }
  2684. }
  2685. // method id "reseller.subscriptions.startPaidService":
  2686. type SubscriptionsStartPaidServiceCall struct {
  2687. s *Service
  2688. customerId string
  2689. subscriptionId string
  2690. urlParams_ gensupport.URLParams
  2691. ctx_ context.Context
  2692. header_ http.Header
  2693. }
  2694. // StartPaidService: Immediately move a 30-day free trial subscription
  2695. // to a paid service subscription.
  2696. func (r *SubscriptionsService) StartPaidService(customerId string, subscriptionId string) *SubscriptionsStartPaidServiceCall {
  2697. c := &SubscriptionsStartPaidServiceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2698. c.customerId = customerId
  2699. c.subscriptionId = subscriptionId
  2700. return c
  2701. }
  2702. // Fields allows partial responses to be retrieved. See
  2703. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2704. // for more information.
  2705. func (c *SubscriptionsStartPaidServiceCall) Fields(s ...googleapi.Field) *SubscriptionsStartPaidServiceCall {
  2706. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2707. return c
  2708. }
  2709. // Context sets the context to be used in this call's Do method. Any
  2710. // pending HTTP request will be aborted if the provided context is
  2711. // canceled.
  2712. func (c *SubscriptionsStartPaidServiceCall) Context(ctx context.Context) *SubscriptionsStartPaidServiceCall {
  2713. c.ctx_ = ctx
  2714. return c
  2715. }
  2716. // Header returns an http.Header that can be modified by the caller to
  2717. // add HTTP headers to the request.
  2718. func (c *SubscriptionsStartPaidServiceCall) Header() http.Header {
  2719. if c.header_ == nil {
  2720. c.header_ = make(http.Header)
  2721. }
  2722. return c.header_
  2723. }
  2724. func (c *SubscriptionsStartPaidServiceCall) doRequest(alt string) (*http.Response, error) {
  2725. reqHeaders := make(http.Header)
  2726. for k, v := range c.header_ {
  2727. reqHeaders[k] = v
  2728. }
  2729. reqHeaders.Set("User-Agent", c.s.userAgent())
  2730. var body io.Reader = nil
  2731. c.urlParams_.Set("alt", alt)
  2732. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/startPaidService")
  2733. urls += "?" + c.urlParams_.Encode()
  2734. req, _ := http.NewRequest("POST", urls, body)
  2735. req.Header = reqHeaders
  2736. googleapi.Expand(req.URL, map[string]string{
  2737. "customerId": c.customerId,
  2738. "subscriptionId": c.subscriptionId,
  2739. })
  2740. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2741. }
  2742. // Do executes the "reseller.subscriptions.startPaidService" call.
  2743. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2744. // status code is an error. Response headers are in either
  2745. // *Subscription.ServerResponse.Header or (if a response was returned at
  2746. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2747. // to check whether the returned error was because
  2748. // http.StatusNotModified was returned.
  2749. func (c *SubscriptionsStartPaidServiceCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2750. gensupport.SetOptions(c.urlParams_, opts...)
  2751. res, err := c.doRequest("json")
  2752. if res != nil && res.StatusCode == http.StatusNotModified {
  2753. if res.Body != nil {
  2754. res.Body.Close()
  2755. }
  2756. return nil, &googleapi.Error{
  2757. Code: res.StatusCode,
  2758. Header: res.Header,
  2759. }
  2760. }
  2761. if err != nil {
  2762. return nil, err
  2763. }
  2764. defer googleapi.CloseBody(res)
  2765. if err := googleapi.CheckResponse(res); err != nil {
  2766. return nil, err
  2767. }
  2768. ret := &Subscription{
  2769. ServerResponse: googleapi.ServerResponse{
  2770. Header: res.Header,
  2771. HTTPStatusCode: res.StatusCode,
  2772. },
  2773. }
  2774. target := &ret
  2775. if err := gensupport.DecodeResponse(target, res); err != nil {
  2776. return nil, err
  2777. }
  2778. return ret, nil
  2779. // {
  2780. // "description": "Immediately move a 30-day free trial subscription to a paid service subscription.",
  2781. // "httpMethod": "POST",
  2782. // "id": "reseller.subscriptions.startPaidService",
  2783. // "parameterOrder": [
  2784. // "customerId",
  2785. // "subscriptionId"
  2786. // ],
  2787. // "parameters": {
  2788. // "customerId": {
  2789. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  2790. // "location": "path",
  2791. // "required": true,
  2792. // "type": "string"
  2793. // },
  2794. // "subscriptionId": {
  2795. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  2796. // "location": "path",
  2797. // "required": true,
  2798. // "type": "string"
  2799. // }
  2800. // },
  2801. // "path": "customers/{customerId}/subscriptions/{subscriptionId}/startPaidService",
  2802. // "response": {
  2803. // "$ref": "Subscription"
  2804. // },
  2805. // "scopes": [
  2806. // "https://www.googleapis.com/auth/apps.order"
  2807. // ]
  2808. // }
  2809. }
  2810. // method id "reseller.subscriptions.suspend":
  2811. type SubscriptionsSuspendCall struct {
  2812. s *Service
  2813. customerId string
  2814. subscriptionId string
  2815. urlParams_ gensupport.URLParams
  2816. ctx_ context.Context
  2817. header_ http.Header
  2818. }
  2819. // Suspend: Suspends an active subscription.
  2820. func (r *SubscriptionsService) Suspend(customerId string, subscriptionId string) *SubscriptionsSuspendCall {
  2821. c := &SubscriptionsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2822. c.customerId = customerId
  2823. c.subscriptionId = subscriptionId
  2824. return c
  2825. }
  2826. // Fields allows partial responses to be retrieved. See
  2827. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2828. // for more information.
  2829. func (c *SubscriptionsSuspendCall) Fields(s ...googleapi.Field) *SubscriptionsSuspendCall {
  2830. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2831. return c
  2832. }
  2833. // Context sets the context to be used in this call's Do method. Any
  2834. // pending HTTP request will be aborted if the provided context is
  2835. // canceled.
  2836. func (c *SubscriptionsSuspendCall) Context(ctx context.Context) *SubscriptionsSuspendCall {
  2837. c.ctx_ = ctx
  2838. return c
  2839. }
  2840. // Header returns an http.Header that can be modified by the caller to
  2841. // add HTTP headers to the request.
  2842. func (c *SubscriptionsSuspendCall) Header() http.Header {
  2843. if c.header_ == nil {
  2844. c.header_ = make(http.Header)
  2845. }
  2846. return c.header_
  2847. }
  2848. func (c *SubscriptionsSuspendCall) doRequest(alt string) (*http.Response, error) {
  2849. reqHeaders := make(http.Header)
  2850. for k, v := range c.header_ {
  2851. reqHeaders[k] = v
  2852. }
  2853. reqHeaders.Set("User-Agent", c.s.userAgent())
  2854. var body io.Reader = nil
  2855. c.urlParams_.Set("alt", alt)
  2856. urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/suspend")
  2857. urls += "?" + c.urlParams_.Encode()
  2858. req, _ := http.NewRequest("POST", urls, body)
  2859. req.Header = reqHeaders
  2860. googleapi.Expand(req.URL, map[string]string{
  2861. "customerId": c.customerId,
  2862. "subscriptionId": c.subscriptionId,
  2863. })
  2864. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2865. }
  2866. // Do executes the "reseller.subscriptions.suspend" call.
  2867. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2868. // status code is an error. Response headers are in either
  2869. // *Subscription.ServerResponse.Header or (if a response was returned at
  2870. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2871. // to check whether the returned error was because
  2872. // http.StatusNotModified was returned.
  2873. func (c *SubscriptionsSuspendCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2874. gensupport.SetOptions(c.urlParams_, opts...)
  2875. res, err := c.doRequest("json")
  2876. if res != nil && res.StatusCode == http.StatusNotModified {
  2877. if res.Body != nil {
  2878. res.Body.Close()
  2879. }
  2880. return nil, &googleapi.Error{
  2881. Code: res.StatusCode,
  2882. Header: res.Header,
  2883. }
  2884. }
  2885. if err != nil {
  2886. return nil, err
  2887. }
  2888. defer googleapi.CloseBody(res)
  2889. if err := googleapi.CheckResponse(res); err != nil {
  2890. return nil, err
  2891. }
  2892. ret := &Subscription{
  2893. ServerResponse: googleapi.ServerResponse{
  2894. Header: res.Header,
  2895. HTTPStatusCode: res.StatusCode,
  2896. },
  2897. }
  2898. target := &ret
  2899. if err := gensupport.DecodeResponse(target, res); err != nil {
  2900. return nil, err
  2901. }
  2902. return ret, nil
  2903. // {
  2904. // "description": "Suspends an active subscription.",
  2905. // "httpMethod": "POST",
  2906. // "id": "reseller.subscriptions.suspend",
  2907. // "parameterOrder": [
  2908. // "customerId",
  2909. // "subscriptionId"
  2910. // ],
  2911. // "parameters": {
  2912. // "customerId": {
  2913. // "description": "Either the customer's primary domain name or the customer's unique identifier. If using the domain name, we do not recommend using a customerId as a key for persistent data. If the domain name for a customerId is changed, the Google system automatically updates.",
  2914. // "location": "path",
  2915. // "required": true,
  2916. // "type": "string"
  2917. // },
  2918. // "subscriptionId": {
  2919. // "description": "This is a required property. The subscriptionId is the subscription identifier and is unique for each customer. Since a subscriptionId changes when a subscription is updated, we recommend to not use this ID as a key for persistent data. And the subscriptionId can be found using the retrieve all reseller subscriptions method.",
  2920. // "location": "path",
  2921. // "required": true,
  2922. // "type": "string"
  2923. // }
  2924. // },
  2925. // "path": "customers/{customerId}/subscriptions/{subscriptionId}/suspend",
  2926. // "response": {
  2927. // "$ref": "Subscription"
  2928. // },
  2929. // "scopes": [
  2930. // "https://www.googleapis.com/auth/apps.order"
  2931. // ]
  2932. // }
  2933. }