{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- |
-- Module      : Gogol.AppsLicensing.Licensing.LicenseAssignments.Insert
-- Copyright   : (c) 2015-2025 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+gogol@gmail.com>
--               Toni Cebrián <toni@tonicebrian.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Assign a license.
--
-- /See:/ <https://developers.google.com/admin-sdk/licensing/ Enterprise License Manager API Reference> for @licensing.licenseAssignments.insert@.
module Gogol.AppsLicensing.Licensing.LicenseAssignments.Insert
  ( -- * Resource
    LicensingLicenseAssignmentsInsertResource,

    -- ** Constructing a Request
    LicensingLicenseAssignmentsInsert (..),
    newLicensingLicenseAssignmentsInsert,
  )
where

import Gogol.AppsLicensing.Types
import Gogol.Prelude qualified as Core

-- | A resource alias for @licensing.licenseAssignments.insert@ method which the
-- 'LicensingLicenseAssignmentsInsert' request conforms to.
type LicensingLicenseAssignmentsInsertResource =
  "apps"
    Core.:> "licensing"
    Core.:> "v1"
    Core.:> "product"
    Core.:> Core.Capture "productId" Core.Text
    Core.:> "sku"
    Core.:> Core.Capture "skuId" Core.Text
    Core.:> "user"
    Core.:> Core.QueryParam "$.xgafv" Xgafv
    Core.:> Core.QueryParam "access_token" Core.Text
    Core.:> Core.QueryParam "callback" Core.Text
    Core.:> Core.QueryParam "uploadType" Core.Text
    Core.:> Core.QueryParam "upload_protocol" Core.Text
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.ReqBody '[Core.JSON] LicenseAssignmentInsert
    Core.:> Core.Post '[Core.JSON] LicenseAssignment

-- | Assign a license.
--
-- /See:/ 'newLicensingLicenseAssignmentsInsert' smart constructor.
data LicensingLicenseAssignmentsInsert = LicensingLicenseAssignmentsInsert
  { -- | V1 error format.
    LicensingLicenseAssignmentsInsert -> Maybe Xgafv
xgafv :: (Core.Maybe Xgafv),
    -- | OAuth access token.
    LicensingLicenseAssignmentsInsert -> Maybe Text
accessToken :: (Core.Maybe Core.Text),
    -- | JSONP
    LicensingLicenseAssignmentsInsert -> Maybe Text
callback :: (Core.Maybe Core.Text),
    -- | Multipart request metadata.
    LicensingLicenseAssignmentsInsert -> LicenseAssignmentInsert
payload :: LicenseAssignmentInsert,
    -- | A product\'s unique identifier. For more information about products in this version of the API, see Products and SKUs.
    LicensingLicenseAssignmentsInsert -> Text
productId :: Core.Text,
    -- | A product SKU\'s unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
    LicensingLicenseAssignmentsInsert -> Text
skuId :: Core.Text,
    -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
    LicensingLicenseAssignmentsInsert -> Maybe Text
uploadType :: (Core.Maybe Core.Text),
    -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
    LicensingLicenseAssignmentsInsert -> Maybe Text
uploadProtocol :: (Core.Maybe Core.Text)
  }
  deriving (LicensingLicenseAssignmentsInsert
-> LicensingLicenseAssignmentsInsert -> Bool
(LicensingLicenseAssignmentsInsert
 -> LicensingLicenseAssignmentsInsert -> Bool)
-> (LicensingLicenseAssignmentsInsert
    -> LicensingLicenseAssignmentsInsert -> Bool)
-> Eq LicensingLicenseAssignmentsInsert
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LicensingLicenseAssignmentsInsert
-> LicensingLicenseAssignmentsInsert -> Bool
== :: LicensingLicenseAssignmentsInsert
-> LicensingLicenseAssignmentsInsert -> Bool
$c/= :: LicensingLicenseAssignmentsInsert
-> LicensingLicenseAssignmentsInsert -> Bool
/= :: LicensingLicenseAssignmentsInsert
-> LicensingLicenseAssignmentsInsert -> Bool
Core.Eq, Int -> LicensingLicenseAssignmentsInsert -> ShowS
[LicensingLicenseAssignmentsInsert] -> ShowS
LicensingLicenseAssignmentsInsert -> String
(Int -> LicensingLicenseAssignmentsInsert -> ShowS)
-> (LicensingLicenseAssignmentsInsert -> String)
-> ([LicensingLicenseAssignmentsInsert] -> ShowS)
-> Show LicensingLicenseAssignmentsInsert
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LicensingLicenseAssignmentsInsert -> ShowS
showsPrec :: Int -> LicensingLicenseAssignmentsInsert -> ShowS
$cshow :: LicensingLicenseAssignmentsInsert -> String
show :: LicensingLicenseAssignmentsInsert -> String
$cshowList :: [LicensingLicenseAssignmentsInsert] -> ShowS
showList :: [LicensingLicenseAssignmentsInsert] -> ShowS
Core.Show, (forall x.
 LicensingLicenseAssignmentsInsert
 -> Rep LicensingLicenseAssignmentsInsert x)
-> (forall x.
    Rep LicensingLicenseAssignmentsInsert x
    -> LicensingLicenseAssignmentsInsert)
-> Generic LicensingLicenseAssignmentsInsert
forall x.
Rep LicensingLicenseAssignmentsInsert x
-> LicensingLicenseAssignmentsInsert
forall x.
LicensingLicenseAssignmentsInsert
-> Rep LicensingLicenseAssignmentsInsert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
LicensingLicenseAssignmentsInsert
-> Rep LicensingLicenseAssignmentsInsert x
from :: forall x.
LicensingLicenseAssignmentsInsert
-> Rep LicensingLicenseAssignmentsInsert x
$cto :: forall x.
Rep LicensingLicenseAssignmentsInsert x
-> LicensingLicenseAssignmentsInsert
to :: forall x.
Rep LicensingLicenseAssignmentsInsert x
-> LicensingLicenseAssignmentsInsert
Core.Generic)

-- | Creates a value of 'LicensingLicenseAssignmentsInsert' with the minimum fields required to make a request.
newLicensingLicenseAssignmentsInsert ::
  -- |  Multipart request metadata. See 'payload'.
  LicenseAssignmentInsert ->
  -- |  A product\'s unique identifier. For more information about products in this version of the API, see Products and SKUs. See 'productId'.
  Core.Text ->
  -- |  A product SKU\'s unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs. See 'skuId'.
  Core.Text ->
  LicensingLicenseAssignmentsInsert
newLicensingLicenseAssignmentsInsert :: LicenseAssignmentInsert
-> Text -> Text -> LicensingLicenseAssignmentsInsert
newLicensingLicenseAssignmentsInsert LicenseAssignmentInsert
payload Text
productId Text
skuId =
  LicensingLicenseAssignmentsInsert
    { xgafv :: Maybe Xgafv
xgafv = Maybe Xgafv
forall a. Maybe a
Core.Nothing,
      accessToken :: Maybe Text
accessToken = Maybe Text
forall a. Maybe a
Core.Nothing,
      callback :: Maybe Text
callback = Maybe Text
forall a. Maybe a
Core.Nothing,
      payload :: LicenseAssignmentInsert
payload = LicenseAssignmentInsert
payload,
      productId :: Text
productId = Text
productId,
      skuId :: Text
skuId = Text
skuId,
      uploadType :: Maybe Text
uploadType = Maybe Text
forall a. Maybe a
Core.Nothing,
      uploadProtocol :: Maybe Text
uploadProtocol = Maybe Text
forall a. Maybe a
Core.Nothing
    }

instance Core.GoogleRequest LicensingLicenseAssignmentsInsert where
  type Rs LicensingLicenseAssignmentsInsert = LicenseAssignment
  type Scopes LicensingLicenseAssignmentsInsert = '[Apps'Licensing]
  requestClient :: LicensingLicenseAssignmentsInsert
-> GClient (Rs LicensingLicenseAssignmentsInsert)
requestClient LicensingLicenseAssignmentsInsert {Maybe Text
Maybe Xgafv
Text
LicenseAssignmentInsert
xgafv :: LicensingLicenseAssignmentsInsert -> Maybe Xgafv
accessToken :: LicensingLicenseAssignmentsInsert -> Maybe Text
callback :: LicensingLicenseAssignmentsInsert -> Maybe Text
payload :: LicensingLicenseAssignmentsInsert -> LicenseAssignmentInsert
productId :: LicensingLicenseAssignmentsInsert -> Text
skuId :: LicensingLicenseAssignmentsInsert -> Text
uploadType :: LicensingLicenseAssignmentsInsert -> Maybe Text
uploadProtocol :: LicensingLicenseAssignmentsInsert -> Maybe Text
xgafv :: Maybe Xgafv
accessToken :: Maybe Text
callback :: Maybe Text
payload :: LicenseAssignmentInsert
productId :: Text
skuId :: Text
uploadType :: Maybe Text
uploadProtocol :: Maybe Text
..} =
    Text
-> Text
-> Maybe Xgafv
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AltJSON
-> LicenseAssignmentInsert
-> ServiceConfig
-> GClient LicenseAssignment
go
      Text
productId
      Text
skuId
      Maybe Xgafv
xgafv
      Maybe Text
accessToken
      Maybe Text
callback
      Maybe Text
uploadType
      Maybe Text
uploadProtocol
      (AltJSON -> Maybe AltJSON
forall a. a -> Maybe a
Core.Just AltJSON
Core.AltJSON)
      LicenseAssignmentInsert
payload
      ServiceConfig
appsLicensingService
    where
      go :: Fn LicensingLicenseAssignmentsInsertResource
go =
        Proxy LicensingLicenseAssignmentsInsertResource
-> Request -> Fn LicensingLicenseAssignmentsInsertResource
forall {k} (fn :: k).
GoogleClient fn =>
Proxy fn -> Request -> Fn fn
Core.buildClient
          ( Proxy LicensingLicenseAssignmentsInsertResource
forall {k} (t :: k). Proxy t
Core.Proxy ::
              Core.Proxy LicensingLicenseAssignmentsInsertResource
          )
          Request
forall a. Monoid a => a
Core.mempty