{-# 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.Internal.Product
-- 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)
module Gogol.AppsLicensing.Internal.Product
  ( -- * Empty
    Empty (..),
    newEmpty,

    -- * LicenseAssignment
    LicenseAssignment (..),
    newLicenseAssignment,

    -- * LicenseAssignmentInsert
    LicenseAssignmentInsert (..),
    newLicenseAssignmentInsert,

    -- * LicenseAssignmentList
    LicenseAssignmentList (..),
    newLicenseAssignmentList,
  )
where

import Gogol.AppsLicensing.Internal.Sum
import Gogol.Prelude qualified as Core

-- | A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
--
-- /See:/ 'newEmpty' smart constructor.
data Empty = Empty
  deriving (Empty -> Empty -> Bool
(Empty -> Empty -> Bool) -> (Empty -> Empty -> Bool) -> Eq Empty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Empty -> Empty -> Bool
== :: Empty -> Empty -> Bool
$c/= :: Empty -> Empty -> Bool
/= :: Empty -> Empty -> Bool
Core.Eq, Int -> Empty -> ShowS
[Empty] -> ShowS
Empty -> String
(Int -> Empty -> ShowS)
-> (Empty -> String) -> ([Empty] -> ShowS) -> Show Empty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Empty -> ShowS
showsPrec :: Int -> Empty -> ShowS
$cshow :: Empty -> String
show :: Empty -> String
$cshowList :: [Empty] -> ShowS
showList :: [Empty] -> ShowS
Core.Show, (forall x. Empty -> Rep Empty x)
-> (forall x. Rep Empty x -> Empty) -> Generic Empty
forall x. Rep Empty x -> Empty
forall x. Empty -> Rep Empty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Empty -> Rep Empty x
from :: forall x. Empty -> Rep Empty x
$cto :: forall x. Rep Empty x -> Empty
to :: forall x. Rep Empty x -> Empty
Core.Generic)

-- | Creates a value of 'Empty' with the minimum fields required to make a request.
newEmpty ::
  Empty
newEmpty :: Empty
newEmpty = Empty
Empty

instance Core.FromJSON Empty where
  parseJSON :: Value -> Parser Empty
parseJSON = String -> (Object -> Parser Empty) -> Value -> Parser Empty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject String
"Empty" (\Object
o -> Empty -> Parser Empty
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
Core.pure Empty
Empty)

instance Core.ToJSON Empty where
  toJSON :: Empty -> Value
toJSON = Value -> Empty -> Value
forall a b. a -> b -> a
Core.const Value
Core.emptyObject

-- | Representation of a license assignment.
--
-- /See:/ 'newLicenseAssignment' smart constructor.
data LicenseAssignment = LicenseAssignment
  { -- | ETag of the resource.
    LicenseAssignment -> Maybe Text
etags :: (Core.Maybe Core.Text),
    -- | Identifies the resource as a LicenseAssignment, which is @licensing#licenseAssignment@.
    LicenseAssignment -> Text
kind :: Core.Text,
    -- | A product\'s unique identifier. For more information about products in this version of the API, see Product and SKU IDs.
    LicenseAssignment -> Maybe Text
productId :: (Core.Maybe Core.Text),
    -- | Display Name of the product.
    LicenseAssignment -> Maybe Text
productName :: (Core.Maybe Core.Text),
    -- | Link to this page.
    LicenseAssignment -> Maybe Text
selfLink :: (Core.Maybe Core.Text),
    -- | A product SKU\'s unique identifier. For more information about available SKUs in this version of the API, see Products and SKUs.
    LicenseAssignment -> Maybe Text
skuId :: (Core.Maybe Core.Text),
    -- | Display Name of the sku of the product.
    LicenseAssignment -> Maybe Text
skuName :: (Core.Maybe Core.Text),
    -- | The user\'s current primary email address. If the user\'s email address changes, use the new email address in your API requests. Since a @userId@ is subject to change, do not use a @userId@ value as a key for persistent data. This key could break if the current user\'s email address changes. If the @userId@ is suspended, the license status changes.
    LicenseAssignment -> Maybe Text
userId :: (Core.Maybe Core.Text)
  }
  deriving (LicenseAssignment -> LicenseAssignment -> Bool
(LicenseAssignment -> LicenseAssignment -> Bool)
-> (LicenseAssignment -> LicenseAssignment -> Bool)
-> Eq LicenseAssignment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LicenseAssignment -> LicenseAssignment -> Bool
== :: LicenseAssignment -> LicenseAssignment -> Bool
$c/= :: LicenseAssignment -> LicenseAssignment -> Bool
/= :: LicenseAssignment -> LicenseAssignment -> Bool
Core.Eq, Int -> LicenseAssignment -> ShowS
[LicenseAssignment] -> ShowS
LicenseAssignment -> String
(Int -> LicenseAssignment -> ShowS)
-> (LicenseAssignment -> String)
-> ([LicenseAssignment] -> ShowS)
-> Show LicenseAssignment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LicenseAssignment -> ShowS
showsPrec :: Int -> LicenseAssignment -> ShowS
$cshow :: LicenseAssignment -> String
show :: LicenseAssignment -> String
$cshowList :: [LicenseAssignment] -> ShowS
showList :: [LicenseAssignment] -> ShowS
Core.Show, (forall x. LicenseAssignment -> Rep LicenseAssignment x)
-> (forall x. Rep LicenseAssignment x -> LicenseAssignment)
-> Generic LicenseAssignment
forall x. Rep LicenseAssignment x -> LicenseAssignment
forall x. LicenseAssignment -> Rep LicenseAssignment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LicenseAssignment -> Rep LicenseAssignment x
from :: forall x. LicenseAssignment -> Rep LicenseAssignment x
$cto :: forall x. Rep LicenseAssignment x -> LicenseAssignment
to :: forall x. Rep LicenseAssignment x -> LicenseAssignment
Core.Generic)

-- | Creates a value of 'LicenseAssignment' with the minimum fields required to make a request.
newLicenseAssignment ::
  LicenseAssignment
newLicenseAssignment :: LicenseAssignment
newLicenseAssignment =
  LicenseAssignment
    { etags :: Maybe Text
etags = Maybe Text
forall a. Maybe a
Core.Nothing,
      kind :: Text
kind = Text
"licensing#licenseAssignment",
      productId :: Maybe Text
productId = Maybe Text
forall a. Maybe a
Core.Nothing,
      productName :: Maybe Text
productName = Maybe Text
forall a. Maybe a
Core.Nothing,
      selfLink :: Maybe Text
selfLink = Maybe Text
forall a. Maybe a
Core.Nothing,
      skuId :: Maybe Text
skuId = Maybe Text
forall a. Maybe a
Core.Nothing,
      skuName :: Maybe Text
skuName = Maybe Text
forall a. Maybe a
Core.Nothing,
      userId :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Core.Nothing
    }

instance Core.FromJSON LicenseAssignment where
  parseJSON :: Value -> Parser LicenseAssignment
parseJSON =
    String
-> (Object -> Parser LicenseAssignment)
-> Value
-> Parser LicenseAssignment
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LicenseAssignment"
      ( \Object
o ->
          Maybe Text
-> Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> LicenseAssignment
LicenseAssignment
            (Maybe Text
 -> Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> LicenseAssignment)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> LicenseAssignment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"etags")
            Parser
  (Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> LicenseAssignment)
-> Parser Text
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> LicenseAssignment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"kind" Parser (Maybe Text) -> Text -> Parser Text
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Text
"licensing#licenseAssignment")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> LicenseAssignment)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> LicenseAssignment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"productId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> LicenseAssignment)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> LicenseAssignment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"productName")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> LicenseAssignment)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> LicenseAssignment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"selfLink")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> LicenseAssignment)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> LicenseAssignment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"skuId")
            Parser (Maybe Text -> Maybe Text -> LicenseAssignment)
-> Parser (Maybe Text) -> Parser (Maybe Text -> LicenseAssignment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"skuName")
            Parser (Maybe Text -> LicenseAssignment)
-> Parser (Maybe Text) -> Parser LicenseAssignment
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"userId")
      )

instance Core.ToJSON LicenseAssignment where
  toJSON :: LicenseAssignment -> Value
toJSON LicenseAssignment {Maybe Text
Text
etags :: LicenseAssignment -> Maybe Text
kind :: LicenseAssignment -> Text
productId :: LicenseAssignment -> Maybe Text
productName :: LicenseAssignment -> Maybe Text
selfLink :: LicenseAssignment -> Maybe Text
skuId :: LicenseAssignment -> Maybe Text
skuName :: LicenseAssignment -> Maybe Text
userId :: LicenseAssignment -> Maybe Text
etags :: Maybe Text
kind :: Text
productId :: Maybe Text
productName :: Maybe Text
selfLink :: Maybe Text
skuId :: Maybe Text
skuName :: Maybe Text
userId :: Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Core.catMaybes
          [ (Key
"etags" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
etags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Core.Just (Key
"kind" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Core..= Text
kind),
            (Key
"productId" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
productId,
            (Key
"productName" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
productName,
            (Key
"selfLink" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
selfLink,
            (Key
"skuId" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
skuId,
            (Key
"skuName" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
skuName,
            (Key
"userId" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
userId
          ]
      )

-- | Representation of a license assignment.
--
-- /See:/ 'newLicenseAssignmentInsert' smart constructor.
newtype LicenseAssignmentInsert = LicenseAssignmentInsert
  { -- | Email id of the user
    LicenseAssignmentInsert -> Maybe Text
userId :: (Core.Maybe Core.Text)
  }
  deriving (LicenseAssignmentInsert -> LicenseAssignmentInsert -> Bool
(LicenseAssignmentInsert -> LicenseAssignmentInsert -> Bool)
-> (LicenseAssignmentInsert -> LicenseAssignmentInsert -> Bool)
-> Eq LicenseAssignmentInsert
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LicenseAssignmentInsert -> LicenseAssignmentInsert -> Bool
== :: LicenseAssignmentInsert -> LicenseAssignmentInsert -> Bool
$c/= :: LicenseAssignmentInsert -> LicenseAssignmentInsert -> Bool
/= :: LicenseAssignmentInsert -> LicenseAssignmentInsert -> Bool
Core.Eq, Int -> LicenseAssignmentInsert -> ShowS
[LicenseAssignmentInsert] -> ShowS
LicenseAssignmentInsert -> String
(Int -> LicenseAssignmentInsert -> ShowS)
-> (LicenseAssignmentInsert -> String)
-> ([LicenseAssignmentInsert] -> ShowS)
-> Show LicenseAssignmentInsert
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LicenseAssignmentInsert -> ShowS
showsPrec :: Int -> LicenseAssignmentInsert -> ShowS
$cshow :: LicenseAssignmentInsert -> String
show :: LicenseAssignmentInsert -> String
$cshowList :: [LicenseAssignmentInsert] -> ShowS
showList :: [LicenseAssignmentInsert] -> ShowS
Core.Show, (forall x.
 LicenseAssignmentInsert -> Rep LicenseAssignmentInsert x)
-> (forall x.
    Rep LicenseAssignmentInsert x -> LicenseAssignmentInsert)
-> Generic LicenseAssignmentInsert
forall x. Rep LicenseAssignmentInsert x -> LicenseAssignmentInsert
forall x. LicenseAssignmentInsert -> Rep LicenseAssignmentInsert x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LicenseAssignmentInsert -> Rep LicenseAssignmentInsert x
from :: forall x. LicenseAssignmentInsert -> Rep LicenseAssignmentInsert x
$cto :: forall x. Rep LicenseAssignmentInsert x -> LicenseAssignmentInsert
to :: forall x. Rep LicenseAssignmentInsert x -> LicenseAssignmentInsert
Core.Generic)

-- | Creates a value of 'LicenseAssignmentInsert' with the minimum fields required to make a request.
newLicenseAssignmentInsert ::
  LicenseAssignmentInsert
newLicenseAssignmentInsert :: LicenseAssignmentInsert
newLicenseAssignmentInsert =
  LicenseAssignmentInsert {userId :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Core.Nothing}

instance Core.FromJSON LicenseAssignmentInsert where
  parseJSON :: Value -> Parser LicenseAssignmentInsert
parseJSON =
    String
-> (Object -> Parser LicenseAssignmentInsert)
-> Value
-> Parser LicenseAssignmentInsert
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LicenseAssignmentInsert"
      (\Object
o -> Maybe Text -> LicenseAssignmentInsert
LicenseAssignmentInsert (Maybe Text -> LicenseAssignmentInsert)
-> Parser (Maybe Text) -> Parser LicenseAssignmentInsert
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"userId"))

instance Core.ToJSON LicenseAssignmentInsert where
  toJSON :: LicenseAssignmentInsert -> Value
toJSON LicenseAssignmentInsert {Maybe Text
userId :: LicenseAssignmentInsert -> Maybe Text
userId :: Maybe Text
..} =
    [Pair] -> Value
Core.object ([Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Core.catMaybes [(Key
"userId" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
userId])

--
-- /See:/ 'newLicenseAssignmentList' smart constructor.
data LicenseAssignmentList = LicenseAssignmentList
  { -- | ETag of the resource.
    LicenseAssignmentList -> Maybe Text
etag :: (Core.Maybe Core.Text),
    -- | The LicenseAssignments in this page of results.
    LicenseAssignmentList -> Maybe [LicenseAssignment]
items :: (Core.Maybe [LicenseAssignment]),
    -- | Identifies the resource as a collection of LicenseAssignments.
    LicenseAssignmentList -> Text
kind :: Core.Text,
    -- | The token that you must submit in a subsequent request to retrieve additional license results matching your query parameters. The @maxResults@ query string is related to the @nextPageToken@ since @maxResults@ determines how many entries are returned on each next page.
    LicenseAssignmentList -> Maybe Text
nextPageToken :: (Core.Maybe Core.Text)
  }
  deriving (LicenseAssignmentList -> LicenseAssignmentList -> Bool
(LicenseAssignmentList -> LicenseAssignmentList -> Bool)
-> (LicenseAssignmentList -> LicenseAssignmentList -> Bool)
-> Eq LicenseAssignmentList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LicenseAssignmentList -> LicenseAssignmentList -> Bool
== :: LicenseAssignmentList -> LicenseAssignmentList -> Bool
$c/= :: LicenseAssignmentList -> LicenseAssignmentList -> Bool
/= :: LicenseAssignmentList -> LicenseAssignmentList -> Bool
Core.Eq, Int -> LicenseAssignmentList -> ShowS
[LicenseAssignmentList] -> ShowS
LicenseAssignmentList -> String
(Int -> LicenseAssignmentList -> ShowS)
-> (LicenseAssignmentList -> String)
-> ([LicenseAssignmentList] -> ShowS)
-> Show LicenseAssignmentList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LicenseAssignmentList -> ShowS
showsPrec :: Int -> LicenseAssignmentList -> ShowS
$cshow :: LicenseAssignmentList -> String
show :: LicenseAssignmentList -> String
$cshowList :: [LicenseAssignmentList] -> ShowS
showList :: [LicenseAssignmentList] -> ShowS
Core.Show, (forall x. LicenseAssignmentList -> Rep LicenseAssignmentList x)
-> (forall x. Rep LicenseAssignmentList x -> LicenseAssignmentList)
-> Generic LicenseAssignmentList
forall x. Rep LicenseAssignmentList x -> LicenseAssignmentList
forall x. LicenseAssignmentList -> Rep LicenseAssignmentList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. LicenseAssignmentList -> Rep LicenseAssignmentList x
from :: forall x. LicenseAssignmentList -> Rep LicenseAssignmentList x
$cto :: forall x. Rep LicenseAssignmentList x -> LicenseAssignmentList
to :: forall x. Rep LicenseAssignmentList x -> LicenseAssignmentList
Core.Generic)

-- | Creates a value of 'LicenseAssignmentList' with the minimum fields required to make a request.
newLicenseAssignmentList ::
  LicenseAssignmentList
newLicenseAssignmentList :: LicenseAssignmentList
newLicenseAssignmentList =
  LicenseAssignmentList
    { etag :: Maybe Text
etag = Maybe Text
forall a. Maybe a
Core.Nothing,
      items :: Maybe [LicenseAssignment]
items = Maybe [LicenseAssignment]
forall a. Maybe a
Core.Nothing,
      kind :: Text
kind = Text
"licensing#licenseAssignmentList",
      nextPageToken :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Core.Nothing
    }

instance Core.FromJSON LicenseAssignmentList where
  parseJSON :: Value -> Parser LicenseAssignmentList
parseJSON =
    String
-> (Object -> Parser LicenseAssignmentList)
-> Value
-> Parser LicenseAssignmentList
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LicenseAssignmentList"
      ( \Object
o ->
          Maybe Text
-> Maybe [LicenseAssignment]
-> Text
-> Maybe Text
-> LicenseAssignmentList
LicenseAssignmentList
            (Maybe Text
 -> Maybe [LicenseAssignment]
 -> Text
 -> Maybe Text
 -> LicenseAssignmentList)
-> Parser (Maybe Text)
-> Parser
     (Maybe [LicenseAssignment]
      -> Text -> Maybe Text -> LicenseAssignmentList)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"etag")
            Parser
  (Maybe [LicenseAssignment]
   -> Text -> Maybe Text -> LicenseAssignmentList)
-> Parser (Maybe [LicenseAssignment])
-> Parser (Text -> Maybe Text -> LicenseAssignmentList)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe [LicenseAssignment])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"items")
            Parser (Text -> Maybe Text -> LicenseAssignmentList)
-> Parser Text -> Parser (Maybe Text -> LicenseAssignmentList)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"kind" Parser (Maybe Text) -> Text -> Parser Text
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Text
"licensing#licenseAssignmentList")
            Parser (Maybe Text -> LicenseAssignmentList)
-> Parser (Maybe Text) -> Parser LicenseAssignmentList
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Core.<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Core..:? Key
"nextPageToken")
      )

instance Core.ToJSON LicenseAssignmentList where
  toJSON :: LicenseAssignmentList -> Value
toJSON LicenseAssignmentList {Maybe [LicenseAssignment]
Maybe Text
Text
etag :: LicenseAssignmentList -> Maybe Text
items :: LicenseAssignmentList -> Maybe [LicenseAssignment]
kind :: LicenseAssignmentList -> Text
nextPageToken :: LicenseAssignmentList -> Maybe Text
etag :: Maybe Text
items :: Maybe [LicenseAssignment]
kind :: Text
nextPageToken :: Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Core.catMaybes
          [ (Key
"etag" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
etag,
            (Key
"items" Core..=) ([LicenseAssignment] -> Pair)
-> Maybe [LicenseAssignment] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe [LicenseAssignment]
items,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Core.Just (Key
"kind" Key -> Text -> Pair
forall v. ToJSON v => Key -> v -> Pair
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
Core..= Text
kind),
            (Key
"nextPageToken" Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Core.<$> Maybe Text
nextPageToken
          ]
      )