123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322 |
- // Package reseller provides access to the Enterprise Apps Reseller API.
- //
- // See https://developers.google.com/google-apps/reseller/
- //
- // Usage example:
- //
- // import "google.golang.org/api/reseller/v1sandbox"
- // ...
- // resellerService, err := reseller.New(oauthHttpClient)
- package reseller // import "google.golang.org/api/reseller/v1sandbox"
- import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- context "golang.org/x/net/context"
- ctxhttp "golang.org/x/net/context/ctxhttp"
- gensupport "google.golang.org/api/gensupport"
- googleapi "google.golang.org/api/googleapi"
- "io"
- "net/http"
- "net/url"
- "strconv"
- "strings"
- )
- // Always reference these packages, just in case the auto-generated code
- // below doesn't.
- var _ = bytes.NewBuffer
- var _ = strconv.Itoa
- var _ = fmt.Sprintf
- var _ = json.NewDecoder
- var _ = io.Copy
- var _ = url.Parse
- var _ = gensupport.MarshalJSON
- var _ = googleapi.Version
- var _ = errors.New
- var _ = strings.Replace
- var _ = context.Canceled
- var _ = ctxhttp.Do
- const apiId = "reseller:v1sandbox"
- const apiName = "reseller"
- const apiVersion = "v1sandbox"
- const basePath = "https://www.googleapis.com/apps/reseller/v1sandbox/"
- // OAuth2 scopes used by this API.
- const (
- // Manage users on your domain
- AppsOrderScope = "https://www.googleapis.com/auth/apps.order"
- // Manage users on your domain
- AppsOrderReadonlyScope = "https://www.googleapis.com/auth/apps.order.readonly"
- )
- func New(client *http.Client) (*Service, error) {
- if client == nil {
- return nil, errors.New("client is nil")
- }
- s := &Service{client: client, BasePath: basePath}
- s.Customers = NewCustomersService(s)
- s.Subscriptions = NewSubscriptionsService(s)
- return s, nil
- }
- type Service struct {
- client *http.Client
- BasePath string // API endpoint base URL
- UserAgent string // optional additional User-Agent fragment
- Customers *CustomersService
- Subscriptions *SubscriptionsService
- }
- func (s *Service) userAgent() string {
- if s.UserAgent == "" {
- return googleapi.UserAgent
- }
- return googleapi.UserAgent + " " + s.UserAgent
- }
- func NewCustomersService(s *Service) *CustomersService {
- rs := &CustomersService{s: s}
- return rs
- }
- type CustomersService struct {
- s *Service
- }
- func NewSubscriptionsService(s *Service) *SubscriptionsService {
- rs := &SubscriptionsService{s: s}
- return rs
- }
- type SubscriptionsService struct {
- s *Service
- }
- // Address: JSON template for address of a customer.
- type Address struct {
- // AddressLine1: Address line 1 of the address.
- AddressLine1 string `json:"addressLine1,omitempty"`
- // AddressLine2: Address line 2 of the address.
- AddressLine2 string `json:"addressLine2,omitempty"`
- // AddressLine3: Address line 3 of the address.
- AddressLine3 string `json:"addressLine3,omitempty"`
- // ContactName: Name of the contact person.
- ContactName string `json:"contactName,omitempty"`
- // CountryCode: ISO 3166 country code.
- CountryCode string `json:"countryCode,omitempty"`
- // Kind: Identifies the resource as a customer address.
- Kind string `json:"kind,omitempty"`
- // Locality: Name of the locality. This is in accordance with -
- // http://portablecontacts.net/draft-spec.html#address_element.
- Locality string `json:"locality,omitempty"`
- // OrganizationName: Name of the organization.
- OrganizationName string `json:"organizationName,omitempty"`
- // PostalCode: The postal code. This is in accordance with -
- // http://portablecontacts.net/draft-spec.html#address_element.
- PostalCode string `json:"postalCode,omitempty"`
- // Region: Name of the region. This is in accordance with -
- // http://portablecontacts.net/draft-spec.html#address_element.
- Region string `json:"region,omitempty"`
- // ForceSendFields is a list of field names (e.g. "AddressLine1") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Address) MarshalJSON() ([]byte, error) {
- type noMethod Address
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // ChangePlanRequest: JSON template for the ChangePlan rpc request.
- type ChangePlanRequest struct {
- // Kind: Identifies the resource as a subscription change plan request.
- Kind string `json:"kind,omitempty"`
- // PlanName: Name of the plan to change to.
- PlanName string `json:"planName,omitempty"`
- // PurchaseOrderId: Purchase order id for your order tracking purposes.
- PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
- // Seats: Number/Limit of seats in the new plan.
- Seats *Seats `json:"seats,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Kind") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *ChangePlanRequest) MarshalJSON() ([]byte, error) {
- type noMethod ChangePlanRequest
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Customer: JSON template for a customer.
- type Customer struct {
- // AlternateEmail: The alternate email of the customer.
- AlternateEmail string `json:"alternateEmail,omitempty"`
- // CustomerDomain: The domain name of the customer.
- CustomerDomain string `json:"customerDomain,omitempty"`
- // CustomerDomainVerified: Whether the customer's primary domain has
- // been verified.
- CustomerDomainVerified bool `json:"customerDomainVerified,omitempty"`
- // CustomerId: The id of the customer.
- CustomerId string `json:"customerId,omitempty"`
- // Kind: Identifies the resource as a customer.
- Kind string `json:"kind,omitempty"`
- // PhoneNumber: The phone number of the customer.
- PhoneNumber string `json:"phoneNumber,omitempty"`
- // PostalAddress: The postal address of the customer.
- PostalAddress *Address `json:"postalAddress,omitempty"`
- // ResourceUiUrl: Ui url for customer resource.
- ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "AlternateEmail") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Customer) MarshalJSON() ([]byte, error) {
- type noMethod Customer
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // RenewalSettings: JSON template for a subscription renewal settings.
- type RenewalSettings struct {
- // Kind: Identifies the resource as a subscription renewal setting.
- Kind string `json:"kind,omitempty"`
- // RenewalType: Subscription renewal type.
- RenewalType string `json:"renewalType,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Kind") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *RenewalSettings) MarshalJSON() ([]byte, error) {
- type noMethod RenewalSettings
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Seats: JSON template for subscription seats.
- type Seats struct {
- // Kind: Identifies the resource as a subscription change plan request.
- Kind string `json:"kind,omitempty"`
- // LicensedNumberOfSeats: Read-only field containing the current number
- // of licensed seats for FLEXIBLE Google-Apps subscriptions and
- // secondary subscriptions such as Google-Vault and Drive-storage.
- LicensedNumberOfSeats int64 `json:"licensedNumberOfSeats,omitempty"`
- // MaximumNumberOfSeats: Maximum number of seats that can be purchased.
- // This needs to be provided only for a non-commitment plan. For a
- // commitment plan it is decided by the contract.
- MaximumNumberOfSeats int64 `json:"maximumNumberOfSeats,omitempty"`
- // NumberOfSeats: Number of seats to purchase. This is applicable only
- // for a commitment plan.
- NumberOfSeats int64 `json:"numberOfSeats,omitempty"`
- // ForceSendFields is a list of field names (e.g. "Kind") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Seats) MarshalJSON() ([]byte, error) {
- type noMethod Seats
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Subscription: JSON template for a subscription.
- type Subscription struct {
- // BillingMethod: Billing method of this subscription.
- BillingMethod string `json:"billingMethod,omitempty"`
- // CreationTime: Creation time of this subscription in milliseconds
- // since Unix epoch.
- CreationTime int64 `json:"creationTime,omitempty,string"`
- // CustomerId: The id of the customer to whom the subscription belongs.
- CustomerId string `json:"customerId,omitempty"`
- // Kind: Identifies the resource as a Subscription.
- Kind string `json:"kind,omitempty"`
- // Plan: Plan details of the subscription
- Plan *SubscriptionPlan `json:"plan,omitempty"`
- // PurchaseOrderId: Purchase order id for your order tracking purposes.
- PurchaseOrderId string `json:"purchaseOrderId,omitempty"`
- // RenewalSettings: Renewal settings of the subscription.
- RenewalSettings *RenewalSettings `json:"renewalSettings,omitempty"`
- // ResourceUiUrl: Ui url for subscription resource.
- ResourceUiUrl string `json:"resourceUiUrl,omitempty"`
- // Seats: Number/Limit of seats in the new plan.
- Seats *Seats `json:"seats,omitempty"`
- // SkuId: Name of the sku for which this subscription is purchased.
- SkuId string `json:"skuId,omitempty"`
- // Status: Status of the subscription.
- Status string `json:"status,omitempty"`
- // SubscriptionId: The id of the subscription.
- SubscriptionId string `json:"subscriptionId,omitempty"`
- // SuspensionReasons: field listing all current reasons the subscription
- // is suspended. It is possible for a subscription to have multiple
- // suspension reasons. A subscription's status is SUSPENDED until all
- // pending suspensions are removed. Possible options include:
- // - PENDING_TOS_ACCEPTANCE — The customer has not logged in and
- // accepted the Google Apps Resold Terms of Services.
- // - RENEWAL_WITH_TYPE_CANCEL — The customer's commitment ended and
- // their service was cancelled at the end of their term.
- // - RESELLER_INITIATED — A manual suspension invoked by a Reseller.
- //
- // - TRIAL_ENDED — The customer's trial expired without a plan
- // selected.
- // - OTHER — The customer is suspended for an internal Google reason
- // (e.g. abuse or otherwise).
- SuspensionReasons []string `json:"suspensionReasons,omitempty"`
- // TransferInfo: Transfer related information for the subscription.
- TransferInfo *SubscriptionTransferInfo `json:"transferInfo,omitempty"`
- // TrialSettings: Trial Settings of the subscription.
- TrialSettings *SubscriptionTrialSettings `json:"trialSettings,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "BillingMethod") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Subscription) MarshalJSON() ([]byte, error) {
- type noMethod Subscription
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SubscriptionPlan: Plan details of the subscription
- type SubscriptionPlan struct {
- // CommitmentInterval: Interval of the commitment if it is a commitment
- // plan.
- CommitmentInterval *SubscriptionPlanCommitmentInterval `json:"commitmentInterval,omitempty"`
- // IsCommitmentPlan: Whether the plan is a commitment plan or not.
- IsCommitmentPlan bool `json:"isCommitmentPlan,omitempty"`
- // PlanName: The plan name of this subscription's plan.
- PlanName string `json:"planName,omitempty"`
- // ForceSendFields is a list of field names (e.g. "CommitmentInterval")
- // to unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SubscriptionPlan) MarshalJSON() ([]byte, error) {
- type noMethod SubscriptionPlan
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SubscriptionPlanCommitmentInterval: Interval of the commitment if it
- // is a commitment plan.
- type SubscriptionPlanCommitmentInterval struct {
- // EndTime: End time of the commitment interval in milliseconds since
- // Unix epoch.
- EndTime int64 `json:"endTime,omitempty,string"`
- // StartTime: Start time of the commitment interval in milliseconds
- // since Unix epoch.
- StartTime int64 `json:"startTime,omitempty,string"`
- // ForceSendFields is a list of field names (e.g. "EndTime") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SubscriptionPlanCommitmentInterval) MarshalJSON() ([]byte, error) {
- type noMethod SubscriptionPlanCommitmentInterval
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SubscriptionTransferInfo: Transfer related information for the
- // subscription.
- type SubscriptionTransferInfo struct {
- MinimumTransferableSeats int64 `json:"minimumTransferableSeats,omitempty"`
- // TransferabilityExpirationTime: Time when transfer token or intent to
- // transfer will expire.
- TransferabilityExpirationTime int64 `json:"transferabilityExpirationTime,omitempty,string"`
- // ForceSendFields is a list of field names (e.g.
- // "MinimumTransferableSeats") to unconditionally include in API
- // requests. By default, fields with empty values are omitted from API
- // requests. However, any non-pointer, non-interface field appearing in
- // ForceSendFields will be sent to the server regardless of whether the
- // field is empty or not. This may be used to include empty fields in
- // Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SubscriptionTransferInfo) MarshalJSON() ([]byte, error) {
- type noMethod SubscriptionTransferInfo
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // SubscriptionTrialSettings: Trial Settings of the subscription.
- type SubscriptionTrialSettings struct {
- // IsInTrial: Whether the subscription is in trial.
- IsInTrial bool `json:"isInTrial,omitempty"`
- // TrialEndTime: End time of the trial in milliseconds since Unix epoch.
- TrialEndTime int64 `json:"trialEndTime,omitempty,string"`
- // ForceSendFields is a list of field names (e.g. "IsInTrial") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *SubscriptionTrialSettings) MarshalJSON() ([]byte, error) {
- type noMethod SubscriptionTrialSettings
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // Subscriptions: JSON template for a subscription list.
- type Subscriptions struct {
- // Kind: Identifies the resource as a collection of subscriptions.
- Kind string `json:"kind,omitempty"`
- // NextPageToken: The continuation token, used to page through large
- // result sets. Provide this value in a subsequent request to return the
- // next page of results.
- NextPageToken string `json:"nextPageToken,omitempty"`
- // Subscriptions: The subscriptions in this page of results.
- Subscriptions []*Subscription `json:"subscriptions,omitempty"`
- // ServerResponse contains the HTTP response code and headers from the
- // server.
- googleapi.ServerResponse `json:"-"`
- // ForceSendFields is a list of field names (e.g. "Kind") to
- // unconditionally include in API requests. By default, fields with
- // empty values are omitted from API requests. However, any non-pointer,
- // non-interface field appearing in ForceSendFields will be sent to the
- // server regardless of whether the field is empty or not. This may be
- // used to include empty fields in Patch requests.
- ForceSendFields []string `json:"-"`
- }
- func (s *Subscriptions) MarshalJSON() ([]byte, error) {
- type noMethod Subscriptions
- raw := noMethod(*s)
- return gensupport.MarshalJSON(raw, s.ForceSendFields)
- }
- // method id "reseller.customers.get":
- type CustomersGetCall struct {
- s *Service
- customerId string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a customer resource if one exists and is owned by the
- // reseller.
- func (r *CustomersService) Get(customerId string) *CustomersGetCall {
- c := &CustomersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *CustomersGetCall) Fields(s ...googleapi.Field) *CustomersGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *CustomersGetCall) IfNoneMatch(entityTag string) *CustomersGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *CustomersGetCall) Context(ctx context.Context) *CustomersGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *CustomersGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.customers.get" call.
- // Exactly one of *Customer or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Customer.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *CustomersGetCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Customer{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a customer resource if one exists and is owned by the reseller.",
- // "httpMethod": "GET",
- // "id": "reseller.customers.get",
- // "parameterOrder": [
- // "customerId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}",
- // "response": {
- // "$ref": "Customer"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order",
- // "https://www.googleapis.com/auth/apps.order.readonly"
- // ]
- // }
- }
- // method id "reseller.customers.insert":
- type CustomersInsertCall struct {
- s *Service
- customer *Customer
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Creates a customer resource if one does not already exist.
- func (r *CustomersService) Insert(customer *Customer) *CustomersInsertCall {
- c := &CustomersInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customer = customer
- return c
- }
- // CustomerAuthToken sets the optional parameter "customerAuthToken": An
- // auth token needed for inserting a customer for which domain already
- // exists. Can be generated at https://admin.google.com/TransferToken.
- func (c *CustomersInsertCall) CustomerAuthToken(customerAuthToken string) *CustomersInsertCall {
- c.urlParams_.Set("customerAuthToken", customerAuthToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *CustomersInsertCall) Fields(s ...googleapi.Field) *CustomersInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *CustomersInsertCall) Context(ctx context.Context) *CustomersInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *CustomersInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.customers.insert" call.
- // Exactly one of *Customer or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Customer.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *CustomersInsertCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Customer{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates a customer resource if one does not already exist.",
- // "httpMethod": "POST",
- // "id": "reseller.customers.insert",
- // "parameters": {
- // "customerAuthToken": {
- // "description": "An auth token needed for inserting a customer for which domain already exists. Can be generated at https://admin.google.com/TransferToken. Optional.",
- // "location": "query",
- // "type": "string"
- // }
- // },
- // "path": "customers",
- // "request": {
- // "$ref": "Customer"
- // },
- // "response": {
- // "$ref": "Customer"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.customers.patch":
- type CustomersPatchCall struct {
- s *Service
- customerId string
- customer *Customer
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Patch: Update a customer resource if one it exists and is owned by
- // the reseller. This method supports patch semantics.
- func (r *CustomersService) Patch(customerId string, customer *Customer) *CustomersPatchCall {
- c := &CustomersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.customer = customer
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *CustomersPatchCall) Fields(s ...googleapi.Field) *CustomersPatchCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *CustomersPatchCall) Context(ctx context.Context) *CustomersPatchCall {
- c.ctx_ = ctx
- return c
- }
- func (c *CustomersPatchCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PATCH", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.customers.patch" call.
- // Exactly one of *Customer or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Customer.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *CustomersPatchCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Customer{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Update a customer resource if one it exists and is owned by the reseller. This method supports patch semantics.",
- // "httpMethod": "PATCH",
- // "id": "reseller.customers.patch",
- // "parameterOrder": [
- // "customerId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}",
- // "request": {
- // "$ref": "Customer"
- // },
- // "response": {
- // "$ref": "Customer"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.customers.update":
- type CustomersUpdateCall struct {
- s *Service
- customerId string
- customer *Customer
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Update: Update a customer resource if one it exists and is owned by
- // the reseller.
- func (r *CustomersService) Update(customerId string, customer *Customer) *CustomersUpdateCall {
- c := &CustomersUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.customer = customer
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *CustomersUpdateCall) Fields(s ...googleapi.Field) *CustomersUpdateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *CustomersUpdateCall) Context(ctx context.Context) *CustomersUpdateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *CustomersUpdateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.customer)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("PUT", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.customers.update" call.
- // Exactly one of *Customer or error will be non-nil. Any non-2xx status
- // code is an error. Response headers are in either
- // *Customer.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *CustomersUpdateCall) Do(opts ...googleapi.CallOption) (*Customer, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Customer{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Update a customer resource if one it exists and is owned by the reseller.",
- // "httpMethod": "PUT",
- // "id": "reseller.customers.update",
- // "parameterOrder": [
- // "customerId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}",
- // "request": {
- // "$ref": "Customer"
- // },
- // "response": {
- // "$ref": "Customer"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.activate":
- type SubscriptionsActivateCall struct {
- s *Service
- customerId string
- subscriptionId string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Activate: Activates a subscription previously suspended by the
- // reseller
- func (r *SubscriptionsService) Activate(customerId string, subscriptionId string) *SubscriptionsActivateCall {
- c := &SubscriptionsActivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsActivateCall) Fields(s ...googleapi.Field) *SubscriptionsActivateCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsActivateCall) Context(ctx context.Context) *SubscriptionsActivateCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsActivateCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/activate")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.activate" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsActivateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Activates a subscription previously suspended by the reseller",
- // "httpMethod": "POST",
- // "id": "reseller.subscriptions.activate",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}/activate",
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.changePlan":
- type SubscriptionsChangePlanCall struct {
- s *Service
- customerId string
- subscriptionId string
- changeplanrequest *ChangePlanRequest
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // ChangePlan: Changes the plan of a subscription
- func (r *SubscriptionsService) ChangePlan(customerId string, subscriptionId string, changeplanrequest *ChangePlanRequest) *SubscriptionsChangePlanCall {
- c := &SubscriptionsChangePlanCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- c.changeplanrequest = changeplanrequest
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsChangePlanCall) Fields(s ...googleapi.Field) *SubscriptionsChangePlanCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsChangePlanCall) Context(ctx context.Context) *SubscriptionsChangePlanCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsChangePlanCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.changeplanrequest)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changePlan")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.changePlan" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsChangePlanCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Changes the plan of a subscription",
- // "httpMethod": "POST",
- // "id": "reseller.subscriptions.changePlan",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}/changePlan",
- // "request": {
- // "$ref": "ChangePlanRequest"
- // },
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.changeRenewalSettings":
- type SubscriptionsChangeRenewalSettingsCall struct {
- s *Service
- customerId string
- subscriptionId string
- renewalsettings *RenewalSettings
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // ChangeRenewalSettings: Changes the renewal settings of a subscription
- func (r *SubscriptionsService) ChangeRenewalSettings(customerId string, subscriptionId string, renewalsettings *RenewalSettings) *SubscriptionsChangeRenewalSettingsCall {
- c := &SubscriptionsChangeRenewalSettingsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- c.renewalsettings = renewalsettings
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsChangeRenewalSettingsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeRenewalSettingsCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsChangeRenewalSettingsCall) Context(ctx context.Context) *SubscriptionsChangeRenewalSettingsCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsChangeRenewalSettingsCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.renewalsettings)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.changeRenewalSettings" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsChangeRenewalSettingsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Changes the renewal settings of a subscription",
- // "httpMethod": "POST",
- // "id": "reseller.subscriptions.changeRenewalSettings",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeRenewalSettings",
- // "request": {
- // "$ref": "RenewalSettings"
- // },
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.changeSeats":
- type SubscriptionsChangeSeatsCall struct {
- s *Service
- customerId string
- subscriptionId string
- seats *Seats
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // ChangeSeats: Changes the seats configuration of a subscription
- func (r *SubscriptionsService) ChangeSeats(customerId string, subscriptionId string, seats *Seats) *SubscriptionsChangeSeatsCall {
- c := &SubscriptionsChangeSeatsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- c.seats = seats
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsChangeSeatsCall) Fields(s ...googleapi.Field) *SubscriptionsChangeSeatsCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsChangeSeatsCall) Context(ctx context.Context) *SubscriptionsChangeSeatsCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsChangeSeatsCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.seats)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/changeSeats")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.changeSeats" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsChangeSeatsCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Changes the seats configuration of a subscription",
- // "httpMethod": "POST",
- // "id": "reseller.subscriptions.changeSeats",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}/changeSeats",
- // "request": {
- // "$ref": "Seats"
- // },
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.delete":
- type SubscriptionsDeleteCall struct {
- s *Service
- customerId string
- subscriptionId string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Delete: Cancels/Downgrades a subscription.
- func (r *SubscriptionsService) Delete(customerId string, subscriptionId string, deletionType string) *SubscriptionsDeleteCall {
- c := &SubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- c.urlParams_.Set("deletionType", deletionType)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsDeleteCall) Fields(s ...googleapi.Field) *SubscriptionsDeleteCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsDeleteCall) Context(ctx context.Context) *SubscriptionsDeleteCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("DELETE", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.delete" call.
- func (c *SubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) error {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if err != nil {
- return err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return err
- }
- return nil
- // {
- // "description": "Cancels/Downgrades a subscription.",
- // "httpMethod": "DELETE",
- // "id": "reseller.subscriptions.delete",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId",
- // "deletionType"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "deletionType": {
- // "description": "Whether the subscription is to be fully cancelled or downgraded",
- // "enum": [
- // "cancel",
- // "downgrade",
- // "suspend",
- // "transfer_to_direct"
- // ],
- // "enumDescriptions": [
- // "Cancels the subscription immediately",
- // "Downgrades a Google Apps for Business subscription to Google Apps",
- // "Suspends the subscriptions for 4 days before cancelling it",
- // "Transfers a subscription directly to Google"
- // ],
- // "location": "query",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}",
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.get":
- type SubscriptionsGetCall struct {
- s *Service
- customerId string
- subscriptionId string
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // Get: Gets a subscription of the customer.
- func (r *SubscriptionsService) Get(customerId string, subscriptionId string) *SubscriptionsGetCall {
- c := &SubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsGetCall) Fields(s ...googleapi.Field) *SubscriptionsGetCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *SubscriptionsGetCall) IfNoneMatch(entityTag string) *SubscriptionsGetCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsGetCall) Context(ctx context.Context) *SubscriptionsGetCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.get" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Gets a subscription of the customer.",
- // "httpMethod": "GET",
- // "id": "reseller.subscriptions.get",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}",
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order",
- // "https://www.googleapis.com/auth/apps.order.readonly"
- // ]
- // }
- }
- // method id "reseller.subscriptions.insert":
- type SubscriptionsInsertCall struct {
- s *Service
- customerId string
- subscription *Subscription
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Insert: Creates/Transfers a subscription for the customer.
- func (r *SubscriptionsService) Insert(customerId string, subscription *Subscription) *SubscriptionsInsertCall {
- c := &SubscriptionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscription = subscription
- return c
- }
- // CustomerAuthToken sets the optional parameter "customerAuthToken": An
- // auth token needed for transferring a subscription. Can be generated
- // at https://www.google.com/a/cpanel/customer-domain/TransferToken.
- func (c *SubscriptionsInsertCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsInsertCall {
- c.urlParams_.Set("customerAuthToken", customerAuthToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsInsertCall) Fields(s ...googleapi.Field) *SubscriptionsInsertCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsInsertCall) Context(ctx context.Context) *SubscriptionsInsertCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsInsertCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
- if err != nil {
- return nil, err
- }
- ctype := "application/json"
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- })
- req.Header.Set("Content-Type", ctype)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.insert" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsInsertCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Creates/Transfers a subscription for the customer.",
- // "httpMethod": "POST",
- // "id": "reseller.subscriptions.insert",
- // "parameterOrder": [
- // "customerId"
- // ],
- // "parameters": {
- // "customerAuthToken": {
- // "description": "An auth token needed for transferring a subscription. Can be generated at https://www.google.com/a/cpanel/customer-domain/TransferToken. Optional.",
- // "location": "query",
- // "type": "string"
- // },
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions",
- // "request": {
- // "$ref": "Subscription"
- // },
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.list":
- type SubscriptionsListCall struct {
- s *Service
- urlParams_ gensupport.URLParams
- ifNoneMatch_ string
- ctx_ context.Context
- }
- // List: Lists subscriptions of a reseller, optionally filtered by a
- // customer name prefix.
- func (r *SubscriptionsService) List() *SubscriptionsListCall {
- c := &SubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- return c
- }
- // CustomerAuthToken sets the optional parameter "customerAuthToken": An
- // auth token needed if the customer is not a resold customer of this
- // reseller. Can be generated at
- // https://www.google.com/a/cpanel/customer-domain/TransferToken.
- func (c *SubscriptionsListCall) CustomerAuthToken(customerAuthToken string) *SubscriptionsListCall {
- c.urlParams_.Set("customerAuthToken", customerAuthToken)
- return c
- }
- // CustomerId sets the optional parameter "customerId": Id of the
- // Customer
- func (c *SubscriptionsListCall) CustomerId(customerId string) *SubscriptionsListCall {
- c.urlParams_.Set("customerId", customerId)
- return c
- }
- // CustomerNamePrefix sets the optional parameter "customerNamePrefix":
- // Prefix of the customer's domain name by which the subscriptions
- // should be filtered. Optional
- func (c *SubscriptionsListCall) CustomerNamePrefix(customerNamePrefix string) *SubscriptionsListCall {
- c.urlParams_.Set("customerNamePrefix", customerNamePrefix)
- return c
- }
- // MaxResults sets the optional parameter "maxResults": Maximum number
- // of results to return
- func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
- c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
- return c
- }
- // PageToken sets the optional parameter "pageToken": Token to specify
- // next page in the list
- func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
- c.urlParams_.Set("pageToken", pageToken)
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsListCall) Fields(s ...googleapi.Field) *SubscriptionsListCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // IfNoneMatch sets the optional parameter which makes the operation
- // fail if the object's ETag matches the given value. This is useful for
- // getting updates only after the object has changed since the last
- // request. Use googleapi.IsNotModified to check whether the response
- // error from Do is the result of In-None-Match.
- func (c *SubscriptionsListCall) IfNoneMatch(entityTag string) *SubscriptionsListCall {
- c.ifNoneMatch_ = entityTag
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsListCall) Context(ctx context.Context) *SubscriptionsListCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("GET", urls, body)
- googleapi.SetOpaque(req.URL)
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ifNoneMatch_ != "" {
- req.Header.Set("If-None-Match", c.ifNoneMatch_)
- }
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.list" call.
- // Exactly one of *Subscriptions or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscriptions.ServerResponse.Header or (if a response was returned
- // at all) in error.(*googleapi.Error).Header. Use
- // googleapi.IsNotModified to check whether the returned error was
- // because http.StatusNotModified was returned.
- func (c *SubscriptionsListCall) Do(opts ...googleapi.CallOption) (*Subscriptions, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscriptions{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Lists subscriptions of a reseller, optionally filtered by a customer name prefix.",
- // "httpMethod": "GET",
- // "id": "reseller.subscriptions.list",
- // "parameters": {
- // "customerAuthToken": {
- // "description": "An auth token needed if the customer is not a resold customer of this reseller. Can be generated at https://www.google.com/a/cpanel/customer-domain/TransferToken.Optional.",
- // "location": "query",
- // "type": "string"
- // },
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "query",
- // "type": "string"
- // },
- // "customerNamePrefix": {
- // "description": "Prefix of the customer's domain name by which the subscriptions should be filtered. Optional",
- // "location": "query",
- // "type": "string"
- // },
- // "maxResults": {
- // "description": "Maximum number of results to return",
- // "format": "uint32",
- // "location": "query",
- // "maximum": "100",
- // "minimum": "1",
- // "type": "integer"
- // },
- // "pageToken": {
- // "description": "Token to specify next page in the list",
- // "location": "query",
- // "type": "string"
- // }
- // },
- // "path": "subscriptions",
- // "response": {
- // "$ref": "Subscriptions"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order",
- // "https://www.googleapis.com/auth/apps.order.readonly"
- // ]
- // }
- }
- // Pages invokes f for each page of results.
- // A non-nil error returned from f will halt the iteration.
- // The provided context supersedes any context provided to the Context method.
- func (c *SubscriptionsListCall) Pages(ctx context.Context, f func(*Subscriptions) error) error {
- c.ctx_ = ctx
- defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
- for {
- x, err := c.Do()
- if err != nil {
- return err
- }
- if err := f(x); err != nil {
- return err
- }
- if x.NextPageToken == "" {
- return nil
- }
- c.PageToken(x.NextPageToken)
- }
- }
- // method id "reseller.subscriptions.startPaidService":
- type SubscriptionsStartPaidServiceCall struct {
- s *Service
- customerId string
- subscriptionId string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // StartPaidService: Starts paid service of a trial subscription
- func (r *SubscriptionsService) StartPaidService(customerId string, subscriptionId string) *SubscriptionsStartPaidServiceCall {
- c := &SubscriptionsStartPaidServiceCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsStartPaidServiceCall) Fields(s ...googleapi.Field) *SubscriptionsStartPaidServiceCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsStartPaidServiceCall) Context(ctx context.Context) *SubscriptionsStartPaidServiceCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsStartPaidServiceCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/startPaidService")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.startPaidService" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsStartPaidServiceCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Starts paid service of a trial subscription",
- // "httpMethod": "POST",
- // "id": "reseller.subscriptions.startPaidService",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}/startPaidService",
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
- // method id "reseller.subscriptions.suspend":
- type SubscriptionsSuspendCall struct {
- s *Service
- customerId string
- subscriptionId string
- urlParams_ gensupport.URLParams
- ctx_ context.Context
- }
- // Suspend: Suspends an active subscription
- func (r *SubscriptionsService) Suspend(customerId string, subscriptionId string) *SubscriptionsSuspendCall {
- c := &SubscriptionsSuspendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
- c.customerId = customerId
- c.subscriptionId = subscriptionId
- return c
- }
- // Fields allows partial responses to be retrieved. See
- // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
- // for more information.
- func (c *SubscriptionsSuspendCall) Fields(s ...googleapi.Field) *SubscriptionsSuspendCall {
- c.urlParams_.Set("fields", googleapi.CombineFields(s))
- return c
- }
- // Context sets the context to be used in this call's Do method. Any
- // pending HTTP request will be aborted if the provided context is
- // canceled.
- func (c *SubscriptionsSuspendCall) Context(ctx context.Context) *SubscriptionsSuspendCall {
- c.ctx_ = ctx
- return c
- }
- func (c *SubscriptionsSuspendCall) doRequest(alt string) (*http.Response, error) {
- var body io.Reader = nil
- c.urlParams_.Set("alt", alt)
- urls := googleapi.ResolveRelative(c.s.BasePath, "customers/{customerId}/subscriptions/{subscriptionId}/suspend")
- urls += "?" + c.urlParams_.Encode()
- req, _ := http.NewRequest("POST", urls, body)
- googleapi.Expand(req.URL, map[string]string{
- "customerId": c.customerId,
- "subscriptionId": c.subscriptionId,
- })
- req.Header.Set("User-Agent", c.s.userAgent())
- if c.ctx_ != nil {
- return ctxhttp.Do(c.ctx_, c.s.client, req)
- }
- return c.s.client.Do(req)
- }
- // Do executes the "reseller.subscriptions.suspend" call.
- // Exactly one of *Subscription or error will be non-nil. Any non-2xx
- // status code is an error. Response headers are in either
- // *Subscription.ServerResponse.Header or (if a response was returned at
- // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
- // to check whether the returned error was because
- // http.StatusNotModified was returned.
- func (c *SubscriptionsSuspendCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
- gensupport.SetOptions(c.urlParams_, opts...)
- res, err := c.doRequest("json")
- if res != nil && res.StatusCode == http.StatusNotModified {
- if res.Body != nil {
- res.Body.Close()
- }
- return nil, &googleapi.Error{
- Code: res.StatusCode,
- Header: res.Header,
- }
- }
- if err != nil {
- return nil, err
- }
- defer googleapi.CloseBody(res)
- if err := googleapi.CheckResponse(res); err != nil {
- return nil, err
- }
- ret := &Subscription{
- ServerResponse: googleapi.ServerResponse{
- Header: res.Header,
- HTTPStatusCode: res.StatusCode,
- },
- }
- if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
- return nil, err
- }
- return ret, nil
- // {
- // "description": "Suspends an active subscription",
- // "httpMethod": "POST",
- // "id": "reseller.subscriptions.suspend",
- // "parameterOrder": [
- // "customerId",
- // "subscriptionId"
- // ],
- // "parameters": {
- // "customerId": {
- // "description": "Id of the Customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // },
- // "subscriptionId": {
- // "description": "Id of the subscription, which is unique for a customer",
- // "location": "path",
- // "required": true,
- // "type": "string"
- // }
- // },
- // "path": "customers/{customerId}/subscriptions/{subscriptionId}/suspend",
- // "response": {
- // "$ref": "Subscription"
- // },
- // "scopes": [
- // "https://www.googleapis.com/auth/apps.order"
- // ]
- // }
- }
|