...

Source file src/google.golang.org/api/licensing/v1/licensing-gen.go

Documentation: google.golang.org/api/licensing/v1

     1  // Copyright 2024 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  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package licensing provides access to the Enterprise License Manager API.
     8  //
     9  // For product documentation, see: https://developers.google.com/admin-sdk/licensing/
    10  //
    11  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/licensing/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	licensingService, err := licensing.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // To use an API key for authentication (note: some APIs do not support API
    38  // keys), use [google.golang.org/api/option.WithAPIKey]:
    39  //
    40  //	licensingService, err := licensing.NewService(ctx, option.WithAPIKey("AIza..."))
    41  //
    42  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    43  // flow, use [google.golang.org/api/option.WithTokenSource]:
    44  //
    45  //	config := &oauth2.Config{...}
    46  //	// ...
    47  //	token, err := config.Exchange(ctx, ...)
    48  //	licensingService, err := licensing.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package licensing // import "google.golang.org/api/licensing/v1"
    52  
    53  import (
    54  	"bytes"
    55  	"context"
    56  	"encoding/json"
    57  	"errors"
    58  	"fmt"
    59  	"io"
    60  	"net/http"
    61  	"net/url"
    62  	"strconv"
    63  	"strings"
    64  
    65  	googleapi "google.golang.org/api/googleapi"
    66  	internal "google.golang.org/api/internal"
    67  	gensupport "google.golang.org/api/internal/gensupport"
    68  	option "google.golang.org/api/option"
    69  	internaloption "google.golang.org/api/option/internaloption"
    70  	htransport "google.golang.org/api/transport/http"
    71  )
    72  
    73  // Always reference these packages, just in case the auto-generated code
    74  // below doesn't.
    75  var _ = bytes.NewBuffer
    76  var _ = strconv.Itoa
    77  var _ = fmt.Sprintf
    78  var _ = json.NewDecoder
    79  var _ = io.Copy
    80  var _ = url.Parse
    81  var _ = gensupport.MarshalJSON
    82  var _ = googleapi.Version
    83  var _ = errors.New
    84  var _ = strings.Replace
    85  var _ = context.Canceled
    86  var _ = internaloption.WithDefaultEndpoint
    87  var _ = internal.Version
    88  
    89  const apiId = "licensing:v1"
    90  const apiName = "licensing"
    91  const apiVersion = "v1"
    92  const basePath = "https://licensing.googleapis.com/"
    93  const basePathTemplate = "https://licensing.UNIVERSE_DOMAIN/"
    94  const mtlsBasePath = "https://licensing.mtls.googleapis.com/"
    95  
    96  // OAuth2 scopes used by this API.
    97  const (
    98  	// View and manage G Suite licenses for your domain
    99  	AppsLicensingScope = "https://www.googleapis.com/auth/apps.licensing"
   100  )
   101  
   102  // NewService creates a new Service.
   103  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   104  	scopesOption := internaloption.WithDefaultScopes(
   105  		"https://www.googleapis.com/auth/apps.licensing",
   106  	)
   107  	// NOTE: prepend, so we don't override user-specified scopes.
   108  	opts = append([]option.ClientOption{scopesOption}, opts...)
   109  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   110  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   111  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   112  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   113  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	s, err := New(client)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	if endpoint != "" {
   122  		s.BasePath = endpoint
   123  	}
   124  	return s, nil
   125  }
   126  
   127  // New creates a new Service. It uses the provided http.Client for requests.
   128  //
   129  // Deprecated: please use NewService instead.
   130  // To provide a custom HTTP client, use option.WithHTTPClient.
   131  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   132  func New(client *http.Client) (*Service, error) {
   133  	if client == nil {
   134  		return nil, errors.New("client is nil")
   135  	}
   136  	s := &Service{client: client, BasePath: basePath}
   137  	s.LicenseAssignments = NewLicenseAssignmentsService(s)
   138  	return s, nil
   139  }
   140  
   141  type Service struct {
   142  	client    *http.Client
   143  	BasePath  string // API endpoint base URL
   144  	UserAgent string // optional additional User-Agent fragment
   145  
   146  	LicenseAssignments *LicenseAssignmentsService
   147  }
   148  
   149  func (s *Service) userAgent() string {
   150  	if s.UserAgent == "" {
   151  		return googleapi.UserAgent
   152  	}
   153  	return googleapi.UserAgent + " " + s.UserAgent
   154  }
   155  
   156  func NewLicenseAssignmentsService(s *Service) *LicenseAssignmentsService {
   157  	rs := &LicenseAssignmentsService{s: s}
   158  	return rs
   159  }
   160  
   161  type LicenseAssignmentsService struct {
   162  	s *Service
   163  }
   164  
   165  // Empty: A generic empty message that you can re-use to avoid defining
   166  // duplicated empty messages in your APIs. A typical example is to use it as
   167  // the request or the response type of an API method. For instance: service Foo
   168  // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
   169  type Empty struct {
   170  	// ServerResponse contains the HTTP response code and headers from the server.
   171  	googleapi.ServerResponse `json:"-"`
   172  }
   173  
   174  // LicenseAssignment: Representation of a license assignment.
   175  type LicenseAssignment struct {
   176  	// Etags: ETag of the resource.
   177  	Etags string `json:"etags,omitempty"`
   178  	// Kind: Identifies the resource as a LicenseAssignment, which is
   179  	// `licensing#licenseAssignment`.
   180  	Kind string `json:"kind,omitempty"`
   181  	// ProductId: A product's unique identifier. For more information about
   182  	// products in this version of the API, see Product and SKU IDs.
   183  	ProductId string `json:"productId,omitempty"`
   184  	// ProductName: Display Name of the product.
   185  	ProductName string `json:"productName,omitempty"`
   186  	// SelfLink: Link to this page.
   187  	SelfLink string `json:"selfLink,omitempty"`
   188  	// SkuId: A product SKU's unique identifier. For more information about
   189  	// available SKUs in this version of the API, see Products and SKUs.
   190  	SkuId string `json:"skuId,omitempty"`
   191  	// SkuName: Display Name of the sku of the product.
   192  	SkuName string `json:"skuName,omitempty"`
   193  	// UserId: The user's current primary email address. If the user's email
   194  	// address changes, use the new email address in your API requests. Since a
   195  	// `userId` is subject to change, do not use a `userId` value as a key for
   196  	// persistent data. This key could break if the current user's email address
   197  	// changes. If the `userId` is suspended, the license status changes.
   198  	UserId string `json:"userId,omitempty"`
   199  
   200  	// ServerResponse contains the HTTP response code and headers from the server.
   201  	googleapi.ServerResponse `json:"-"`
   202  	// ForceSendFields is a list of field names (e.g. "Etags") to unconditionally
   203  	// include in API requests. By default, fields with empty or default values are
   204  	// omitted from API requests. See
   205  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   206  	// details.
   207  	ForceSendFields []string `json:"-"`
   208  	// NullFields is a list of field names (e.g. "Etags") to include in API
   209  	// requests with the JSON null value. By default, fields with empty values are
   210  	// omitted from API requests. See
   211  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   212  	NullFields []string `json:"-"`
   213  }
   214  
   215  func (s *LicenseAssignment) MarshalJSON() ([]byte, error) {
   216  	type NoMethod LicenseAssignment
   217  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   218  }
   219  
   220  // LicenseAssignmentInsert: Representation of a license assignment.
   221  type LicenseAssignmentInsert struct {
   222  	// UserId: Email id of the user
   223  	UserId string `json:"userId,omitempty"`
   224  	// ForceSendFields is a list of field names (e.g. "UserId") to unconditionally
   225  	// include in API requests. By default, fields with empty or default values are
   226  	// omitted from API requests. See
   227  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   228  	// details.
   229  	ForceSendFields []string `json:"-"`
   230  	// NullFields is a list of field names (e.g. "UserId") to include in API
   231  	// requests with the JSON null value. By default, fields with empty values are
   232  	// omitted from API requests. See
   233  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   234  	NullFields []string `json:"-"`
   235  }
   236  
   237  func (s *LicenseAssignmentInsert) MarshalJSON() ([]byte, error) {
   238  	type NoMethod LicenseAssignmentInsert
   239  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   240  }
   241  
   242  type LicenseAssignmentList struct {
   243  	// Etag: ETag of the resource.
   244  	Etag string `json:"etag,omitempty"`
   245  	// Items: The LicenseAssignments in this page of results.
   246  	Items []*LicenseAssignment `json:"items,omitempty"`
   247  	// Kind: Identifies the resource as a collection of LicenseAssignments.
   248  	Kind string `json:"kind,omitempty"`
   249  	// NextPageToken: The token that you must submit in a subsequent request to
   250  	// retrieve additional license results matching your query parameters. The
   251  	// `maxResults` query string is related to the `nextPageToken` since
   252  	// `maxResults` determines how many entries are returned on each next page.
   253  	NextPageToken string `json:"nextPageToken,omitempty"`
   254  
   255  	// ServerResponse contains the HTTP response code and headers from the server.
   256  	googleapi.ServerResponse `json:"-"`
   257  	// ForceSendFields is a list of field names (e.g. "Etag") to unconditionally
   258  	// include in API requests. By default, fields with empty or default values are
   259  	// omitted from API requests. See
   260  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   261  	// details.
   262  	ForceSendFields []string `json:"-"`
   263  	// NullFields is a list of field names (e.g. "Etag") to include in API requests
   264  	// with the JSON null value. By default, fields with empty values are omitted
   265  	// from API requests. See
   266  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   267  	NullFields []string `json:"-"`
   268  }
   269  
   270  func (s *LicenseAssignmentList) MarshalJSON() ([]byte, error) {
   271  	type NoMethod LicenseAssignmentList
   272  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   273  }
   274  
   275  type LicenseAssignmentsDeleteCall struct {
   276  	s          *Service
   277  	productId  string
   278  	skuId      string
   279  	userId     string
   280  	urlParams_ gensupport.URLParams
   281  	ctx_       context.Context
   282  	header_    http.Header
   283  }
   284  
   285  // Delete: Revoke a license.
   286  //
   287  //   - productId: A product's unique identifier. For more information about
   288  //     products in this version of the API, see Products and SKUs.
   289  //   - skuId: A product SKU's unique identifier. For more information about
   290  //     available SKUs in this version of the API, see Products and SKUs.
   291  //   - userId: The user's current primary email address. If the user's email
   292  //     address changes, use the new email address in your API requests. Since a
   293  //     `userId` is subject to change, do not use a `userId` value as a key for
   294  //     persistent data. This key could break if the current user's email address
   295  //     changes. If the `userId` is suspended, the license status changes.
   296  func (r *LicenseAssignmentsService) Delete(productId string, skuId string, userId string) *LicenseAssignmentsDeleteCall {
   297  	c := &LicenseAssignmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   298  	c.productId = productId
   299  	c.skuId = skuId
   300  	c.userId = userId
   301  	return c
   302  }
   303  
   304  // Fields allows partial responses to be retrieved. See
   305  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   306  // details.
   307  func (c *LicenseAssignmentsDeleteCall) Fields(s ...googleapi.Field) *LicenseAssignmentsDeleteCall {
   308  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   309  	return c
   310  }
   311  
   312  // Context sets the context to be used in this call's Do method.
   313  func (c *LicenseAssignmentsDeleteCall) Context(ctx context.Context) *LicenseAssignmentsDeleteCall {
   314  	c.ctx_ = ctx
   315  	return c
   316  }
   317  
   318  // Header returns a http.Header that can be modified by the caller to add
   319  // headers to the request.
   320  func (c *LicenseAssignmentsDeleteCall) Header() http.Header {
   321  	if c.header_ == nil {
   322  		c.header_ = make(http.Header)
   323  	}
   324  	return c.header_
   325  }
   326  
   327  func (c *LicenseAssignmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
   328  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   329  	var body io.Reader = nil
   330  	c.urlParams_.Set("alt", alt)
   331  	c.urlParams_.Set("prettyPrint", "false")
   332  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/licensing/v1/product/{productId}/sku/{skuId}/user/{userId}")
   333  	urls += "?" + c.urlParams_.Encode()
   334  	req, err := http.NewRequest("DELETE", urls, body)
   335  	if err != nil {
   336  		return nil, err
   337  	}
   338  	req.Header = reqHeaders
   339  	googleapi.Expand(req.URL, map[string]string{
   340  		"productId": c.productId,
   341  		"skuId":     c.skuId,
   342  		"userId":    c.userId,
   343  	})
   344  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   345  }
   346  
   347  // Do executes the "licensing.licenseAssignments.delete" call.
   348  // Any non-2xx status code is an error. Response headers are in either
   349  // *Empty.ServerResponse.Header or (if a response was returned at all) in
   350  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
   351  // whether the returned error was because http.StatusNotModified was returned.
   352  func (c *LicenseAssignmentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
   353  	gensupport.SetOptions(c.urlParams_, opts...)
   354  	res, err := c.doRequest("json")
   355  	if res != nil && res.StatusCode == http.StatusNotModified {
   356  		if res.Body != nil {
   357  			res.Body.Close()
   358  		}
   359  		return nil, gensupport.WrapError(&googleapi.Error{
   360  			Code:   res.StatusCode,
   361  			Header: res.Header,
   362  		})
   363  	}
   364  	if err != nil {
   365  		return nil, err
   366  	}
   367  	defer googleapi.CloseBody(res)
   368  	if err := googleapi.CheckResponse(res); err != nil {
   369  		return nil, gensupport.WrapError(err)
   370  	}
   371  	ret := &Empty{
   372  		ServerResponse: googleapi.ServerResponse{
   373  			Header:         res.Header,
   374  			HTTPStatusCode: res.StatusCode,
   375  		},
   376  	}
   377  	target := &ret
   378  	if err := gensupport.DecodeResponse(target, res); err != nil {
   379  		return nil, err
   380  	}
   381  	return ret, nil
   382  }
   383  
   384  type LicenseAssignmentsGetCall struct {
   385  	s            *Service
   386  	productId    string
   387  	skuId        string
   388  	userId       string
   389  	urlParams_   gensupport.URLParams
   390  	ifNoneMatch_ string
   391  	ctx_         context.Context
   392  	header_      http.Header
   393  }
   394  
   395  // Get: Get a specific user's license by product SKU.
   396  //
   397  //   - productId: A product's unique identifier. For more information about
   398  //     products in this version of the API, see Products and SKUs.
   399  //   - skuId: A product SKU's unique identifier. For more information about
   400  //     available SKUs in this version of the API, see Products and SKUs.
   401  //   - userId: The user's current primary email address. If the user's email
   402  //     address changes, use the new email address in your API requests. Since a
   403  //     `userId` is subject to change, do not use a `userId` value as a key for
   404  //     persistent data. This key could break if the current user's email address
   405  //     changes. If the `userId` is suspended, the license status changes.
   406  func (r *LicenseAssignmentsService) Get(productId string, skuId string, userId string) *LicenseAssignmentsGetCall {
   407  	c := &LicenseAssignmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   408  	c.productId = productId
   409  	c.skuId = skuId
   410  	c.userId = userId
   411  	return c
   412  }
   413  
   414  // Fields allows partial responses to be retrieved. See
   415  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   416  // details.
   417  func (c *LicenseAssignmentsGetCall) Fields(s ...googleapi.Field) *LicenseAssignmentsGetCall {
   418  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   419  	return c
   420  }
   421  
   422  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   423  // object's ETag matches the given value. This is useful for getting updates
   424  // only after the object has changed since the last request.
   425  func (c *LicenseAssignmentsGetCall) IfNoneMatch(entityTag string) *LicenseAssignmentsGetCall {
   426  	c.ifNoneMatch_ = entityTag
   427  	return c
   428  }
   429  
   430  // Context sets the context to be used in this call's Do method.
   431  func (c *LicenseAssignmentsGetCall) Context(ctx context.Context) *LicenseAssignmentsGetCall {
   432  	c.ctx_ = ctx
   433  	return c
   434  }
   435  
   436  // Header returns a http.Header that can be modified by the caller to add
   437  // headers to the request.
   438  func (c *LicenseAssignmentsGetCall) Header() http.Header {
   439  	if c.header_ == nil {
   440  		c.header_ = make(http.Header)
   441  	}
   442  	return c.header_
   443  }
   444  
   445  func (c *LicenseAssignmentsGetCall) doRequest(alt string) (*http.Response, error) {
   446  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   447  	if c.ifNoneMatch_ != "" {
   448  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   449  	}
   450  	var body io.Reader = nil
   451  	c.urlParams_.Set("alt", alt)
   452  	c.urlParams_.Set("prettyPrint", "false")
   453  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/licensing/v1/product/{productId}/sku/{skuId}/user/{userId}")
   454  	urls += "?" + c.urlParams_.Encode()
   455  	req, err := http.NewRequest("GET", urls, body)
   456  	if err != nil {
   457  		return nil, err
   458  	}
   459  	req.Header = reqHeaders
   460  	googleapi.Expand(req.URL, map[string]string{
   461  		"productId": c.productId,
   462  		"skuId":     c.skuId,
   463  		"userId":    c.userId,
   464  	})
   465  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   466  }
   467  
   468  // Do executes the "licensing.licenseAssignments.get" call.
   469  // Any non-2xx status code is an error. Response headers are in either
   470  // *LicenseAssignment.ServerResponse.Header or (if a response was returned at
   471  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   472  // check whether the returned error was because http.StatusNotModified was
   473  // returned.
   474  func (c *LicenseAssignmentsGetCall) Do(opts ...googleapi.CallOption) (*LicenseAssignment, error) {
   475  	gensupport.SetOptions(c.urlParams_, opts...)
   476  	res, err := c.doRequest("json")
   477  	if res != nil && res.StatusCode == http.StatusNotModified {
   478  		if res.Body != nil {
   479  			res.Body.Close()
   480  		}
   481  		return nil, gensupport.WrapError(&googleapi.Error{
   482  			Code:   res.StatusCode,
   483  			Header: res.Header,
   484  		})
   485  	}
   486  	if err != nil {
   487  		return nil, err
   488  	}
   489  	defer googleapi.CloseBody(res)
   490  	if err := googleapi.CheckResponse(res); err != nil {
   491  		return nil, gensupport.WrapError(err)
   492  	}
   493  	ret := &LicenseAssignment{
   494  		ServerResponse: googleapi.ServerResponse{
   495  			Header:         res.Header,
   496  			HTTPStatusCode: res.StatusCode,
   497  		},
   498  	}
   499  	target := &ret
   500  	if err := gensupport.DecodeResponse(target, res); err != nil {
   501  		return nil, err
   502  	}
   503  	return ret, nil
   504  }
   505  
   506  type LicenseAssignmentsInsertCall struct {
   507  	s                       *Service
   508  	productId               string
   509  	skuId                   string
   510  	licenseassignmentinsert *LicenseAssignmentInsert
   511  	urlParams_              gensupport.URLParams
   512  	ctx_                    context.Context
   513  	header_                 http.Header
   514  }
   515  
   516  // Insert: Assign a license.
   517  //
   518  //   - productId: A product's unique identifier. For more information about
   519  //     products in this version of the API, see Products and SKUs.
   520  //   - skuId: A product SKU's unique identifier. For more information about
   521  //     available SKUs in this version of the API, see Products and SKUs.
   522  func (r *LicenseAssignmentsService) Insert(productId string, skuId string, licenseassignmentinsert *LicenseAssignmentInsert) *LicenseAssignmentsInsertCall {
   523  	c := &LicenseAssignmentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   524  	c.productId = productId
   525  	c.skuId = skuId
   526  	c.licenseassignmentinsert = licenseassignmentinsert
   527  	return c
   528  }
   529  
   530  // Fields allows partial responses to be retrieved. See
   531  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   532  // details.
   533  func (c *LicenseAssignmentsInsertCall) Fields(s ...googleapi.Field) *LicenseAssignmentsInsertCall {
   534  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   535  	return c
   536  }
   537  
   538  // Context sets the context to be used in this call's Do method.
   539  func (c *LicenseAssignmentsInsertCall) Context(ctx context.Context) *LicenseAssignmentsInsertCall {
   540  	c.ctx_ = ctx
   541  	return c
   542  }
   543  
   544  // Header returns a http.Header that can be modified by the caller to add
   545  // headers to the request.
   546  func (c *LicenseAssignmentsInsertCall) Header() http.Header {
   547  	if c.header_ == nil {
   548  		c.header_ = make(http.Header)
   549  	}
   550  	return c.header_
   551  }
   552  
   553  func (c *LicenseAssignmentsInsertCall) doRequest(alt string) (*http.Response, error) {
   554  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   555  	var body io.Reader = nil
   556  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.licenseassignmentinsert)
   557  	if err != nil {
   558  		return nil, err
   559  	}
   560  	c.urlParams_.Set("alt", alt)
   561  	c.urlParams_.Set("prettyPrint", "false")
   562  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/licensing/v1/product/{productId}/sku/{skuId}/user")
   563  	urls += "?" + c.urlParams_.Encode()
   564  	req, err := http.NewRequest("POST", urls, body)
   565  	if err != nil {
   566  		return nil, err
   567  	}
   568  	req.Header = reqHeaders
   569  	googleapi.Expand(req.URL, map[string]string{
   570  		"productId": c.productId,
   571  		"skuId":     c.skuId,
   572  	})
   573  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   574  }
   575  
   576  // Do executes the "licensing.licenseAssignments.insert" call.
   577  // Any non-2xx status code is an error. Response headers are in either
   578  // *LicenseAssignment.ServerResponse.Header or (if a response was returned at
   579  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   580  // check whether the returned error was because http.StatusNotModified was
   581  // returned.
   582  func (c *LicenseAssignmentsInsertCall) Do(opts ...googleapi.CallOption) (*LicenseAssignment, error) {
   583  	gensupport.SetOptions(c.urlParams_, opts...)
   584  	res, err := c.doRequest("json")
   585  	if res != nil && res.StatusCode == http.StatusNotModified {
   586  		if res.Body != nil {
   587  			res.Body.Close()
   588  		}
   589  		return nil, gensupport.WrapError(&googleapi.Error{
   590  			Code:   res.StatusCode,
   591  			Header: res.Header,
   592  		})
   593  	}
   594  	if err != nil {
   595  		return nil, err
   596  	}
   597  	defer googleapi.CloseBody(res)
   598  	if err := googleapi.CheckResponse(res); err != nil {
   599  		return nil, gensupport.WrapError(err)
   600  	}
   601  	ret := &LicenseAssignment{
   602  		ServerResponse: googleapi.ServerResponse{
   603  			Header:         res.Header,
   604  			HTTPStatusCode: res.StatusCode,
   605  		},
   606  	}
   607  	target := &ret
   608  	if err := gensupport.DecodeResponse(target, res); err != nil {
   609  		return nil, err
   610  	}
   611  	return ret, nil
   612  }
   613  
   614  type LicenseAssignmentsListForProductCall struct {
   615  	s            *Service
   616  	productId    string
   617  	urlParams_   gensupport.URLParams
   618  	ifNoneMatch_ string
   619  	ctx_         context.Context
   620  	header_      http.Header
   621  }
   622  
   623  // ListForProduct: List all users assigned licenses for a specific product SKU.
   624  //
   625  //   - customerId: The customer's unique ID as defined in the Admin console, such
   626  //     as `C00000000`. If the customer is suspended, the server returns an error.
   627  //   - productId: A product's unique identifier. For more information about
   628  //     products in this version of the API, see Products and SKUs.
   629  func (r *LicenseAssignmentsService) ListForProduct(productId string, customerId string) *LicenseAssignmentsListForProductCall {
   630  	c := &LicenseAssignmentsListForProductCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   631  	c.productId = productId
   632  	c.urlParams_.Set("customerId", customerId)
   633  	return c
   634  }
   635  
   636  // MaxResults sets the optional parameter "maxResults": The `maxResults` query
   637  // string determines how many entries are returned on each page of a large
   638  // response. This is an optional parameter. The value must be a positive
   639  // number.
   640  func (c *LicenseAssignmentsListForProductCall) MaxResults(maxResults int64) *LicenseAssignmentsListForProductCall {
   641  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
   642  	return c
   643  }
   644  
   645  // PageToken sets the optional parameter "pageToken": Token to fetch the next
   646  // page of data. The `maxResults` query string is related to the `pageToken`
   647  // since `maxResults` determines how many entries are returned on each page.
   648  // This is an optional query string. If not specified, the server returns the
   649  // first page.
   650  func (c *LicenseAssignmentsListForProductCall) PageToken(pageToken string) *LicenseAssignmentsListForProductCall {
   651  	c.urlParams_.Set("pageToken", pageToken)
   652  	return c
   653  }
   654  
   655  // Fields allows partial responses to be retrieved. See
   656  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   657  // details.
   658  func (c *LicenseAssignmentsListForProductCall) Fields(s ...googleapi.Field) *LicenseAssignmentsListForProductCall {
   659  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   660  	return c
   661  }
   662  
   663  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   664  // object's ETag matches the given value. This is useful for getting updates
   665  // only after the object has changed since the last request.
   666  func (c *LicenseAssignmentsListForProductCall) IfNoneMatch(entityTag string) *LicenseAssignmentsListForProductCall {
   667  	c.ifNoneMatch_ = entityTag
   668  	return c
   669  }
   670  
   671  // Context sets the context to be used in this call's Do method.
   672  func (c *LicenseAssignmentsListForProductCall) Context(ctx context.Context) *LicenseAssignmentsListForProductCall {
   673  	c.ctx_ = ctx
   674  	return c
   675  }
   676  
   677  // Header returns a http.Header that can be modified by the caller to add
   678  // headers to the request.
   679  func (c *LicenseAssignmentsListForProductCall) Header() http.Header {
   680  	if c.header_ == nil {
   681  		c.header_ = make(http.Header)
   682  	}
   683  	return c.header_
   684  }
   685  
   686  func (c *LicenseAssignmentsListForProductCall) doRequest(alt string) (*http.Response, error) {
   687  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   688  	if c.ifNoneMatch_ != "" {
   689  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   690  	}
   691  	var body io.Reader = nil
   692  	c.urlParams_.Set("alt", alt)
   693  	c.urlParams_.Set("prettyPrint", "false")
   694  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/licensing/v1/product/{productId}/users")
   695  	urls += "?" + c.urlParams_.Encode()
   696  	req, err := http.NewRequest("GET", urls, body)
   697  	if err != nil {
   698  		return nil, err
   699  	}
   700  	req.Header = reqHeaders
   701  	googleapi.Expand(req.URL, map[string]string{
   702  		"productId": c.productId,
   703  	})
   704  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   705  }
   706  
   707  // Do executes the "licensing.licenseAssignments.listForProduct" call.
   708  // Any non-2xx status code is an error. Response headers are in either
   709  // *LicenseAssignmentList.ServerResponse.Header or (if a response was returned
   710  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   711  // check whether the returned error was because http.StatusNotModified was
   712  // returned.
   713  func (c *LicenseAssignmentsListForProductCall) Do(opts ...googleapi.CallOption) (*LicenseAssignmentList, error) {
   714  	gensupport.SetOptions(c.urlParams_, opts...)
   715  	res, err := c.doRequest("json")
   716  	if res != nil && res.StatusCode == http.StatusNotModified {
   717  		if res.Body != nil {
   718  			res.Body.Close()
   719  		}
   720  		return nil, gensupport.WrapError(&googleapi.Error{
   721  			Code:   res.StatusCode,
   722  			Header: res.Header,
   723  		})
   724  	}
   725  	if err != nil {
   726  		return nil, err
   727  	}
   728  	defer googleapi.CloseBody(res)
   729  	if err := googleapi.CheckResponse(res); err != nil {
   730  		return nil, gensupport.WrapError(err)
   731  	}
   732  	ret := &LicenseAssignmentList{
   733  		ServerResponse: googleapi.ServerResponse{
   734  			Header:         res.Header,
   735  			HTTPStatusCode: res.StatusCode,
   736  		},
   737  	}
   738  	target := &ret
   739  	if err := gensupport.DecodeResponse(target, res); err != nil {
   740  		return nil, err
   741  	}
   742  	return ret, nil
   743  }
   744  
   745  // Pages invokes f for each page of results.
   746  // A non-nil error returned from f will halt the iteration.
   747  // The provided context supersedes any context provided to the Context method.
   748  func (c *LicenseAssignmentsListForProductCall) Pages(ctx context.Context, f func(*LicenseAssignmentList) error) error {
   749  	c.ctx_ = ctx
   750  	defer c.PageToken(c.urlParams_.Get("pageToken"))
   751  	for {
   752  		x, err := c.Do()
   753  		if err != nil {
   754  			return err
   755  		}
   756  		if err := f(x); err != nil {
   757  			return err
   758  		}
   759  		if x.NextPageToken == "" {
   760  			return nil
   761  		}
   762  		c.PageToken(x.NextPageToken)
   763  	}
   764  }
   765  
   766  type LicenseAssignmentsListForProductAndSkuCall struct {
   767  	s            *Service
   768  	productId    string
   769  	skuId        string
   770  	urlParams_   gensupport.URLParams
   771  	ifNoneMatch_ string
   772  	ctx_         context.Context
   773  	header_      http.Header
   774  }
   775  
   776  // ListForProductAndSku: List all users assigned licenses for a specific
   777  // product SKU.
   778  //
   779  //   - customerId: The customer's unique ID as defined in the Admin console, such
   780  //     as `C00000000`. If the customer is suspended, the server returns an error.
   781  //   - productId: A product's unique identifier. For more information about
   782  //     products in this version of the API, see Products and SKUs.
   783  //   - skuId: A product SKU's unique identifier. For more information about
   784  //     available SKUs in this version of the API, see Products and SKUs.
   785  func (r *LicenseAssignmentsService) ListForProductAndSku(productId string, skuId string, customerId string) *LicenseAssignmentsListForProductAndSkuCall {
   786  	c := &LicenseAssignmentsListForProductAndSkuCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   787  	c.productId = productId
   788  	c.skuId = skuId
   789  	c.urlParams_.Set("customerId", customerId)
   790  	return c
   791  }
   792  
   793  // MaxResults sets the optional parameter "maxResults": The `maxResults` query
   794  // string determines how many entries are returned on each page of a large
   795  // response. This is an optional parameter. The value must be a positive
   796  // number.
   797  func (c *LicenseAssignmentsListForProductAndSkuCall) MaxResults(maxResults int64) *LicenseAssignmentsListForProductAndSkuCall {
   798  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
   799  	return c
   800  }
   801  
   802  // PageToken sets the optional parameter "pageToken": Token to fetch the next
   803  // page of data. The `maxResults` query string is related to the `pageToken`
   804  // since `maxResults` determines how many entries are returned on each page.
   805  // This is an optional query string. If not specified, the server returns the
   806  // first page.
   807  func (c *LicenseAssignmentsListForProductAndSkuCall) PageToken(pageToken string) *LicenseAssignmentsListForProductAndSkuCall {
   808  	c.urlParams_.Set("pageToken", pageToken)
   809  	return c
   810  }
   811  
   812  // Fields allows partial responses to be retrieved. See
   813  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   814  // details.
   815  func (c *LicenseAssignmentsListForProductAndSkuCall) Fields(s ...googleapi.Field) *LicenseAssignmentsListForProductAndSkuCall {
   816  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   817  	return c
   818  }
   819  
   820  // IfNoneMatch sets an optional parameter which makes the operation fail if the
   821  // object's ETag matches the given value. This is useful for getting updates
   822  // only after the object has changed since the last request.
   823  func (c *LicenseAssignmentsListForProductAndSkuCall) IfNoneMatch(entityTag string) *LicenseAssignmentsListForProductAndSkuCall {
   824  	c.ifNoneMatch_ = entityTag
   825  	return c
   826  }
   827  
   828  // Context sets the context to be used in this call's Do method.
   829  func (c *LicenseAssignmentsListForProductAndSkuCall) Context(ctx context.Context) *LicenseAssignmentsListForProductAndSkuCall {
   830  	c.ctx_ = ctx
   831  	return c
   832  }
   833  
   834  // Header returns a http.Header that can be modified by the caller to add
   835  // headers to the request.
   836  func (c *LicenseAssignmentsListForProductAndSkuCall) Header() http.Header {
   837  	if c.header_ == nil {
   838  		c.header_ = make(http.Header)
   839  	}
   840  	return c.header_
   841  }
   842  
   843  func (c *LicenseAssignmentsListForProductAndSkuCall) doRequest(alt string) (*http.Response, error) {
   844  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
   845  	if c.ifNoneMatch_ != "" {
   846  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
   847  	}
   848  	var body io.Reader = nil
   849  	c.urlParams_.Set("alt", alt)
   850  	c.urlParams_.Set("prettyPrint", "false")
   851  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/licensing/v1/product/{productId}/sku/{skuId}/users")
   852  	urls += "?" + c.urlParams_.Encode()
   853  	req, err := http.NewRequest("GET", urls, body)
   854  	if err != nil {
   855  		return nil, err
   856  	}
   857  	req.Header = reqHeaders
   858  	googleapi.Expand(req.URL, map[string]string{
   859  		"productId": c.productId,
   860  		"skuId":     c.skuId,
   861  	})
   862  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   863  }
   864  
   865  // Do executes the "licensing.licenseAssignments.listForProductAndSku" call.
   866  // Any non-2xx status code is an error. Response headers are in either
   867  // *LicenseAssignmentList.ServerResponse.Header or (if a response was returned
   868  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
   869  // check whether the returned error was because http.StatusNotModified was
   870  // returned.
   871  func (c *LicenseAssignmentsListForProductAndSkuCall) Do(opts ...googleapi.CallOption) (*LicenseAssignmentList, error) {
   872  	gensupport.SetOptions(c.urlParams_, opts...)
   873  	res, err := c.doRequest("json")
   874  	if res != nil && res.StatusCode == http.StatusNotModified {
   875  		if res.Body != nil {
   876  			res.Body.Close()
   877  		}
   878  		return nil, gensupport.WrapError(&googleapi.Error{
   879  			Code:   res.StatusCode,
   880  			Header: res.Header,
   881  		})
   882  	}
   883  	if err != nil {
   884  		return nil, err
   885  	}
   886  	defer googleapi.CloseBody(res)
   887  	if err := googleapi.CheckResponse(res); err != nil {
   888  		return nil, gensupport.WrapError(err)
   889  	}
   890  	ret := &LicenseAssignmentList{
   891  		ServerResponse: googleapi.ServerResponse{
   892  			Header:         res.Header,
   893  			HTTPStatusCode: res.StatusCode,
   894  		},
   895  	}
   896  	target := &ret
   897  	if err := gensupport.DecodeResponse(target, res); err != nil {
   898  		return nil, err
   899  	}
   900  	return ret, nil
   901  }
   902  
   903  // Pages invokes f for each page of results.
   904  // A non-nil error returned from f will halt the iteration.
   905  // The provided context supersedes any context provided to the Context method.
   906  func (c *LicenseAssignmentsListForProductAndSkuCall) Pages(ctx context.Context, f func(*LicenseAssignmentList) error) error {
   907  	c.ctx_ = ctx
   908  	defer c.PageToken(c.urlParams_.Get("pageToken"))
   909  	for {
   910  		x, err := c.Do()
   911  		if err != nil {
   912  			return err
   913  		}
   914  		if err := f(x); err != nil {
   915  			return err
   916  		}
   917  		if x.NextPageToken == "" {
   918  			return nil
   919  		}
   920  		c.PageToken(x.NextPageToken)
   921  	}
   922  }
   923  
   924  type LicenseAssignmentsPatchCall struct {
   925  	s                 *Service
   926  	productId         string
   927  	skuId             string
   928  	userId            string
   929  	licenseassignment *LicenseAssignment
   930  	urlParams_        gensupport.URLParams
   931  	ctx_              context.Context
   932  	header_           http.Header
   933  }
   934  
   935  // Patch: Reassign a user's product SKU with a different SKU in the same
   936  // product. This method supports patch semantics.
   937  //
   938  //   - productId: A product's unique identifier. For more information about
   939  //     products in this version of the API, see Products and SKUs.
   940  //   - skuId: A product SKU's unique identifier. For more information about
   941  //     available SKUs in this version of the API, see Products and SKUs.
   942  //   - userId: The user's current primary email address. If the user's email
   943  //     address changes, use the new email address in your API requests. Since a
   944  //     `userId` is subject to change, do not use a `userId` value as a key for
   945  //     persistent data. This key could break if the current user's email address
   946  //     changes. If the `userId` is suspended, the license status changes.
   947  func (r *LicenseAssignmentsService) Patch(productId string, skuId string, userId string, licenseassignment *LicenseAssignment) *LicenseAssignmentsPatchCall {
   948  	c := &LicenseAssignmentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   949  	c.productId = productId
   950  	c.skuId = skuId
   951  	c.userId = userId
   952  	c.licenseassignment = licenseassignment
   953  	return c
   954  }
   955  
   956  // Fields allows partial responses to be retrieved. See
   957  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   958  // details.
   959  func (c *LicenseAssignmentsPatchCall) Fields(s ...googleapi.Field) *LicenseAssignmentsPatchCall {
   960  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   961  	return c
   962  }
   963  
   964  // Context sets the context to be used in this call's Do method.
   965  func (c *LicenseAssignmentsPatchCall) Context(ctx context.Context) *LicenseAssignmentsPatchCall {
   966  	c.ctx_ = ctx
   967  	return c
   968  }
   969  
   970  // Header returns a http.Header that can be modified by the caller to add
   971  // headers to the request.
   972  func (c *LicenseAssignmentsPatchCall) Header() http.Header {
   973  	if c.header_ == nil {
   974  		c.header_ = make(http.Header)
   975  	}
   976  	return c.header_
   977  }
   978  
   979  func (c *LicenseAssignmentsPatchCall) doRequest(alt string) (*http.Response, error) {
   980  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   981  	var body io.Reader = nil
   982  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.licenseassignment)
   983  	if err != nil {
   984  		return nil, err
   985  	}
   986  	c.urlParams_.Set("alt", alt)
   987  	c.urlParams_.Set("prettyPrint", "false")
   988  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/licensing/v1/product/{productId}/sku/{skuId}/user/{userId}")
   989  	urls += "?" + c.urlParams_.Encode()
   990  	req, err := http.NewRequest("PATCH", urls, body)
   991  	if err != nil {
   992  		return nil, err
   993  	}
   994  	req.Header = reqHeaders
   995  	googleapi.Expand(req.URL, map[string]string{
   996  		"productId": c.productId,
   997  		"skuId":     c.skuId,
   998  		"userId":    c.userId,
   999  	})
  1000  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1001  }
  1002  
  1003  // Do executes the "licensing.licenseAssignments.patch" call.
  1004  // Any non-2xx status code is an error. Response headers are in either
  1005  // *LicenseAssignment.ServerResponse.Header or (if a response was returned at
  1006  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1007  // check whether the returned error was because http.StatusNotModified was
  1008  // returned.
  1009  func (c *LicenseAssignmentsPatchCall) Do(opts ...googleapi.CallOption) (*LicenseAssignment, error) {
  1010  	gensupport.SetOptions(c.urlParams_, opts...)
  1011  	res, err := c.doRequest("json")
  1012  	if res != nil && res.StatusCode == http.StatusNotModified {
  1013  		if res.Body != nil {
  1014  			res.Body.Close()
  1015  		}
  1016  		return nil, gensupport.WrapError(&googleapi.Error{
  1017  			Code:   res.StatusCode,
  1018  			Header: res.Header,
  1019  		})
  1020  	}
  1021  	if err != nil {
  1022  		return nil, err
  1023  	}
  1024  	defer googleapi.CloseBody(res)
  1025  	if err := googleapi.CheckResponse(res); err != nil {
  1026  		return nil, gensupport.WrapError(err)
  1027  	}
  1028  	ret := &LicenseAssignment{
  1029  		ServerResponse: googleapi.ServerResponse{
  1030  			Header:         res.Header,
  1031  			HTTPStatusCode: res.StatusCode,
  1032  		},
  1033  	}
  1034  	target := &ret
  1035  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1036  		return nil, err
  1037  	}
  1038  	return ret, nil
  1039  }
  1040  
  1041  type LicenseAssignmentsUpdateCall struct {
  1042  	s                 *Service
  1043  	productId         string
  1044  	skuId             string
  1045  	userId            string
  1046  	licenseassignment *LicenseAssignment
  1047  	urlParams_        gensupport.URLParams
  1048  	ctx_              context.Context
  1049  	header_           http.Header
  1050  }
  1051  
  1052  // Update: Reassign a user's product SKU with a different SKU in the same
  1053  // product.
  1054  //
  1055  //   - productId: A product's unique identifier. For more information about
  1056  //     products in this version of the API, see Products and SKUs.
  1057  //   - skuId: A product SKU's unique identifier. For more information about
  1058  //     available SKUs in this version of the API, see Products and SKUs.
  1059  //   - userId: The user's current primary email address. If the user's email
  1060  //     address changes, use the new email address in your API requests. Since a
  1061  //     `userId` is subject to change, do not use a `userId` value as a key for
  1062  //     persistent data. This key could break if the current user's email address
  1063  //     changes. If the `userId` is suspended, the license status changes.
  1064  func (r *LicenseAssignmentsService) Update(productId string, skuId string, userId string, licenseassignment *LicenseAssignment) *LicenseAssignmentsUpdateCall {
  1065  	c := &LicenseAssignmentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1066  	c.productId = productId
  1067  	c.skuId = skuId
  1068  	c.userId = userId
  1069  	c.licenseassignment = licenseassignment
  1070  	return c
  1071  }
  1072  
  1073  // Fields allows partial responses to be retrieved. See
  1074  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1075  // details.
  1076  func (c *LicenseAssignmentsUpdateCall) Fields(s ...googleapi.Field) *LicenseAssignmentsUpdateCall {
  1077  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1078  	return c
  1079  }
  1080  
  1081  // Context sets the context to be used in this call's Do method.
  1082  func (c *LicenseAssignmentsUpdateCall) Context(ctx context.Context) *LicenseAssignmentsUpdateCall {
  1083  	c.ctx_ = ctx
  1084  	return c
  1085  }
  1086  
  1087  // Header returns a http.Header that can be modified by the caller to add
  1088  // headers to the request.
  1089  func (c *LicenseAssignmentsUpdateCall) Header() http.Header {
  1090  	if c.header_ == nil {
  1091  		c.header_ = make(http.Header)
  1092  	}
  1093  	return c.header_
  1094  }
  1095  
  1096  func (c *LicenseAssignmentsUpdateCall) doRequest(alt string) (*http.Response, error) {
  1097  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1098  	var body io.Reader = nil
  1099  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.licenseassignment)
  1100  	if err != nil {
  1101  		return nil, err
  1102  	}
  1103  	c.urlParams_.Set("alt", alt)
  1104  	c.urlParams_.Set("prettyPrint", "false")
  1105  	urls := googleapi.ResolveRelative(c.s.BasePath, "apps/licensing/v1/product/{productId}/sku/{skuId}/user/{userId}")
  1106  	urls += "?" + c.urlParams_.Encode()
  1107  	req, err := http.NewRequest("PUT", urls, body)
  1108  	if err != nil {
  1109  		return nil, err
  1110  	}
  1111  	req.Header = reqHeaders
  1112  	googleapi.Expand(req.URL, map[string]string{
  1113  		"productId": c.productId,
  1114  		"skuId":     c.skuId,
  1115  		"userId":    c.userId,
  1116  	})
  1117  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1118  }
  1119  
  1120  // Do executes the "licensing.licenseAssignments.update" call.
  1121  // Any non-2xx status code is an error. Response headers are in either
  1122  // *LicenseAssignment.ServerResponse.Header or (if a response was returned at
  1123  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1124  // check whether the returned error was because http.StatusNotModified was
  1125  // returned.
  1126  func (c *LicenseAssignmentsUpdateCall) Do(opts ...googleapi.CallOption) (*LicenseAssignment, error) {
  1127  	gensupport.SetOptions(c.urlParams_, opts...)
  1128  	res, err := c.doRequest("json")
  1129  	if res != nil && res.StatusCode == http.StatusNotModified {
  1130  		if res.Body != nil {
  1131  			res.Body.Close()
  1132  		}
  1133  		return nil, gensupport.WrapError(&googleapi.Error{
  1134  			Code:   res.StatusCode,
  1135  			Header: res.Header,
  1136  		})
  1137  	}
  1138  	if err != nil {
  1139  		return nil, err
  1140  	}
  1141  	defer googleapi.CloseBody(res)
  1142  	if err := googleapi.CheckResponse(res); err != nil {
  1143  		return nil, gensupport.WrapError(err)
  1144  	}
  1145  	ret := &LicenseAssignment{
  1146  		ServerResponse: googleapi.ServerResponse{
  1147  			Header:         res.Header,
  1148  			HTTPStatusCode: res.StatusCode,
  1149  		},
  1150  	}
  1151  	target := &ret
  1152  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1153  		return nil, err
  1154  	}
  1155  	return ret, nil
  1156  }
  1157  

View as plain text