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

1338 lines
42 KiB

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