You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

3341 lines
120 KiB

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