{-
   Generative Language API

   The Gemini API allows developers to build generative AI applications using Gemini models. Gemini is our most capable model, built from the ground up to be multimodal. It can generalize and seamlessly understand, operate across, and combine different types of information including language, images, audio, video, and code. You can use the Gemini API for use cases like reasoning across text and images, content generation, dialogue agents, summarization and classification systems, and more.

   OpenAPI Version: 3.0.3
   Generative Language API API version: v1beta
   Generated by OpenAPI Generator (https://openapi-generator.tech)
-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-matches -fno-warn-unused-binds -fno-warn-unused-imports #-}

{- |
Module : GenAI.Client.Model
-}
module GenAI.Client.Model where

import GenAI.Client.Core
import GenAI.Client.MimeTypes

import Data.Aeson ((.:), (.:!), (.:?), (.=))

import Control.Arrow qualified as P (left)
import Data.Aeson qualified as A
import Data.ByteString qualified as B
import Data.ByteString.Base64 qualified as B64
import Data.ByteString.Char8 qualified as BC
import Data.ByteString.Lazy qualified as BL
import Data.Data qualified as P (TypeRep, Typeable, typeOf, typeRep)
import Data.Foldable qualified as P
import Data.HashMap.Lazy qualified as HM
import Data.Map qualified as Map
import Data.Maybe qualified as P
import Data.Set qualified as Set
import Data.Text qualified as T
import Data.Text.Encoding qualified as T
import Data.Time qualified as TI
import Lens.Micro qualified as L
import Web.FormUrlEncoded qualified as WH
import Web.HttpApiData qualified as WH

import Control.Applicative (Alternative, (<|>))
import Data.Function ((&))
import Data.Monoid ((<>))
import Data.Text (Text)
import Prelude (Applicative, Bool (..), Char, Double, FilePath, Float, Functor, Int, Integer, Maybe (..), Monad, String, fmap, maybe, mempty, pure, undefined, ($), (.), (/=), (<$>), (<*>), (=<<), (>>=))

import Prelude qualified as P

-- * Parameter newtypes

-- ** Alt
newtype Alt = Alt {Alt -> E'Alt
unAlt :: E'Alt} deriving (Alt -> Alt -> Bool
(Alt -> Alt -> Bool) -> (Alt -> Alt -> Bool) -> Eq Alt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Alt -> Alt -> Bool
== :: Alt -> Alt -> Bool
$c/= :: Alt -> Alt -> Bool
/= :: Alt -> Alt -> Bool
P.Eq, Int -> Alt -> ShowS
[Alt] -> ShowS
Alt -> [Char]
(Int -> Alt -> ShowS)
-> (Alt -> [Char]) -> ([Alt] -> ShowS) -> Show Alt
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Alt -> ShowS
showsPrec :: Int -> Alt -> ShowS
$cshow :: Alt -> [Char]
show :: Alt -> [Char]
$cshowList :: [Alt] -> ShowS
showList :: [Alt] -> ShowS
P.Show)

-- ** Callback
newtype Callback = Callback {Callback -> Text
unCallback :: Text} deriving (Callback -> Callback -> Bool
(Callback -> Callback -> Bool)
-> (Callback -> Callback -> Bool) -> Eq Callback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Callback -> Callback -> Bool
== :: Callback -> Callback -> Bool
$c/= :: Callback -> Callback -> Bool
/= :: Callback -> Callback -> Bool
P.Eq, Int -> Callback -> ShowS
[Callback] -> ShowS
Callback -> [Char]
(Int -> Callback -> ShowS)
-> (Callback -> [Char]) -> ([Callback] -> ShowS) -> Show Callback
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Callback -> ShowS
showsPrec :: Int -> Callback -> ShowS
$cshow :: Callback -> [Char]
show :: Callback -> [Char]
$cshowList :: [Callback] -> ShowS
showList :: [Callback] -> ShowS
P.Show)

-- ** Chunk2
newtype Chunk2 = Chunk2 {Chunk2 -> Text
unChunk2 :: Text} deriving (Chunk2 -> Chunk2 -> Bool
(Chunk2 -> Chunk2 -> Bool)
-> (Chunk2 -> Chunk2 -> Bool) -> Eq Chunk2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Chunk2 -> Chunk2 -> Bool
== :: Chunk2 -> Chunk2 -> Bool
$c/= :: Chunk2 -> Chunk2 -> Bool
/= :: Chunk2 -> Chunk2 -> Bool
P.Eq, Int -> Chunk2 -> ShowS
[Chunk2] -> ShowS
Chunk2 -> [Char]
(Int -> Chunk2 -> ShowS)
-> (Chunk2 -> [Char]) -> ([Chunk2] -> ShowS) -> Show Chunk2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Chunk2 -> ShowS
showsPrec :: Int -> Chunk2 -> ShowS
$cshow :: Chunk2 -> [Char]
show :: Chunk2 -> [Char]
$cshowList :: [Chunk2] -> ShowS
showList :: [Chunk2] -> ShowS
P.Show)

-- ** Corpus2
newtype Corpus2 = Corpus2 {Corpus2 -> Text
unCorpus2 :: Text} deriving (Corpus2 -> Corpus2 -> Bool
(Corpus2 -> Corpus2 -> Bool)
-> (Corpus2 -> Corpus2 -> Bool) -> Eq Corpus2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Corpus2 -> Corpus2 -> Bool
== :: Corpus2 -> Corpus2 -> Bool
$c/= :: Corpus2 -> Corpus2 -> Bool
/= :: Corpus2 -> Corpus2 -> Bool
P.Eq, Int -> Corpus2 -> ShowS
[Corpus2] -> ShowS
Corpus2 -> [Char]
(Int -> Corpus2 -> ShowS)
-> (Corpus2 -> [Char]) -> ([Corpus2] -> ShowS) -> Show Corpus2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Corpus2 -> ShowS
showsPrec :: Int -> Corpus2 -> ShowS
$cshow :: Corpus2 -> [Char]
show :: Corpus2 -> [Char]
$cshowList :: [Corpus2] -> ShowS
showList :: [Corpus2] -> ShowS
P.Show)

-- ** Document2
newtype Document2 = Document2 {Document2 -> Text
unDocument2 :: Text} deriving (Document2 -> Document2 -> Bool
(Document2 -> Document2 -> Bool)
-> (Document2 -> Document2 -> Bool) -> Eq Document2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Document2 -> Document2 -> Bool
== :: Document2 -> Document2 -> Bool
$c/= :: Document2 -> Document2 -> Bool
/= :: Document2 -> Document2 -> Bool
P.Eq, Int -> Document2 -> ShowS
[Document2] -> ShowS
Document2 -> [Char]
(Int -> Document2 -> ShowS)
-> (Document2 -> [Char])
-> ([Document2] -> ShowS)
-> Show Document2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Document2 -> ShowS
showsPrec :: Int -> Document2 -> ShowS
$cshow :: Document2 -> [Char]
show :: Document2 -> [Char]
$cshowList :: [Document2] -> ShowS
showList :: [Document2] -> ShowS
P.Show)

-- ** DynamicId
newtype DynamicId = DynamicId {DynamicId -> Text
unDynamicId :: Text} deriving (DynamicId -> DynamicId -> Bool
(DynamicId -> DynamicId -> Bool)
-> (DynamicId -> DynamicId -> Bool) -> Eq DynamicId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DynamicId -> DynamicId -> Bool
== :: DynamicId -> DynamicId -> Bool
$c/= :: DynamicId -> DynamicId -> Bool
/= :: DynamicId -> DynamicId -> Bool
P.Eq, Int -> DynamicId -> ShowS
[DynamicId] -> ShowS
DynamicId -> [Char]
(Int -> DynamicId -> ShowS)
-> (DynamicId -> [Char])
-> ([DynamicId] -> ShowS)
-> Show DynamicId
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DynamicId -> ShowS
showsPrec :: Int -> DynamicId -> ShowS
$cshow :: DynamicId -> [Char]
show :: DynamicId -> [Char]
$cshowList :: [DynamicId] -> ShowS
showList :: [DynamicId] -> ShowS
P.Show)

-- ** File2
newtype File2 = File2 {File2 -> Text
unFile2 :: Text} deriving (File2 -> File2 -> Bool
(File2 -> File2 -> Bool) -> (File2 -> File2 -> Bool) -> Eq File2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: File2 -> File2 -> Bool
== :: File2 -> File2 -> Bool
$c/= :: File2 -> File2 -> Bool
/= :: File2 -> File2 -> Bool
P.Eq, Int -> File2 -> ShowS
[File2] -> ShowS
File2 -> [Char]
(Int -> File2 -> ShowS)
-> (File2 -> [Char]) -> ([File2] -> ShowS) -> Show File2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> File2 -> ShowS
showsPrec :: Int -> File2 -> ShowS
$cshow :: File2 -> [Char]
show :: File2 -> [Char]
$cshowList :: [File2] -> ShowS
showList :: [File2] -> ShowS
P.Show)

-- ** Filter
newtype Filter = Filter {Filter -> Text
unFilter :: Text} deriving (Filter -> Filter -> Bool
(Filter -> Filter -> Bool)
-> (Filter -> Filter -> Bool) -> Eq Filter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Filter -> Filter -> Bool
== :: Filter -> Filter -> Bool
$c/= :: Filter -> Filter -> Bool
/= :: Filter -> Filter -> Bool
P.Eq, Int -> Filter -> ShowS
[Filter] -> ShowS
Filter -> [Char]
(Int -> Filter -> ShowS)
-> (Filter -> [Char]) -> ([Filter] -> ShowS) -> Show Filter
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Filter -> ShowS
showsPrec :: Int -> Filter -> ShowS
$cshow :: Filter -> [Char]
show :: Filter -> [Char]
$cshowList :: [Filter] -> ShowS
showList :: [Filter] -> ShowS
P.Show)

-- ** Force
newtype Force = Force {Force -> Bool
unForce :: Bool} deriving (Force -> Force -> Bool
(Force -> Force -> Bool) -> (Force -> Force -> Bool) -> Eq Force
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Force -> Force -> Bool
== :: Force -> Force -> Bool
$c/= :: Force -> Force -> Bool
/= :: Force -> Force -> Bool
P.Eq, Int -> Force -> ShowS
[Force] -> ShowS
Force -> [Char]
(Int -> Force -> ShowS)
-> (Force -> [Char]) -> ([Force] -> ShowS) -> Show Force
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Force -> ShowS
showsPrec :: Int -> Force -> ShowS
$cshow :: Force -> [Char]
show :: Force -> [Char]
$cshowList :: [Force] -> ShowS
showList :: [Force] -> ShowS
P.Show)

-- ** GenerateContentBatch
newtype GenerateContentBatch = GenerateContentBatch {GenerateContentBatch -> Text
unGenerateContentBatch :: Text} deriving (GenerateContentBatch -> GenerateContentBatch -> Bool
(GenerateContentBatch -> GenerateContentBatch -> Bool)
-> (GenerateContentBatch -> GenerateContentBatch -> Bool)
-> Eq GenerateContentBatch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateContentBatch -> GenerateContentBatch -> Bool
== :: GenerateContentBatch -> GenerateContentBatch -> Bool
$c/= :: GenerateContentBatch -> GenerateContentBatch -> Bool
/= :: GenerateContentBatch -> GenerateContentBatch -> Bool
P.Eq, Int -> GenerateContentBatch -> ShowS
[GenerateContentBatch] -> ShowS
GenerateContentBatch -> [Char]
(Int -> GenerateContentBatch -> ShowS)
-> (GenerateContentBatch -> [Char])
-> ([GenerateContentBatch] -> ShowS)
-> Show GenerateContentBatch
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateContentBatch -> ShowS
showsPrec :: Int -> GenerateContentBatch -> ShowS
$cshow :: GenerateContentBatch -> [Char]
show :: GenerateContentBatch -> [Char]
$cshowList :: [GenerateContentBatch] -> ShowS
showList :: [GenerateContentBatch] -> ShowS
P.Show)

-- ** GeneratedFile2
newtype GeneratedFile2 = GeneratedFile2 {GeneratedFile2 -> Text
unGeneratedFile2 :: Text} deriving (GeneratedFile2 -> GeneratedFile2 -> Bool
(GeneratedFile2 -> GeneratedFile2 -> Bool)
-> (GeneratedFile2 -> GeneratedFile2 -> Bool) -> Eq GeneratedFile2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GeneratedFile2 -> GeneratedFile2 -> Bool
== :: GeneratedFile2 -> GeneratedFile2 -> Bool
$c/= :: GeneratedFile2 -> GeneratedFile2 -> Bool
/= :: GeneratedFile2 -> GeneratedFile2 -> Bool
P.Eq, Int -> GeneratedFile2 -> ShowS
[GeneratedFile2] -> ShowS
GeneratedFile2 -> [Char]
(Int -> GeneratedFile2 -> ShowS)
-> (GeneratedFile2 -> [Char])
-> ([GeneratedFile2] -> ShowS)
-> Show GeneratedFile2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GeneratedFile2 -> ShowS
showsPrec :: Int -> GeneratedFile2 -> ShowS
$cshow :: GeneratedFile2 -> [Char]
show :: GeneratedFile2 -> [Char]
$cshowList :: [GeneratedFile2] -> ShowS
showList :: [GeneratedFile2] -> ShowS
P.Show)

-- ** Id
newtype Id = Id {Id -> Text
unId :: Text} deriving (Id -> Id -> Bool
(Id -> Id -> Bool) -> (Id -> Id -> Bool) -> Eq Id
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Id -> Id -> Bool
== :: Id -> Id -> Bool
$c/= :: Id -> Id -> Bool
/= :: Id -> Id -> Bool
P.Eq, Int -> Id -> ShowS
[Id] -> ShowS
Id -> [Char]
(Int -> Id -> ShowS)
-> (Id -> [Char]) -> ([Id] -> ShowS) -> Show Id
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Id -> ShowS
showsPrec :: Int -> Id -> ShowS
$cshow :: Id -> [Char]
show :: Id -> [Char]
$cshowList :: [Id] -> ShowS
showList :: [Id] -> ShowS
P.Show)

-- ** Model2
newtype Model2 = Model2 {Model2 -> Text
unModel2 :: Text} deriving (Model2 -> Model2 -> Bool
(Model2 -> Model2 -> Bool)
-> (Model2 -> Model2 -> Bool) -> Eq Model2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Model2 -> Model2 -> Bool
== :: Model2 -> Model2 -> Bool
$c/= :: Model2 -> Model2 -> Bool
/= :: Model2 -> Model2 -> Bool
P.Eq, Int -> Model2 -> ShowS
[Model2] -> ShowS
Model2 -> [Char]
(Int -> Model2 -> ShowS)
-> (Model2 -> [Char]) -> ([Model2] -> ShowS) -> Show Model2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Model2 -> ShowS
showsPrec :: Int -> Model2 -> ShowS
$cshow :: Model2 -> [Char]
show :: Model2 -> [Char]
$cshowList :: [Model2] -> ShowS
showList :: [Model2] -> ShowS
P.Show)

-- ** Operation2
newtype Operation2 = Operation2 {Operation2 -> Text
unOperation2 :: Text} deriving (Operation2 -> Operation2 -> Bool
(Operation2 -> Operation2 -> Bool)
-> (Operation2 -> Operation2 -> Bool) -> Eq Operation2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Operation2 -> Operation2 -> Bool
== :: Operation2 -> Operation2 -> Bool
$c/= :: Operation2 -> Operation2 -> Bool
/= :: Operation2 -> Operation2 -> Bool
P.Eq, Int -> Operation2 -> ShowS
[Operation2] -> ShowS
Operation2 -> [Char]
(Int -> Operation2 -> ShowS)
-> (Operation2 -> [Char])
-> ([Operation2] -> ShowS)
-> Show Operation2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Operation2 -> ShowS
showsPrec :: Int -> Operation2 -> ShowS
$cshow :: Operation2 -> [Char]
show :: Operation2 -> [Char]
$cshowList :: [Operation2] -> ShowS
showList :: [Operation2] -> ShowS
P.Show)

-- ** PageSize
newtype PageSize = PageSize {PageSize -> Int
unPageSize :: Int} deriving (PageSize -> PageSize -> Bool
(PageSize -> PageSize -> Bool)
-> (PageSize -> PageSize -> Bool) -> Eq PageSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PageSize -> PageSize -> Bool
== :: PageSize -> PageSize -> Bool
$c/= :: PageSize -> PageSize -> Bool
/= :: PageSize -> PageSize -> Bool
P.Eq, Int -> PageSize -> ShowS
[PageSize] -> ShowS
PageSize -> [Char]
(Int -> PageSize -> ShowS)
-> (PageSize -> [Char]) -> ([PageSize] -> ShowS) -> Show PageSize
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PageSize -> ShowS
showsPrec :: Int -> PageSize -> ShowS
$cshow :: PageSize -> [Char]
show :: PageSize -> [Char]
$cshowList :: [PageSize] -> ShowS
showList :: [PageSize] -> ShowS
P.Show)

-- ** PageToken
newtype PageToken = PageToken {PageToken -> Text
unPageToken :: Text} deriving (PageToken -> PageToken -> Bool
(PageToken -> PageToken -> Bool)
-> (PageToken -> PageToken -> Bool) -> Eq PageToken
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PageToken -> PageToken -> Bool
== :: PageToken -> PageToken -> Bool
$c/= :: PageToken -> PageToken -> Bool
/= :: PageToken -> PageToken -> Bool
P.Eq, Int -> PageToken -> ShowS
[PageToken] -> ShowS
PageToken -> [Char]
(Int -> PageToken -> ShowS)
-> (PageToken -> [Char])
-> ([PageToken] -> ShowS)
-> Show PageToken
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PageToken -> ShowS
showsPrec :: Int -> PageToken -> ShowS
$cshow :: PageToken -> [Char]
show :: PageToken -> [Char]
$cshowList :: [PageToken] -> ShowS
showList :: [PageToken] -> ShowS
P.Show)

-- ** Permission2
newtype Permission2 = Permission2 {Permission2 -> Text
unPermission2 :: Text} deriving (Permission2 -> Permission2 -> Bool
(Permission2 -> Permission2 -> Bool)
-> (Permission2 -> Permission2 -> Bool) -> Eq Permission2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Permission2 -> Permission2 -> Bool
== :: Permission2 -> Permission2 -> Bool
$c/= :: Permission2 -> Permission2 -> Bool
/= :: Permission2 -> Permission2 -> Bool
P.Eq, Int -> Permission2 -> ShowS
[Permission2] -> ShowS
Permission2 -> [Char]
(Int -> Permission2 -> ShowS)
-> (Permission2 -> [Char])
-> ([Permission2] -> ShowS)
-> Show Permission2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Permission2 -> ShowS
showsPrec :: Int -> Permission2 -> ShowS
$cshow :: Permission2 -> [Char]
show :: Permission2 -> [Char]
$cshowList :: [Permission2] -> ShowS
showList :: [Permission2] -> ShowS
P.Show)

-- ** PrettyPrint
newtype PrettyPrint = PrettyPrint {PrettyPrint -> Bool
unPrettyPrint :: Bool} deriving (PrettyPrint -> PrettyPrint -> Bool
(PrettyPrint -> PrettyPrint -> Bool)
-> (PrettyPrint -> PrettyPrint -> Bool) -> Eq PrettyPrint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrettyPrint -> PrettyPrint -> Bool
== :: PrettyPrint -> PrettyPrint -> Bool
$c/= :: PrettyPrint -> PrettyPrint -> Bool
/= :: PrettyPrint -> PrettyPrint -> Bool
P.Eq, Int -> PrettyPrint -> ShowS
[PrettyPrint] -> ShowS
PrettyPrint -> [Char]
(Int -> PrettyPrint -> ShowS)
-> (PrettyPrint -> [Char])
-> ([PrettyPrint] -> ShowS)
-> Show PrettyPrint
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrettyPrint -> ShowS
showsPrec :: Int -> PrettyPrint -> ShowS
$cshow :: PrettyPrint -> [Char]
show :: PrettyPrint -> [Char]
$cshowList :: [PrettyPrint] -> ShowS
showList :: [PrettyPrint] -> ShowS
P.Show)

-- ** TunedModel2
newtype TunedModel2 = TunedModel2 {TunedModel2 -> Text
unTunedModel2 :: Text} deriving (TunedModel2 -> TunedModel2 -> Bool
(TunedModel2 -> TunedModel2 -> Bool)
-> (TunedModel2 -> TunedModel2 -> Bool) -> Eq TunedModel2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TunedModel2 -> TunedModel2 -> Bool
== :: TunedModel2 -> TunedModel2 -> Bool
$c/= :: TunedModel2 -> TunedModel2 -> Bool
/= :: TunedModel2 -> TunedModel2 -> Bool
P.Eq, Int -> TunedModel2 -> ShowS
[TunedModel2] -> ShowS
TunedModel2 -> [Char]
(Int -> TunedModel2 -> ShowS)
-> (TunedModel2 -> [Char])
-> ([TunedModel2] -> ShowS)
-> Show TunedModel2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TunedModel2 -> ShowS
showsPrec :: Int -> TunedModel2 -> ShowS
$cshow :: TunedModel2 -> [Char]
show :: TunedModel2 -> [Char]
$cshowList :: [TunedModel2] -> ShowS
showList :: [TunedModel2] -> ShowS
P.Show)

-- ** TunedModelId
newtype TunedModelId = TunedModelId {TunedModelId -> Text
unTunedModelId :: Text} deriving (TunedModelId -> TunedModelId -> Bool
(TunedModelId -> TunedModelId -> Bool)
-> (TunedModelId -> TunedModelId -> Bool) -> Eq TunedModelId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TunedModelId -> TunedModelId -> Bool
== :: TunedModelId -> TunedModelId -> Bool
$c/= :: TunedModelId -> TunedModelId -> Bool
/= :: TunedModelId -> TunedModelId -> Bool
P.Eq, Int -> TunedModelId -> ShowS
[TunedModelId] -> ShowS
TunedModelId -> [Char]
(Int -> TunedModelId -> ShowS)
-> (TunedModelId -> [Char])
-> ([TunedModelId] -> ShowS)
-> Show TunedModelId
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TunedModelId -> ShowS
showsPrec :: Int -> TunedModelId -> ShowS
$cshow :: TunedModelId -> [Char]
show :: TunedModelId -> [Char]
$cshowList :: [TunedModelId] -> ShowS
showList :: [TunedModelId] -> ShowS
P.Show)

-- ** UpdateMask
newtype UpdateMask = UpdateMask {UpdateMask -> Text
unUpdateMask :: Text} deriving (UpdateMask -> UpdateMask -> Bool
(UpdateMask -> UpdateMask -> Bool)
-> (UpdateMask -> UpdateMask -> Bool) -> Eq UpdateMask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpdateMask -> UpdateMask -> Bool
== :: UpdateMask -> UpdateMask -> Bool
$c/= :: UpdateMask -> UpdateMask -> Bool
/= :: UpdateMask -> UpdateMask -> Bool
P.Eq, Int -> UpdateMask -> ShowS
[UpdateMask] -> ShowS
UpdateMask -> [Char]
(Int -> UpdateMask -> ShowS)
-> (UpdateMask -> [Char])
-> ([UpdateMask] -> ShowS)
-> Show UpdateMask
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdateMask -> ShowS
showsPrec :: Int -> UpdateMask -> ShowS
$cshow :: UpdateMask -> [Char]
show :: UpdateMask -> [Char]
$cshowList :: [UpdateMask] -> ShowS
showList :: [UpdateMask] -> ShowS
P.Show)

-- ** Xgafv
newtype Xgafv = Xgafv {Xgafv -> E'Xgafv
unXgafv :: E'Xgafv} deriving (Xgafv -> Xgafv -> Bool
(Xgafv -> Xgafv -> Bool) -> (Xgafv -> Xgafv -> Bool) -> Eq Xgafv
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Xgafv -> Xgafv -> Bool
== :: Xgafv -> Xgafv -> Bool
$c/= :: Xgafv -> Xgafv -> Bool
/= :: Xgafv -> Xgafv -> Bool
P.Eq, Int -> Xgafv -> ShowS
[Xgafv] -> ShowS
Xgafv -> [Char]
(Int -> Xgafv -> ShowS)
-> (Xgafv -> [Char]) -> ([Xgafv] -> ShowS) -> Show Xgafv
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Xgafv -> ShowS
showsPrec :: Int -> Xgafv -> ShowS
$cshow :: Xgafv -> [Char]
show :: Xgafv -> [Char]
$cshowList :: [Xgafv] -> ShowS
showList :: [Xgafv] -> ShowS
P.Show)

-- * Models

-- ** AttributionSourceId

{- | AttributionSourceId
Identifier for the source contributing to this attribution.
-}
data AttributionSourceId = AttributionSourceId
  { AttributionSourceId -> Maybe GroundingPassageId
attributionSourceIdGroundingPassage :: !(Maybe GroundingPassageId)
  -- ^ "groundingPassage" - Identifier for an inline passage.
  , AttributionSourceId -> Maybe SemanticRetrieverChunk
attributionSourceIdSemanticRetrieverChunk :: !(Maybe SemanticRetrieverChunk)
  -- ^ "semanticRetrieverChunk" - Identifier for a &#x60;Chunk&#x60; fetched via Semantic Retriever.
  }
  deriving (Int -> AttributionSourceId -> ShowS
[AttributionSourceId] -> ShowS
AttributionSourceId -> [Char]
(Int -> AttributionSourceId -> ShowS)
-> (AttributionSourceId -> [Char])
-> ([AttributionSourceId] -> ShowS)
-> Show AttributionSourceId
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AttributionSourceId -> ShowS
showsPrec :: Int -> AttributionSourceId -> ShowS
$cshow :: AttributionSourceId -> [Char]
show :: AttributionSourceId -> [Char]
$cshowList :: [AttributionSourceId] -> ShowS
showList :: [AttributionSourceId] -> ShowS
P.Show, AttributionSourceId -> AttributionSourceId -> Bool
(AttributionSourceId -> AttributionSourceId -> Bool)
-> (AttributionSourceId -> AttributionSourceId -> Bool)
-> Eq AttributionSourceId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AttributionSourceId -> AttributionSourceId -> Bool
== :: AttributionSourceId -> AttributionSourceId -> Bool
$c/= :: AttributionSourceId -> AttributionSourceId -> Bool
/= :: AttributionSourceId -> AttributionSourceId -> Bool
P.Eq, P.Typeable)

-- | FromJSON AttributionSourceId
instance A.FromJSON AttributionSourceId where
  parseJSON :: Value -> Parser AttributionSourceId
parseJSON = [Char]
-> (Object -> Parser AttributionSourceId)
-> Value
-> Parser AttributionSourceId
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"AttributionSourceId" ((Object -> Parser AttributionSourceId)
 -> Value -> Parser AttributionSourceId)
-> (Object -> Parser AttributionSourceId)
-> Value
-> Parser AttributionSourceId
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe GroundingPassageId
-> Maybe SemanticRetrieverChunk -> AttributionSourceId
AttributionSourceId
      (Maybe GroundingPassageId
 -> Maybe SemanticRetrieverChunk -> AttributionSourceId)
-> Parser (Maybe GroundingPassageId)
-> Parser (Maybe SemanticRetrieverChunk -> AttributionSourceId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe GroundingPassageId)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"groundingPassage")
      Parser (Maybe SemanticRetrieverChunk -> AttributionSourceId)
-> Parser (Maybe SemanticRetrieverChunk)
-> Parser AttributionSourceId
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe SemanticRetrieverChunk)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"semanticRetrieverChunk")

-- | ToJSON AttributionSourceId
instance A.ToJSON AttributionSourceId where
  toJSON :: AttributionSourceId -> Value
toJSON AttributionSourceId {Maybe GroundingPassageId
Maybe SemanticRetrieverChunk
attributionSourceIdGroundingPassage :: AttributionSourceId -> Maybe GroundingPassageId
attributionSourceIdSemanticRetrieverChunk :: AttributionSourceId -> Maybe SemanticRetrieverChunk
attributionSourceIdGroundingPassage :: Maybe GroundingPassageId
attributionSourceIdSemanticRetrieverChunk :: Maybe SemanticRetrieverChunk
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"groundingPassage" Key -> Maybe GroundingPassageId -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GroundingPassageId
attributionSourceIdGroundingPassage
      , Key
"semanticRetrieverChunk" Key -> Maybe SemanticRetrieverChunk -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe SemanticRetrieverChunk
attributionSourceIdSemanticRetrieverChunk
      ]

-- | Construct a value of type 'AttributionSourceId' (by applying it's required fields, if any)
mkAttributionSourceId ::
  AttributionSourceId
mkAttributionSourceId :: AttributionSourceId
mkAttributionSourceId =
  AttributionSourceId
    { attributionSourceIdGroundingPassage :: Maybe GroundingPassageId
attributionSourceIdGroundingPassage = Maybe GroundingPassageId
forall a. Maybe a
Nothing
    , attributionSourceIdSemanticRetrieverChunk :: Maybe SemanticRetrieverChunk
attributionSourceIdSemanticRetrieverChunk = Maybe SemanticRetrieverChunk
forall a. Maybe a
Nothing
    }

-- ** BaseOperation

{- | BaseOperation
This resource represents a long-running operation that is the result of a network API call.
-}
data BaseOperation = BaseOperation
  { BaseOperation -> Maybe Bool
baseOperationDone :: !(Maybe Bool)
  -- ^ "done" - If the value is &#x60;false&#x60;, it means the operation is still in progress. If &#x60;true&#x60;, the operation is completed, and either &#x60;error&#x60; or &#x60;response&#x60; is available.
  , BaseOperation -> Maybe Text
baseOperationName :: !(Maybe Text)
  -- ^ "name" - The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the &#x60;name&#x60; should be a resource name ending with &#x60;operations/{unique_id}&#x60;.
  , BaseOperation -> Maybe Status
baseOperationError :: !(Maybe Status)
  -- ^ "error" - The error result of the operation in case of failure or cancellation.
  }
  deriving (Int -> BaseOperation -> ShowS
[BaseOperation] -> ShowS
BaseOperation -> [Char]
(Int -> BaseOperation -> ShowS)
-> (BaseOperation -> [Char])
-> ([BaseOperation] -> ShowS)
-> Show BaseOperation
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BaseOperation -> ShowS
showsPrec :: Int -> BaseOperation -> ShowS
$cshow :: BaseOperation -> [Char]
show :: BaseOperation -> [Char]
$cshowList :: [BaseOperation] -> ShowS
showList :: [BaseOperation] -> ShowS
P.Show, BaseOperation -> BaseOperation -> Bool
(BaseOperation -> BaseOperation -> Bool)
-> (BaseOperation -> BaseOperation -> Bool) -> Eq BaseOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BaseOperation -> BaseOperation -> Bool
== :: BaseOperation -> BaseOperation -> Bool
$c/= :: BaseOperation -> BaseOperation -> Bool
/= :: BaseOperation -> BaseOperation -> Bool
P.Eq, P.Typeable)

-- | FromJSON BaseOperation
instance A.FromJSON BaseOperation where
  parseJSON :: Value -> Parser BaseOperation
parseJSON = [Char]
-> (Object -> Parser BaseOperation)
-> Value
-> Parser BaseOperation
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BaseOperation" ((Object -> Parser BaseOperation) -> Value -> Parser BaseOperation)
-> (Object -> Parser BaseOperation)
-> Value
-> Parser BaseOperation
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Bool -> Maybe Text -> Maybe Status -> BaseOperation
BaseOperation
      (Maybe Bool -> Maybe Text -> Maybe Status -> BaseOperation)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> Maybe Status -> BaseOperation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"done")
      Parser (Maybe Text -> Maybe Status -> BaseOperation)
-> Parser (Maybe Text) -> Parser (Maybe Status -> BaseOperation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser (Maybe Status -> BaseOperation)
-> Parser (Maybe Status) -> Parser BaseOperation
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"error")

-- | ToJSON BaseOperation
instance A.ToJSON BaseOperation where
  toJSON :: BaseOperation -> Value
toJSON BaseOperation {Maybe Bool
Maybe Text
Maybe Status
baseOperationDone :: BaseOperation -> Maybe Bool
baseOperationName :: BaseOperation -> Maybe Text
baseOperationError :: BaseOperation -> Maybe Status
baseOperationDone :: Maybe Bool
baseOperationName :: Maybe Text
baseOperationError :: Maybe Status
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"done" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
baseOperationDone
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
baseOperationName
      , Key
"error" Key -> Maybe Status -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Status
baseOperationError
      ]

-- | Construct a value of type 'BaseOperation' (by applying it's required fields, if any)
mkBaseOperation ::
  BaseOperation
mkBaseOperation :: BaseOperation
mkBaseOperation =
  BaseOperation
    { baseOperationDone :: Maybe Bool
baseOperationDone = Maybe Bool
forall a. Maybe a
Nothing
    , baseOperationName :: Maybe Text
baseOperationName = Maybe Text
forall a. Maybe a
Nothing
    , baseOperationError :: Maybe Status
baseOperationError = Maybe Status
forall a. Maybe a
Nothing
    }

-- ** BatchCreateChunksRequest

{- | BatchCreateChunksRequest
Request to batch create `Chunk`s.
-}
data BatchCreateChunksRequest = BatchCreateChunksRequest
  { BatchCreateChunksRequest -> [CreateChunkRequest]
batchCreateChunksRequestRequests :: !([CreateChunkRequest])
  -- ^ /Required/ "requests" - Required. The request messages specifying the &#x60;Chunk&#x60;s to create. A maximum of 100 &#x60;Chunk&#x60;s can be created in a batch.
  }
  deriving (Int -> BatchCreateChunksRequest -> ShowS
[BatchCreateChunksRequest] -> ShowS
BatchCreateChunksRequest -> [Char]
(Int -> BatchCreateChunksRequest -> ShowS)
-> (BatchCreateChunksRequest -> [Char])
-> ([BatchCreateChunksRequest] -> ShowS)
-> Show BatchCreateChunksRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchCreateChunksRequest -> ShowS
showsPrec :: Int -> BatchCreateChunksRequest -> ShowS
$cshow :: BatchCreateChunksRequest -> [Char]
show :: BatchCreateChunksRequest -> [Char]
$cshowList :: [BatchCreateChunksRequest] -> ShowS
showList :: [BatchCreateChunksRequest] -> ShowS
P.Show, BatchCreateChunksRequest -> BatchCreateChunksRequest -> Bool
(BatchCreateChunksRequest -> BatchCreateChunksRequest -> Bool)
-> (BatchCreateChunksRequest -> BatchCreateChunksRequest -> Bool)
-> Eq BatchCreateChunksRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchCreateChunksRequest -> BatchCreateChunksRequest -> Bool
== :: BatchCreateChunksRequest -> BatchCreateChunksRequest -> Bool
$c/= :: BatchCreateChunksRequest -> BatchCreateChunksRequest -> Bool
/= :: BatchCreateChunksRequest -> BatchCreateChunksRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchCreateChunksRequest
instance A.FromJSON BatchCreateChunksRequest where
  parseJSON :: Value -> Parser BatchCreateChunksRequest
parseJSON = [Char]
-> (Object -> Parser BatchCreateChunksRequest)
-> Value
-> Parser BatchCreateChunksRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchCreateChunksRequest" ((Object -> Parser BatchCreateChunksRequest)
 -> Value -> Parser BatchCreateChunksRequest)
-> (Object -> Parser BatchCreateChunksRequest)
-> Value
-> Parser BatchCreateChunksRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    [CreateChunkRequest] -> BatchCreateChunksRequest
BatchCreateChunksRequest
      ([CreateChunkRequest] -> BatchCreateChunksRequest)
-> Parser [CreateChunkRequest] -> Parser BatchCreateChunksRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser [CreateChunkRequest]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"requests")

-- | ToJSON BatchCreateChunksRequest
instance A.ToJSON BatchCreateChunksRequest where
  toJSON :: BatchCreateChunksRequest -> Value
toJSON BatchCreateChunksRequest {[CreateChunkRequest]
batchCreateChunksRequestRequests :: BatchCreateChunksRequest -> [CreateChunkRequest]
batchCreateChunksRequestRequests :: [CreateChunkRequest]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"requests" Key -> [CreateChunkRequest] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [CreateChunkRequest]
batchCreateChunksRequestRequests
      ]

-- | Construct a value of type 'BatchCreateChunksRequest' (by applying it's required fields, if any)
mkBatchCreateChunksRequest ::
  -- | 'batchCreateChunksRequestRequests': Required. The request messages specifying the `Chunk`s to create. A maximum of 100 `Chunk`s can be created in a batch.
  [CreateChunkRequest] ->
  BatchCreateChunksRequest
mkBatchCreateChunksRequest :: [CreateChunkRequest] -> BatchCreateChunksRequest
mkBatchCreateChunksRequest [CreateChunkRequest]
batchCreateChunksRequestRequests =
  BatchCreateChunksRequest
    { [CreateChunkRequest]
batchCreateChunksRequestRequests :: [CreateChunkRequest]
batchCreateChunksRequestRequests :: [CreateChunkRequest]
batchCreateChunksRequestRequests
    }

-- ** BatchCreateChunksResponse

{- | BatchCreateChunksResponse
Response from `BatchCreateChunks` containing a list of created `Chunk`s.
-}
data BatchCreateChunksResponse = BatchCreateChunksResponse
  { BatchCreateChunksResponse -> Maybe [Chunk]
batchCreateChunksResponseChunks :: !(Maybe [Chunk])
  -- ^ "chunks" - &#x60;Chunk&#x60;s created.
  }
  deriving (Int -> BatchCreateChunksResponse -> ShowS
[BatchCreateChunksResponse] -> ShowS
BatchCreateChunksResponse -> [Char]
(Int -> BatchCreateChunksResponse -> ShowS)
-> (BatchCreateChunksResponse -> [Char])
-> ([BatchCreateChunksResponse] -> ShowS)
-> Show BatchCreateChunksResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchCreateChunksResponse -> ShowS
showsPrec :: Int -> BatchCreateChunksResponse -> ShowS
$cshow :: BatchCreateChunksResponse -> [Char]
show :: BatchCreateChunksResponse -> [Char]
$cshowList :: [BatchCreateChunksResponse] -> ShowS
showList :: [BatchCreateChunksResponse] -> ShowS
P.Show, BatchCreateChunksResponse -> BatchCreateChunksResponse -> Bool
(BatchCreateChunksResponse -> BatchCreateChunksResponse -> Bool)
-> (BatchCreateChunksResponse -> BatchCreateChunksResponse -> Bool)
-> Eq BatchCreateChunksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchCreateChunksResponse -> BatchCreateChunksResponse -> Bool
== :: BatchCreateChunksResponse -> BatchCreateChunksResponse -> Bool
$c/= :: BatchCreateChunksResponse -> BatchCreateChunksResponse -> Bool
/= :: BatchCreateChunksResponse -> BatchCreateChunksResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchCreateChunksResponse
instance A.FromJSON BatchCreateChunksResponse where
  parseJSON :: Value -> Parser BatchCreateChunksResponse
parseJSON = [Char]
-> (Object -> Parser BatchCreateChunksResponse)
-> Value
-> Parser BatchCreateChunksResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchCreateChunksResponse" ((Object -> Parser BatchCreateChunksResponse)
 -> Value -> Parser BatchCreateChunksResponse)
-> (Object -> Parser BatchCreateChunksResponse)
-> Value
-> Parser BatchCreateChunksResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Chunk] -> BatchCreateChunksResponse
BatchCreateChunksResponse
      (Maybe [Chunk] -> BatchCreateChunksResponse)
-> Parser (Maybe [Chunk]) -> Parser BatchCreateChunksResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Chunk])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"chunks")

-- | ToJSON BatchCreateChunksResponse
instance A.ToJSON BatchCreateChunksResponse where
  toJSON :: BatchCreateChunksResponse -> Value
toJSON BatchCreateChunksResponse {Maybe [Chunk]
batchCreateChunksResponseChunks :: BatchCreateChunksResponse -> Maybe [Chunk]
batchCreateChunksResponseChunks :: Maybe [Chunk]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"chunks" Key -> Maybe [Chunk] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Chunk]
batchCreateChunksResponseChunks
      ]

-- | Construct a value of type 'BatchCreateChunksResponse' (by applying it's required fields, if any)
mkBatchCreateChunksResponse ::
  BatchCreateChunksResponse
mkBatchCreateChunksResponse :: BatchCreateChunksResponse
mkBatchCreateChunksResponse =
  BatchCreateChunksResponse
    { batchCreateChunksResponseChunks :: Maybe [Chunk]
batchCreateChunksResponseChunks = Maybe [Chunk]
forall a. Maybe a
Nothing
    }

-- ** BatchDeleteChunksRequest

{- | BatchDeleteChunksRequest
Request to batch delete `Chunk`s.
-}
data BatchDeleteChunksRequest = BatchDeleteChunksRequest
  { BatchDeleteChunksRequest -> [DeleteChunkRequest]
batchDeleteChunksRequestRequests :: !([DeleteChunkRequest])
  -- ^ /Required/ "requests" - Required. The request messages specifying the &#x60;Chunk&#x60;s to delete.
  }
  deriving (Int -> BatchDeleteChunksRequest -> ShowS
[BatchDeleteChunksRequest] -> ShowS
BatchDeleteChunksRequest -> [Char]
(Int -> BatchDeleteChunksRequest -> ShowS)
-> (BatchDeleteChunksRequest -> [Char])
-> ([BatchDeleteChunksRequest] -> ShowS)
-> Show BatchDeleteChunksRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchDeleteChunksRequest -> ShowS
showsPrec :: Int -> BatchDeleteChunksRequest -> ShowS
$cshow :: BatchDeleteChunksRequest -> [Char]
show :: BatchDeleteChunksRequest -> [Char]
$cshowList :: [BatchDeleteChunksRequest] -> ShowS
showList :: [BatchDeleteChunksRequest] -> ShowS
P.Show, BatchDeleteChunksRequest -> BatchDeleteChunksRequest -> Bool
(BatchDeleteChunksRequest -> BatchDeleteChunksRequest -> Bool)
-> (BatchDeleteChunksRequest -> BatchDeleteChunksRequest -> Bool)
-> Eq BatchDeleteChunksRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchDeleteChunksRequest -> BatchDeleteChunksRequest -> Bool
== :: BatchDeleteChunksRequest -> BatchDeleteChunksRequest -> Bool
$c/= :: BatchDeleteChunksRequest -> BatchDeleteChunksRequest -> Bool
/= :: BatchDeleteChunksRequest -> BatchDeleteChunksRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchDeleteChunksRequest
instance A.FromJSON BatchDeleteChunksRequest where
  parseJSON :: Value -> Parser BatchDeleteChunksRequest
parseJSON = [Char]
-> (Object -> Parser BatchDeleteChunksRequest)
-> Value
-> Parser BatchDeleteChunksRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchDeleteChunksRequest" ((Object -> Parser BatchDeleteChunksRequest)
 -> Value -> Parser BatchDeleteChunksRequest)
-> (Object -> Parser BatchDeleteChunksRequest)
-> Value
-> Parser BatchDeleteChunksRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    [DeleteChunkRequest] -> BatchDeleteChunksRequest
BatchDeleteChunksRequest
      ([DeleteChunkRequest] -> BatchDeleteChunksRequest)
-> Parser [DeleteChunkRequest] -> Parser BatchDeleteChunksRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser [DeleteChunkRequest]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"requests")

-- | ToJSON BatchDeleteChunksRequest
instance A.ToJSON BatchDeleteChunksRequest where
  toJSON :: BatchDeleteChunksRequest -> Value
toJSON BatchDeleteChunksRequest {[DeleteChunkRequest]
batchDeleteChunksRequestRequests :: BatchDeleteChunksRequest -> [DeleteChunkRequest]
batchDeleteChunksRequestRequests :: [DeleteChunkRequest]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"requests" Key -> [DeleteChunkRequest] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [DeleteChunkRequest]
batchDeleteChunksRequestRequests
      ]

-- | Construct a value of type 'BatchDeleteChunksRequest' (by applying it's required fields, if any)
mkBatchDeleteChunksRequest ::
  -- | 'batchDeleteChunksRequestRequests': Required. The request messages specifying the `Chunk`s to delete.
  [DeleteChunkRequest] ->
  BatchDeleteChunksRequest
mkBatchDeleteChunksRequest :: [DeleteChunkRequest] -> BatchDeleteChunksRequest
mkBatchDeleteChunksRequest [DeleteChunkRequest]
batchDeleteChunksRequestRequests =
  BatchDeleteChunksRequest
    { [DeleteChunkRequest]
batchDeleteChunksRequestRequests :: [DeleteChunkRequest]
batchDeleteChunksRequestRequests :: [DeleteChunkRequest]
batchDeleteChunksRequestRequests
    }

-- ** BatchEmbedContentsRequest

{- | BatchEmbedContentsRequest
Batch request to get embeddings from the model for a list of prompts.
-}
data BatchEmbedContentsRequest = BatchEmbedContentsRequest
  { BatchEmbedContentsRequest -> [EmbedContentRequest]
batchEmbedContentsRequestRequests :: !([EmbedContentRequest])
  -- ^ /Required/ "requests" - Required. Embed requests for the batch. The model in each of these requests must match the model specified &#x60;BatchEmbedContentsRequest.model&#x60;.
  }
  deriving (Int -> BatchEmbedContentsRequest -> ShowS
[BatchEmbedContentsRequest] -> ShowS
BatchEmbedContentsRequest -> [Char]
(Int -> BatchEmbedContentsRequest -> ShowS)
-> (BatchEmbedContentsRequest -> [Char])
-> ([BatchEmbedContentsRequest] -> ShowS)
-> Show BatchEmbedContentsRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchEmbedContentsRequest -> ShowS
showsPrec :: Int -> BatchEmbedContentsRequest -> ShowS
$cshow :: BatchEmbedContentsRequest -> [Char]
show :: BatchEmbedContentsRequest -> [Char]
$cshowList :: [BatchEmbedContentsRequest] -> ShowS
showList :: [BatchEmbedContentsRequest] -> ShowS
P.Show, BatchEmbedContentsRequest -> BatchEmbedContentsRequest -> Bool
(BatchEmbedContentsRequest -> BatchEmbedContentsRequest -> Bool)
-> (BatchEmbedContentsRequest -> BatchEmbedContentsRequest -> Bool)
-> Eq BatchEmbedContentsRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchEmbedContentsRequest -> BatchEmbedContentsRequest -> Bool
== :: BatchEmbedContentsRequest -> BatchEmbedContentsRequest -> Bool
$c/= :: BatchEmbedContentsRequest -> BatchEmbedContentsRequest -> Bool
/= :: BatchEmbedContentsRequest -> BatchEmbedContentsRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchEmbedContentsRequest
instance A.FromJSON BatchEmbedContentsRequest where
  parseJSON :: Value -> Parser BatchEmbedContentsRequest
parseJSON = [Char]
-> (Object -> Parser BatchEmbedContentsRequest)
-> Value
-> Parser BatchEmbedContentsRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchEmbedContentsRequest" ((Object -> Parser BatchEmbedContentsRequest)
 -> Value -> Parser BatchEmbedContentsRequest)
-> (Object -> Parser BatchEmbedContentsRequest)
-> Value
-> Parser BatchEmbedContentsRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    [EmbedContentRequest] -> BatchEmbedContentsRequest
BatchEmbedContentsRequest
      ([EmbedContentRequest] -> BatchEmbedContentsRequest)
-> Parser [EmbedContentRequest] -> Parser BatchEmbedContentsRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser [EmbedContentRequest]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"requests")

-- | ToJSON BatchEmbedContentsRequest
instance A.ToJSON BatchEmbedContentsRequest where
  toJSON :: BatchEmbedContentsRequest -> Value
toJSON BatchEmbedContentsRequest {[EmbedContentRequest]
batchEmbedContentsRequestRequests :: BatchEmbedContentsRequest -> [EmbedContentRequest]
batchEmbedContentsRequestRequests :: [EmbedContentRequest]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"requests" Key -> [EmbedContentRequest] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [EmbedContentRequest]
batchEmbedContentsRequestRequests
      ]

-- | Construct a value of type 'BatchEmbedContentsRequest' (by applying it's required fields, if any)
mkBatchEmbedContentsRequest ::
  -- | 'batchEmbedContentsRequestRequests': Required. Embed requests for the batch. The model in each of these requests must match the model specified `BatchEmbedContentsRequest.model`.
  [EmbedContentRequest] ->
  BatchEmbedContentsRequest
mkBatchEmbedContentsRequest :: [EmbedContentRequest] -> BatchEmbedContentsRequest
mkBatchEmbedContentsRequest [EmbedContentRequest]
batchEmbedContentsRequestRequests =
  BatchEmbedContentsRequest
    { [EmbedContentRequest]
batchEmbedContentsRequestRequests :: [EmbedContentRequest]
batchEmbedContentsRequestRequests :: [EmbedContentRequest]
batchEmbedContentsRequestRequests
    }

-- ** BatchEmbedContentsResponse

{- | BatchEmbedContentsResponse
The response to a `BatchEmbedContentsRequest`.
-}
data BatchEmbedContentsResponse = BatchEmbedContentsResponse
  { BatchEmbedContentsResponse -> Maybe [ContentEmbedding]
batchEmbedContentsResponseEmbeddings :: !(Maybe [ContentEmbedding])
  -- ^ /ReadOnly/ "embeddings" - Output only. The embeddings for each request, in the same order as provided in the batch request.
  }
  deriving (Int -> BatchEmbedContentsResponse -> ShowS
[BatchEmbedContentsResponse] -> ShowS
BatchEmbedContentsResponse -> [Char]
(Int -> BatchEmbedContentsResponse -> ShowS)
-> (BatchEmbedContentsResponse -> [Char])
-> ([BatchEmbedContentsResponse] -> ShowS)
-> Show BatchEmbedContentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchEmbedContentsResponse -> ShowS
showsPrec :: Int -> BatchEmbedContentsResponse -> ShowS
$cshow :: BatchEmbedContentsResponse -> [Char]
show :: BatchEmbedContentsResponse -> [Char]
$cshowList :: [BatchEmbedContentsResponse] -> ShowS
showList :: [BatchEmbedContentsResponse] -> ShowS
P.Show, BatchEmbedContentsResponse -> BatchEmbedContentsResponse -> Bool
(BatchEmbedContentsResponse -> BatchEmbedContentsResponse -> Bool)
-> (BatchEmbedContentsResponse
    -> BatchEmbedContentsResponse -> Bool)
-> Eq BatchEmbedContentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchEmbedContentsResponse -> BatchEmbedContentsResponse -> Bool
== :: BatchEmbedContentsResponse -> BatchEmbedContentsResponse -> Bool
$c/= :: BatchEmbedContentsResponse -> BatchEmbedContentsResponse -> Bool
/= :: BatchEmbedContentsResponse -> BatchEmbedContentsResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchEmbedContentsResponse
instance A.FromJSON BatchEmbedContentsResponse where
  parseJSON :: Value -> Parser BatchEmbedContentsResponse
parseJSON = [Char]
-> (Object -> Parser BatchEmbedContentsResponse)
-> Value
-> Parser BatchEmbedContentsResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchEmbedContentsResponse" ((Object -> Parser BatchEmbedContentsResponse)
 -> Value -> Parser BatchEmbedContentsResponse)
-> (Object -> Parser BatchEmbedContentsResponse)
-> Value
-> Parser BatchEmbedContentsResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [ContentEmbedding] -> BatchEmbedContentsResponse
BatchEmbedContentsResponse
      (Maybe [ContentEmbedding] -> BatchEmbedContentsResponse)
-> Parser (Maybe [ContentEmbedding])
-> Parser BatchEmbedContentsResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [ContentEmbedding])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"embeddings")

-- | ToJSON BatchEmbedContentsResponse
instance A.ToJSON BatchEmbedContentsResponse where
  toJSON :: BatchEmbedContentsResponse -> Value
toJSON BatchEmbedContentsResponse {Maybe [ContentEmbedding]
batchEmbedContentsResponseEmbeddings :: BatchEmbedContentsResponse -> Maybe [ContentEmbedding]
batchEmbedContentsResponseEmbeddings :: Maybe [ContentEmbedding]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"embeddings" Key -> Maybe [ContentEmbedding] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ContentEmbedding]
batchEmbedContentsResponseEmbeddings
      ]

-- | Construct a value of type 'BatchEmbedContentsResponse' (by applying it's required fields, if any)
mkBatchEmbedContentsResponse ::
  BatchEmbedContentsResponse
mkBatchEmbedContentsResponse :: BatchEmbedContentsResponse
mkBatchEmbedContentsResponse =
  BatchEmbedContentsResponse
    { batchEmbedContentsResponseEmbeddings :: Maybe [ContentEmbedding]
batchEmbedContentsResponseEmbeddings = Maybe [ContentEmbedding]
forall a. Maybe a
Nothing
    }

-- ** BatchEmbedTextRequest

{- | BatchEmbedTextRequest
Batch request to get a text embedding from the model.
-}
data BatchEmbedTextRequest = BatchEmbedTextRequest
  { BatchEmbedTextRequest -> Maybe [EmbedTextRequest]
batchEmbedTextRequestRequests :: !(Maybe [EmbedTextRequest])
  -- ^ "requests" - Optional. Embed requests for the batch. Only one of &#x60;texts&#x60; or &#x60;requests&#x60; can be set.
  , BatchEmbedTextRequest -> Maybe [Text]
batchEmbedTextRequestTexts :: !(Maybe [Text])
  -- ^ "texts" - Optional. The free-form input texts that the model will turn into an embedding. The current limit is 100 texts, over which an error will be thrown.
  }
  deriving (Int -> BatchEmbedTextRequest -> ShowS
[BatchEmbedTextRequest] -> ShowS
BatchEmbedTextRequest -> [Char]
(Int -> BatchEmbedTextRequest -> ShowS)
-> (BatchEmbedTextRequest -> [Char])
-> ([BatchEmbedTextRequest] -> ShowS)
-> Show BatchEmbedTextRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchEmbedTextRequest -> ShowS
showsPrec :: Int -> BatchEmbedTextRequest -> ShowS
$cshow :: BatchEmbedTextRequest -> [Char]
show :: BatchEmbedTextRequest -> [Char]
$cshowList :: [BatchEmbedTextRequest] -> ShowS
showList :: [BatchEmbedTextRequest] -> ShowS
P.Show, BatchEmbedTextRequest -> BatchEmbedTextRequest -> Bool
(BatchEmbedTextRequest -> BatchEmbedTextRequest -> Bool)
-> (BatchEmbedTextRequest -> BatchEmbedTextRequest -> Bool)
-> Eq BatchEmbedTextRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchEmbedTextRequest -> BatchEmbedTextRequest -> Bool
== :: BatchEmbedTextRequest -> BatchEmbedTextRequest -> Bool
$c/= :: BatchEmbedTextRequest -> BatchEmbedTextRequest -> Bool
/= :: BatchEmbedTextRequest -> BatchEmbedTextRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchEmbedTextRequest
instance A.FromJSON BatchEmbedTextRequest where
  parseJSON :: Value -> Parser BatchEmbedTextRequest
parseJSON = [Char]
-> (Object -> Parser BatchEmbedTextRequest)
-> Value
-> Parser BatchEmbedTextRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchEmbedTextRequest" ((Object -> Parser BatchEmbedTextRequest)
 -> Value -> Parser BatchEmbedTextRequest)
-> (Object -> Parser BatchEmbedTextRequest)
-> Value
-> Parser BatchEmbedTextRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [EmbedTextRequest] -> Maybe [Text] -> BatchEmbedTextRequest
BatchEmbedTextRequest
      (Maybe [EmbedTextRequest] -> Maybe [Text] -> BatchEmbedTextRequest)
-> Parser (Maybe [EmbedTextRequest])
-> Parser (Maybe [Text] -> BatchEmbedTextRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [EmbedTextRequest])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"requests")
      Parser (Maybe [Text] -> BatchEmbedTextRequest)
-> Parser (Maybe [Text]) -> Parser BatchEmbedTextRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"texts")

-- | ToJSON BatchEmbedTextRequest
instance A.ToJSON BatchEmbedTextRequest where
  toJSON :: BatchEmbedTextRequest -> Value
toJSON BatchEmbedTextRequest {Maybe [Text]
Maybe [EmbedTextRequest]
batchEmbedTextRequestRequests :: BatchEmbedTextRequest -> Maybe [EmbedTextRequest]
batchEmbedTextRequestTexts :: BatchEmbedTextRequest -> Maybe [Text]
batchEmbedTextRequestRequests :: Maybe [EmbedTextRequest]
batchEmbedTextRequestTexts :: Maybe [Text]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"requests" Key -> Maybe [EmbedTextRequest] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [EmbedTextRequest]
batchEmbedTextRequestRequests
      , Key
"texts" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
batchEmbedTextRequestTexts
      ]

-- | Construct a value of type 'BatchEmbedTextRequest' (by applying it's required fields, if any)
mkBatchEmbedTextRequest ::
  BatchEmbedTextRequest
mkBatchEmbedTextRequest :: BatchEmbedTextRequest
mkBatchEmbedTextRequest =
  BatchEmbedTextRequest
    { batchEmbedTextRequestRequests :: Maybe [EmbedTextRequest]
batchEmbedTextRequestRequests = Maybe [EmbedTextRequest]
forall a. Maybe a
Nothing
    , batchEmbedTextRequestTexts :: Maybe [Text]
batchEmbedTextRequestTexts = Maybe [Text]
forall a. Maybe a
Nothing
    }

-- ** BatchEmbedTextResponse

{- | BatchEmbedTextResponse
The response to a EmbedTextRequest.
-}
data BatchEmbedTextResponse = BatchEmbedTextResponse
  { BatchEmbedTextResponse -> Maybe [Embedding]
batchEmbedTextResponseEmbeddings :: !(Maybe [Embedding])
  -- ^ /ReadOnly/ "embeddings" - Output only. The embeddings generated from the input text.
  }
  deriving (Int -> BatchEmbedTextResponse -> ShowS
[BatchEmbedTextResponse] -> ShowS
BatchEmbedTextResponse -> [Char]
(Int -> BatchEmbedTextResponse -> ShowS)
-> (BatchEmbedTextResponse -> [Char])
-> ([BatchEmbedTextResponse] -> ShowS)
-> Show BatchEmbedTextResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchEmbedTextResponse -> ShowS
showsPrec :: Int -> BatchEmbedTextResponse -> ShowS
$cshow :: BatchEmbedTextResponse -> [Char]
show :: BatchEmbedTextResponse -> [Char]
$cshowList :: [BatchEmbedTextResponse] -> ShowS
showList :: [BatchEmbedTextResponse] -> ShowS
P.Show, BatchEmbedTextResponse -> BatchEmbedTextResponse -> Bool
(BatchEmbedTextResponse -> BatchEmbedTextResponse -> Bool)
-> (BatchEmbedTextResponse -> BatchEmbedTextResponse -> Bool)
-> Eq BatchEmbedTextResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchEmbedTextResponse -> BatchEmbedTextResponse -> Bool
== :: BatchEmbedTextResponse -> BatchEmbedTextResponse -> Bool
$c/= :: BatchEmbedTextResponse -> BatchEmbedTextResponse -> Bool
/= :: BatchEmbedTextResponse -> BatchEmbedTextResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchEmbedTextResponse
instance A.FromJSON BatchEmbedTextResponse where
  parseJSON :: Value -> Parser BatchEmbedTextResponse
parseJSON = [Char]
-> (Object -> Parser BatchEmbedTextResponse)
-> Value
-> Parser BatchEmbedTextResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchEmbedTextResponse" ((Object -> Parser BatchEmbedTextResponse)
 -> Value -> Parser BatchEmbedTextResponse)
-> (Object -> Parser BatchEmbedTextResponse)
-> Value
-> Parser BatchEmbedTextResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Embedding] -> BatchEmbedTextResponse
BatchEmbedTextResponse
      (Maybe [Embedding] -> BatchEmbedTextResponse)
-> Parser (Maybe [Embedding]) -> Parser BatchEmbedTextResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Embedding])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"embeddings")

-- | ToJSON BatchEmbedTextResponse
instance A.ToJSON BatchEmbedTextResponse where
  toJSON :: BatchEmbedTextResponse -> Value
toJSON BatchEmbedTextResponse {Maybe [Embedding]
batchEmbedTextResponseEmbeddings :: BatchEmbedTextResponse -> Maybe [Embedding]
batchEmbedTextResponseEmbeddings :: Maybe [Embedding]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"embeddings" Key -> Maybe [Embedding] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Embedding]
batchEmbedTextResponseEmbeddings
      ]

-- | Construct a value of type 'BatchEmbedTextResponse' (by applying it's required fields, if any)
mkBatchEmbedTextResponse ::
  BatchEmbedTextResponse
mkBatchEmbedTextResponse :: BatchEmbedTextResponse
mkBatchEmbedTextResponse =
  BatchEmbedTextResponse
    { batchEmbedTextResponseEmbeddings :: Maybe [Embedding]
batchEmbedTextResponseEmbeddings = Maybe [Embedding]
forall a. Maybe a
Nothing
    }

-- ** BatchUpdateChunksRequest

{- | BatchUpdateChunksRequest
Request to batch update `Chunk`s.
-}
data BatchUpdateChunksRequest = BatchUpdateChunksRequest
  { BatchUpdateChunksRequest -> [UpdateChunkRequest]
batchUpdateChunksRequestRequests :: !([UpdateChunkRequest])
  -- ^ /Required/ "requests" - Required. The request messages specifying the &#x60;Chunk&#x60;s to update. A maximum of 100 &#x60;Chunk&#x60;s can be updated in a batch.
  }
  deriving (Int -> BatchUpdateChunksRequest -> ShowS
[BatchUpdateChunksRequest] -> ShowS
BatchUpdateChunksRequest -> [Char]
(Int -> BatchUpdateChunksRequest -> ShowS)
-> (BatchUpdateChunksRequest -> [Char])
-> ([BatchUpdateChunksRequest] -> ShowS)
-> Show BatchUpdateChunksRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchUpdateChunksRequest -> ShowS
showsPrec :: Int -> BatchUpdateChunksRequest -> ShowS
$cshow :: BatchUpdateChunksRequest -> [Char]
show :: BatchUpdateChunksRequest -> [Char]
$cshowList :: [BatchUpdateChunksRequest] -> ShowS
showList :: [BatchUpdateChunksRequest] -> ShowS
P.Show, BatchUpdateChunksRequest -> BatchUpdateChunksRequest -> Bool
(BatchUpdateChunksRequest -> BatchUpdateChunksRequest -> Bool)
-> (BatchUpdateChunksRequest -> BatchUpdateChunksRequest -> Bool)
-> Eq BatchUpdateChunksRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchUpdateChunksRequest -> BatchUpdateChunksRequest -> Bool
== :: BatchUpdateChunksRequest -> BatchUpdateChunksRequest -> Bool
$c/= :: BatchUpdateChunksRequest -> BatchUpdateChunksRequest -> Bool
/= :: BatchUpdateChunksRequest -> BatchUpdateChunksRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchUpdateChunksRequest
instance A.FromJSON BatchUpdateChunksRequest where
  parseJSON :: Value -> Parser BatchUpdateChunksRequest
parseJSON = [Char]
-> (Object -> Parser BatchUpdateChunksRequest)
-> Value
-> Parser BatchUpdateChunksRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchUpdateChunksRequest" ((Object -> Parser BatchUpdateChunksRequest)
 -> Value -> Parser BatchUpdateChunksRequest)
-> (Object -> Parser BatchUpdateChunksRequest)
-> Value
-> Parser BatchUpdateChunksRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    [UpdateChunkRequest] -> BatchUpdateChunksRequest
BatchUpdateChunksRequest
      ([UpdateChunkRequest] -> BatchUpdateChunksRequest)
-> Parser [UpdateChunkRequest] -> Parser BatchUpdateChunksRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser [UpdateChunkRequest]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"requests")

-- | ToJSON BatchUpdateChunksRequest
instance A.ToJSON BatchUpdateChunksRequest where
  toJSON :: BatchUpdateChunksRequest -> Value
toJSON BatchUpdateChunksRequest {[UpdateChunkRequest]
batchUpdateChunksRequestRequests :: BatchUpdateChunksRequest -> [UpdateChunkRequest]
batchUpdateChunksRequestRequests :: [UpdateChunkRequest]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"requests" Key -> [UpdateChunkRequest] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [UpdateChunkRequest]
batchUpdateChunksRequestRequests
      ]

-- | Construct a value of type 'BatchUpdateChunksRequest' (by applying it's required fields, if any)
mkBatchUpdateChunksRequest ::
  -- | 'batchUpdateChunksRequestRequests': Required. The request messages specifying the `Chunk`s to update. A maximum of 100 `Chunk`s can be updated in a batch.
  [UpdateChunkRequest] ->
  BatchUpdateChunksRequest
mkBatchUpdateChunksRequest :: [UpdateChunkRequest] -> BatchUpdateChunksRequest
mkBatchUpdateChunksRequest [UpdateChunkRequest]
batchUpdateChunksRequestRequests =
  BatchUpdateChunksRequest
    { [UpdateChunkRequest]
batchUpdateChunksRequestRequests :: [UpdateChunkRequest]
batchUpdateChunksRequestRequests :: [UpdateChunkRequest]
batchUpdateChunksRequestRequests
    }

-- ** BatchUpdateChunksResponse

{- | BatchUpdateChunksResponse
Response from `BatchUpdateChunks` containing a list of updated `Chunk`s.
-}
data BatchUpdateChunksResponse = BatchUpdateChunksResponse
  { BatchUpdateChunksResponse -> Maybe [Chunk]
batchUpdateChunksResponseChunks :: !(Maybe [Chunk])
  -- ^ "chunks" - &#x60;Chunk&#x60;s updated.
  }
  deriving (Int -> BatchUpdateChunksResponse -> ShowS
[BatchUpdateChunksResponse] -> ShowS
BatchUpdateChunksResponse -> [Char]
(Int -> BatchUpdateChunksResponse -> ShowS)
-> (BatchUpdateChunksResponse -> [Char])
-> ([BatchUpdateChunksResponse] -> ShowS)
-> Show BatchUpdateChunksResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BatchUpdateChunksResponse -> ShowS
showsPrec :: Int -> BatchUpdateChunksResponse -> ShowS
$cshow :: BatchUpdateChunksResponse -> [Char]
show :: BatchUpdateChunksResponse -> [Char]
$cshowList :: [BatchUpdateChunksResponse] -> ShowS
showList :: [BatchUpdateChunksResponse] -> ShowS
P.Show, BatchUpdateChunksResponse -> BatchUpdateChunksResponse -> Bool
(BatchUpdateChunksResponse -> BatchUpdateChunksResponse -> Bool)
-> (BatchUpdateChunksResponse -> BatchUpdateChunksResponse -> Bool)
-> Eq BatchUpdateChunksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BatchUpdateChunksResponse -> BatchUpdateChunksResponse -> Bool
== :: BatchUpdateChunksResponse -> BatchUpdateChunksResponse -> Bool
$c/= :: BatchUpdateChunksResponse -> BatchUpdateChunksResponse -> Bool
/= :: BatchUpdateChunksResponse -> BatchUpdateChunksResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON BatchUpdateChunksResponse
instance A.FromJSON BatchUpdateChunksResponse where
  parseJSON :: Value -> Parser BatchUpdateChunksResponse
parseJSON = [Char]
-> (Object -> Parser BatchUpdateChunksResponse)
-> Value
-> Parser BatchUpdateChunksResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"BatchUpdateChunksResponse" ((Object -> Parser BatchUpdateChunksResponse)
 -> Value -> Parser BatchUpdateChunksResponse)
-> (Object -> Parser BatchUpdateChunksResponse)
-> Value
-> Parser BatchUpdateChunksResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Chunk] -> BatchUpdateChunksResponse
BatchUpdateChunksResponse
      (Maybe [Chunk] -> BatchUpdateChunksResponse)
-> Parser (Maybe [Chunk]) -> Parser BatchUpdateChunksResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Chunk])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"chunks")

-- | ToJSON BatchUpdateChunksResponse
instance A.ToJSON BatchUpdateChunksResponse where
  toJSON :: BatchUpdateChunksResponse -> Value
toJSON BatchUpdateChunksResponse {Maybe [Chunk]
batchUpdateChunksResponseChunks :: BatchUpdateChunksResponse -> Maybe [Chunk]
batchUpdateChunksResponseChunks :: Maybe [Chunk]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"chunks" Key -> Maybe [Chunk] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Chunk]
batchUpdateChunksResponseChunks
      ]

-- | Construct a value of type 'BatchUpdateChunksResponse' (by applying it's required fields, if any)
mkBatchUpdateChunksResponse ::
  BatchUpdateChunksResponse
mkBatchUpdateChunksResponse :: BatchUpdateChunksResponse
mkBatchUpdateChunksResponse =
  BatchUpdateChunksResponse
    { batchUpdateChunksResponseChunks :: Maybe [Chunk]
batchUpdateChunksResponseChunks = Maybe [Chunk]
forall a. Maybe a
Nothing
    }

-- ** Blob

{- | Blob
Raw media bytes.  Text should not be sent as raw bytes, use the 'text' field.
-}
data Blob = Blob
  { Blob -> Maybe ByteArray
blobData :: !(Maybe ByteArray)
  -- ^ "data" - Raw bytes for media formats.
  , Blob -> Maybe Text
blobMimeType :: !(Maybe Text)
  -- ^ "mimeType" - The IANA standard MIME type of the source data. Examples:   - image/png   - image/jpeg If an unsupported MIME type is provided, an error will be returned. For a complete list of supported types, see [Supported file formats](https://ai.google.dev/gemini-api/docs/prompting_with_media#supported_file_formats).
  }
  deriving (Int -> Blob -> ShowS
[Blob] -> ShowS
Blob -> [Char]
(Int -> Blob -> ShowS)
-> (Blob -> [Char]) -> ([Blob] -> ShowS) -> Show Blob
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Blob -> ShowS
showsPrec :: Int -> Blob -> ShowS
$cshow :: Blob -> [Char]
show :: Blob -> [Char]
$cshowList :: [Blob] -> ShowS
showList :: [Blob] -> ShowS
P.Show, Blob -> Blob -> Bool
(Blob -> Blob -> Bool) -> (Blob -> Blob -> Bool) -> Eq Blob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Blob -> Blob -> Bool
== :: Blob -> Blob -> Bool
$c/= :: Blob -> Blob -> Bool
/= :: Blob -> Blob -> Bool
P.Eq, P.Typeable)

-- | FromJSON Blob
instance A.FromJSON Blob where
  parseJSON :: Value -> Parser Blob
parseJSON = [Char] -> (Object -> Parser Blob) -> Value -> Parser Blob
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Blob" ((Object -> Parser Blob) -> Value -> Parser Blob)
-> (Object -> Parser Blob) -> Value -> Parser Blob
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe ByteArray -> Maybe Text -> Blob
Blob
      (Maybe ByteArray -> Maybe Text -> Blob)
-> Parser (Maybe ByteArray) -> Parser (Maybe Text -> Blob)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe ByteArray)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"data")
      Parser (Maybe Text -> Blob) -> Parser (Maybe Text) -> Parser Blob
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mimeType")

-- | ToJSON Blob
instance A.ToJSON Blob where
  toJSON :: Blob -> Value
toJSON Blob {Maybe Text
Maybe ByteArray
blobData :: Blob -> Maybe ByteArray
blobMimeType :: Blob -> Maybe Text
blobData :: Maybe ByteArray
blobMimeType :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"data" Key -> Maybe ByteArray -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ByteArray
blobData
      , Key
"mimeType" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
blobMimeType
      ]

-- | Construct a value of type 'Blob' (by applying it's required fields, if any)
mkBlob ::
  Blob
mkBlob :: Blob
mkBlob =
  Blob
    { blobData :: Maybe ByteArray
blobData = Maybe ByteArray
forall a. Maybe a
Nothing
    , blobMimeType :: Maybe Text
blobMimeType = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** CachedContent

{- | CachedContent
Content that has been preprocessed and can be used in subsequent request to GenerativeService.  Cached content can be only used with model it was created for.
-}
data CachedContent = CachedContent
  { CachedContent -> Maybe [Tool]
cachedContentTools :: !(Maybe [Tool])
  -- ^ "tools" - Optional. Input only. Immutable. A list of &#x60;Tools&#x60; the model may use to generate the next response
  , CachedContent -> Maybe Text
cachedContentDisplayName :: !(Maybe Text)
  -- ^ "displayName" - Optional. Immutable. The user-generated meaningful display name of the cached content. Maximum 128 Unicode characters.
  , CachedContent -> Text
cachedContentModel :: !(Text)
  -- ^ /Required/ "model" - Required. Immutable. The name of the &#x60;Model&#x60; to use for cached content Format: &#x60;models/{model}&#x60;
  , CachedContent -> Maybe DateTime
cachedContentExpireTime :: !(Maybe DateTime)
  -- ^ "expireTime" - Timestamp in UTC of when this resource is considered expired. This is *always* provided on output, regardless of what was sent on input.
  , CachedContent -> Maybe CachedContentUsageMetadata
cachedContentUsageMetadata :: !(Maybe CachedContentUsageMetadata)
  -- ^ /ReadOnly/ "usageMetadata" - Output only. Metadata on the usage of the cached content.
  , CachedContent -> Maybe Text
cachedContentName :: !(Maybe Text)
  -- ^ /ReadOnly/ "name" - Output only. Identifier. The resource name referring to the cached content. Format: &#x60;cachedContents/{id}&#x60;
  , CachedContent -> Maybe [Content]
cachedContentContents :: !(Maybe [Content])
  -- ^ "contents" - Optional. Input only. Immutable. The content to cache.
  , CachedContent -> Maybe Content
cachedContentSystemInstruction :: !(Maybe Content)
  -- ^ "systemInstruction" - Optional. Input only. Immutable. Developer set system instruction. Currently text only.
  , CachedContent -> Maybe ToolConfig
cachedContentToolConfig :: !(Maybe ToolConfig)
  -- ^ "toolConfig" - Optional. Input only. Immutable. Tool config. This config is shared for all tools.
  , CachedContent -> Maybe DateTime
cachedContentCreateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "createTime" - Output only. Creation time of the cache entry.
  , CachedContent -> Maybe Text
cachedContentTtl :: !(Maybe Text)
  -- ^ "ttl" - Input only. New TTL for this resource, input only.
  , CachedContent -> Maybe DateTime
cachedContentUpdateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "updateTime" - Output only. When the cache entry was last updated in UTC time.
  }
  deriving (Int -> CachedContent -> ShowS
[CachedContent] -> ShowS
CachedContent -> [Char]
(Int -> CachedContent -> ShowS)
-> (CachedContent -> [Char])
-> ([CachedContent] -> ShowS)
-> Show CachedContent
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CachedContent -> ShowS
showsPrec :: Int -> CachedContent -> ShowS
$cshow :: CachedContent -> [Char]
show :: CachedContent -> [Char]
$cshowList :: [CachedContent] -> ShowS
showList :: [CachedContent] -> ShowS
P.Show, CachedContent -> CachedContent -> Bool
(CachedContent -> CachedContent -> Bool)
-> (CachedContent -> CachedContent -> Bool) -> Eq CachedContent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CachedContent -> CachedContent -> Bool
== :: CachedContent -> CachedContent -> Bool
$c/= :: CachedContent -> CachedContent -> Bool
/= :: CachedContent -> CachedContent -> Bool
P.Eq, P.Typeable)

-- | FromJSON CachedContent
instance A.FromJSON CachedContent where
  parseJSON :: Value -> Parser CachedContent
parseJSON = [Char]
-> (Object -> Parser CachedContent)
-> Value
-> Parser CachedContent
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CachedContent" ((Object -> Parser CachedContent) -> Value -> Parser CachedContent)
-> (Object -> Parser CachedContent)
-> Value
-> Parser CachedContent
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Tool]
-> Maybe Text
-> Text
-> Maybe DateTime
-> Maybe CachedContentUsageMetadata
-> Maybe Text
-> Maybe [Content]
-> Maybe Content
-> Maybe ToolConfig
-> Maybe DateTime
-> Maybe Text
-> Maybe DateTime
-> CachedContent
CachedContent
      (Maybe [Tool]
 -> Maybe Text
 -> Text
 -> Maybe DateTime
 -> Maybe CachedContentUsageMetadata
 -> Maybe Text
 -> Maybe [Content]
 -> Maybe Content
 -> Maybe ToolConfig
 -> Maybe DateTime
 -> Maybe Text
 -> Maybe DateTime
 -> CachedContent)
-> Parser (Maybe [Tool])
-> Parser
     (Maybe Text
      -> Text
      -> Maybe DateTime
      -> Maybe CachedContentUsageMetadata
      -> Maybe Text
      -> Maybe [Content]
      -> Maybe Content
      -> Maybe ToolConfig
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe DateTime
      -> CachedContent)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Tool])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tools")
      Parser
  (Maybe Text
   -> Text
   -> Maybe DateTime
   -> Maybe CachedContentUsageMetadata
   -> Maybe Text
   -> Maybe [Content]
   -> Maybe Content
   -> Maybe ToolConfig
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe DateTime
   -> CachedContent)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Maybe DateTime
      -> Maybe CachedContentUsageMetadata
      -> Maybe Text
      -> Maybe [Content]
      -> Maybe Content
      -> Maybe ToolConfig
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe DateTime
      -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"displayName")
      Parser
  (Text
   -> Maybe DateTime
   -> Maybe CachedContentUsageMetadata
   -> Maybe Text
   -> Maybe [Content]
   -> Maybe Content
   -> Maybe ToolConfig
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe DateTime
   -> CachedContent)
-> Parser Text
-> Parser
     (Maybe DateTime
      -> Maybe CachedContentUsageMetadata
      -> Maybe Text
      -> Maybe [Content]
      -> Maybe Content
      -> Maybe ToolConfig
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe DateTime
      -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"model")
      Parser
  (Maybe DateTime
   -> Maybe CachedContentUsageMetadata
   -> Maybe Text
   -> Maybe [Content]
   -> Maybe Content
   -> Maybe ToolConfig
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe DateTime
   -> CachedContent)
-> Parser (Maybe DateTime)
-> Parser
     (Maybe CachedContentUsageMetadata
      -> Maybe Text
      -> Maybe [Content]
      -> Maybe Content
      -> Maybe ToolConfig
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe DateTime
      -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"expireTime")
      Parser
  (Maybe CachedContentUsageMetadata
   -> Maybe Text
   -> Maybe [Content]
   -> Maybe Content
   -> Maybe ToolConfig
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe DateTime
   -> CachedContent)
-> Parser (Maybe CachedContentUsageMetadata)
-> Parser
     (Maybe Text
      -> Maybe [Content]
      -> Maybe Content
      -> Maybe ToolConfig
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe DateTime
      -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe CachedContentUsageMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"usageMetadata")
      Parser
  (Maybe Text
   -> Maybe [Content]
   -> Maybe Content
   -> Maybe ToolConfig
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe DateTime
   -> CachedContent)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Content]
      -> Maybe Content
      -> Maybe ToolConfig
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe DateTime
      -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser
  (Maybe [Content]
   -> Maybe Content
   -> Maybe ToolConfig
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe DateTime
   -> CachedContent)
-> Parser (Maybe [Content])
-> Parser
     (Maybe Content
      -> Maybe ToolConfig
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe DateTime
      -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Content])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"contents")
      Parser
  (Maybe Content
   -> Maybe ToolConfig
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe DateTime
   -> CachedContent)
-> Parser (Maybe Content)
-> Parser
     (Maybe ToolConfig
      -> Maybe DateTime -> Maybe Text -> Maybe DateTime -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Content)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"systemInstruction")
      Parser
  (Maybe ToolConfig
   -> Maybe DateTime -> Maybe Text -> Maybe DateTime -> CachedContent)
-> Parser (Maybe ToolConfig)
-> Parser
     (Maybe DateTime -> Maybe Text -> Maybe DateTime -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe ToolConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"toolConfig")
      Parser
  (Maybe DateTime -> Maybe Text -> Maybe DateTime -> CachedContent)
-> Parser (Maybe DateTime)
-> Parser (Maybe Text -> Maybe DateTime -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"createTime")
      Parser (Maybe Text -> Maybe DateTime -> CachedContent)
-> Parser (Maybe Text) -> Parser (Maybe DateTime -> CachedContent)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"ttl")
      Parser (Maybe DateTime -> CachedContent)
-> Parser (Maybe DateTime) -> Parser CachedContent
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"updateTime")

-- | ToJSON CachedContent
instance A.ToJSON CachedContent where
  toJSON :: CachedContent -> Value
toJSON CachedContent {Maybe [Content]
Maybe [Tool]
Maybe Text
Maybe DateTime
Maybe CachedContentUsageMetadata
Maybe Content
Maybe ToolConfig
Text
cachedContentTools :: CachedContent -> Maybe [Tool]
cachedContentDisplayName :: CachedContent -> Maybe Text
cachedContentModel :: CachedContent -> Text
cachedContentExpireTime :: CachedContent -> Maybe DateTime
cachedContentUsageMetadata :: CachedContent -> Maybe CachedContentUsageMetadata
cachedContentName :: CachedContent -> Maybe Text
cachedContentContents :: CachedContent -> Maybe [Content]
cachedContentSystemInstruction :: CachedContent -> Maybe Content
cachedContentToolConfig :: CachedContent -> Maybe ToolConfig
cachedContentCreateTime :: CachedContent -> Maybe DateTime
cachedContentTtl :: CachedContent -> Maybe Text
cachedContentUpdateTime :: CachedContent -> Maybe DateTime
cachedContentTools :: Maybe [Tool]
cachedContentDisplayName :: Maybe Text
cachedContentModel :: Text
cachedContentExpireTime :: Maybe DateTime
cachedContentUsageMetadata :: Maybe CachedContentUsageMetadata
cachedContentName :: Maybe Text
cachedContentContents :: Maybe [Content]
cachedContentSystemInstruction :: Maybe Content
cachedContentToolConfig :: Maybe ToolConfig
cachedContentCreateTime :: Maybe DateTime
cachedContentTtl :: Maybe Text
cachedContentUpdateTime :: Maybe DateTime
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"tools" Key -> Maybe [Tool] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Tool]
cachedContentTools
      , Key
"displayName" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
cachedContentDisplayName
      , Key
"model" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
cachedContentModel
      , Key
"expireTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
cachedContentExpireTime
      , Key
"usageMetadata" Key -> Maybe CachedContentUsageMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe CachedContentUsageMetadata
cachedContentUsageMetadata
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
cachedContentName
      , Key
"contents" Key -> Maybe [Content] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Content]
cachedContentContents
      , Key
"systemInstruction" Key -> Maybe Content -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Content
cachedContentSystemInstruction
      , Key
"toolConfig" Key -> Maybe ToolConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ToolConfig
cachedContentToolConfig
      , Key
"createTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
cachedContentCreateTime
      , Key
"ttl" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
cachedContentTtl
      , Key
"updateTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
cachedContentUpdateTime
      ]

-- | Construct a value of type 'CachedContent' (by applying it's required fields, if any)
mkCachedContent ::
  -- | 'cachedContentModel': Required. Immutable. The name of the `Model` to use for cached content Format: `models/{model}`
  Text ->
  CachedContent
mkCachedContent :: Text -> CachedContent
mkCachedContent Text
cachedContentModel =
  CachedContent
    { cachedContentTools :: Maybe [Tool]
cachedContentTools = Maybe [Tool]
forall a. Maybe a
Nothing
    , cachedContentDisplayName :: Maybe Text
cachedContentDisplayName = Maybe Text
forall a. Maybe a
Nothing
    , Text
cachedContentModel :: Text
cachedContentModel :: Text
cachedContentModel
    , cachedContentExpireTime :: Maybe DateTime
cachedContentExpireTime = Maybe DateTime
forall a. Maybe a
Nothing
    , cachedContentUsageMetadata :: Maybe CachedContentUsageMetadata
cachedContentUsageMetadata = Maybe CachedContentUsageMetadata
forall a. Maybe a
Nothing
    , cachedContentName :: Maybe Text
cachedContentName = Maybe Text
forall a. Maybe a
Nothing
    , cachedContentContents :: Maybe [Content]
cachedContentContents = Maybe [Content]
forall a. Maybe a
Nothing
    , cachedContentSystemInstruction :: Maybe Content
cachedContentSystemInstruction = Maybe Content
forall a. Maybe a
Nothing
    , cachedContentToolConfig :: Maybe ToolConfig
cachedContentToolConfig = Maybe ToolConfig
forall a. Maybe a
Nothing
    , cachedContentCreateTime :: Maybe DateTime
cachedContentCreateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , cachedContentTtl :: Maybe Text
cachedContentTtl = Maybe Text
forall a. Maybe a
Nothing
    , cachedContentUpdateTime :: Maybe DateTime
cachedContentUpdateTime = Maybe DateTime
forall a. Maybe a
Nothing
    }

-- ** CachedContentUsageMetadata

{- | CachedContentUsageMetadata
Metadata on the usage of the cached content.
-}
data CachedContentUsageMetadata = CachedContentUsageMetadata
  { CachedContentUsageMetadata -> Maybe Int
cachedContentUsageMetadataTotalTokenCount :: !(Maybe Int)
  -- ^ "totalTokenCount" - Total number of tokens that the cached content consumes.
  }
  deriving (Int -> CachedContentUsageMetadata -> ShowS
[CachedContentUsageMetadata] -> ShowS
CachedContentUsageMetadata -> [Char]
(Int -> CachedContentUsageMetadata -> ShowS)
-> (CachedContentUsageMetadata -> [Char])
-> ([CachedContentUsageMetadata] -> ShowS)
-> Show CachedContentUsageMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CachedContentUsageMetadata -> ShowS
showsPrec :: Int -> CachedContentUsageMetadata -> ShowS
$cshow :: CachedContentUsageMetadata -> [Char]
show :: CachedContentUsageMetadata -> [Char]
$cshowList :: [CachedContentUsageMetadata] -> ShowS
showList :: [CachedContentUsageMetadata] -> ShowS
P.Show, CachedContentUsageMetadata -> CachedContentUsageMetadata -> Bool
(CachedContentUsageMetadata -> CachedContentUsageMetadata -> Bool)
-> (CachedContentUsageMetadata
    -> CachedContentUsageMetadata -> Bool)
-> Eq CachedContentUsageMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CachedContentUsageMetadata -> CachedContentUsageMetadata -> Bool
== :: CachedContentUsageMetadata -> CachedContentUsageMetadata -> Bool
$c/= :: CachedContentUsageMetadata -> CachedContentUsageMetadata -> Bool
/= :: CachedContentUsageMetadata -> CachedContentUsageMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON CachedContentUsageMetadata
instance A.FromJSON CachedContentUsageMetadata where
  parseJSON :: Value -> Parser CachedContentUsageMetadata
parseJSON = [Char]
-> (Object -> Parser CachedContentUsageMetadata)
-> Value
-> Parser CachedContentUsageMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CachedContentUsageMetadata" ((Object -> Parser CachedContentUsageMetadata)
 -> Value -> Parser CachedContentUsageMetadata)
-> (Object -> Parser CachedContentUsageMetadata)
-> Value
-> Parser CachedContentUsageMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int -> CachedContentUsageMetadata
CachedContentUsageMetadata
      (Maybe Int -> CachedContentUsageMetadata)
-> Parser (Maybe Int) -> Parser CachedContentUsageMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"totalTokenCount")

-- | ToJSON CachedContentUsageMetadata
instance A.ToJSON CachedContentUsageMetadata where
  toJSON :: CachedContentUsageMetadata -> Value
toJSON CachedContentUsageMetadata {Maybe Int
cachedContentUsageMetadataTotalTokenCount :: CachedContentUsageMetadata -> Maybe Int
cachedContentUsageMetadataTotalTokenCount :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"totalTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
cachedContentUsageMetadataTotalTokenCount
      ]

-- | Construct a value of type 'CachedContentUsageMetadata' (by applying it's required fields, if any)
mkCachedContentUsageMetadata ::
  CachedContentUsageMetadata
mkCachedContentUsageMetadata :: CachedContentUsageMetadata
mkCachedContentUsageMetadata =
  CachedContentUsageMetadata
    { cachedContentUsageMetadataTotalTokenCount :: Maybe Int
cachedContentUsageMetadataTotalTokenCount = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** Candidate

{- | Candidate
A response candidate generated from the model.
-}
data Candidate = Candidate
  { Candidate -> Maybe CitationMetadata
candidateCitationMetadata :: !(Maybe CitationMetadata)
  -- ^ /ReadOnly/ "citationMetadata" - Output only. Citation information for model-generated candidate.  This field may be populated with recitation information for any text included in the &#x60;content&#x60;. These are passages that are \&quot;recited\&quot; from copyrighted material in the foundational LLM&#39;s training data.
  , Candidate -> Maybe GroundingMetadata
candidateGroundingMetadata :: !(Maybe GroundingMetadata)
  -- ^ /ReadOnly/ "groundingMetadata" - Output only. Grounding metadata for the candidate.  This field is populated for &#x60;GenerateContent&#x60; calls.
  , Candidate -> Maybe UrlContextMetadata
candidateUrlContextMetadata :: !(Maybe UrlContextMetadata)
  -- ^ /ReadOnly/ "urlContextMetadata" - Output only. Metadata related to url context retrieval tool.
  , Candidate -> Maybe [GroundingAttribution]
candidateGroundingAttributions :: !(Maybe [GroundingAttribution])
  -- ^ /ReadOnly/ "groundingAttributions" - Output only. Attribution information for sources that contributed to a grounded answer.  This field is populated for &#x60;GenerateAnswer&#x60; calls.
  , Candidate -> Maybe LogprobsResult
candidateLogprobsResult :: !(Maybe LogprobsResult)
  -- ^ /ReadOnly/ "logprobsResult" - Output only. Log-likelihood scores for the response tokens and top tokens
  , Candidate -> Maybe Content
candidateContent :: !(Maybe Content)
  -- ^ /ReadOnly/ "content" - Output only. Generated content returned from the model.
  , Candidate -> Maybe Double
candidateAvgLogprobs :: !(Maybe Double)
  -- ^ /ReadOnly/ "avgLogprobs" - Output only. Average log probability score of the candidate.
  , Candidate -> Maybe Int
candidateIndex :: !(Maybe Int)
  -- ^ /ReadOnly/ "index" - Output only. Index of the candidate in the list of response candidates.
  , Candidate -> Maybe E'FinishReason
candidateFinishReason :: !(Maybe E'FinishReason)
  -- ^ /ReadOnly/ "finishReason" - Optional. Output only. The reason why the model stopped generating tokens.  If empty, the model has not stopped generating tokens.
  , Candidate -> Maybe [SafetyRating]
candidateSafetyRatings :: !(Maybe [SafetyRating])
  -- ^ "safetyRatings" - List of ratings for the safety of a response candidate.  There is at most one rating per category.
  , Candidate -> Maybe Int
candidateTokenCount :: !(Maybe Int)
  -- ^ /ReadOnly/ "tokenCount" - Output only. Token count for this candidate.
  }
  deriving (Int -> Candidate -> ShowS
[Candidate] -> ShowS
Candidate -> [Char]
(Int -> Candidate -> ShowS)
-> (Candidate -> [Char])
-> ([Candidate] -> ShowS)
-> Show Candidate
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Candidate -> ShowS
showsPrec :: Int -> Candidate -> ShowS
$cshow :: Candidate -> [Char]
show :: Candidate -> [Char]
$cshowList :: [Candidate] -> ShowS
showList :: [Candidate] -> ShowS
P.Show, Candidate -> Candidate -> Bool
(Candidate -> Candidate -> Bool)
-> (Candidate -> Candidate -> Bool) -> Eq Candidate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Candidate -> Candidate -> Bool
== :: Candidate -> Candidate -> Bool
$c/= :: Candidate -> Candidate -> Bool
/= :: Candidate -> Candidate -> Bool
P.Eq, P.Typeable)

-- | FromJSON Candidate
instance A.FromJSON Candidate where
  parseJSON :: Value -> Parser Candidate
parseJSON = [Char] -> (Object -> Parser Candidate) -> Value -> Parser Candidate
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Candidate" ((Object -> Parser Candidate) -> Value -> Parser Candidate)
-> (Object -> Parser Candidate) -> Value -> Parser Candidate
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe CitationMetadata
-> Maybe GroundingMetadata
-> Maybe UrlContextMetadata
-> Maybe [GroundingAttribution]
-> Maybe LogprobsResult
-> Maybe Content
-> Maybe Double
-> Maybe Int
-> Maybe E'FinishReason
-> Maybe [SafetyRating]
-> Maybe Int
-> Candidate
Candidate
      (Maybe CitationMetadata
 -> Maybe GroundingMetadata
 -> Maybe UrlContextMetadata
 -> Maybe [GroundingAttribution]
 -> Maybe LogprobsResult
 -> Maybe Content
 -> Maybe Double
 -> Maybe Int
 -> Maybe E'FinishReason
 -> Maybe [SafetyRating]
 -> Maybe Int
 -> Candidate)
-> Parser (Maybe CitationMetadata)
-> Parser
     (Maybe GroundingMetadata
      -> Maybe UrlContextMetadata
      -> Maybe [GroundingAttribution]
      -> Maybe LogprobsResult
      -> Maybe Content
      -> Maybe Double
      -> Maybe Int
      -> Maybe E'FinishReason
      -> Maybe [SafetyRating]
      -> Maybe Int
      -> Candidate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe CitationMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"citationMetadata")
      Parser
  (Maybe GroundingMetadata
   -> Maybe UrlContextMetadata
   -> Maybe [GroundingAttribution]
   -> Maybe LogprobsResult
   -> Maybe Content
   -> Maybe Double
   -> Maybe Int
   -> Maybe E'FinishReason
   -> Maybe [SafetyRating]
   -> Maybe Int
   -> Candidate)
-> Parser (Maybe GroundingMetadata)
-> Parser
     (Maybe UrlContextMetadata
      -> Maybe [GroundingAttribution]
      -> Maybe LogprobsResult
      -> Maybe Content
      -> Maybe Double
      -> Maybe Int
      -> Maybe E'FinishReason
      -> Maybe [SafetyRating]
      -> Maybe Int
      -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe GroundingMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"groundingMetadata")
      Parser
  (Maybe UrlContextMetadata
   -> Maybe [GroundingAttribution]
   -> Maybe LogprobsResult
   -> Maybe Content
   -> Maybe Double
   -> Maybe Int
   -> Maybe E'FinishReason
   -> Maybe [SafetyRating]
   -> Maybe Int
   -> Candidate)
-> Parser (Maybe UrlContextMetadata)
-> Parser
     (Maybe [GroundingAttribution]
      -> Maybe LogprobsResult
      -> Maybe Content
      -> Maybe Double
      -> Maybe Int
      -> Maybe E'FinishReason
      -> Maybe [SafetyRating]
      -> Maybe Int
      -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe UrlContextMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"urlContextMetadata")
      Parser
  (Maybe [GroundingAttribution]
   -> Maybe LogprobsResult
   -> Maybe Content
   -> Maybe Double
   -> Maybe Int
   -> Maybe E'FinishReason
   -> Maybe [SafetyRating]
   -> Maybe Int
   -> Candidate)
-> Parser (Maybe [GroundingAttribution])
-> Parser
     (Maybe LogprobsResult
      -> Maybe Content
      -> Maybe Double
      -> Maybe Int
      -> Maybe E'FinishReason
      -> Maybe [SafetyRating]
      -> Maybe Int
      -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [GroundingAttribution])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"groundingAttributions")
      Parser
  (Maybe LogprobsResult
   -> Maybe Content
   -> Maybe Double
   -> Maybe Int
   -> Maybe E'FinishReason
   -> Maybe [SafetyRating]
   -> Maybe Int
   -> Candidate)
-> Parser (Maybe LogprobsResult)
-> Parser
     (Maybe Content
      -> Maybe Double
      -> Maybe Int
      -> Maybe E'FinishReason
      -> Maybe [SafetyRating]
      -> Maybe Int
      -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe LogprobsResult)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"logprobsResult")
      Parser
  (Maybe Content
   -> Maybe Double
   -> Maybe Int
   -> Maybe E'FinishReason
   -> Maybe [SafetyRating]
   -> Maybe Int
   -> Candidate)
-> Parser (Maybe Content)
-> Parser
     (Maybe Double
      -> Maybe Int
      -> Maybe E'FinishReason
      -> Maybe [SafetyRating]
      -> Maybe Int
      -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Content)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"content")
      Parser
  (Maybe Double
   -> Maybe Int
   -> Maybe E'FinishReason
   -> Maybe [SafetyRating]
   -> Maybe Int
   -> Candidate)
-> Parser (Maybe Double)
-> Parser
     (Maybe Int
      -> Maybe E'FinishReason
      -> Maybe [SafetyRating]
      -> Maybe Int
      -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"avgLogprobs")
      Parser
  (Maybe Int
   -> Maybe E'FinishReason
   -> Maybe [SafetyRating]
   -> Maybe Int
   -> Candidate)
-> Parser (Maybe Int)
-> Parser
     (Maybe E'FinishReason
      -> Maybe [SafetyRating] -> Maybe Int -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"index")
      Parser
  (Maybe E'FinishReason
   -> Maybe [SafetyRating] -> Maybe Int -> Candidate)
-> Parser (Maybe E'FinishReason)
-> Parser (Maybe [SafetyRating] -> Maybe Int -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'FinishReason)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"finishReason")
      Parser (Maybe [SafetyRating] -> Maybe Int -> Candidate)
-> Parser (Maybe [SafetyRating]) -> Parser (Maybe Int -> Candidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [SafetyRating])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetyRatings")
      Parser (Maybe Int -> Candidate)
-> Parser (Maybe Int) -> Parser Candidate
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tokenCount")

-- | ToJSON Candidate
instance A.ToJSON Candidate where
  toJSON :: Candidate -> Value
toJSON Candidate {Maybe Double
Maybe Int
Maybe [GroundingAttribution]
Maybe [SafetyRating]
Maybe CitationMetadata
Maybe Content
Maybe E'FinishReason
Maybe GroundingMetadata
Maybe LogprobsResult
Maybe UrlContextMetadata
candidateCitationMetadata :: Candidate -> Maybe CitationMetadata
candidateGroundingMetadata :: Candidate -> Maybe GroundingMetadata
candidateUrlContextMetadata :: Candidate -> Maybe UrlContextMetadata
candidateGroundingAttributions :: Candidate -> Maybe [GroundingAttribution]
candidateLogprobsResult :: Candidate -> Maybe LogprobsResult
candidateContent :: Candidate -> Maybe Content
candidateAvgLogprobs :: Candidate -> Maybe Double
candidateIndex :: Candidate -> Maybe Int
candidateFinishReason :: Candidate -> Maybe E'FinishReason
candidateSafetyRatings :: Candidate -> Maybe [SafetyRating]
candidateTokenCount :: Candidate -> Maybe Int
candidateCitationMetadata :: Maybe CitationMetadata
candidateGroundingMetadata :: Maybe GroundingMetadata
candidateUrlContextMetadata :: Maybe UrlContextMetadata
candidateGroundingAttributions :: Maybe [GroundingAttribution]
candidateLogprobsResult :: Maybe LogprobsResult
candidateContent :: Maybe Content
candidateAvgLogprobs :: Maybe Double
candidateIndex :: Maybe Int
candidateFinishReason :: Maybe E'FinishReason
candidateSafetyRatings :: Maybe [SafetyRating]
candidateTokenCount :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"citationMetadata" Key -> Maybe CitationMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe CitationMetadata
candidateCitationMetadata
      , Key
"groundingMetadata" Key -> Maybe GroundingMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GroundingMetadata
candidateGroundingMetadata
      , Key
"urlContextMetadata" Key -> Maybe UrlContextMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe UrlContextMetadata
candidateUrlContextMetadata
      , Key
"groundingAttributions" Key -> Maybe [GroundingAttribution] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [GroundingAttribution]
candidateGroundingAttributions
      , Key
"logprobsResult" Key -> Maybe LogprobsResult -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe LogprobsResult
candidateLogprobsResult
      , Key
"content" Key -> Maybe Content -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Content
candidateContent
      , Key
"avgLogprobs" Key -> Maybe Double -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Double
candidateAvgLogprobs
      , Key
"index" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
candidateIndex
      , Key
"finishReason" Key -> Maybe E'FinishReason -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'FinishReason
candidateFinishReason
      , Key
"safetyRatings" Key -> Maybe [SafetyRating] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetyRating]
candidateSafetyRatings
      , Key
"tokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
candidateTokenCount
      ]

-- | Construct a value of type 'Candidate' (by applying it's required fields, if any)
mkCandidate ::
  Candidate
mkCandidate :: Candidate
mkCandidate =
  Candidate
    { candidateCitationMetadata :: Maybe CitationMetadata
candidateCitationMetadata = Maybe CitationMetadata
forall a. Maybe a
Nothing
    , candidateGroundingMetadata :: Maybe GroundingMetadata
candidateGroundingMetadata = Maybe GroundingMetadata
forall a. Maybe a
Nothing
    , candidateUrlContextMetadata :: Maybe UrlContextMetadata
candidateUrlContextMetadata = Maybe UrlContextMetadata
forall a. Maybe a
Nothing
    , candidateGroundingAttributions :: Maybe [GroundingAttribution]
candidateGroundingAttributions = Maybe [GroundingAttribution]
forall a. Maybe a
Nothing
    , candidateLogprobsResult :: Maybe LogprobsResult
candidateLogprobsResult = Maybe LogprobsResult
forall a. Maybe a
Nothing
    , candidateContent :: Maybe Content
candidateContent = Maybe Content
forall a. Maybe a
Nothing
    , candidateAvgLogprobs :: Maybe Double
candidateAvgLogprobs = Maybe Double
forall a. Maybe a
Nothing
    , candidateIndex :: Maybe Int
candidateIndex = Maybe Int
forall a. Maybe a
Nothing
    , candidateFinishReason :: Maybe E'FinishReason
candidateFinishReason = Maybe E'FinishReason
forall a. Maybe a
Nothing
    , candidateSafetyRatings :: Maybe [SafetyRating]
candidateSafetyRatings = Maybe [SafetyRating]
forall a. Maybe a
Nothing
    , candidateTokenCount :: Maybe Int
candidateTokenCount = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** Chunk

{- | Chunk
A `Chunk` is a subpart of a `Document` that is treated as an independent unit for the purposes of vector representation and storage. A `Corpus` can have a maximum of 1 million `Chunk`s.
-}
data Chunk = Chunk
  { Chunk -> Maybe DateTime
chunkCreateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "createTime" - Output only. The Timestamp of when the &#x60;Chunk&#x60; was created.
  , Chunk -> Maybe [CustomMetadata]
chunkCustomMetadata :: !(Maybe [CustomMetadata])
  -- ^ "customMetadata" - Optional. User provided custom metadata stored as key-value pairs. The maximum number of &#x60;CustomMetadata&#x60; per chunk is 20.
  , Chunk -> ChunkData
chunkData :: !(ChunkData)
  -- ^ /Required/ "data" - Required. The content for the &#x60;Chunk&#x60;, such as the text string. The maximum number of tokens per chunk is 2043.
  , Chunk -> Maybe DateTime
chunkUpdateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "updateTime" - Output only. The Timestamp of when the &#x60;Chunk&#x60; was last updated.
  , Chunk -> Maybe E'State4
chunkState :: !(Maybe E'State4)
  -- ^ /ReadOnly/ "state" - Output only. Current state of the &#x60;Chunk&#x60;.
  , Chunk -> Maybe Text
chunkName :: !(Maybe Text)
  -- ^ "name" - Immutable. Identifier. The &#x60;Chunk&#x60; resource name. The ID (name excluding the \&quot;corpora/*/documents/*/chunks/\&quot; prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a random 12-character unique ID will be generated. Example: &#x60;corpora/{corpus_id}/documents/{document_id}/chunks/123a456b789c&#x60;
  }
  deriving (Int -> Chunk -> ShowS
[Chunk] -> ShowS
Chunk -> [Char]
(Int -> Chunk -> ShowS)
-> (Chunk -> [Char]) -> ([Chunk] -> ShowS) -> Show Chunk
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Chunk -> ShowS
showsPrec :: Int -> Chunk -> ShowS
$cshow :: Chunk -> [Char]
show :: Chunk -> [Char]
$cshowList :: [Chunk] -> ShowS
showList :: [Chunk] -> ShowS
P.Show, Chunk -> Chunk -> Bool
(Chunk -> Chunk -> Bool) -> (Chunk -> Chunk -> Bool) -> Eq Chunk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Chunk -> Chunk -> Bool
== :: Chunk -> Chunk -> Bool
$c/= :: Chunk -> Chunk -> Bool
/= :: Chunk -> Chunk -> Bool
P.Eq, P.Typeable)

-- | FromJSON Chunk
instance A.FromJSON Chunk where
  parseJSON :: Value -> Parser Chunk
parseJSON = [Char] -> (Object -> Parser Chunk) -> Value -> Parser Chunk
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Chunk" ((Object -> Parser Chunk) -> Value -> Parser Chunk)
-> (Object -> Parser Chunk) -> Value -> Parser Chunk
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe DateTime
-> Maybe [CustomMetadata]
-> ChunkData
-> Maybe DateTime
-> Maybe E'State4
-> Maybe Text
-> Chunk
Chunk
      (Maybe DateTime
 -> Maybe [CustomMetadata]
 -> ChunkData
 -> Maybe DateTime
 -> Maybe E'State4
 -> Maybe Text
 -> Chunk)
-> Parser (Maybe DateTime)
-> Parser
     (Maybe [CustomMetadata]
      -> ChunkData
      -> Maybe DateTime
      -> Maybe E'State4
      -> Maybe Text
      -> Chunk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"createTime")
      Parser
  (Maybe [CustomMetadata]
   -> ChunkData
   -> Maybe DateTime
   -> Maybe E'State4
   -> Maybe Text
   -> Chunk)
-> Parser (Maybe [CustomMetadata])
-> Parser
     (ChunkData
      -> Maybe DateTime -> Maybe E'State4 -> Maybe Text -> Chunk)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [CustomMetadata])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"customMetadata")
      Parser
  (ChunkData
   -> Maybe DateTime -> Maybe E'State4 -> Maybe Text -> Chunk)
-> Parser ChunkData
-> Parser (Maybe DateTime -> Maybe E'State4 -> Maybe Text -> Chunk)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser ChunkData
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"data")
      Parser (Maybe DateTime -> Maybe E'State4 -> Maybe Text -> Chunk)
-> Parser (Maybe DateTime)
-> Parser (Maybe E'State4 -> Maybe Text -> Chunk)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"updateTime")
      Parser (Maybe E'State4 -> Maybe Text -> Chunk)
-> Parser (Maybe E'State4) -> Parser (Maybe Text -> Chunk)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'State4)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"state")
      Parser (Maybe Text -> Chunk) -> Parser (Maybe Text) -> Parser Chunk
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")

-- | ToJSON Chunk
instance A.ToJSON Chunk where
  toJSON :: Chunk -> Value
toJSON Chunk {Maybe [CustomMetadata]
Maybe Text
Maybe DateTime
Maybe E'State4
ChunkData
chunkCreateTime :: Chunk -> Maybe DateTime
chunkCustomMetadata :: Chunk -> Maybe [CustomMetadata]
chunkData :: Chunk -> ChunkData
chunkUpdateTime :: Chunk -> Maybe DateTime
chunkState :: Chunk -> Maybe E'State4
chunkName :: Chunk -> Maybe Text
chunkCreateTime :: Maybe DateTime
chunkCustomMetadata :: Maybe [CustomMetadata]
chunkData :: ChunkData
chunkUpdateTime :: Maybe DateTime
chunkState :: Maybe E'State4
chunkName :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"createTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
chunkCreateTime
      , Key
"customMetadata" Key -> Maybe [CustomMetadata] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [CustomMetadata]
chunkCustomMetadata
      , Key
"data" Key -> ChunkData -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ChunkData
chunkData
      , Key
"updateTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
chunkUpdateTime
      , Key
"state" Key -> Maybe E'State4 -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'State4
chunkState
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
chunkName
      ]

-- | Construct a value of type 'Chunk' (by applying it's required fields, if any)
mkChunk ::
  -- | 'chunkData': Required. The content for the `Chunk`, such as the text string. The maximum number of tokens per chunk is 2043.
  ChunkData ->
  Chunk
mkChunk :: ChunkData -> Chunk
mkChunk ChunkData
chunkData =
  Chunk
    { chunkCreateTime :: Maybe DateTime
chunkCreateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , chunkCustomMetadata :: Maybe [CustomMetadata]
chunkCustomMetadata = Maybe [CustomMetadata]
forall a. Maybe a
Nothing
    , ChunkData
chunkData :: ChunkData
chunkData :: ChunkData
chunkData
    , chunkUpdateTime :: Maybe DateTime
chunkUpdateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , chunkState :: Maybe E'State4
chunkState = Maybe E'State4
forall a. Maybe a
Nothing
    , chunkName :: Maybe Text
chunkName = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** ChunkData

{- | ChunkData
Extracted data that represents the `Chunk` content.
-}
data ChunkData = ChunkData
  { ChunkData -> Maybe Text
chunkDataStringValue :: !(Maybe Text)
  -- ^ "stringValue" - The &#x60;Chunk&#x60; content as a string. The maximum number of tokens per chunk is 2043.
  }
  deriving (Int -> ChunkData -> ShowS
[ChunkData] -> ShowS
ChunkData -> [Char]
(Int -> ChunkData -> ShowS)
-> (ChunkData -> [Char])
-> ([ChunkData] -> ShowS)
-> Show ChunkData
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ChunkData -> ShowS
showsPrec :: Int -> ChunkData -> ShowS
$cshow :: ChunkData -> [Char]
show :: ChunkData -> [Char]
$cshowList :: [ChunkData] -> ShowS
showList :: [ChunkData] -> ShowS
P.Show, ChunkData -> ChunkData -> Bool
(ChunkData -> ChunkData -> Bool)
-> (ChunkData -> ChunkData -> Bool) -> Eq ChunkData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ChunkData -> ChunkData -> Bool
== :: ChunkData -> ChunkData -> Bool
$c/= :: ChunkData -> ChunkData -> Bool
/= :: ChunkData -> ChunkData -> Bool
P.Eq, P.Typeable)

-- | FromJSON ChunkData
instance A.FromJSON ChunkData where
  parseJSON :: Value -> Parser ChunkData
parseJSON = [Char] -> (Object -> Parser ChunkData) -> Value -> Parser ChunkData
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ChunkData" ((Object -> Parser ChunkData) -> Value -> Parser ChunkData)
-> (Object -> Parser ChunkData) -> Value -> Parser ChunkData
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> ChunkData
ChunkData
      (Maybe Text -> ChunkData)
-> Parser (Maybe Text) -> Parser ChunkData
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"stringValue")

-- | ToJSON ChunkData
instance A.ToJSON ChunkData where
  toJSON :: ChunkData -> Value
toJSON ChunkData {Maybe Text
chunkDataStringValue :: ChunkData -> Maybe Text
chunkDataStringValue :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"stringValue" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
chunkDataStringValue
      ]

-- | Construct a value of type 'ChunkData' (by applying it's required fields, if any)
mkChunkData ::
  ChunkData
mkChunkData :: ChunkData
mkChunkData =
  ChunkData
    { chunkDataStringValue :: Maybe Text
chunkDataStringValue = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** CitationMetadata

{- | CitationMetadata
A collection of source attributions for a piece of content.
-}
data CitationMetadata = CitationMetadata
  { CitationMetadata -> Maybe [CitationSource]
citationMetadataCitationSources :: !(Maybe [CitationSource])
  -- ^ "citationSources" - Citations to sources for a specific response.
  }
  deriving (Int -> CitationMetadata -> ShowS
[CitationMetadata] -> ShowS
CitationMetadata -> [Char]
(Int -> CitationMetadata -> ShowS)
-> (CitationMetadata -> [Char])
-> ([CitationMetadata] -> ShowS)
-> Show CitationMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CitationMetadata -> ShowS
showsPrec :: Int -> CitationMetadata -> ShowS
$cshow :: CitationMetadata -> [Char]
show :: CitationMetadata -> [Char]
$cshowList :: [CitationMetadata] -> ShowS
showList :: [CitationMetadata] -> ShowS
P.Show, CitationMetadata -> CitationMetadata -> Bool
(CitationMetadata -> CitationMetadata -> Bool)
-> (CitationMetadata -> CitationMetadata -> Bool)
-> Eq CitationMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CitationMetadata -> CitationMetadata -> Bool
== :: CitationMetadata -> CitationMetadata -> Bool
$c/= :: CitationMetadata -> CitationMetadata -> Bool
/= :: CitationMetadata -> CitationMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON CitationMetadata
instance A.FromJSON CitationMetadata where
  parseJSON :: Value -> Parser CitationMetadata
parseJSON = [Char]
-> (Object -> Parser CitationMetadata)
-> Value
-> Parser CitationMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CitationMetadata" ((Object -> Parser CitationMetadata)
 -> Value -> Parser CitationMetadata)
-> (Object -> Parser CitationMetadata)
-> Value
-> Parser CitationMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [CitationSource] -> CitationMetadata
CitationMetadata
      (Maybe [CitationSource] -> CitationMetadata)
-> Parser (Maybe [CitationSource]) -> Parser CitationMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [CitationSource])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"citationSources")

-- | ToJSON CitationMetadata
instance A.ToJSON CitationMetadata where
  toJSON :: CitationMetadata -> Value
toJSON CitationMetadata {Maybe [CitationSource]
citationMetadataCitationSources :: CitationMetadata -> Maybe [CitationSource]
citationMetadataCitationSources :: Maybe [CitationSource]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"citationSources" Key -> Maybe [CitationSource] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [CitationSource]
citationMetadataCitationSources
      ]

-- | Construct a value of type 'CitationMetadata' (by applying it's required fields, if any)
mkCitationMetadata ::
  CitationMetadata
mkCitationMetadata :: CitationMetadata
mkCitationMetadata =
  CitationMetadata
    { citationMetadataCitationSources :: Maybe [CitationSource]
citationMetadataCitationSources = Maybe [CitationSource]
forall a. Maybe a
Nothing
    }

-- ** CitationSource

{- | CitationSource
A citation to a source for a portion of a specific response.
-}
data CitationSource = CitationSource
  { CitationSource -> Maybe Int
citationSourceStartIndex :: !(Maybe Int)
  -- ^ "startIndex" - Optional. Start of segment of the response that is attributed to this source.  Index indicates the start of the segment, measured in bytes.
  , CitationSource -> Maybe Text
citationSourceUri :: !(Maybe Text)
  -- ^ "uri" - Optional. URI that is attributed as a source for a portion of the text.
  , CitationSource -> Maybe Int
citationSourceEndIndex :: !(Maybe Int)
  -- ^ "endIndex" - Optional. End of the attributed segment, exclusive.
  , CitationSource -> Maybe Text
citationSourceLicense :: !(Maybe Text)
  -- ^ "license" - Optional. License for the GitHub project that is attributed as a source for segment.  License info is required for code citations.
  }
  deriving (Int -> CitationSource -> ShowS
[CitationSource] -> ShowS
CitationSource -> [Char]
(Int -> CitationSource -> ShowS)
-> (CitationSource -> [Char])
-> ([CitationSource] -> ShowS)
-> Show CitationSource
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CitationSource -> ShowS
showsPrec :: Int -> CitationSource -> ShowS
$cshow :: CitationSource -> [Char]
show :: CitationSource -> [Char]
$cshowList :: [CitationSource] -> ShowS
showList :: [CitationSource] -> ShowS
P.Show, CitationSource -> CitationSource -> Bool
(CitationSource -> CitationSource -> Bool)
-> (CitationSource -> CitationSource -> Bool) -> Eq CitationSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CitationSource -> CitationSource -> Bool
== :: CitationSource -> CitationSource -> Bool
$c/= :: CitationSource -> CitationSource -> Bool
/= :: CitationSource -> CitationSource -> Bool
P.Eq, P.Typeable)

-- | FromJSON CitationSource
instance A.FromJSON CitationSource where
  parseJSON :: Value -> Parser CitationSource
parseJSON = [Char]
-> (Object -> Parser CitationSource)
-> Value
-> Parser CitationSource
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CitationSource" ((Object -> Parser CitationSource)
 -> Value -> Parser CitationSource)
-> (Object -> Parser CitationSource)
-> Value
-> Parser CitationSource
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int
-> Maybe Text -> Maybe Int -> Maybe Text -> CitationSource
CitationSource
      (Maybe Int
 -> Maybe Text -> Maybe Int -> Maybe Text -> CitationSource)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Int -> Maybe Text -> CitationSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"startIndex")
      Parser (Maybe Text -> Maybe Int -> Maybe Text -> CitationSource)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> CitationSource)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"uri")
      Parser (Maybe Int -> Maybe Text -> CitationSource)
-> Parser (Maybe Int) -> Parser (Maybe Text -> CitationSource)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"endIndex")
      Parser (Maybe Text -> CitationSource)
-> Parser (Maybe Text) -> Parser CitationSource
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"license")

-- | ToJSON CitationSource
instance A.ToJSON CitationSource where
  toJSON :: CitationSource -> Value
toJSON CitationSource {Maybe Int
Maybe Text
citationSourceStartIndex :: CitationSource -> Maybe Int
citationSourceUri :: CitationSource -> Maybe Text
citationSourceEndIndex :: CitationSource -> Maybe Int
citationSourceLicense :: CitationSource -> Maybe Text
citationSourceStartIndex :: Maybe Int
citationSourceUri :: Maybe Text
citationSourceEndIndex :: Maybe Int
citationSourceLicense :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"startIndex" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
citationSourceStartIndex
      , Key
"uri" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
citationSourceUri
      , Key
"endIndex" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
citationSourceEndIndex
      , Key
"license" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
citationSourceLicense
      ]

-- | Construct a value of type 'CitationSource' (by applying it's required fields, if any)
mkCitationSource ::
  CitationSource
mkCitationSource :: CitationSource
mkCitationSource =
  CitationSource
    { citationSourceStartIndex :: Maybe Int
citationSourceStartIndex = Maybe Int
forall a. Maybe a
Nothing
    , citationSourceUri :: Maybe Text
citationSourceUri = Maybe Text
forall a. Maybe a
Nothing
    , citationSourceEndIndex :: Maybe Int
citationSourceEndIndex = Maybe Int
forall a. Maybe a
Nothing
    , citationSourceLicense :: Maybe Text
citationSourceLicense = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** CodeExecutionResult

{- | CodeExecutionResult
Result of executing the `ExecutableCode`.  Only generated when using the `CodeExecution`, and always follows a `part` containing the `ExecutableCode`.
-}
data CodeExecutionResult = CodeExecutionResult
  { CodeExecutionResult -> E'Outcome
codeExecutionResultOutcome :: !(E'Outcome)
  -- ^ /Required/ "outcome" - Required. Outcome of the code execution.
  , CodeExecutionResult -> Maybe Text
codeExecutionResultOutput :: !(Maybe Text)
  -- ^ "output" - Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
  }
  deriving (Int -> CodeExecutionResult -> ShowS
[CodeExecutionResult] -> ShowS
CodeExecutionResult -> [Char]
(Int -> CodeExecutionResult -> ShowS)
-> (CodeExecutionResult -> [Char])
-> ([CodeExecutionResult] -> ShowS)
-> Show CodeExecutionResult
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CodeExecutionResult -> ShowS
showsPrec :: Int -> CodeExecutionResult -> ShowS
$cshow :: CodeExecutionResult -> [Char]
show :: CodeExecutionResult -> [Char]
$cshowList :: [CodeExecutionResult] -> ShowS
showList :: [CodeExecutionResult] -> ShowS
P.Show, CodeExecutionResult -> CodeExecutionResult -> Bool
(CodeExecutionResult -> CodeExecutionResult -> Bool)
-> (CodeExecutionResult -> CodeExecutionResult -> Bool)
-> Eq CodeExecutionResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CodeExecutionResult -> CodeExecutionResult -> Bool
== :: CodeExecutionResult -> CodeExecutionResult -> Bool
$c/= :: CodeExecutionResult -> CodeExecutionResult -> Bool
/= :: CodeExecutionResult -> CodeExecutionResult -> Bool
P.Eq, P.Typeable)

-- | FromJSON CodeExecutionResult
instance A.FromJSON CodeExecutionResult where
  parseJSON :: Value -> Parser CodeExecutionResult
parseJSON = [Char]
-> (Object -> Parser CodeExecutionResult)
-> Value
-> Parser CodeExecutionResult
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CodeExecutionResult" ((Object -> Parser CodeExecutionResult)
 -> Value -> Parser CodeExecutionResult)
-> (Object -> Parser CodeExecutionResult)
-> Value
-> Parser CodeExecutionResult
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    E'Outcome -> Maybe Text -> CodeExecutionResult
CodeExecutionResult
      (E'Outcome -> Maybe Text -> CodeExecutionResult)
-> Parser E'Outcome -> Parser (Maybe Text -> CodeExecutionResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser E'Outcome
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"outcome")
      Parser (Maybe Text -> CodeExecutionResult)
-> Parser (Maybe Text) -> Parser CodeExecutionResult
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"output")

-- | ToJSON CodeExecutionResult
instance A.ToJSON CodeExecutionResult where
  toJSON :: CodeExecutionResult -> Value
toJSON CodeExecutionResult {Maybe Text
E'Outcome
codeExecutionResultOutcome :: CodeExecutionResult -> E'Outcome
codeExecutionResultOutput :: CodeExecutionResult -> Maybe Text
codeExecutionResultOutcome :: E'Outcome
codeExecutionResultOutput :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"outcome" Key -> E'Outcome -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= E'Outcome
codeExecutionResultOutcome
      , Key
"output" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
codeExecutionResultOutput
      ]

-- | Construct a value of type 'CodeExecutionResult' (by applying it's required fields, if any)
mkCodeExecutionResult ::
  -- | 'codeExecutionResultOutcome': Required. Outcome of the code execution.
  E'Outcome ->
  CodeExecutionResult
mkCodeExecutionResult :: E'Outcome -> CodeExecutionResult
mkCodeExecutionResult E'Outcome
codeExecutionResultOutcome =
  CodeExecutionResult
    { E'Outcome
codeExecutionResultOutcome :: E'Outcome
codeExecutionResultOutcome :: E'Outcome
codeExecutionResultOutcome
    , codeExecutionResultOutput :: Maybe Text
codeExecutionResultOutput = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** Condition

{- | Condition
Filter condition applicable to a single key.
-}
data Condition = Condition
  { Condition -> Maybe Float
conditionNumericValue :: !(Maybe Float)
  -- ^ "numericValue" - The numeric value to filter the metadata on.
  , Condition -> E'Operation
conditionOperation :: !(E'Operation)
  -- ^ /Required/ "operation" - Required. Operator applied to the given key-value pair to trigger the condition.
  , Condition -> Maybe Text
conditionStringValue :: !(Maybe Text)
  -- ^ "stringValue" - The string value to filter the metadata on.
  }
  deriving (Int -> Condition -> ShowS
[Condition] -> ShowS
Condition -> [Char]
(Int -> Condition -> ShowS)
-> (Condition -> [Char])
-> ([Condition] -> ShowS)
-> Show Condition
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Condition -> ShowS
showsPrec :: Int -> Condition -> ShowS
$cshow :: Condition -> [Char]
show :: Condition -> [Char]
$cshowList :: [Condition] -> ShowS
showList :: [Condition] -> ShowS
P.Show, Condition -> Condition -> Bool
(Condition -> Condition -> Bool)
-> (Condition -> Condition -> Bool) -> Eq Condition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Condition -> Condition -> Bool
== :: Condition -> Condition -> Bool
$c/= :: Condition -> Condition -> Bool
/= :: Condition -> Condition -> Bool
P.Eq, P.Typeable)

-- | FromJSON Condition
instance A.FromJSON Condition where
  parseJSON :: Value -> Parser Condition
parseJSON = [Char] -> (Object -> Parser Condition) -> Value -> Parser Condition
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Condition" ((Object -> Parser Condition) -> Value -> Parser Condition)
-> (Object -> Parser Condition) -> Value -> Parser Condition
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Float -> E'Operation -> Maybe Text -> Condition
Condition
      (Maybe Float -> E'Operation -> Maybe Text -> Condition)
-> Parser (Maybe Float)
-> Parser (E'Operation -> Maybe Text -> Condition)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"numericValue")
      Parser (E'Operation -> Maybe Text -> Condition)
-> Parser E'Operation -> Parser (Maybe Text -> Condition)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser E'Operation
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"operation")
      Parser (Maybe Text -> Condition)
-> Parser (Maybe Text) -> Parser Condition
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"stringValue")

-- | ToJSON Condition
instance A.ToJSON Condition where
  toJSON :: Condition -> Value
toJSON Condition {Maybe Float
Maybe Text
E'Operation
conditionNumericValue :: Condition -> Maybe Float
conditionOperation :: Condition -> E'Operation
conditionStringValue :: Condition -> Maybe Text
conditionNumericValue :: Maybe Float
conditionOperation :: E'Operation
conditionStringValue :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"numericValue" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
conditionNumericValue
      , Key
"operation" Key -> E'Operation -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= E'Operation
conditionOperation
      , Key
"stringValue" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
conditionStringValue
      ]

-- | Construct a value of type 'Condition' (by applying it's required fields, if any)
mkCondition ::
  -- | 'conditionOperation': Required. Operator applied to the given key-value pair to trigger the condition.
  E'Operation ->
  Condition
mkCondition :: E'Operation -> Condition
mkCondition E'Operation
conditionOperation =
  Condition
    { conditionNumericValue :: Maybe Float
conditionNumericValue = Maybe Float
forall a. Maybe a
Nothing
    , E'Operation
conditionOperation :: E'Operation
conditionOperation :: E'Operation
conditionOperation
    , conditionStringValue :: Maybe Text
conditionStringValue = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** Content

{- | Content
The base structured datatype containing multi-part content of a message.  A `Content` includes a `role` field designating the producer of the `Content` and a `parts` field containing multi-part data that contains the content of the message turn.
-}
data Content = Content
  { Content -> Maybe [Part]
contentParts :: !(Maybe [Part])
  -- ^ "parts" - Ordered &#x60;Parts&#x60; that constitute a single message. Parts may have different MIME types.
  , Content -> Maybe Text
contentRole :: !(Maybe Text)
  -- ^ "role" - Optional. The producer of the content. Must be either &#39;user&#39; or &#39;model&#39;.  Useful to set for multi-turn conversations, otherwise can be left blank or unset.
  }
  deriving (Int -> Content -> ShowS
[Content] -> ShowS
Content -> [Char]
(Int -> Content -> ShowS)
-> (Content -> [Char]) -> ([Content] -> ShowS) -> Show Content
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Content -> ShowS
showsPrec :: Int -> Content -> ShowS
$cshow :: Content -> [Char]
show :: Content -> [Char]
$cshowList :: [Content] -> ShowS
showList :: [Content] -> ShowS
P.Show, Content -> Content -> Bool
(Content -> Content -> Bool)
-> (Content -> Content -> Bool) -> Eq Content
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Content -> Content -> Bool
== :: Content -> Content -> Bool
$c/= :: Content -> Content -> Bool
/= :: Content -> Content -> Bool
P.Eq, P.Typeable)

-- | FromJSON Content
instance A.FromJSON Content where
  parseJSON :: Value -> Parser Content
parseJSON = [Char] -> (Object -> Parser Content) -> Value -> Parser Content
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Content" ((Object -> Parser Content) -> Value -> Parser Content)
-> (Object -> Parser Content) -> Value -> Parser Content
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Part] -> Maybe Text -> Content
Content
      (Maybe [Part] -> Maybe Text -> Content)
-> Parser (Maybe [Part]) -> Parser (Maybe Text -> Content)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Part])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"parts")
      Parser (Maybe Text -> Content)
-> Parser (Maybe Text) -> Parser Content
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"role")

-- | ToJSON Content
instance A.ToJSON Content where
  toJSON :: Content -> Value
toJSON Content {Maybe [Part]
Maybe Text
contentParts :: Content -> Maybe [Part]
contentRole :: Content -> Maybe Text
contentParts :: Maybe [Part]
contentRole :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"parts" Key -> Maybe [Part] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Part]
contentParts
      , Key
"role" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
contentRole
      ]

-- | Construct a value of type 'Content' (by applying it's required fields, if any)
mkContent ::
  Content
mkContent :: Content
mkContent =
  Content
    { contentParts :: Maybe [Part]
contentParts = Maybe [Part]
forall a. Maybe a
Nothing
    , contentRole :: Maybe Text
contentRole = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** ContentEmbedding

{- | ContentEmbedding
A list of floats representing an embedding.
-}
data ContentEmbedding = ContentEmbedding
  { ContentEmbedding -> Maybe [Float]
contentEmbeddingValues :: !(Maybe [Float])
  -- ^ "values" - The embedding values.
  }
  deriving (Int -> ContentEmbedding -> ShowS
[ContentEmbedding] -> ShowS
ContentEmbedding -> [Char]
(Int -> ContentEmbedding -> ShowS)
-> (ContentEmbedding -> [Char])
-> ([ContentEmbedding] -> ShowS)
-> Show ContentEmbedding
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ContentEmbedding -> ShowS
showsPrec :: Int -> ContentEmbedding -> ShowS
$cshow :: ContentEmbedding -> [Char]
show :: ContentEmbedding -> [Char]
$cshowList :: [ContentEmbedding] -> ShowS
showList :: [ContentEmbedding] -> ShowS
P.Show, ContentEmbedding -> ContentEmbedding -> Bool
(ContentEmbedding -> ContentEmbedding -> Bool)
-> (ContentEmbedding -> ContentEmbedding -> Bool)
-> Eq ContentEmbedding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ContentEmbedding -> ContentEmbedding -> Bool
== :: ContentEmbedding -> ContentEmbedding -> Bool
$c/= :: ContentEmbedding -> ContentEmbedding -> Bool
/= :: ContentEmbedding -> ContentEmbedding -> Bool
P.Eq, P.Typeable)

-- | FromJSON ContentEmbedding
instance A.FromJSON ContentEmbedding where
  parseJSON :: Value -> Parser ContentEmbedding
parseJSON = [Char]
-> (Object -> Parser ContentEmbedding)
-> Value
-> Parser ContentEmbedding
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ContentEmbedding" ((Object -> Parser ContentEmbedding)
 -> Value -> Parser ContentEmbedding)
-> (Object -> Parser ContentEmbedding)
-> Value
-> Parser ContentEmbedding
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Float] -> ContentEmbedding
ContentEmbedding
      (Maybe [Float] -> ContentEmbedding)
-> Parser (Maybe [Float]) -> Parser ContentEmbedding
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Float])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"values")

-- | ToJSON ContentEmbedding
instance A.ToJSON ContentEmbedding where
  toJSON :: ContentEmbedding -> Value
toJSON ContentEmbedding {Maybe [Float]
contentEmbeddingValues :: ContentEmbedding -> Maybe [Float]
contentEmbeddingValues :: Maybe [Float]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"values" Key -> Maybe [Float] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Float]
contentEmbeddingValues
      ]

-- | Construct a value of type 'ContentEmbedding' (by applying it's required fields, if any)
mkContentEmbedding ::
  ContentEmbedding
mkContentEmbedding :: ContentEmbedding
mkContentEmbedding =
  ContentEmbedding
    { contentEmbeddingValues :: Maybe [Float]
contentEmbeddingValues = Maybe [Float]
forall a. Maybe a
Nothing
    }

-- ** ContentFilter

{- | ContentFilter
Content filtering metadata associated with processing a single request.  ContentFilter contains a reason and an optional supporting string. The reason may be unspecified.
-}
data ContentFilter = ContentFilter
  { ContentFilter -> Maybe E'Reason
contentFilterReason :: !(Maybe E'Reason)
  -- ^ "reason" - The reason content was blocked during request processing.
  , ContentFilter -> Maybe Text
contentFilterMessage :: !(Maybe Text)
  -- ^ "message" - A string that describes the filtering behavior in more detail.
  }
  deriving (Int -> ContentFilter -> ShowS
[ContentFilter] -> ShowS
ContentFilter -> [Char]
(Int -> ContentFilter -> ShowS)
-> (ContentFilter -> [Char])
-> ([ContentFilter] -> ShowS)
-> Show ContentFilter
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ContentFilter -> ShowS
showsPrec :: Int -> ContentFilter -> ShowS
$cshow :: ContentFilter -> [Char]
show :: ContentFilter -> [Char]
$cshowList :: [ContentFilter] -> ShowS
showList :: [ContentFilter] -> ShowS
P.Show, ContentFilter -> ContentFilter -> Bool
(ContentFilter -> ContentFilter -> Bool)
-> (ContentFilter -> ContentFilter -> Bool) -> Eq ContentFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ContentFilter -> ContentFilter -> Bool
== :: ContentFilter -> ContentFilter -> Bool
$c/= :: ContentFilter -> ContentFilter -> Bool
/= :: ContentFilter -> ContentFilter -> Bool
P.Eq, P.Typeable)

-- | FromJSON ContentFilter
instance A.FromJSON ContentFilter where
  parseJSON :: Value -> Parser ContentFilter
parseJSON = [Char]
-> (Object -> Parser ContentFilter)
-> Value
-> Parser ContentFilter
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ContentFilter" ((Object -> Parser ContentFilter) -> Value -> Parser ContentFilter)
-> (Object -> Parser ContentFilter)
-> Value
-> Parser ContentFilter
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe E'Reason -> Maybe Text -> ContentFilter
ContentFilter
      (Maybe E'Reason -> Maybe Text -> ContentFilter)
-> Parser (Maybe E'Reason) -> Parser (Maybe Text -> ContentFilter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe E'Reason)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"reason")
      Parser (Maybe Text -> ContentFilter)
-> Parser (Maybe Text) -> Parser ContentFilter
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"message")

-- | ToJSON ContentFilter
instance A.ToJSON ContentFilter where
  toJSON :: ContentFilter -> Value
toJSON ContentFilter {Maybe Text
Maybe E'Reason
contentFilterReason :: ContentFilter -> Maybe E'Reason
contentFilterMessage :: ContentFilter -> Maybe Text
contentFilterReason :: Maybe E'Reason
contentFilterMessage :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"reason" Key -> Maybe E'Reason -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'Reason
contentFilterReason
      , Key
"message" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
contentFilterMessage
      ]

-- | Construct a value of type 'ContentFilter' (by applying it's required fields, if any)
mkContentFilter ::
  ContentFilter
mkContentFilter :: ContentFilter
mkContentFilter =
  ContentFilter
    { contentFilterReason :: Maybe E'Reason
contentFilterReason = Maybe E'Reason
forall a. Maybe a
Nothing
    , contentFilterMessage :: Maybe Text
contentFilterMessage = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** Corpus

{- | Corpus
A `Corpus` is a collection of `Document`s. A project can create up to 5 corpora.
-}
data Corpus = Corpus
  { Corpus -> Maybe DateTime
corpusUpdateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "updateTime" - Output only. The Timestamp of when the &#x60;Corpus&#x60; was last updated.
  , Corpus -> Maybe DateTime
corpusCreateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "createTime" - Output only. The Timestamp of when the &#x60;Corpus&#x60; was created.
  , Corpus -> Maybe Text
corpusDisplayName :: !(Maybe Text)
  -- ^ "displayName" - Optional. The human-readable display name for the &#x60;Corpus&#x60;. The display name must be no more than 512 characters in length, including spaces. Example: \&quot;Docs on Semantic Retriever\&quot;
  , Corpus -> Maybe Text
corpusName :: !(Maybe Text)
  -- ^ "name" - Immutable. Identifier. The &#x60;Corpus&#x60; resource name. The ID (name excluding the \&quot;corpora/\&quot; prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be derived from &#x60;display_name&#x60; along with a 12 character random suffix. Example: &#x60;corpora/my-awesome-corpora-123a456b789c&#x60;
  }
  deriving (Int -> Corpus -> ShowS
[Corpus] -> ShowS
Corpus -> [Char]
(Int -> Corpus -> ShowS)
-> (Corpus -> [Char]) -> ([Corpus] -> ShowS) -> Show Corpus
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Corpus -> ShowS
showsPrec :: Int -> Corpus -> ShowS
$cshow :: Corpus -> [Char]
show :: Corpus -> [Char]
$cshowList :: [Corpus] -> ShowS
showList :: [Corpus] -> ShowS
P.Show, Corpus -> Corpus -> Bool
(Corpus -> Corpus -> Bool)
-> (Corpus -> Corpus -> Bool) -> Eq Corpus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Corpus -> Corpus -> Bool
== :: Corpus -> Corpus -> Bool
$c/= :: Corpus -> Corpus -> Bool
/= :: Corpus -> Corpus -> Bool
P.Eq, P.Typeable)

-- | FromJSON Corpus
instance A.FromJSON Corpus where
  parseJSON :: Value -> Parser Corpus
parseJSON = [Char] -> (Object -> Parser Corpus) -> Value -> Parser Corpus
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Corpus" ((Object -> Parser Corpus) -> Value -> Parser Corpus)
-> (Object -> Parser Corpus) -> Value -> Parser Corpus
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe DateTime
-> Maybe DateTime -> Maybe Text -> Maybe Text -> Corpus
Corpus
      (Maybe DateTime
 -> Maybe DateTime -> Maybe Text -> Maybe Text -> Corpus)
-> Parser (Maybe DateTime)
-> Parser (Maybe DateTime -> Maybe Text -> Maybe Text -> Corpus)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"updateTime")
      Parser (Maybe DateTime -> Maybe Text -> Maybe Text -> Corpus)
-> Parser (Maybe DateTime)
-> Parser (Maybe Text -> Maybe Text -> Corpus)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"createTime")
      Parser (Maybe Text -> Maybe Text -> Corpus)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Corpus)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"displayName")
      Parser (Maybe Text -> Corpus)
-> Parser (Maybe Text) -> Parser Corpus
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")

-- | ToJSON Corpus
instance A.ToJSON Corpus where
  toJSON :: Corpus -> Value
toJSON Corpus {Maybe Text
Maybe DateTime
corpusUpdateTime :: Corpus -> Maybe DateTime
corpusCreateTime :: Corpus -> Maybe DateTime
corpusDisplayName :: Corpus -> Maybe Text
corpusName :: Corpus -> Maybe Text
corpusUpdateTime :: Maybe DateTime
corpusCreateTime :: Maybe DateTime
corpusDisplayName :: Maybe Text
corpusName :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"updateTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
corpusUpdateTime
      , Key
"createTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
corpusCreateTime
      , Key
"displayName" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
corpusDisplayName
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
corpusName
      ]

-- | Construct a value of type 'Corpus' (by applying it's required fields, if any)
mkCorpus ::
  Corpus
mkCorpus :: Corpus
mkCorpus =
  Corpus
    { corpusUpdateTime :: Maybe DateTime
corpusUpdateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , corpusCreateTime :: Maybe DateTime
corpusCreateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , corpusDisplayName :: Maybe Text
corpusDisplayName = Maybe Text
forall a. Maybe a
Nothing
    , corpusName :: Maybe Text
corpusName = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** CountMessageTokensRequest

{- | CountMessageTokensRequest
Counts the number of tokens in the `prompt` sent to a model.  Models may tokenize text differently, so each model may return a different `token_count`.
-}
data CountMessageTokensRequest = CountMessageTokensRequest
  { CountMessageTokensRequest -> MessagePrompt
countMessageTokensRequestPrompt :: !(MessagePrompt)
  -- ^ /Required/ "prompt" - Required. The prompt, whose token count is to be returned.
  }
  deriving (Int -> CountMessageTokensRequest -> ShowS
[CountMessageTokensRequest] -> ShowS
CountMessageTokensRequest -> [Char]
(Int -> CountMessageTokensRequest -> ShowS)
-> (CountMessageTokensRequest -> [Char])
-> ([CountMessageTokensRequest] -> ShowS)
-> Show CountMessageTokensRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CountMessageTokensRequest -> ShowS
showsPrec :: Int -> CountMessageTokensRequest -> ShowS
$cshow :: CountMessageTokensRequest -> [Char]
show :: CountMessageTokensRequest -> [Char]
$cshowList :: [CountMessageTokensRequest] -> ShowS
showList :: [CountMessageTokensRequest] -> ShowS
P.Show, CountMessageTokensRequest -> CountMessageTokensRequest -> Bool
(CountMessageTokensRequest -> CountMessageTokensRequest -> Bool)
-> (CountMessageTokensRequest -> CountMessageTokensRequest -> Bool)
-> Eq CountMessageTokensRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CountMessageTokensRequest -> CountMessageTokensRequest -> Bool
== :: CountMessageTokensRequest -> CountMessageTokensRequest -> Bool
$c/= :: CountMessageTokensRequest -> CountMessageTokensRequest -> Bool
/= :: CountMessageTokensRequest -> CountMessageTokensRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON CountMessageTokensRequest
instance A.FromJSON CountMessageTokensRequest where
  parseJSON :: Value -> Parser CountMessageTokensRequest
parseJSON = [Char]
-> (Object -> Parser CountMessageTokensRequest)
-> Value
-> Parser CountMessageTokensRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CountMessageTokensRequest" ((Object -> Parser CountMessageTokensRequest)
 -> Value -> Parser CountMessageTokensRequest)
-> (Object -> Parser CountMessageTokensRequest)
-> Value
-> Parser CountMessageTokensRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    MessagePrompt -> CountMessageTokensRequest
CountMessageTokensRequest
      (MessagePrompt -> CountMessageTokensRequest)
-> Parser MessagePrompt -> Parser CountMessageTokensRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser MessagePrompt
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"prompt")

-- | ToJSON CountMessageTokensRequest
instance A.ToJSON CountMessageTokensRequest where
  toJSON :: CountMessageTokensRequest -> Value
toJSON CountMessageTokensRequest {MessagePrompt
countMessageTokensRequestPrompt :: CountMessageTokensRequest -> MessagePrompt
countMessageTokensRequestPrompt :: MessagePrompt
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"prompt" Key -> MessagePrompt -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= MessagePrompt
countMessageTokensRequestPrompt
      ]

-- | Construct a value of type 'CountMessageTokensRequest' (by applying it's required fields, if any)
mkCountMessageTokensRequest ::
  -- | 'countMessageTokensRequestPrompt': Required. The prompt, whose token count is to be returned.
  MessagePrompt ->
  CountMessageTokensRequest
mkCountMessageTokensRequest :: MessagePrompt -> CountMessageTokensRequest
mkCountMessageTokensRequest MessagePrompt
countMessageTokensRequestPrompt =
  CountMessageTokensRequest
    { MessagePrompt
countMessageTokensRequestPrompt :: MessagePrompt
countMessageTokensRequestPrompt :: MessagePrompt
countMessageTokensRequestPrompt
    }

-- ** CountMessageTokensResponse

{- | CountMessageTokensResponse
A response from `CountMessageTokens`.  It returns the model's `token_count` for the `prompt`.
-}
data CountMessageTokensResponse = CountMessageTokensResponse
  { CountMessageTokensResponse -> Maybe Int
countMessageTokensResponseTokenCount :: !(Maybe Int)
  -- ^ "tokenCount" - The number of tokens that the &#x60;model&#x60; tokenizes the &#x60;prompt&#x60; into.  Always non-negative.
  }
  deriving (Int -> CountMessageTokensResponse -> ShowS
[CountMessageTokensResponse] -> ShowS
CountMessageTokensResponse -> [Char]
(Int -> CountMessageTokensResponse -> ShowS)
-> (CountMessageTokensResponse -> [Char])
-> ([CountMessageTokensResponse] -> ShowS)
-> Show CountMessageTokensResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CountMessageTokensResponse -> ShowS
showsPrec :: Int -> CountMessageTokensResponse -> ShowS
$cshow :: CountMessageTokensResponse -> [Char]
show :: CountMessageTokensResponse -> [Char]
$cshowList :: [CountMessageTokensResponse] -> ShowS
showList :: [CountMessageTokensResponse] -> ShowS
P.Show, CountMessageTokensResponse -> CountMessageTokensResponse -> Bool
(CountMessageTokensResponse -> CountMessageTokensResponse -> Bool)
-> (CountMessageTokensResponse
    -> CountMessageTokensResponse -> Bool)
-> Eq CountMessageTokensResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CountMessageTokensResponse -> CountMessageTokensResponse -> Bool
== :: CountMessageTokensResponse -> CountMessageTokensResponse -> Bool
$c/= :: CountMessageTokensResponse -> CountMessageTokensResponse -> Bool
/= :: CountMessageTokensResponse -> CountMessageTokensResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON CountMessageTokensResponse
instance A.FromJSON CountMessageTokensResponse where
  parseJSON :: Value -> Parser CountMessageTokensResponse
parseJSON = [Char]
-> (Object -> Parser CountMessageTokensResponse)
-> Value
-> Parser CountMessageTokensResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CountMessageTokensResponse" ((Object -> Parser CountMessageTokensResponse)
 -> Value -> Parser CountMessageTokensResponse)
-> (Object -> Parser CountMessageTokensResponse)
-> Value
-> Parser CountMessageTokensResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int -> CountMessageTokensResponse
CountMessageTokensResponse
      (Maybe Int -> CountMessageTokensResponse)
-> Parser (Maybe Int) -> Parser CountMessageTokensResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tokenCount")

-- | ToJSON CountMessageTokensResponse
instance A.ToJSON CountMessageTokensResponse where
  toJSON :: CountMessageTokensResponse -> Value
toJSON CountMessageTokensResponse {Maybe Int
countMessageTokensResponseTokenCount :: CountMessageTokensResponse -> Maybe Int
countMessageTokensResponseTokenCount :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"tokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
countMessageTokensResponseTokenCount
      ]

-- | Construct a value of type 'CountMessageTokensResponse' (by applying it's required fields, if any)
mkCountMessageTokensResponse ::
  CountMessageTokensResponse
mkCountMessageTokensResponse :: CountMessageTokensResponse
mkCountMessageTokensResponse =
  CountMessageTokensResponse
    { countMessageTokensResponseTokenCount :: Maybe Int
countMessageTokensResponseTokenCount = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** CountTextTokensRequest

{- | CountTextTokensRequest
Counts the number of tokens in the `prompt` sent to a model.  Models may tokenize text differently, so each model may return a different `token_count`.
-}
data CountTextTokensRequest = CountTextTokensRequest
  { CountTextTokensRequest -> TextPrompt
countTextTokensRequestPrompt :: !(TextPrompt)
  -- ^ /Required/ "prompt" - Required. The free-form input text given to the model as a prompt.
  }
  deriving (Int -> CountTextTokensRequest -> ShowS
[CountTextTokensRequest] -> ShowS
CountTextTokensRequest -> [Char]
(Int -> CountTextTokensRequest -> ShowS)
-> (CountTextTokensRequest -> [Char])
-> ([CountTextTokensRequest] -> ShowS)
-> Show CountTextTokensRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CountTextTokensRequest -> ShowS
showsPrec :: Int -> CountTextTokensRequest -> ShowS
$cshow :: CountTextTokensRequest -> [Char]
show :: CountTextTokensRequest -> [Char]
$cshowList :: [CountTextTokensRequest] -> ShowS
showList :: [CountTextTokensRequest] -> ShowS
P.Show, CountTextTokensRequest -> CountTextTokensRequest -> Bool
(CountTextTokensRequest -> CountTextTokensRequest -> Bool)
-> (CountTextTokensRequest -> CountTextTokensRequest -> Bool)
-> Eq CountTextTokensRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CountTextTokensRequest -> CountTextTokensRequest -> Bool
== :: CountTextTokensRequest -> CountTextTokensRequest -> Bool
$c/= :: CountTextTokensRequest -> CountTextTokensRequest -> Bool
/= :: CountTextTokensRequest -> CountTextTokensRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON CountTextTokensRequest
instance A.FromJSON CountTextTokensRequest where
  parseJSON :: Value -> Parser CountTextTokensRequest
parseJSON = [Char]
-> (Object -> Parser CountTextTokensRequest)
-> Value
-> Parser CountTextTokensRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CountTextTokensRequest" ((Object -> Parser CountTextTokensRequest)
 -> Value -> Parser CountTextTokensRequest)
-> (Object -> Parser CountTextTokensRequest)
-> Value
-> Parser CountTextTokensRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    TextPrompt -> CountTextTokensRequest
CountTextTokensRequest
      (TextPrompt -> CountTextTokensRequest)
-> Parser TextPrompt -> Parser CountTextTokensRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser TextPrompt
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"prompt")

-- | ToJSON CountTextTokensRequest
instance A.ToJSON CountTextTokensRequest where
  toJSON :: CountTextTokensRequest -> Value
toJSON CountTextTokensRequest {TextPrompt
countTextTokensRequestPrompt :: CountTextTokensRequest -> TextPrompt
countTextTokensRequestPrompt :: TextPrompt
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"prompt" Key -> TextPrompt -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TextPrompt
countTextTokensRequestPrompt
      ]

-- | Construct a value of type 'CountTextTokensRequest' (by applying it's required fields, if any)
mkCountTextTokensRequest ::
  -- | 'countTextTokensRequestPrompt': Required. The free-form input text given to the model as a prompt.
  TextPrompt ->
  CountTextTokensRequest
mkCountTextTokensRequest :: TextPrompt -> CountTextTokensRequest
mkCountTextTokensRequest TextPrompt
countTextTokensRequestPrompt =
  CountTextTokensRequest
    { TextPrompt
countTextTokensRequestPrompt :: TextPrompt
countTextTokensRequestPrompt :: TextPrompt
countTextTokensRequestPrompt
    }

-- ** CountTextTokensResponse

{- | CountTextTokensResponse
A response from `CountTextTokens`.  It returns the model's `token_count` for the `prompt`.
-}
data CountTextTokensResponse = CountTextTokensResponse
  { CountTextTokensResponse -> Maybe Int
countTextTokensResponseTokenCount :: !(Maybe Int)
  -- ^ "tokenCount" - The number of tokens that the &#x60;model&#x60; tokenizes the &#x60;prompt&#x60; into.  Always non-negative.
  }
  deriving (Int -> CountTextTokensResponse -> ShowS
[CountTextTokensResponse] -> ShowS
CountTextTokensResponse -> [Char]
(Int -> CountTextTokensResponse -> ShowS)
-> (CountTextTokensResponse -> [Char])
-> ([CountTextTokensResponse] -> ShowS)
-> Show CountTextTokensResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CountTextTokensResponse -> ShowS
showsPrec :: Int -> CountTextTokensResponse -> ShowS
$cshow :: CountTextTokensResponse -> [Char]
show :: CountTextTokensResponse -> [Char]
$cshowList :: [CountTextTokensResponse] -> ShowS
showList :: [CountTextTokensResponse] -> ShowS
P.Show, CountTextTokensResponse -> CountTextTokensResponse -> Bool
(CountTextTokensResponse -> CountTextTokensResponse -> Bool)
-> (CountTextTokensResponse -> CountTextTokensResponse -> Bool)
-> Eq CountTextTokensResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CountTextTokensResponse -> CountTextTokensResponse -> Bool
== :: CountTextTokensResponse -> CountTextTokensResponse -> Bool
$c/= :: CountTextTokensResponse -> CountTextTokensResponse -> Bool
/= :: CountTextTokensResponse -> CountTextTokensResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON CountTextTokensResponse
instance A.FromJSON CountTextTokensResponse where
  parseJSON :: Value -> Parser CountTextTokensResponse
parseJSON = [Char]
-> (Object -> Parser CountTextTokensResponse)
-> Value
-> Parser CountTextTokensResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CountTextTokensResponse" ((Object -> Parser CountTextTokensResponse)
 -> Value -> Parser CountTextTokensResponse)
-> (Object -> Parser CountTextTokensResponse)
-> Value
-> Parser CountTextTokensResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int -> CountTextTokensResponse
CountTextTokensResponse
      (Maybe Int -> CountTextTokensResponse)
-> Parser (Maybe Int) -> Parser CountTextTokensResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tokenCount")

-- | ToJSON CountTextTokensResponse
instance A.ToJSON CountTextTokensResponse where
  toJSON :: CountTextTokensResponse -> Value
toJSON CountTextTokensResponse {Maybe Int
countTextTokensResponseTokenCount :: CountTextTokensResponse -> Maybe Int
countTextTokensResponseTokenCount :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"tokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
countTextTokensResponseTokenCount
      ]

-- | Construct a value of type 'CountTextTokensResponse' (by applying it's required fields, if any)
mkCountTextTokensResponse ::
  CountTextTokensResponse
mkCountTextTokensResponse :: CountTextTokensResponse
mkCountTextTokensResponse =
  CountTextTokensResponse
    { countTextTokensResponseTokenCount :: Maybe Int
countTextTokensResponseTokenCount = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** CountTokensRequest

{- | CountTokensRequest
Counts the number of tokens in the `prompt` sent to a model.  Models may tokenize text differently, so each model may return a different `token_count`.
-}
data CountTokensRequest = CountTokensRequest
  { CountTokensRequest -> Maybe [Content]
countTokensRequestContents :: !(Maybe [Content])
  -- ^ "contents" - Optional. The input given to the model as a prompt. This field is ignored when &#x60;generate_content_request&#x60; is set.
  , CountTokensRequest -> Maybe GenerateContentRequest
countTokensRequestGenerateContentRequest :: !(Maybe GenerateContentRequest)
  -- ^ "generateContentRequest" - Optional. The overall input given to the &#x60;Model&#x60;. This includes the prompt as well as other model steering information like [system instructions](https://ai.google.dev/gemini-api/docs/system-instructions), and/or function declarations for [function calling](https://ai.google.dev/gemini-api/docs/function-calling). &#x60;Model&#x60;s/&#x60;Content&#x60;s and &#x60;generate_content_request&#x60;s are mutually exclusive. You can either send &#x60;Model&#x60; + &#x60;Content&#x60;s or a &#x60;generate_content_request&#x60;, but never both.
  }
  deriving (Int -> CountTokensRequest -> ShowS
[CountTokensRequest] -> ShowS
CountTokensRequest -> [Char]
(Int -> CountTokensRequest -> ShowS)
-> (CountTokensRequest -> [Char])
-> ([CountTokensRequest] -> ShowS)
-> Show CountTokensRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CountTokensRequest -> ShowS
showsPrec :: Int -> CountTokensRequest -> ShowS
$cshow :: CountTokensRequest -> [Char]
show :: CountTokensRequest -> [Char]
$cshowList :: [CountTokensRequest] -> ShowS
showList :: [CountTokensRequest] -> ShowS
P.Show, CountTokensRequest -> CountTokensRequest -> Bool
(CountTokensRequest -> CountTokensRequest -> Bool)
-> (CountTokensRequest -> CountTokensRequest -> Bool)
-> Eq CountTokensRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CountTokensRequest -> CountTokensRequest -> Bool
== :: CountTokensRequest -> CountTokensRequest -> Bool
$c/= :: CountTokensRequest -> CountTokensRequest -> Bool
/= :: CountTokensRequest -> CountTokensRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON CountTokensRequest
instance A.FromJSON CountTokensRequest where
  parseJSON :: Value -> Parser CountTokensRequest
parseJSON = [Char]
-> (Object -> Parser CountTokensRequest)
-> Value
-> Parser CountTokensRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CountTokensRequest" ((Object -> Parser CountTokensRequest)
 -> Value -> Parser CountTokensRequest)
-> (Object -> Parser CountTokensRequest)
-> Value
-> Parser CountTokensRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Content]
-> Maybe GenerateContentRequest -> CountTokensRequest
CountTokensRequest
      (Maybe [Content]
 -> Maybe GenerateContentRequest -> CountTokensRequest)
-> Parser (Maybe [Content])
-> Parser (Maybe GenerateContentRequest -> CountTokensRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Content])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"contents")
      Parser (Maybe GenerateContentRequest -> CountTokensRequest)
-> Parser (Maybe GenerateContentRequest)
-> Parser CountTokensRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe GenerateContentRequest)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"generateContentRequest")

-- | ToJSON CountTokensRequest
instance A.ToJSON CountTokensRequest where
  toJSON :: CountTokensRequest -> Value
toJSON CountTokensRequest {Maybe [Content]
Maybe GenerateContentRequest
countTokensRequestContents :: CountTokensRequest -> Maybe [Content]
countTokensRequestGenerateContentRequest :: CountTokensRequest -> Maybe GenerateContentRequest
countTokensRequestContents :: Maybe [Content]
countTokensRequestGenerateContentRequest :: Maybe GenerateContentRequest
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"contents" Key -> Maybe [Content] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Content]
countTokensRequestContents
      , Key
"generateContentRequest" Key -> Maybe GenerateContentRequest -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GenerateContentRequest
countTokensRequestGenerateContentRequest
      ]

-- | Construct a value of type 'CountTokensRequest' (by applying it's required fields, if any)
mkCountTokensRequest ::
  CountTokensRequest
mkCountTokensRequest :: CountTokensRequest
mkCountTokensRequest =
  CountTokensRequest
    { countTokensRequestContents :: Maybe [Content]
countTokensRequestContents = Maybe [Content]
forall a. Maybe a
Nothing
    , countTokensRequestGenerateContentRequest :: Maybe GenerateContentRequest
countTokensRequestGenerateContentRequest = Maybe GenerateContentRequest
forall a. Maybe a
Nothing
    }

-- ** CountTokensResponse

{- | CountTokensResponse
A response from `CountTokens`.  It returns the model's `token_count` for the `prompt`.
-}
data CountTokensResponse = CountTokensResponse
  { CountTokensResponse -> Maybe [ModalityTokenCount]
countTokensResponseCacheTokensDetails :: !(Maybe [ModalityTokenCount])
  -- ^ /ReadOnly/ "cacheTokensDetails" - Output only. List of modalities that were processed in the cached content.
  , CountTokensResponse -> Maybe [ModalityTokenCount]
countTokensResponsePromptTokensDetails :: !(Maybe [ModalityTokenCount])
  -- ^ /ReadOnly/ "promptTokensDetails" - Output only. List of modalities that were processed in the request input.
  , CountTokensResponse -> Maybe Int
countTokensResponseTotalTokens :: !(Maybe Int)
  -- ^ "totalTokens" - The number of tokens that the &#x60;Model&#x60; tokenizes the &#x60;prompt&#x60; into. Always non-negative.
  , CountTokensResponse -> Maybe Int
countTokensResponseCachedContentTokenCount :: !(Maybe Int)
  -- ^ "cachedContentTokenCount" - Number of tokens in the cached part of the prompt (the cached content).
  }
  deriving (Int -> CountTokensResponse -> ShowS
[CountTokensResponse] -> ShowS
CountTokensResponse -> [Char]
(Int -> CountTokensResponse -> ShowS)
-> (CountTokensResponse -> [Char])
-> ([CountTokensResponse] -> ShowS)
-> Show CountTokensResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CountTokensResponse -> ShowS
showsPrec :: Int -> CountTokensResponse -> ShowS
$cshow :: CountTokensResponse -> [Char]
show :: CountTokensResponse -> [Char]
$cshowList :: [CountTokensResponse] -> ShowS
showList :: [CountTokensResponse] -> ShowS
P.Show, CountTokensResponse -> CountTokensResponse -> Bool
(CountTokensResponse -> CountTokensResponse -> Bool)
-> (CountTokensResponse -> CountTokensResponse -> Bool)
-> Eq CountTokensResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CountTokensResponse -> CountTokensResponse -> Bool
== :: CountTokensResponse -> CountTokensResponse -> Bool
$c/= :: CountTokensResponse -> CountTokensResponse -> Bool
/= :: CountTokensResponse -> CountTokensResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON CountTokensResponse
instance A.FromJSON CountTokensResponse where
  parseJSON :: Value -> Parser CountTokensResponse
parseJSON = [Char]
-> (Object -> Parser CountTokensResponse)
-> Value
-> Parser CountTokensResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CountTokensResponse" ((Object -> Parser CountTokensResponse)
 -> Value -> Parser CountTokensResponse)
-> (Object -> Parser CountTokensResponse)
-> Value
-> Parser CountTokensResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [ModalityTokenCount]
-> Maybe [ModalityTokenCount]
-> Maybe Int
-> Maybe Int
-> CountTokensResponse
CountTokensResponse
      (Maybe [ModalityTokenCount]
 -> Maybe [ModalityTokenCount]
 -> Maybe Int
 -> Maybe Int
 -> CountTokensResponse)
-> Parser (Maybe [ModalityTokenCount])
-> Parser
     (Maybe [ModalityTokenCount]
      -> Maybe Int -> Maybe Int -> CountTokensResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [ModalityTokenCount])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"cacheTokensDetails")
      Parser
  (Maybe [ModalityTokenCount]
   -> Maybe Int -> Maybe Int -> CountTokensResponse)
-> Parser (Maybe [ModalityTokenCount])
-> Parser (Maybe Int -> Maybe Int -> CountTokensResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [ModalityTokenCount])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"promptTokensDetails")
      Parser (Maybe Int -> Maybe Int -> CountTokensResponse)
-> Parser (Maybe Int) -> Parser (Maybe Int -> CountTokensResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"totalTokens")
      Parser (Maybe Int -> CountTokensResponse)
-> Parser (Maybe Int) -> Parser CountTokensResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"cachedContentTokenCount")

-- | ToJSON CountTokensResponse
instance A.ToJSON CountTokensResponse where
  toJSON :: CountTokensResponse -> Value
toJSON CountTokensResponse {Maybe Int
Maybe [ModalityTokenCount]
countTokensResponseCacheTokensDetails :: CountTokensResponse -> Maybe [ModalityTokenCount]
countTokensResponsePromptTokensDetails :: CountTokensResponse -> Maybe [ModalityTokenCount]
countTokensResponseTotalTokens :: CountTokensResponse -> Maybe Int
countTokensResponseCachedContentTokenCount :: CountTokensResponse -> Maybe Int
countTokensResponseCacheTokensDetails :: Maybe [ModalityTokenCount]
countTokensResponsePromptTokensDetails :: Maybe [ModalityTokenCount]
countTokensResponseTotalTokens :: Maybe Int
countTokensResponseCachedContentTokenCount :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"cacheTokensDetails" Key -> Maybe [ModalityTokenCount] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ModalityTokenCount]
countTokensResponseCacheTokensDetails
      , Key
"promptTokensDetails" Key -> Maybe [ModalityTokenCount] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ModalityTokenCount]
countTokensResponsePromptTokensDetails
      , Key
"totalTokens" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
countTokensResponseTotalTokens
      , Key
"cachedContentTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
countTokensResponseCachedContentTokenCount
      ]

-- | Construct a value of type 'CountTokensResponse' (by applying it's required fields, if any)
mkCountTokensResponse ::
  CountTokensResponse
mkCountTokensResponse :: CountTokensResponse
mkCountTokensResponse =
  CountTokensResponse
    { countTokensResponseCacheTokensDetails :: Maybe [ModalityTokenCount]
countTokensResponseCacheTokensDetails = Maybe [ModalityTokenCount]
forall a. Maybe a
Nothing
    , countTokensResponsePromptTokensDetails :: Maybe [ModalityTokenCount]
countTokensResponsePromptTokensDetails = Maybe [ModalityTokenCount]
forall a. Maybe a
Nothing
    , countTokensResponseTotalTokens :: Maybe Int
countTokensResponseTotalTokens = Maybe Int
forall a. Maybe a
Nothing
    , countTokensResponseCachedContentTokenCount :: Maybe Int
countTokensResponseCachedContentTokenCount = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** CreateChunkRequest

{- | CreateChunkRequest
Request to create a `Chunk`.
-}
data CreateChunkRequest = CreateChunkRequest
  { CreateChunkRequest -> Text
createChunkRequestParent :: !(Text)
  -- ^ /Required/ "parent" - Required. The name of the &#x60;Document&#x60; where this &#x60;Chunk&#x60; will be created. Example: &#x60;corpora/my-corpus-123/documents/the-doc-abc&#x60;
  , CreateChunkRequest -> Chunk
createChunkRequestChunk :: !(Chunk)
  -- ^ /Required/ "chunk" - Required. The &#x60;Chunk&#x60; to create.
  }
  deriving (Int -> CreateChunkRequest -> ShowS
[CreateChunkRequest] -> ShowS
CreateChunkRequest -> [Char]
(Int -> CreateChunkRequest -> ShowS)
-> (CreateChunkRequest -> [Char])
-> ([CreateChunkRequest] -> ShowS)
-> Show CreateChunkRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateChunkRequest -> ShowS
showsPrec :: Int -> CreateChunkRequest -> ShowS
$cshow :: CreateChunkRequest -> [Char]
show :: CreateChunkRequest -> [Char]
$cshowList :: [CreateChunkRequest] -> ShowS
showList :: [CreateChunkRequest] -> ShowS
P.Show, CreateChunkRequest -> CreateChunkRequest -> Bool
(CreateChunkRequest -> CreateChunkRequest -> Bool)
-> (CreateChunkRequest -> CreateChunkRequest -> Bool)
-> Eq CreateChunkRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateChunkRequest -> CreateChunkRequest -> Bool
== :: CreateChunkRequest -> CreateChunkRequest -> Bool
$c/= :: CreateChunkRequest -> CreateChunkRequest -> Bool
/= :: CreateChunkRequest -> CreateChunkRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON CreateChunkRequest
instance A.FromJSON CreateChunkRequest where
  parseJSON :: Value -> Parser CreateChunkRequest
parseJSON = [Char]
-> (Object -> Parser CreateChunkRequest)
-> Value
-> Parser CreateChunkRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CreateChunkRequest" ((Object -> Parser CreateChunkRequest)
 -> Value -> Parser CreateChunkRequest)
-> (Object -> Parser CreateChunkRequest)
-> Value
-> Parser CreateChunkRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Text -> Chunk -> CreateChunkRequest
CreateChunkRequest
      (Text -> Chunk -> CreateChunkRequest)
-> Parser Text -> Parser (Chunk -> CreateChunkRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"parent")
      Parser (Chunk -> CreateChunkRequest)
-> Parser Chunk -> Parser CreateChunkRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Chunk
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"chunk")

-- | ToJSON CreateChunkRequest
instance A.ToJSON CreateChunkRequest where
  toJSON :: CreateChunkRequest -> Value
toJSON CreateChunkRequest {Text
Chunk
createChunkRequestParent :: CreateChunkRequest -> Text
createChunkRequestChunk :: CreateChunkRequest -> Chunk
createChunkRequestParent :: Text
createChunkRequestChunk :: Chunk
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"parent" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
createChunkRequestParent
      , Key
"chunk" Key -> Chunk -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Chunk
createChunkRequestChunk
      ]

-- | Construct a value of type 'CreateChunkRequest' (by applying it's required fields, if any)
mkCreateChunkRequest ::
  -- | 'createChunkRequestParent': Required. The name of the `Document` where this `Chunk` will be created. Example: `corpora/my-corpus-123/documents/the-doc-abc`
  Text ->
  -- | 'createChunkRequestChunk': Required. The `Chunk` to create.
  Chunk ->
  CreateChunkRequest
mkCreateChunkRequest :: Text -> Chunk -> CreateChunkRequest
mkCreateChunkRequest Text
createChunkRequestParent Chunk
createChunkRequestChunk =
  CreateChunkRequest
    { Text
createChunkRequestParent :: Text
createChunkRequestParent :: Text
createChunkRequestParent
    , Chunk
createChunkRequestChunk :: Chunk
createChunkRequestChunk :: Chunk
createChunkRequestChunk
    }

-- ** CreateFileRequest

{- | CreateFileRequest
Request for `CreateFile`.
-}
data CreateFileRequest = CreateFileRequest
  { CreateFileRequest -> Maybe File
createFileRequestFile :: !(Maybe File)
  -- ^ "file" - Optional. Metadata for the file to create.
  }
  deriving (Int -> CreateFileRequest -> ShowS
[CreateFileRequest] -> ShowS
CreateFileRequest -> [Char]
(Int -> CreateFileRequest -> ShowS)
-> (CreateFileRequest -> [Char])
-> ([CreateFileRequest] -> ShowS)
-> Show CreateFileRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateFileRequest -> ShowS
showsPrec :: Int -> CreateFileRequest -> ShowS
$cshow :: CreateFileRequest -> [Char]
show :: CreateFileRequest -> [Char]
$cshowList :: [CreateFileRequest] -> ShowS
showList :: [CreateFileRequest] -> ShowS
P.Show, CreateFileRequest -> CreateFileRequest -> Bool
(CreateFileRequest -> CreateFileRequest -> Bool)
-> (CreateFileRequest -> CreateFileRequest -> Bool)
-> Eq CreateFileRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateFileRequest -> CreateFileRequest -> Bool
== :: CreateFileRequest -> CreateFileRequest -> Bool
$c/= :: CreateFileRequest -> CreateFileRequest -> Bool
/= :: CreateFileRequest -> CreateFileRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON CreateFileRequest
instance A.FromJSON CreateFileRequest where
  parseJSON :: Value -> Parser CreateFileRequest
parseJSON = [Char]
-> (Object -> Parser CreateFileRequest)
-> Value
-> Parser CreateFileRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CreateFileRequest" ((Object -> Parser CreateFileRequest)
 -> Value -> Parser CreateFileRequest)
-> (Object -> Parser CreateFileRequest)
-> Value
-> Parser CreateFileRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe File -> CreateFileRequest
CreateFileRequest
      (Maybe File -> CreateFileRequest)
-> Parser (Maybe File) -> Parser CreateFileRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"file")

-- | ToJSON CreateFileRequest
instance A.ToJSON CreateFileRequest where
  toJSON :: CreateFileRequest -> Value
toJSON CreateFileRequest {Maybe File
createFileRequestFile :: CreateFileRequest -> Maybe File
createFileRequestFile :: Maybe File
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"file" Key -> Maybe File -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe File
createFileRequestFile
      ]

-- | Construct a value of type 'CreateFileRequest' (by applying it's required fields, if any)
mkCreateFileRequest ::
  CreateFileRequest
mkCreateFileRequest :: CreateFileRequest
mkCreateFileRequest =
  CreateFileRequest
    { createFileRequestFile :: Maybe File
createFileRequestFile = Maybe File
forall a. Maybe a
Nothing
    }

-- ** CreateFileResponse

{- | CreateFileResponse
Response for `CreateFile`.
-}
data CreateFileResponse = CreateFileResponse
  { CreateFileResponse -> Maybe File
createFileResponseFile :: !(Maybe File)
  -- ^ "file" - Metadata for the created file.
  }
  deriving (Int -> CreateFileResponse -> ShowS
[CreateFileResponse] -> ShowS
CreateFileResponse -> [Char]
(Int -> CreateFileResponse -> ShowS)
-> (CreateFileResponse -> [Char])
-> ([CreateFileResponse] -> ShowS)
-> Show CreateFileResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateFileResponse -> ShowS
showsPrec :: Int -> CreateFileResponse -> ShowS
$cshow :: CreateFileResponse -> [Char]
show :: CreateFileResponse -> [Char]
$cshowList :: [CreateFileResponse] -> ShowS
showList :: [CreateFileResponse] -> ShowS
P.Show, CreateFileResponse -> CreateFileResponse -> Bool
(CreateFileResponse -> CreateFileResponse -> Bool)
-> (CreateFileResponse -> CreateFileResponse -> Bool)
-> Eq CreateFileResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateFileResponse -> CreateFileResponse -> Bool
== :: CreateFileResponse -> CreateFileResponse -> Bool
$c/= :: CreateFileResponse -> CreateFileResponse -> Bool
/= :: CreateFileResponse -> CreateFileResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON CreateFileResponse
instance A.FromJSON CreateFileResponse where
  parseJSON :: Value -> Parser CreateFileResponse
parseJSON = [Char]
-> (Object -> Parser CreateFileResponse)
-> Value
-> Parser CreateFileResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CreateFileResponse" ((Object -> Parser CreateFileResponse)
 -> Value -> Parser CreateFileResponse)
-> (Object -> Parser CreateFileResponse)
-> Value
-> Parser CreateFileResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe File -> CreateFileResponse
CreateFileResponse
      (Maybe File -> CreateFileResponse)
-> Parser (Maybe File) -> Parser CreateFileResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe File)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"file")

-- | ToJSON CreateFileResponse
instance A.ToJSON CreateFileResponse where
  toJSON :: CreateFileResponse -> Value
toJSON CreateFileResponse {Maybe File
createFileResponseFile :: CreateFileResponse -> Maybe File
createFileResponseFile :: Maybe File
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"file" Key -> Maybe File -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe File
createFileResponseFile
      ]

-- | Construct a value of type 'CreateFileResponse' (by applying it's required fields, if any)
mkCreateFileResponse ::
  CreateFileResponse
mkCreateFileResponse :: CreateFileResponse
mkCreateFileResponse =
  CreateFileResponse
    { createFileResponseFile :: Maybe File
createFileResponseFile = Maybe File
forall a. Maybe a
Nothing
    }

-- ** CreateTunedModelMetadata

{- | CreateTunedModelMetadata
Metadata about the state and progress of creating a tuned model returned from the long-running operation
-}
data CreateTunedModelMetadata = CreateTunedModelMetadata
  { CreateTunedModelMetadata -> Maybe Float
createTunedModelMetadataCompletedPercent :: !(Maybe Float)
  -- ^ "completedPercent" - The completed percentage for the tuning operation.
  , CreateTunedModelMetadata -> Maybe Int
createTunedModelMetadataCompletedSteps :: !(Maybe Int)
  -- ^ "completedSteps" - The number of steps completed.
  , CreateTunedModelMetadata -> Maybe Int
createTunedModelMetadataTotalSteps :: !(Maybe Int)
  -- ^ "totalSteps" - The total number of tuning steps.
  , CreateTunedModelMetadata -> Maybe [TuningSnapshot]
createTunedModelMetadataSnapshots :: !(Maybe [TuningSnapshot])
  -- ^ "snapshots" - Metrics collected during tuning.
  , CreateTunedModelMetadata -> Maybe Text
createTunedModelMetadataTunedModel :: !(Maybe Text)
  -- ^ "tunedModel" - Name of the tuned model associated with the tuning operation.
  }
  deriving (Int -> CreateTunedModelMetadata -> ShowS
[CreateTunedModelMetadata] -> ShowS
CreateTunedModelMetadata -> [Char]
(Int -> CreateTunedModelMetadata -> ShowS)
-> (CreateTunedModelMetadata -> [Char])
-> ([CreateTunedModelMetadata] -> ShowS)
-> Show CreateTunedModelMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateTunedModelMetadata -> ShowS
showsPrec :: Int -> CreateTunedModelMetadata -> ShowS
$cshow :: CreateTunedModelMetadata -> [Char]
show :: CreateTunedModelMetadata -> [Char]
$cshowList :: [CreateTunedModelMetadata] -> ShowS
showList :: [CreateTunedModelMetadata] -> ShowS
P.Show, CreateTunedModelMetadata -> CreateTunedModelMetadata -> Bool
(CreateTunedModelMetadata -> CreateTunedModelMetadata -> Bool)
-> (CreateTunedModelMetadata -> CreateTunedModelMetadata -> Bool)
-> Eq CreateTunedModelMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateTunedModelMetadata -> CreateTunedModelMetadata -> Bool
== :: CreateTunedModelMetadata -> CreateTunedModelMetadata -> Bool
$c/= :: CreateTunedModelMetadata -> CreateTunedModelMetadata -> Bool
/= :: CreateTunedModelMetadata -> CreateTunedModelMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON CreateTunedModelMetadata
instance A.FromJSON CreateTunedModelMetadata where
  parseJSON :: Value -> Parser CreateTunedModelMetadata
parseJSON = [Char]
-> (Object -> Parser CreateTunedModelMetadata)
-> Value
-> Parser CreateTunedModelMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CreateTunedModelMetadata" ((Object -> Parser CreateTunedModelMetadata)
 -> Value -> Parser CreateTunedModelMetadata)
-> (Object -> Parser CreateTunedModelMetadata)
-> Value
-> Parser CreateTunedModelMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Float
-> Maybe Int
-> Maybe Int
-> Maybe [TuningSnapshot]
-> Maybe Text
-> CreateTunedModelMetadata
CreateTunedModelMetadata
      (Maybe Float
 -> Maybe Int
 -> Maybe Int
 -> Maybe [TuningSnapshot]
 -> Maybe Text
 -> CreateTunedModelMetadata)
-> Parser (Maybe Float)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe [TuningSnapshot]
      -> Maybe Text
      -> CreateTunedModelMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"completedPercent")
      Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe [TuningSnapshot]
   -> Maybe Text
   -> CreateTunedModelMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe [TuningSnapshot]
      -> Maybe Text
      -> CreateTunedModelMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"completedSteps")
      Parser
  (Maybe Int
   -> Maybe [TuningSnapshot]
   -> Maybe Text
   -> CreateTunedModelMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe [TuningSnapshot] -> Maybe Text -> CreateTunedModelMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"totalSteps")
      Parser
  (Maybe [TuningSnapshot] -> Maybe Text -> CreateTunedModelMetadata)
-> Parser (Maybe [TuningSnapshot])
-> Parser (Maybe Text -> CreateTunedModelMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [TuningSnapshot])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"snapshots")
      Parser (Maybe Text -> CreateTunedModelMetadata)
-> Parser (Maybe Text) -> Parser CreateTunedModelMetadata
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tunedModel")

-- | ToJSON CreateTunedModelMetadata
instance A.ToJSON CreateTunedModelMetadata where
  toJSON :: CreateTunedModelMetadata -> Value
toJSON CreateTunedModelMetadata {Maybe Float
Maybe Int
Maybe [TuningSnapshot]
Maybe Text
createTunedModelMetadataCompletedPercent :: CreateTunedModelMetadata -> Maybe Float
createTunedModelMetadataCompletedSteps :: CreateTunedModelMetadata -> Maybe Int
createTunedModelMetadataTotalSteps :: CreateTunedModelMetadata -> Maybe Int
createTunedModelMetadataSnapshots :: CreateTunedModelMetadata -> Maybe [TuningSnapshot]
createTunedModelMetadataTunedModel :: CreateTunedModelMetadata -> Maybe Text
createTunedModelMetadataCompletedPercent :: Maybe Float
createTunedModelMetadataCompletedSteps :: Maybe Int
createTunedModelMetadataTotalSteps :: Maybe Int
createTunedModelMetadataSnapshots :: Maybe [TuningSnapshot]
createTunedModelMetadataTunedModel :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"completedPercent" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
createTunedModelMetadataCompletedPercent
      , Key
"completedSteps" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
createTunedModelMetadataCompletedSteps
      , Key
"totalSteps" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
createTunedModelMetadataTotalSteps
      , Key
"snapshots" Key -> Maybe [TuningSnapshot] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [TuningSnapshot]
createTunedModelMetadataSnapshots
      , Key
"tunedModel" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
createTunedModelMetadataTunedModel
      ]

-- | Construct a value of type 'CreateTunedModelMetadata' (by applying it's required fields, if any)
mkCreateTunedModelMetadata ::
  CreateTunedModelMetadata
mkCreateTunedModelMetadata :: CreateTunedModelMetadata
mkCreateTunedModelMetadata =
  CreateTunedModelMetadata
    { createTunedModelMetadataCompletedPercent :: Maybe Float
createTunedModelMetadataCompletedPercent = Maybe Float
forall a. Maybe a
Nothing
    , createTunedModelMetadataCompletedSteps :: Maybe Int
createTunedModelMetadataCompletedSteps = Maybe Int
forall a. Maybe a
Nothing
    , createTunedModelMetadataTotalSteps :: Maybe Int
createTunedModelMetadataTotalSteps = Maybe Int
forall a. Maybe a
Nothing
    , createTunedModelMetadataSnapshots :: Maybe [TuningSnapshot]
createTunedModelMetadataSnapshots = Maybe [TuningSnapshot]
forall a. Maybe a
Nothing
    , createTunedModelMetadataTunedModel :: Maybe Text
createTunedModelMetadataTunedModel = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** CreateTunedModelOperation

{- | CreateTunedModelOperation
This resource represents a long-running operation where metadata and response fields are strongly typed.
-}
data CreateTunedModelOperation = CreateTunedModelOperation
  { CreateTunedModelOperation -> Maybe Bool
createTunedModelOperationDone :: !(Maybe Bool)
  -- ^ "done" - If the value is &#x60;false&#x60;, it means the operation is still in progress. If &#x60;true&#x60;, the operation is completed, and either &#x60;error&#x60; or &#x60;response&#x60; is available.
  , CreateTunedModelOperation -> Maybe Text
createTunedModelOperationName :: !(Maybe Text)
  -- ^ "name" - The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the &#x60;name&#x60; should be a resource name ending with &#x60;operations/{unique_id}&#x60;.
  , CreateTunedModelOperation -> Maybe Status
createTunedModelOperationError :: !(Maybe Status)
  -- ^ "error" - The error result of the operation in case of failure or cancellation.
  , CreateTunedModelOperation -> Maybe CreateTunedModelMetadata
createTunedModelOperationMetadata :: !(Maybe CreateTunedModelMetadata)
  -- ^ "metadata"
  , CreateTunedModelOperation -> Maybe TunedModel
createTunedModelOperationResponse :: !(Maybe TunedModel)
  -- ^ "response"
  }
  deriving (Int -> CreateTunedModelOperation -> ShowS
[CreateTunedModelOperation] -> ShowS
CreateTunedModelOperation -> [Char]
(Int -> CreateTunedModelOperation -> ShowS)
-> (CreateTunedModelOperation -> [Char])
-> ([CreateTunedModelOperation] -> ShowS)
-> Show CreateTunedModelOperation
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CreateTunedModelOperation -> ShowS
showsPrec :: Int -> CreateTunedModelOperation -> ShowS
$cshow :: CreateTunedModelOperation -> [Char]
show :: CreateTunedModelOperation -> [Char]
$cshowList :: [CreateTunedModelOperation] -> ShowS
showList :: [CreateTunedModelOperation] -> ShowS
P.Show, CreateTunedModelOperation -> CreateTunedModelOperation -> Bool
(CreateTunedModelOperation -> CreateTunedModelOperation -> Bool)
-> (CreateTunedModelOperation -> CreateTunedModelOperation -> Bool)
-> Eq CreateTunedModelOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CreateTunedModelOperation -> CreateTunedModelOperation -> Bool
== :: CreateTunedModelOperation -> CreateTunedModelOperation -> Bool
$c/= :: CreateTunedModelOperation -> CreateTunedModelOperation -> Bool
/= :: CreateTunedModelOperation -> CreateTunedModelOperation -> Bool
P.Eq, P.Typeable)

-- | FromJSON CreateTunedModelOperation
instance A.FromJSON CreateTunedModelOperation where
  parseJSON :: Value -> Parser CreateTunedModelOperation
parseJSON = [Char]
-> (Object -> Parser CreateTunedModelOperation)
-> Value
-> Parser CreateTunedModelOperation
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CreateTunedModelOperation" ((Object -> Parser CreateTunedModelOperation)
 -> Value -> Parser CreateTunedModelOperation)
-> (Object -> Parser CreateTunedModelOperation)
-> Value
-> Parser CreateTunedModelOperation
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Bool
-> Maybe Text
-> Maybe Status
-> Maybe CreateTunedModelMetadata
-> Maybe TunedModel
-> CreateTunedModelOperation
CreateTunedModelOperation
      (Maybe Bool
 -> Maybe Text
 -> Maybe Status
 -> Maybe CreateTunedModelMetadata
 -> Maybe TunedModel
 -> CreateTunedModelOperation)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Status
      -> Maybe CreateTunedModelMetadata
      -> Maybe TunedModel
      -> CreateTunedModelOperation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"done")
      Parser
  (Maybe Text
   -> Maybe Status
   -> Maybe CreateTunedModelMetadata
   -> Maybe TunedModel
   -> CreateTunedModelOperation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Status
      -> Maybe CreateTunedModelMetadata
      -> Maybe TunedModel
      -> CreateTunedModelOperation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser
  (Maybe Status
   -> Maybe CreateTunedModelMetadata
   -> Maybe TunedModel
   -> CreateTunedModelOperation)
-> Parser (Maybe Status)
-> Parser
     (Maybe CreateTunedModelMetadata
      -> Maybe TunedModel -> CreateTunedModelOperation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"error")
      Parser
  (Maybe CreateTunedModelMetadata
   -> Maybe TunedModel -> CreateTunedModelOperation)
-> Parser (Maybe CreateTunedModelMetadata)
-> Parser (Maybe TunedModel -> CreateTunedModelOperation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe CreateTunedModelMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"metadata")
      Parser (Maybe TunedModel -> CreateTunedModelOperation)
-> Parser (Maybe TunedModel) -> Parser CreateTunedModelOperation
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe TunedModel)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"response")

-- | ToJSON CreateTunedModelOperation
instance A.ToJSON CreateTunedModelOperation where
  toJSON :: CreateTunedModelOperation -> Value
toJSON CreateTunedModelOperation {Maybe Bool
Maybe Text
Maybe CreateTunedModelMetadata
Maybe Status
Maybe TunedModel
createTunedModelOperationDone :: CreateTunedModelOperation -> Maybe Bool
createTunedModelOperationName :: CreateTunedModelOperation -> Maybe Text
createTunedModelOperationError :: CreateTunedModelOperation -> Maybe Status
createTunedModelOperationMetadata :: CreateTunedModelOperation -> Maybe CreateTunedModelMetadata
createTunedModelOperationResponse :: CreateTunedModelOperation -> Maybe TunedModel
createTunedModelOperationDone :: Maybe Bool
createTunedModelOperationName :: Maybe Text
createTunedModelOperationError :: Maybe Status
createTunedModelOperationMetadata :: Maybe CreateTunedModelMetadata
createTunedModelOperationResponse :: Maybe TunedModel
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"done" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
createTunedModelOperationDone
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
createTunedModelOperationName
      , Key
"error" Key -> Maybe Status -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Status
createTunedModelOperationError
      , Key
"metadata" Key -> Maybe CreateTunedModelMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe CreateTunedModelMetadata
createTunedModelOperationMetadata
      , Key
"response" Key -> Maybe TunedModel -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe TunedModel
createTunedModelOperationResponse
      ]

-- | Construct a value of type 'CreateTunedModelOperation' (by applying it's required fields, if any)
mkCreateTunedModelOperation ::
  CreateTunedModelOperation
mkCreateTunedModelOperation :: CreateTunedModelOperation
mkCreateTunedModelOperation =
  CreateTunedModelOperation
    { createTunedModelOperationDone :: Maybe Bool
createTunedModelOperationDone = Maybe Bool
forall a. Maybe a
Nothing
    , createTunedModelOperationName :: Maybe Text
createTunedModelOperationName = Maybe Text
forall a. Maybe a
Nothing
    , createTunedModelOperationError :: Maybe Status
createTunedModelOperationError = Maybe Status
forall a. Maybe a
Nothing
    , createTunedModelOperationMetadata :: Maybe CreateTunedModelMetadata
createTunedModelOperationMetadata = Maybe CreateTunedModelMetadata
forall a. Maybe a
Nothing
    , createTunedModelOperationResponse :: Maybe TunedModel
createTunedModelOperationResponse = Maybe TunedModel
forall a. Maybe a
Nothing
    }

-- ** CustomMetadata

{- | CustomMetadata
User provided metadata stored as key-value pairs.
-}
data CustomMetadata = CustomMetadata
  { CustomMetadata -> Maybe StringList
customMetadataStringListValue :: !(Maybe StringList)
  -- ^ "stringListValue" - The StringList value of the metadata to store.
  , CustomMetadata -> Maybe Text
customMetadataStringValue :: !(Maybe Text)
  -- ^ "stringValue" - The string value of the metadata to store.
  , CustomMetadata -> Text
customMetadataKey :: !(Text)
  -- ^ /Required/ "key" - Required. The key of the metadata to store.
  , CustomMetadata -> Maybe Float
customMetadataNumericValue :: !(Maybe Float)
  -- ^ "numericValue" - The numeric value of the metadata to store.
  }
  deriving (Int -> CustomMetadata -> ShowS
[CustomMetadata] -> ShowS
CustomMetadata -> [Char]
(Int -> CustomMetadata -> ShowS)
-> (CustomMetadata -> [Char])
-> ([CustomMetadata] -> ShowS)
-> Show CustomMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CustomMetadata -> ShowS
showsPrec :: Int -> CustomMetadata -> ShowS
$cshow :: CustomMetadata -> [Char]
show :: CustomMetadata -> [Char]
$cshowList :: [CustomMetadata] -> ShowS
showList :: [CustomMetadata] -> ShowS
P.Show, CustomMetadata -> CustomMetadata -> Bool
(CustomMetadata -> CustomMetadata -> Bool)
-> (CustomMetadata -> CustomMetadata -> Bool) -> Eq CustomMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CustomMetadata -> CustomMetadata -> Bool
== :: CustomMetadata -> CustomMetadata -> Bool
$c/= :: CustomMetadata -> CustomMetadata -> Bool
/= :: CustomMetadata -> CustomMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON CustomMetadata
instance A.FromJSON CustomMetadata where
  parseJSON :: Value -> Parser CustomMetadata
parseJSON = [Char]
-> (Object -> Parser CustomMetadata)
-> Value
-> Parser CustomMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"CustomMetadata" ((Object -> Parser CustomMetadata)
 -> Value -> Parser CustomMetadata)
-> (Object -> Parser CustomMetadata)
-> Value
-> Parser CustomMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe StringList
-> Maybe Text -> Text -> Maybe Float -> CustomMetadata
CustomMetadata
      (Maybe StringList
 -> Maybe Text -> Text -> Maybe Float -> CustomMetadata)
-> Parser (Maybe StringList)
-> Parser (Maybe Text -> Text -> Maybe Float -> CustomMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe StringList)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"stringListValue")
      Parser (Maybe Text -> Text -> Maybe Float -> CustomMetadata)
-> Parser (Maybe Text)
-> Parser (Text -> Maybe Float -> CustomMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"stringValue")
      Parser (Text -> Maybe Float -> CustomMetadata)
-> Parser Text -> Parser (Maybe Float -> CustomMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"key")
      Parser (Maybe Float -> CustomMetadata)
-> Parser (Maybe Float) -> Parser CustomMetadata
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"numericValue")

-- | ToJSON CustomMetadata
instance A.ToJSON CustomMetadata where
  toJSON :: CustomMetadata -> Value
toJSON CustomMetadata {Maybe Float
Maybe Text
Maybe StringList
Text
customMetadataStringListValue :: CustomMetadata -> Maybe StringList
customMetadataStringValue :: CustomMetadata -> Maybe Text
customMetadataKey :: CustomMetadata -> Text
customMetadataNumericValue :: CustomMetadata -> Maybe Float
customMetadataStringListValue :: Maybe StringList
customMetadataStringValue :: Maybe Text
customMetadataKey :: Text
customMetadataNumericValue :: Maybe Float
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"stringListValue" Key -> Maybe StringList -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe StringList
customMetadataStringListValue
      , Key
"stringValue" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
customMetadataStringValue
      , Key
"key" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
customMetadataKey
      , Key
"numericValue" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
customMetadataNumericValue
      ]

-- | Construct a value of type 'CustomMetadata' (by applying it's required fields, if any)
mkCustomMetadata ::
  -- | 'customMetadataKey': Required. The key of the metadata to store.
  Text ->
  CustomMetadata
mkCustomMetadata :: Text -> CustomMetadata
mkCustomMetadata Text
customMetadataKey =
  CustomMetadata
    { customMetadataStringListValue :: Maybe StringList
customMetadataStringListValue = Maybe StringList
forall a. Maybe a
Nothing
    , customMetadataStringValue :: Maybe Text
customMetadataStringValue = Maybe Text
forall a. Maybe a
Nothing
    , Text
customMetadataKey :: Text
customMetadataKey :: Text
customMetadataKey
    , customMetadataNumericValue :: Maybe Float
customMetadataNumericValue = Maybe Float
forall a. Maybe a
Nothing
    }

-- ** Dataset

{- | Dataset
Dataset for training or validation.
-}
data Dataset = Dataset
  { Dataset -> Maybe TuningExamples
datasetExamples :: !(Maybe TuningExamples)
  -- ^ "examples" - Optional. Inline examples with simple input/output text.
  }
  deriving (Int -> Dataset -> ShowS
[Dataset] -> ShowS
Dataset -> [Char]
(Int -> Dataset -> ShowS)
-> (Dataset -> [Char]) -> ([Dataset] -> ShowS) -> Show Dataset
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Dataset -> ShowS
showsPrec :: Int -> Dataset -> ShowS
$cshow :: Dataset -> [Char]
show :: Dataset -> [Char]
$cshowList :: [Dataset] -> ShowS
showList :: [Dataset] -> ShowS
P.Show, Dataset -> Dataset -> Bool
(Dataset -> Dataset -> Bool)
-> (Dataset -> Dataset -> Bool) -> Eq Dataset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Dataset -> Dataset -> Bool
== :: Dataset -> Dataset -> Bool
$c/= :: Dataset -> Dataset -> Bool
/= :: Dataset -> Dataset -> Bool
P.Eq, P.Typeable)

-- | FromJSON Dataset
instance A.FromJSON Dataset where
  parseJSON :: Value -> Parser Dataset
parseJSON = [Char] -> (Object -> Parser Dataset) -> Value -> Parser Dataset
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Dataset" ((Object -> Parser Dataset) -> Value -> Parser Dataset)
-> (Object -> Parser Dataset) -> Value -> Parser Dataset
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe TuningExamples -> Dataset
Dataset
      (Maybe TuningExamples -> Dataset)
-> Parser (Maybe TuningExamples) -> Parser Dataset
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe TuningExamples)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"examples")

-- | ToJSON Dataset
instance A.ToJSON Dataset where
  toJSON :: Dataset -> Value
toJSON Dataset {Maybe TuningExamples
datasetExamples :: Dataset -> Maybe TuningExamples
datasetExamples :: Maybe TuningExamples
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"examples" Key -> Maybe TuningExamples -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe TuningExamples
datasetExamples
      ]

-- | Construct a value of type 'Dataset' (by applying it's required fields, if any)
mkDataset ::
  Dataset
mkDataset :: Dataset
mkDataset =
  Dataset
    { datasetExamples :: Maybe TuningExamples
datasetExamples = Maybe TuningExamples
forall a. Maybe a
Nothing
    }

-- ** DeleteChunkRequest

{- | DeleteChunkRequest
Request to delete a `Chunk`.
-}
data DeleteChunkRequest = DeleteChunkRequest
  { DeleteChunkRequest -> Text
deleteChunkRequestName :: !(Text)
  -- ^ /Required/ "name" - Required. The resource name of the &#x60;Chunk&#x60; to delete. Example: &#x60;corpora/my-corpus-123/documents/the-doc-abc/chunks/some-chunk&#x60;
  }
  deriving (Int -> DeleteChunkRequest -> ShowS
[DeleteChunkRequest] -> ShowS
DeleteChunkRequest -> [Char]
(Int -> DeleteChunkRequest -> ShowS)
-> (DeleteChunkRequest -> [Char])
-> ([DeleteChunkRequest] -> ShowS)
-> Show DeleteChunkRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DeleteChunkRequest -> ShowS
showsPrec :: Int -> DeleteChunkRequest -> ShowS
$cshow :: DeleteChunkRequest -> [Char]
show :: DeleteChunkRequest -> [Char]
$cshowList :: [DeleteChunkRequest] -> ShowS
showList :: [DeleteChunkRequest] -> ShowS
P.Show, DeleteChunkRequest -> DeleteChunkRequest -> Bool
(DeleteChunkRequest -> DeleteChunkRequest -> Bool)
-> (DeleteChunkRequest -> DeleteChunkRequest -> Bool)
-> Eq DeleteChunkRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DeleteChunkRequest -> DeleteChunkRequest -> Bool
== :: DeleteChunkRequest -> DeleteChunkRequest -> Bool
$c/= :: DeleteChunkRequest -> DeleteChunkRequest -> Bool
/= :: DeleteChunkRequest -> DeleteChunkRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON DeleteChunkRequest
instance A.FromJSON DeleteChunkRequest where
  parseJSON :: Value -> Parser DeleteChunkRequest
parseJSON = [Char]
-> (Object -> Parser DeleteChunkRequest)
-> Value
-> Parser DeleteChunkRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"DeleteChunkRequest" ((Object -> Parser DeleteChunkRequest)
 -> Value -> Parser DeleteChunkRequest)
-> (Object -> Parser DeleteChunkRequest)
-> Value
-> Parser DeleteChunkRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Text -> DeleteChunkRequest
DeleteChunkRequest
      (Text -> DeleteChunkRequest)
-> Parser Text -> Parser DeleteChunkRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name")

-- | ToJSON DeleteChunkRequest
instance A.ToJSON DeleteChunkRequest where
  toJSON :: DeleteChunkRequest -> Value
toJSON DeleteChunkRequest {Text
deleteChunkRequestName :: DeleteChunkRequest -> Text
deleteChunkRequestName :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"name" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
deleteChunkRequestName
      ]

-- | Construct a value of type 'DeleteChunkRequest' (by applying it's required fields, if any)
mkDeleteChunkRequest ::
  -- | 'deleteChunkRequestName': Required. The resource name of the `Chunk` to delete. Example: `corpora/my-corpus-123/documents/the-doc-abc/chunks/some-chunk`
  Text ->
  DeleteChunkRequest
mkDeleteChunkRequest :: Text -> DeleteChunkRequest
mkDeleteChunkRequest Text
deleteChunkRequestName =
  DeleteChunkRequest
    { Text
deleteChunkRequestName :: Text
deleteChunkRequestName :: Text
deleteChunkRequestName
    }

-- ** Document

{- | Document
A `Document` is a collection of `Chunk`s. A `Corpus` can have a maximum of 10,000 `Document`s.
-}
data Document = Document
  { Document -> Maybe DateTime
documentUpdateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "updateTime" - Output only. The Timestamp of when the &#x60;Document&#x60; was last updated.
  , Document -> Maybe Text
documentName :: !(Maybe Text)
  -- ^ "name" - Immutable. Identifier. The &#x60;Document&#x60; resource name. The ID (name excluding the \&quot;corpora/*/documents/\&quot; prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be derived from &#x60;display_name&#x60; along with a 12 character random suffix. Example: &#x60;corpora/{corpus_id}/documents/my-awesome-doc-123a456b789c&#x60;
  , Document -> Maybe [CustomMetadata]
documentCustomMetadata :: !(Maybe [CustomMetadata])
  -- ^ "customMetadata" - Optional. User provided custom metadata stored as key-value pairs used for querying. A &#x60;Document&#x60; can have a maximum of 20 &#x60;CustomMetadata&#x60;.
  , Document -> Maybe DateTime
documentCreateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "createTime" - Output only. The Timestamp of when the &#x60;Document&#x60; was created.
  , Document -> Maybe Text
documentDisplayName :: !(Maybe Text)
  -- ^ "displayName" - Optional. The human-readable display name for the &#x60;Document&#x60;. The display name must be no more than 512 characters in length, including spaces. Example: \&quot;Semantic Retriever Documentation\&quot;
  }
  deriving (Int -> Document -> ShowS
[Document] -> ShowS
Document -> [Char]
(Int -> Document -> ShowS)
-> (Document -> [Char]) -> ([Document] -> ShowS) -> Show Document
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Document -> ShowS
showsPrec :: Int -> Document -> ShowS
$cshow :: Document -> [Char]
show :: Document -> [Char]
$cshowList :: [Document] -> ShowS
showList :: [Document] -> ShowS
P.Show, Document -> Document -> Bool
(Document -> Document -> Bool)
-> (Document -> Document -> Bool) -> Eq Document
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Document -> Document -> Bool
== :: Document -> Document -> Bool
$c/= :: Document -> Document -> Bool
/= :: Document -> Document -> Bool
P.Eq, P.Typeable)

-- | FromJSON Document
instance A.FromJSON Document where
  parseJSON :: Value -> Parser Document
parseJSON = [Char] -> (Object -> Parser Document) -> Value -> Parser Document
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Document" ((Object -> Parser Document) -> Value -> Parser Document)
-> (Object -> Parser Document) -> Value -> Parser Document
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe DateTime
-> Maybe Text
-> Maybe [CustomMetadata]
-> Maybe DateTime
-> Maybe Text
-> Document
Document
      (Maybe DateTime
 -> Maybe Text
 -> Maybe [CustomMetadata]
 -> Maybe DateTime
 -> Maybe Text
 -> Document)
-> Parser (Maybe DateTime)
-> Parser
     (Maybe Text
      -> Maybe [CustomMetadata]
      -> Maybe DateTime
      -> Maybe Text
      -> Document)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"updateTime")
      Parser
  (Maybe Text
   -> Maybe [CustomMetadata]
   -> Maybe DateTime
   -> Maybe Text
   -> Document)
-> Parser (Maybe Text)
-> Parser
     (Maybe [CustomMetadata]
      -> Maybe DateTime -> Maybe Text -> Document)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser
  (Maybe [CustomMetadata]
   -> Maybe DateTime -> Maybe Text -> Document)
-> Parser (Maybe [CustomMetadata])
-> Parser (Maybe DateTime -> Maybe Text -> Document)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [CustomMetadata])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"customMetadata")
      Parser (Maybe DateTime -> Maybe Text -> Document)
-> Parser (Maybe DateTime) -> Parser (Maybe Text -> Document)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"createTime")
      Parser (Maybe Text -> Document)
-> Parser (Maybe Text) -> Parser Document
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"displayName")

-- | ToJSON Document
instance A.ToJSON Document where
  toJSON :: Document -> Value
toJSON Document {Maybe [CustomMetadata]
Maybe Text
Maybe DateTime
documentUpdateTime :: Document -> Maybe DateTime
documentName :: Document -> Maybe Text
documentCustomMetadata :: Document -> Maybe [CustomMetadata]
documentCreateTime :: Document -> Maybe DateTime
documentDisplayName :: Document -> Maybe Text
documentUpdateTime :: Maybe DateTime
documentName :: Maybe Text
documentCustomMetadata :: Maybe [CustomMetadata]
documentCreateTime :: Maybe DateTime
documentDisplayName :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"updateTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
documentUpdateTime
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
documentName
      , Key
"customMetadata" Key -> Maybe [CustomMetadata] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [CustomMetadata]
documentCustomMetadata
      , Key
"createTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
documentCreateTime
      , Key
"displayName" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
documentDisplayName
      ]

-- | Construct a value of type 'Document' (by applying it's required fields, if any)
mkDocument ::
  Document
mkDocument :: Document
mkDocument =
  Document
    { documentUpdateTime :: Maybe DateTime
documentUpdateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , documentName :: Maybe Text
documentName = Maybe Text
forall a. Maybe a
Nothing
    , documentCustomMetadata :: Maybe [CustomMetadata]
documentCustomMetadata = Maybe [CustomMetadata]
forall a. Maybe a
Nothing
    , documentCreateTime :: Maybe DateTime
documentCreateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , documentDisplayName :: Maybe Text
documentDisplayName = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** DynamicRetrievalConfig

{- | DynamicRetrievalConfig
Describes the options to customize dynamic retrieval.
-}
data DynamicRetrievalConfig = DynamicRetrievalConfig
  { DynamicRetrievalConfig -> Maybe Float
dynamicRetrievalConfigDynamicThreshold :: !(Maybe Float)
  -- ^ "dynamicThreshold" - The threshold to be used in dynamic retrieval. If not set, a system default value is used.
  , DynamicRetrievalConfig -> Maybe E'Mode
dynamicRetrievalConfigMode :: !(Maybe E'Mode)
  -- ^ "mode" - The mode of the predictor to be used in dynamic retrieval.
  }
  deriving (Int -> DynamicRetrievalConfig -> ShowS
[DynamicRetrievalConfig] -> ShowS
DynamicRetrievalConfig -> [Char]
(Int -> DynamicRetrievalConfig -> ShowS)
-> (DynamicRetrievalConfig -> [Char])
-> ([DynamicRetrievalConfig] -> ShowS)
-> Show DynamicRetrievalConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DynamicRetrievalConfig -> ShowS
showsPrec :: Int -> DynamicRetrievalConfig -> ShowS
$cshow :: DynamicRetrievalConfig -> [Char]
show :: DynamicRetrievalConfig -> [Char]
$cshowList :: [DynamicRetrievalConfig] -> ShowS
showList :: [DynamicRetrievalConfig] -> ShowS
P.Show, DynamicRetrievalConfig -> DynamicRetrievalConfig -> Bool
(DynamicRetrievalConfig -> DynamicRetrievalConfig -> Bool)
-> (DynamicRetrievalConfig -> DynamicRetrievalConfig -> Bool)
-> Eq DynamicRetrievalConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DynamicRetrievalConfig -> DynamicRetrievalConfig -> Bool
== :: DynamicRetrievalConfig -> DynamicRetrievalConfig -> Bool
$c/= :: DynamicRetrievalConfig -> DynamicRetrievalConfig -> Bool
/= :: DynamicRetrievalConfig -> DynamicRetrievalConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON DynamicRetrievalConfig
instance A.FromJSON DynamicRetrievalConfig where
  parseJSON :: Value -> Parser DynamicRetrievalConfig
parseJSON = [Char]
-> (Object -> Parser DynamicRetrievalConfig)
-> Value
-> Parser DynamicRetrievalConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"DynamicRetrievalConfig" ((Object -> Parser DynamicRetrievalConfig)
 -> Value -> Parser DynamicRetrievalConfig)
-> (Object -> Parser DynamicRetrievalConfig)
-> Value
-> Parser DynamicRetrievalConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Float -> Maybe E'Mode -> DynamicRetrievalConfig
DynamicRetrievalConfig
      (Maybe Float -> Maybe E'Mode -> DynamicRetrievalConfig)
-> Parser (Maybe Float)
-> Parser (Maybe E'Mode -> DynamicRetrievalConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"dynamicThreshold")
      Parser (Maybe E'Mode -> DynamicRetrievalConfig)
-> Parser (Maybe E'Mode) -> Parser DynamicRetrievalConfig
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'Mode)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mode")

-- | ToJSON DynamicRetrievalConfig
instance A.ToJSON DynamicRetrievalConfig where
  toJSON :: DynamicRetrievalConfig -> Value
toJSON DynamicRetrievalConfig {Maybe Float
Maybe E'Mode
dynamicRetrievalConfigDynamicThreshold :: DynamicRetrievalConfig -> Maybe Float
dynamicRetrievalConfigMode :: DynamicRetrievalConfig -> Maybe E'Mode
dynamicRetrievalConfigDynamicThreshold :: Maybe Float
dynamicRetrievalConfigMode :: Maybe E'Mode
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"dynamicThreshold" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
dynamicRetrievalConfigDynamicThreshold
      , Key
"mode" Key -> Maybe E'Mode -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'Mode
dynamicRetrievalConfigMode
      ]

-- | Construct a value of type 'DynamicRetrievalConfig' (by applying it's required fields, if any)
mkDynamicRetrievalConfig ::
  DynamicRetrievalConfig
mkDynamicRetrievalConfig :: DynamicRetrievalConfig
mkDynamicRetrievalConfig =
  DynamicRetrievalConfig
    { dynamicRetrievalConfigDynamicThreshold :: Maybe Float
dynamicRetrievalConfigDynamicThreshold = Maybe Float
forall a. Maybe a
Nothing
    , dynamicRetrievalConfigMode :: Maybe E'Mode
dynamicRetrievalConfigMode = Maybe E'Mode
forall a. Maybe a
Nothing
    }

-- ** EmbedContentRequest

{- | EmbedContentRequest
Request containing the `Content` for the model to embed.
-}
data EmbedContentRequest = EmbedContentRequest
  { EmbedContentRequest -> Maybe TaskType
embedContentRequestTaskType :: !(Maybe TaskType)
  -- ^ "taskType" - Optional. Optional task type for which the embeddings will be used. Not supported on earlier models (&#x60;models/embedding-001&#x60;).
  , EmbedContentRequest -> Content
embedContentRequestContent :: !(Content)
  -- ^ /Required/ "content" - Required. The content to embed. Only the &#x60;parts.text&#x60; fields will be counted.
  , EmbedContentRequest -> Maybe Int
embedContentRequestOutputDimensionality :: !(Maybe Int)
  -- ^ "outputDimensionality" - Optional. Optional reduced dimension for the output embedding. If set, excessive values in the output embedding are truncated from the end. Supported by newer models since 2024 only. You cannot set this value if using the earlier model (&#x60;models/embedding-001&#x60;).
  , EmbedContentRequest -> Text
embedContentRequestModel :: !(Text)
  -- ^ /Required/ "model" - Required. The model&#39;s resource name. This serves as an ID for the Model to use.  This name should match a model name returned by the &#x60;ListModels&#x60; method.  Format: &#x60;models/{model}&#x60;
  , EmbedContentRequest -> Maybe Text
embedContentRequestTitle :: !(Maybe Text)
  -- ^ "title" - Optional. An optional title for the text. Only applicable when TaskType is &#x60;RETRIEVAL_DOCUMENT&#x60;.  Note: Specifying a &#x60;title&#x60; for &#x60;RETRIEVAL_DOCUMENT&#x60; provides better quality embeddings for retrieval.
  }
  deriving (Int -> EmbedContentRequest -> ShowS
[EmbedContentRequest] -> ShowS
EmbedContentRequest -> [Char]
(Int -> EmbedContentRequest -> ShowS)
-> (EmbedContentRequest -> [Char])
-> ([EmbedContentRequest] -> ShowS)
-> Show EmbedContentRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EmbedContentRequest -> ShowS
showsPrec :: Int -> EmbedContentRequest -> ShowS
$cshow :: EmbedContentRequest -> [Char]
show :: EmbedContentRequest -> [Char]
$cshowList :: [EmbedContentRequest] -> ShowS
showList :: [EmbedContentRequest] -> ShowS
P.Show, EmbedContentRequest -> EmbedContentRequest -> Bool
(EmbedContentRequest -> EmbedContentRequest -> Bool)
-> (EmbedContentRequest -> EmbedContentRequest -> Bool)
-> Eq EmbedContentRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EmbedContentRequest -> EmbedContentRequest -> Bool
== :: EmbedContentRequest -> EmbedContentRequest -> Bool
$c/= :: EmbedContentRequest -> EmbedContentRequest -> Bool
/= :: EmbedContentRequest -> EmbedContentRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON EmbedContentRequest
instance A.FromJSON EmbedContentRequest where
  parseJSON :: Value -> Parser EmbedContentRequest
parseJSON = [Char]
-> (Object -> Parser EmbedContentRequest)
-> Value
-> Parser EmbedContentRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"EmbedContentRequest" ((Object -> Parser EmbedContentRequest)
 -> Value -> Parser EmbedContentRequest)
-> (Object -> Parser EmbedContentRequest)
-> Value
-> Parser EmbedContentRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe TaskType
-> Content
-> Maybe Int
-> Text
-> Maybe Text
-> EmbedContentRequest
EmbedContentRequest
      (Maybe TaskType
 -> Content
 -> Maybe Int
 -> Text
 -> Maybe Text
 -> EmbedContentRequest)
-> Parser (Maybe TaskType)
-> Parser
     (Content -> Maybe Int -> Text -> Maybe Text -> EmbedContentRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe TaskType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"taskType")
      Parser
  (Content -> Maybe Int -> Text -> Maybe Text -> EmbedContentRequest)
-> Parser Content
-> Parser (Maybe Int -> Text -> Maybe Text -> EmbedContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Content
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"content")
      Parser (Maybe Int -> Text -> Maybe Text -> EmbedContentRequest)
-> Parser (Maybe Int)
-> Parser (Text -> Maybe Text -> EmbedContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"outputDimensionality")
      Parser (Text -> Maybe Text -> EmbedContentRequest)
-> Parser Text -> Parser (Maybe Text -> EmbedContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"model")
      Parser (Maybe Text -> EmbedContentRequest)
-> Parser (Maybe Text) -> Parser EmbedContentRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title")

-- | ToJSON EmbedContentRequest
instance A.ToJSON EmbedContentRequest where
  toJSON :: EmbedContentRequest -> Value
toJSON EmbedContentRequest {Maybe Int
Maybe Text
Maybe TaskType
Text
Content
embedContentRequestTaskType :: EmbedContentRequest -> Maybe TaskType
embedContentRequestContent :: EmbedContentRequest -> Content
embedContentRequestOutputDimensionality :: EmbedContentRequest -> Maybe Int
embedContentRequestModel :: EmbedContentRequest -> Text
embedContentRequestTitle :: EmbedContentRequest -> Maybe Text
embedContentRequestTaskType :: Maybe TaskType
embedContentRequestContent :: Content
embedContentRequestOutputDimensionality :: Maybe Int
embedContentRequestModel :: Text
embedContentRequestTitle :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"taskType" Key -> Maybe TaskType -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe TaskType
embedContentRequestTaskType
      , Key
"content" Key -> Content -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Content
embedContentRequestContent
      , Key
"outputDimensionality" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
embedContentRequestOutputDimensionality
      , Key
"model" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
embedContentRequestModel
      , Key
"title" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
embedContentRequestTitle
      ]

-- | Construct a value of type 'EmbedContentRequest' (by applying it's required fields, if any)
mkEmbedContentRequest ::
  -- | 'embedContentRequestContent': Required. The content to embed. Only the `parts.text` fields will be counted.
  Content ->
  -- | 'embedContentRequestModel': Required. The model's resource name. This serves as an ID for the Model to use.  This name should match a model name returned by the `ListModels` method.  Format: `models/{model}`
  Text ->
  EmbedContentRequest
mkEmbedContentRequest :: Content -> Text -> EmbedContentRequest
mkEmbedContentRequest Content
embedContentRequestContent Text
embedContentRequestModel =
  EmbedContentRequest
    { embedContentRequestTaskType :: Maybe TaskType
embedContentRequestTaskType = Maybe TaskType
forall a. Maybe a
Nothing
    , Content
embedContentRequestContent :: Content
embedContentRequestContent :: Content
embedContentRequestContent
    , embedContentRequestOutputDimensionality :: Maybe Int
embedContentRequestOutputDimensionality = Maybe Int
forall a. Maybe a
Nothing
    , Text
embedContentRequestModel :: Text
embedContentRequestModel :: Text
embedContentRequestModel
    , embedContentRequestTitle :: Maybe Text
embedContentRequestTitle = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** EmbedContentResponse

{- | EmbedContentResponse
The response to an `EmbedContentRequest`.
-}
data EmbedContentResponse = EmbedContentResponse
  { EmbedContentResponse -> Maybe ContentEmbedding
embedContentResponseEmbedding :: !(Maybe ContentEmbedding)
  -- ^ /ReadOnly/ "embedding" - Output only. The embedding generated from the input content.
  }
  deriving (Int -> EmbedContentResponse -> ShowS
[EmbedContentResponse] -> ShowS
EmbedContentResponse -> [Char]
(Int -> EmbedContentResponse -> ShowS)
-> (EmbedContentResponse -> [Char])
-> ([EmbedContentResponse] -> ShowS)
-> Show EmbedContentResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EmbedContentResponse -> ShowS
showsPrec :: Int -> EmbedContentResponse -> ShowS
$cshow :: EmbedContentResponse -> [Char]
show :: EmbedContentResponse -> [Char]
$cshowList :: [EmbedContentResponse] -> ShowS
showList :: [EmbedContentResponse] -> ShowS
P.Show, EmbedContentResponse -> EmbedContentResponse -> Bool
(EmbedContentResponse -> EmbedContentResponse -> Bool)
-> (EmbedContentResponse -> EmbedContentResponse -> Bool)
-> Eq EmbedContentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EmbedContentResponse -> EmbedContentResponse -> Bool
== :: EmbedContentResponse -> EmbedContentResponse -> Bool
$c/= :: EmbedContentResponse -> EmbedContentResponse -> Bool
/= :: EmbedContentResponse -> EmbedContentResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON EmbedContentResponse
instance A.FromJSON EmbedContentResponse where
  parseJSON :: Value -> Parser EmbedContentResponse
parseJSON = [Char]
-> (Object -> Parser EmbedContentResponse)
-> Value
-> Parser EmbedContentResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"EmbedContentResponse" ((Object -> Parser EmbedContentResponse)
 -> Value -> Parser EmbedContentResponse)
-> (Object -> Parser EmbedContentResponse)
-> Value
-> Parser EmbedContentResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe ContentEmbedding -> EmbedContentResponse
EmbedContentResponse
      (Maybe ContentEmbedding -> EmbedContentResponse)
-> Parser (Maybe ContentEmbedding) -> Parser EmbedContentResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe ContentEmbedding)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"embedding")

-- | ToJSON EmbedContentResponse
instance A.ToJSON EmbedContentResponse where
  toJSON :: EmbedContentResponse -> Value
toJSON EmbedContentResponse {Maybe ContentEmbedding
embedContentResponseEmbedding :: EmbedContentResponse -> Maybe ContentEmbedding
embedContentResponseEmbedding :: Maybe ContentEmbedding
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"embedding" Key -> Maybe ContentEmbedding -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ContentEmbedding
embedContentResponseEmbedding
      ]

-- | Construct a value of type 'EmbedContentResponse' (by applying it's required fields, if any)
mkEmbedContentResponse ::
  EmbedContentResponse
mkEmbedContentResponse :: EmbedContentResponse
mkEmbedContentResponse =
  EmbedContentResponse
    { embedContentResponseEmbedding :: Maybe ContentEmbedding
embedContentResponseEmbedding = Maybe ContentEmbedding
forall a. Maybe a
Nothing
    }

-- ** EmbedTextRequest

{- | EmbedTextRequest
Request to get a text embedding from the model.
-}
data EmbedTextRequest = EmbedTextRequest
  { EmbedTextRequest -> Maybe Text
embedTextRequestText :: !(Maybe Text)
  -- ^ "text" - Optional. The free-form input text that the model will turn into an embedding.
  , EmbedTextRequest -> Text
embedTextRequestModel :: !(Text)
  -- ^ /Required/ "model" - Required. The model name to use with the format model&#x3D;models/{model}.
  }
  deriving (Int -> EmbedTextRequest -> ShowS
[EmbedTextRequest] -> ShowS
EmbedTextRequest -> [Char]
(Int -> EmbedTextRequest -> ShowS)
-> (EmbedTextRequest -> [Char])
-> ([EmbedTextRequest] -> ShowS)
-> Show EmbedTextRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EmbedTextRequest -> ShowS
showsPrec :: Int -> EmbedTextRequest -> ShowS
$cshow :: EmbedTextRequest -> [Char]
show :: EmbedTextRequest -> [Char]
$cshowList :: [EmbedTextRequest] -> ShowS
showList :: [EmbedTextRequest] -> ShowS
P.Show, EmbedTextRequest -> EmbedTextRequest -> Bool
(EmbedTextRequest -> EmbedTextRequest -> Bool)
-> (EmbedTextRequest -> EmbedTextRequest -> Bool)
-> Eq EmbedTextRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EmbedTextRequest -> EmbedTextRequest -> Bool
== :: EmbedTextRequest -> EmbedTextRequest -> Bool
$c/= :: EmbedTextRequest -> EmbedTextRequest -> Bool
/= :: EmbedTextRequest -> EmbedTextRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON EmbedTextRequest
instance A.FromJSON EmbedTextRequest where
  parseJSON :: Value -> Parser EmbedTextRequest
parseJSON = [Char]
-> (Object -> Parser EmbedTextRequest)
-> Value
-> Parser EmbedTextRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"EmbedTextRequest" ((Object -> Parser EmbedTextRequest)
 -> Value -> Parser EmbedTextRequest)
-> (Object -> Parser EmbedTextRequest)
-> Value
-> Parser EmbedTextRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Text -> EmbedTextRequest
EmbedTextRequest
      (Maybe Text -> Text -> EmbedTextRequest)
-> Parser (Maybe Text) -> Parser (Text -> EmbedTextRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"text")
      Parser (Text -> EmbedTextRequest)
-> Parser Text -> Parser EmbedTextRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"model")

-- | ToJSON EmbedTextRequest
instance A.ToJSON EmbedTextRequest where
  toJSON :: EmbedTextRequest -> Value
toJSON EmbedTextRequest {Maybe Text
Text
embedTextRequestText :: EmbedTextRequest -> Maybe Text
embedTextRequestModel :: EmbedTextRequest -> Text
embedTextRequestText :: Maybe Text
embedTextRequestModel :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"text" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
embedTextRequestText
      , Key
"model" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
embedTextRequestModel
      ]

-- | Construct a value of type 'EmbedTextRequest' (by applying it's required fields, if any)
mkEmbedTextRequest ::
  -- | 'embedTextRequestModel': Required. The model name to use with the format model=models/{model}.
  Text ->
  EmbedTextRequest
mkEmbedTextRequest :: Text -> EmbedTextRequest
mkEmbedTextRequest Text
embedTextRequestModel =
  EmbedTextRequest
    { embedTextRequestText :: Maybe Text
embedTextRequestText = Maybe Text
forall a. Maybe a
Nothing
    , Text
embedTextRequestModel :: Text
embedTextRequestModel :: Text
embedTextRequestModel
    }

-- ** EmbedTextResponse

{- | EmbedTextResponse
The response to a EmbedTextRequest.
-}
data EmbedTextResponse = EmbedTextResponse
  { EmbedTextResponse -> Maybe Embedding
embedTextResponseEmbedding :: !(Maybe Embedding)
  -- ^ /ReadOnly/ "embedding" - Output only. The embedding generated from the input text.
  }
  deriving (Int -> EmbedTextResponse -> ShowS
[EmbedTextResponse] -> ShowS
EmbedTextResponse -> [Char]
(Int -> EmbedTextResponse -> ShowS)
-> (EmbedTextResponse -> [Char])
-> ([EmbedTextResponse] -> ShowS)
-> Show EmbedTextResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EmbedTextResponse -> ShowS
showsPrec :: Int -> EmbedTextResponse -> ShowS
$cshow :: EmbedTextResponse -> [Char]
show :: EmbedTextResponse -> [Char]
$cshowList :: [EmbedTextResponse] -> ShowS
showList :: [EmbedTextResponse] -> ShowS
P.Show, EmbedTextResponse -> EmbedTextResponse -> Bool
(EmbedTextResponse -> EmbedTextResponse -> Bool)
-> (EmbedTextResponse -> EmbedTextResponse -> Bool)
-> Eq EmbedTextResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EmbedTextResponse -> EmbedTextResponse -> Bool
== :: EmbedTextResponse -> EmbedTextResponse -> Bool
$c/= :: EmbedTextResponse -> EmbedTextResponse -> Bool
/= :: EmbedTextResponse -> EmbedTextResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON EmbedTextResponse
instance A.FromJSON EmbedTextResponse where
  parseJSON :: Value -> Parser EmbedTextResponse
parseJSON = [Char]
-> (Object -> Parser EmbedTextResponse)
-> Value
-> Parser EmbedTextResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"EmbedTextResponse" ((Object -> Parser EmbedTextResponse)
 -> Value -> Parser EmbedTextResponse)
-> (Object -> Parser EmbedTextResponse)
-> Value
-> Parser EmbedTextResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Embedding -> EmbedTextResponse
EmbedTextResponse
      (Maybe Embedding -> EmbedTextResponse)
-> Parser (Maybe Embedding) -> Parser EmbedTextResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Embedding)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"embedding")

-- | ToJSON EmbedTextResponse
instance A.ToJSON EmbedTextResponse where
  toJSON :: EmbedTextResponse -> Value
toJSON EmbedTextResponse {Maybe Embedding
embedTextResponseEmbedding :: EmbedTextResponse -> Maybe Embedding
embedTextResponseEmbedding :: Maybe Embedding
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"embedding" Key -> Maybe Embedding -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Embedding
embedTextResponseEmbedding
      ]

-- | Construct a value of type 'EmbedTextResponse' (by applying it's required fields, if any)
mkEmbedTextResponse ::
  EmbedTextResponse
mkEmbedTextResponse :: EmbedTextResponse
mkEmbedTextResponse =
  EmbedTextResponse
    { embedTextResponseEmbedding :: Maybe Embedding
embedTextResponseEmbedding = Maybe Embedding
forall a. Maybe a
Nothing
    }

-- ** Embedding

{- | Embedding
A list of floats representing the embedding.
-}
data Embedding = Embedding
  { Embedding -> Maybe [Float]
embeddingValue :: !(Maybe [Float])
  -- ^ "value" - The embedding values.
  }
  deriving (Int -> Embedding -> ShowS
[Embedding] -> ShowS
Embedding -> [Char]
(Int -> Embedding -> ShowS)
-> (Embedding -> [Char])
-> ([Embedding] -> ShowS)
-> Show Embedding
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Embedding -> ShowS
showsPrec :: Int -> Embedding -> ShowS
$cshow :: Embedding -> [Char]
show :: Embedding -> [Char]
$cshowList :: [Embedding] -> ShowS
showList :: [Embedding] -> ShowS
P.Show, Embedding -> Embedding -> Bool
(Embedding -> Embedding -> Bool)
-> (Embedding -> Embedding -> Bool) -> Eq Embedding
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Embedding -> Embedding -> Bool
== :: Embedding -> Embedding -> Bool
$c/= :: Embedding -> Embedding -> Bool
/= :: Embedding -> Embedding -> Bool
P.Eq, P.Typeable)

-- | FromJSON Embedding
instance A.FromJSON Embedding where
  parseJSON :: Value -> Parser Embedding
parseJSON = [Char] -> (Object -> Parser Embedding) -> Value -> Parser Embedding
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Embedding" ((Object -> Parser Embedding) -> Value -> Parser Embedding)
-> (Object -> Parser Embedding) -> Value -> Parser Embedding
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Float] -> Embedding
Embedding
      (Maybe [Float] -> Embedding)
-> Parser (Maybe [Float]) -> Parser Embedding
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Float])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"value")

-- | ToJSON Embedding
instance A.ToJSON Embedding where
  toJSON :: Embedding -> Value
toJSON Embedding {Maybe [Float]
embeddingValue :: Embedding -> Maybe [Float]
embeddingValue :: Maybe [Float]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"value" Key -> Maybe [Float] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Float]
embeddingValue
      ]

-- | Construct a value of type 'Embedding' (by applying it's required fields, if any)
mkEmbedding ::
  Embedding
mkEmbedding :: Embedding
mkEmbedding =
  Embedding
    { embeddingValue :: Maybe [Float]
embeddingValue = Maybe [Float]
forall a. Maybe a
Nothing
    }

-- ** Example

{- | Example
An input/output example used to instruct the Model.  It demonstrates how the model should respond or format its response.
-}
data Example = Example
  { Example -> Message
exampleOutput :: !(Message)
  -- ^ /Required/ "output" - Required. An example of what the model should output given the input.
  , Example -> Message
exampleInput :: !(Message)
  -- ^ /Required/ "input" - Required. An example of an input &#x60;Message&#x60; from the user.
  }
  deriving (Int -> Example -> ShowS
[Example] -> ShowS
Example -> [Char]
(Int -> Example -> ShowS)
-> (Example -> [Char]) -> ([Example] -> ShowS) -> Show Example
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Example -> ShowS
showsPrec :: Int -> Example -> ShowS
$cshow :: Example -> [Char]
show :: Example -> [Char]
$cshowList :: [Example] -> ShowS
showList :: [Example] -> ShowS
P.Show, Example -> Example -> Bool
(Example -> Example -> Bool)
-> (Example -> Example -> Bool) -> Eq Example
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Example -> Example -> Bool
== :: Example -> Example -> Bool
$c/= :: Example -> Example -> Bool
/= :: Example -> Example -> Bool
P.Eq, P.Typeable)

-- | FromJSON Example
instance A.FromJSON Example where
  parseJSON :: Value -> Parser Example
parseJSON = [Char] -> (Object -> Parser Example) -> Value -> Parser Example
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Example" ((Object -> Parser Example) -> Value -> Parser Example)
-> (Object -> Parser Example) -> Value -> Parser Example
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Message -> Message -> Example
Example
      (Message -> Message -> Example)
-> Parser Message -> Parser (Message -> Example)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Message
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"output")
      Parser (Message -> Example) -> Parser Message -> Parser Example
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Message
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"input")

-- | ToJSON Example
instance A.ToJSON Example where
  toJSON :: Example -> Value
toJSON Example {Message
exampleOutput :: Example -> Message
exampleInput :: Example -> Message
exampleOutput :: Message
exampleInput :: Message
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"output" Key -> Message -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Message
exampleOutput
      , Key
"input" Key -> Message -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Message
exampleInput
      ]

-- | Construct a value of type 'Example' (by applying it's required fields, if any)
mkExample ::
  -- | 'exampleOutput': Required. An example of what the model should output given the input.
  Message ->
  -- | 'exampleInput': Required. An example of an input `Message` from the user.
  Message ->
  Example
mkExample :: Message -> Message -> Example
mkExample Message
exampleOutput Message
exampleInput =
  Example
    { Message
exampleOutput :: Message
exampleOutput :: Message
exampleOutput
    , Message
exampleInput :: Message
exampleInput :: Message
exampleInput
    }

-- ** ExecutableCode

{- | ExecutableCode
Code generated by the model that is meant to be executed, and the result returned to the model.  Only generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding `CodeExecutionResult` will also be generated.
-}
data ExecutableCode = ExecutableCode
  { ExecutableCode -> E'Language
executableCodeLanguage :: !(E'Language)
  -- ^ /Required/ "language" - Required. Programming language of the &#x60;code&#x60;.
  , ExecutableCode -> Text
executableCodeCode :: !(Text)
  -- ^ /Required/ "code" - Required. The code to be executed.
  }
  deriving (Int -> ExecutableCode -> ShowS
[ExecutableCode] -> ShowS
ExecutableCode -> [Char]
(Int -> ExecutableCode -> ShowS)
-> (ExecutableCode -> [Char])
-> ([ExecutableCode] -> ShowS)
-> Show ExecutableCode
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ExecutableCode -> ShowS
showsPrec :: Int -> ExecutableCode -> ShowS
$cshow :: ExecutableCode -> [Char]
show :: ExecutableCode -> [Char]
$cshowList :: [ExecutableCode] -> ShowS
showList :: [ExecutableCode] -> ShowS
P.Show, ExecutableCode -> ExecutableCode -> Bool
(ExecutableCode -> ExecutableCode -> Bool)
-> (ExecutableCode -> ExecutableCode -> Bool) -> Eq ExecutableCode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ExecutableCode -> ExecutableCode -> Bool
== :: ExecutableCode -> ExecutableCode -> Bool
$c/= :: ExecutableCode -> ExecutableCode -> Bool
/= :: ExecutableCode -> ExecutableCode -> Bool
P.Eq, P.Typeable)

-- | FromJSON ExecutableCode
instance A.FromJSON ExecutableCode where
  parseJSON :: Value -> Parser ExecutableCode
parseJSON = [Char]
-> (Object -> Parser ExecutableCode)
-> Value
-> Parser ExecutableCode
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ExecutableCode" ((Object -> Parser ExecutableCode)
 -> Value -> Parser ExecutableCode)
-> (Object -> Parser ExecutableCode)
-> Value
-> Parser ExecutableCode
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    E'Language -> Text -> ExecutableCode
ExecutableCode
      (E'Language -> Text -> ExecutableCode)
-> Parser E'Language -> Parser (Text -> ExecutableCode)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser E'Language
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"language")
      Parser (Text -> ExecutableCode)
-> Parser Text -> Parser ExecutableCode
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"code")

-- | ToJSON ExecutableCode
instance A.ToJSON ExecutableCode where
  toJSON :: ExecutableCode -> Value
toJSON ExecutableCode {Text
E'Language
executableCodeLanguage :: ExecutableCode -> E'Language
executableCodeCode :: ExecutableCode -> Text
executableCodeLanguage :: E'Language
executableCodeCode :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"language" Key -> E'Language -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= E'Language
executableCodeLanguage
      , Key
"code" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
executableCodeCode
      ]

-- | Construct a value of type 'ExecutableCode' (by applying it's required fields, if any)
mkExecutableCode ::
  -- | 'executableCodeLanguage': Required. Programming language of the `code`.
  E'Language ->
  -- | 'executableCodeCode': Required. The code to be executed.
  Text ->
  ExecutableCode
mkExecutableCode :: E'Language -> Text -> ExecutableCode
mkExecutableCode E'Language
executableCodeLanguage Text
executableCodeCode =
  ExecutableCode
    { E'Language
executableCodeLanguage :: E'Language
executableCodeLanguage :: E'Language
executableCodeLanguage
    , Text
executableCodeCode :: Text
executableCodeCode :: Text
executableCodeCode
    }

-- ** File

{- | File
A file uploaded to the API. Next ID: 15
-}
data File = File
  { File -> Maybe Text
fileUri :: !(Maybe Text)
  -- ^ /ReadOnly/ "uri" - Output only. The uri of the &#x60;File&#x60;.
  , File -> Maybe Text
fileName :: !(Maybe Text)
  -- ^ "name" - Immutable. Identifier. The &#x60;File&#x60; resource name. The ID (name excluding the \&quot;files/\&quot; prefix) can contain up to 40 characters that are lowercase alphanumeric or dashes (-). The ID cannot start or end with a dash. If the name is empty on create, a unique name will be generated. Example: &#x60;files/123-456&#x60;
  , File -> Maybe DateTime
fileExpirationTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "expirationTime" - Output only. The timestamp of when the &#x60;File&#x60; will be deleted. Only set if the &#x60;File&#x60; is scheduled to expire.
  , File -> Maybe Text
fileDisplayName :: !(Maybe Text)
  -- ^ "displayName" - Optional. The human-readable display name for the &#x60;File&#x60;. The display name must be no more than 512 characters in length, including spaces. Example: \&quot;Welcome Image\&quot;
  , File -> Maybe VideoFileMetadata
fileVideoMetadata :: !(Maybe VideoFileMetadata)
  -- ^ /ReadOnly/ "videoMetadata" - Output only. Metadata for a video.
  , File -> Maybe E'State
fileState :: !(Maybe E'State)
  -- ^ /ReadOnly/ "state" - Output only. Processing state of the File.
  , File -> Maybe E'Source
fileSource :: !(Maybe E'Source)
  -- ^ "source" - Source of the File.
  , File -> Maybe Text
fileMimeType :: !(Maybe Text)
  -- ^ /ReadOnly/ "mimeType" - Output only. MIME type of the file.
  , File -> Maybe DateTime
fileCreateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "createTime" - Output only. The timestamp of when the &#x60;File&#x60; was created.
  , File -> Maybe Status
fileError :: !(Maybe Status)
  -- ^ /ReadOnly/ "error" - Output only. Error status if File processing failed.
  , File -> Maybe Text
fileDownloadUri :: !(Maybe Text)
  -- ^ /ReadOnly/ "downloadUri" - Output only. The download uri of the &#x60;File&#x60;.
  , File -> Maybe Text
fileSizeBytes :: !(Maybe Text)
  -- ^ /ReadOnly/ "sizeBytes" - Output only. Size of the file in bytes.
  , File -> Maybe ByteArray
fileSha256Hash :: !(Maybe ByteArray)
  -- ^ /ReadOnly/ "sha256Hash" - Output only. SHA-256 hash of the uploaded bytes.
  , File -> Maybe DateTime
fileUpdateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "updateTime" - Output only. The timestamp of when the &#x60;File&#x60; was last updated.
  }
  deriving (Int -> File -> ShowS
[File] -> ShowS
File -> [Char]
(Int -> File -> ShowS)
-> (File -> [Char]) -> ([File] -> ShowS) -> Show File
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> File -> ShowS
showsPrec :: Int -> File -> ShowS
$cshow :: File -> [Char]
show :: File -> [Char]
$cshowList :: [File] -> ShowS
showList :: [File] -> ShowS
P.Show, File -> File -> Bool
(File -> File -> Bool) -> (File -> File -> Bool) -> Eq File
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: File -> File -> Bool
== :: File -> File -> Bool
$c/= :: File -> File -> Bool
/= :: File -> File -> Bool
P.Eq, P.Typeable)

-- | FromJSON File
instance A.FromJSON File where
  parseJSON :: Value -> Parser File
parseJSON = [Char] -> (Object -> Parser File) -> Value -> Parser File
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"File" ((Object -> Parser File) -> Value -> Parser File)
-> (Object -> Parser File) -> Value -> Parser File
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text
-> Maybe Text
-> Maybe DateTime
-> Maybe Text
-> Maybe VideoFileMetadata
-> Maybe E'State
-> Maybe E'Source
-> Maybe Text
-> Maybe DateTime
-> Maybe Status
-> Maybe Text
-> Maybe Text
-> Maybe ByteArray
-> Maybe DateTime
-> File
File
      (Maybe Text
 -> Maybe Text
 -> Maybe DateTime
 -> Maybe Text
 -> Maybe VideoFileMetadata
 -> Maybe E'State
 -> Maybe E'Source
 -> Maybe Text
 -> Maybe DateTime
 -> Maybe Status
 -> Maybe Text
 -> Maybe Text
 -> Maybe ByteArray
 -> Maybe DateTime
 -> File)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe DateTime
      -> Maybe Text
      -> Maybe VideoFileMetadata
      -> Maybe E'State
      -> Maybe E'Source
      -> Maybe Text
      -> Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"uri")
      Parser
  (Maybe Text
   -> Maybe DateTime
   -> Maybe Text
   -> Maybe VideoFileMetadata
   -> Maybe E'State
   -> Maybe E'Source
   -> Maybe Text
   -> Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe Text)
-> Parser
     (Maybe DateTime
      -> Maybe Text
      -> Maybe VideoFileMetadata
      -> Maybe E'State
      -> Maybe E'Source
      -> Maybe Text
      -> Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser
  (Maybe DateTime
   -> Maybe Text
   -> Maybe VideoFileMetadata
   -> Maybe E'State
   -> Maybe E'Source
   -> Maybe Text
   -> Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe DateTime)
-> Parser
     (Maybe Text
      -> Maybe VideoFileMetadata
      -> Maybe E'State
      -> Maybe E'Source
      -> Maybe Text
      -> Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"expirationTime")
      Parser
  (Maybe Text
   -> Maybe VideoFileMetadata
   -> Maybe E'State
   -> Maybe E'Source
   -> Maybe Text
   -> Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe Text)
-> Parser
     (Maybe VideoFileMetadata
      -> Maybe E'State
      -> Maybe E'Source
      -> Maybe Text
      -> Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"displayName")
      Parser
  (Maybe VideoFileMetadata
   -> Maybe E'State
   -> Maybe E'Source
   -> Maybe Text
   -> Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe VideoFileMetadata)
-> Parser
     (Maybe E'State
      -> Maybe E'Source
      -> Maybe Text
      -> Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe VideoFileMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"videoMetadata")
      Parser
  (Maybe E'State
   -> Maybe E'Source
   -> Maybe Text
   -> Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe E'State)
-> Parser
     (Maybe E'Source
      -> Maybe Text
      -> Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'State)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"state")
      Parser
  (Maybe E'Source
   -> Maybe Text
   -> Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe E'Source)
-> Parser
     (Maybe Text
      -> Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'Source)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"source")
      Parser
  (Maybe Text
   -> Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe Text)
-> Parser
     (Maybe DateTime
      -> Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mimeType")
      Parser
  (Maybe DateTime
   -> Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe DateTime)
-> Parser
     (Maybe Status
      -> Maybe Text
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe DateTime
      -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"createTime")
      Parser
  (Maybe Status
   -> Maybe Text
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe DateTime
   -> File)
-> Parser (Maybe Status)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe ByteArray -> Maybe DateTime -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"error")
      Parser
  (Maybe Text
   -> Maybe Text -> Maybe ByteArray -> Maybe DateTime -> File)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe ByteArray -> Maybe DateTime -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"downloadUri")
      Parser (Maybe Text -> Maybe ByteArray -> Maybe DateTime -> File)
-> Parser (Maybe Text)
-> Parser (Maybe ByteArray -> Maybe DateTime -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"sizeBytes")
      Parser (Maybe ByteArray -> Maybe DateTime -> File)
-> Parser (Maybe ByteArray) -> Parser (Maybe DateTime -> File)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe ByteArray)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"sha256Hash")
      Parser (Maybe DateTime -> File)
-> Parser (Maybe DateTime) -> Parser File
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"updateTime")

-- | ToJSON File
instance A.ToJSON File where
  toJSON :: File -> Value
toJSON File {Maybe Text
Maybe ByteArray
Maybe DateTime
Maybe E'Source
Maybe E'State
Maybe Status
Maybe VideoFileMetadata
fileUri :: File -> Maybe Text
fileName :: File -> Maybe Text
fileExpirationTime :: File -> Maybe DateTime
fileDisplayName :: File -> Maybe Text
fileVideoMetadata :: File -> Maybe VideoFileMetadata
fileState :: File -> Maybe E'State
fileSource :: File -> Maybe E'Source
fileMimeType :: File -> Maybe Text
fileCreateTime :: File -> Maybe DateTime
fileError :: File -> Maybe Status
fileDownloadUri :: File -> Maybe Text
fileSizeBytes :: File -> Maybe Text
fileSha256Hash :: File -> Maybe ByteArray
fileUpdateTime :: File -> Maybe DateTime
fileUri :: Maybe Text
fileName :: Maybe Text
fileExpirationTime :: Maybe DateTime
fileDisplayName :: Maybe Text
fileVideoMetadata :: Maybe VideoFileMetadata
fileState :: Maybe E'State
fileSource :: Maybe E'Source
fileMimeType :: Maybe Text
fileCreateTime :: Maybe DateTime
fileError :: Maybe Status
fileDownloadUri :: Maybe Text
fileSizeBytes :: Maybe Text
fileSha256Hash :: Maybe ByteArray
fileUpdateTime :: Maybe DateTime
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"uri" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
fileUri
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
fileName
      , Key
"expirationTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
fileExpirationTime
      , Key
"displayName" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
fileDisplayName
      , Key
"videoMetadata" Key -> Maybe VideoFileMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe VideoFileMetadata
fileVideoMetadata
      , Key
"state" Key -> Maybe E'State -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'State
fileState
      , Key
"source" Key -> Maybe E'Source -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'Source
fileSource
      , Key
"mimeType" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
fileMimeType
      , Key
"createTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
fileCreateTime
      , Key
"error" Key -> Maybe Status -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Status
fileError
      , Key
"downloadUri" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
fileDownloadUri
      , Key
"sizeBytes" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
fileSizeBytes
      , Key
"sha256Hash" Key -> Maybe ByteArray -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ByteArray
fileSha256Hash
      , Key
"updateTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
fileUpdateTime
      ]

-- | Construct a value of type 'File' (by applying it's required fields, if any)
mkFile ::
  File
mkFile :: File
mkFile =
  File
    { fileUri :: Maybe Text
fileUri = Maybe Text
forall a. Maybe a
Nothing
    , fileName :: Maybe Text
fileName = Maybe Text
forall a. Maybe a
Nothing
    , fileExpirationTime :: Maybe DateTime
fileExpirationTime = Maybe DateTime
forall a. Maybe a
Nothing
    , fileDisplayName :: Maybe Text
fileDisplayName = Maybe Text
forall a. Maybe a
Nothing
    , fileVideoMetadata :: Maybe VideoFileMetadata
fileVideoMetadata = Maybe VideoFileMetadata
forall a. Maybe a
Nothing
    , fileState :: Maybe E'State
fileState = Maybe E'State
forall a. Maybe a
Nothing
    , fileSource :: Maybe E'Source
fileSource = Maybe E'Source
forall a. Maybe a
Nothing
    , fileMimeType :: Maybe Text
fileMimeType = Maybe Text
forall a. Maybe a
Nothing
    , fileCreateTime :: Maybe DateTime
fileCreateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , fileError :: Maybe Status
fileError = Maybe Status
forall a. Maybe a
Nothing
    , fileDownloadUri :: Maybe Text
fileDownloadUri = Maybe Text
forall a. Maybe a
Nothing
    , fileSizeBytes :: Maybe Text
fileSizeBytes = Maybe Text
forall a. Maybe a
Nothing
    , fileSha256Hash :: Maybe ByteArray
fileSha256Hash = Maybe ByteArray
forall a. Maybe a
Nothing
    , fileUpdateTime :: Maybe DateTime
fileUpdateTime = Maybe DateTime
forall a. Maybe a
Nothing
    }

-- ** FileData

{- | FileData
URI based data.
-}
data FileData = FileData
  { FileData -> Maybe Text
fileDataMimeType :: !(Maybe Text)
  -- ^ "mimeType" - Optional. The IANA standard MIME type of the source data.
  , FileData -> Text
fileDataFileUri :: !(Text)
  -- ^ /Required/ "fileUri" - Required. URI.
  }
  deriving (Int -> FileData -> ShowS
[FileData] -> ShowS
FileData -> [Char]
(Int -> FileData -> ShowS)
-> (FileData -> [Char]) -> ([FileData] -> ShowS) -> Show FileData
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FileData -> ShowS
showsPrec :: Int -> FileData -> ShowS
$cshow :: FileData -> [Char]
show :: FileData -> [Char]
$cshowList :: [FileData] -> ShowS
showList :: [FileData] -> ShowS
P.Show, FileData -> FileData -> Bool
(FileData -> FileData -> Bool)
-> (FileData -> FileData -> Bool) -> Eq FileData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FileData -> FileData -> Bool
== :: FileData -> FileData -> Bool
$c/= :: FileData -> FileData -> Bool
/= :: FileData -> FileData -> Bool
P.Eq, P.Typeable)

-- | FromJSON FileData
instance A.FromJSON FileData where
  parseJSON :: Value -> Parser FileData
parseJSON = [Char] -> (Object -> Parser FileData) -> Value -> Parser FileData
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"FileData" ((Object -> Parser FileData) -> Value -> Parser FileData)
-> (Object -> Parser FileData) -> Value -> Parser FileData
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Text -> FileData
FileData
      (Maybe Text -> Text -> FileData)
-> Parser (Maybe Text) -> Parser (Text -> FileData)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mimeType")
      Parser (Text -> FileData) -> Parser Text -> Parser FileData
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"fileUri")

-- | ToJSON FileData
instance A.ToJSON FileData where
  toJSON :: FileData -> Value
toJSON FileData {Maybe Text
Text
fileDataMimeType :: FileData -> Maybe Text
fileDataFileUri :: FileData -> Text
fileDataMimeType :: Maybe Text
fileDataFileUri :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"mimeType" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
fileDataMimeType
      , Key
"fileUri" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
fileDataFileUri
      ]

-- | Construct a value of type 'FileData' (by applying it's required fields, if any)
mkFileData ::
  -- | 'fileDataFileUri': Required. URI.
  Text ->
  FileData
mkFileData :: Text -> FileData
mkFileData Text
fileDataFileUri =
  FileData
    { fileDataMimeType :: Maybe Text
fileDataMimeType = Maybe Text
forall a. Maybe a
Nothing
    , Text
fileDataFileUri :: Text
fileDataFileUri :: Text
fileDataFileUri
    }

-- ** FunctionCall

{- | FunctionCall
A predicted `FunctionCall` returned from the model that contains a string representing the `FunctionDeclaration.name` with the arguments and their values.
-}
data FunctionCall = FunctionCall
  { FunctionCall -> Maybe (Map [Char] [Char])
functionCallArgs :: !(Maybe (Map.Map String String))
  -- ^ "args" - Optional. The function parameters and values in JSON object format.
  , FunctionCall -> Maybe Text
functionCallId :: !(Maybe Text)
  -- ^ "id" - Optional. The unique id of the function call. If populated, the client to execute the &#x60;function_call&#x60; and return the response with the matching &#x60;id&#x60;.
  , FunctionCall -> Text
functionCallName :: !(Text)
  -- ^ /Required/ "name" - Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63.
  }
  deriving (Int -> FunctionCall -> ShowS
[FunctionCall] -> ShowS
FunctionCall -> [Char]
(Int -> FunctionCall -> ShowS)
-> (FunctionCall -> [Char])
-> ([FunctionCall] -> ShowS)
-> Show FunctionCall
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionCall -> ShowS
showsPrec :: Int -> FunctionCall -> ShowS
$cshow :: FunctionCall -> [Char]
show :: FunctionCall -> [Char]
$cshowList :: [FunctionCall] -> ShowS
showList :: [FunctionCall] -> ShowS
P.Show, FunctionCall -> FunctionCall -> Bool
(FunctionCall -> FunctionCall -> Bool)
-> (FunctionCall -> FunctionCall -> Bool) -> Eq FunctionCall
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionCall -> FunctionCall -> Bool
== :: FunctionCall -> FunctionCall -> Bool
$c/= :: FunctionCall -> FunctionCall -> Bool
/= :: FunctionCall -> FunctionCall -> Bool
P.Eq, P.Typeable)

-- | FromJSON FunctionCall
instance A.FromJSON FunctionCall where
  parseJSON :: Value -> Parser FunctionCall
parseJSON = [Char]
-> (Object -> Parser FunctionCall) -> Value -> Parser FunctionCall
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"FunctionCall" ((Object -> Parser FunctionCall) -> Value -> Parser FunctionCall)
-> (Object -> Parser FunctionCall) -> Value -> Parser FunctionCall
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe (Map [Char] [Char]) -> Maybe Text -> Text -> FunctionCall
FunctionCall
      (Maybe (Map [Char] [Char]) -> Maybe Text -> Text -> FunctionCall)
-> Parser (Maybe (Map [Char] [Char]))
-> Parser (Maybe Text -> Text -> FunctionCall)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe (Map [Char] [Char]))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"args")
      Parser (Maybe Text -> Text -> FunctionCall)
-> Parser (Maybe Text) -> Parser (Text -> FunctionCall)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"id")
      Parser (Text -> FunctionCall) -> Parser Text -> Parser FunctionCall
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name")

-- | ToJSON FunctionCall
instance A.ToJSON FunctionCall where
  toJSON :: FunctionCall -> Value
toJSON FunctionCall {Maybe Text
Maybe (Map [Char] [Char])
Text
functionCallArgs :: FunctionCall -> Maybe (Map [Char] [Char])
functionCallId :: FunctionCall -> Maybe Text
functionCallName :: FunctionCall -> Text
functionCallArgs :: Maybe (Map [Char] [Char])
functionCallId :: Maybe Text
functionCallName :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"args" Key -> Maybe (Map [Char] [Char]) -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe (Map [Char] [Char])
functionCallArgs
      , Key
"id" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
functionCallId
      , Key
"name" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
functionCallName
      ]

-- | Construct a value of type 'FunctionCall' (by applying it's required fields, if any)
mkFunctionCall ::
  -- | 'functionCallName': Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63.
  Text ->
  FunctionCall
mkFunctionCall :: Text -> FunctionCall
mkFunctionCall Text
functionCallName =
  FunctionCall
    { functionCallArgs :: Maybe (Map [Char] [Char])
functionCallArgs = Maybe (Map [Char] [Char])
forall a. Maybe a
Nothing
    , functionCallId :: Maybe Text
functionCallId = Maybe Text
forall a. Maybe a
Nothing
    , Text
functionCallName :: Text
functionCallName :: Text
functionCallName
    }

-- ** FunctionCallingConfig

{- | FunctionCallingConfig
Configuration for specifying function calling behavior.
-}
data FunctionCallingConfig = FunctionCallingConfig
  { FunctionCallingConfig -> Maybe E'Mode2
functionCallingConfigMode :: !(Maybe E'Mode2)
  -- ^ "mode" - Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO.
  , FunctionCallingConfig -> Maybe [Text]
functionCallingConfigAllowedFunctionNames :: !(Maybe [Text])
  -- ^ "allowedFunctionNames" - Optional. A set of function names that, when provided, limits the functions the model will call.  This should only be set when the Mode is ANY. Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will predict a function call from the set of function names provided.
  }
  deriving (Int -> FunctionCallingConfig -> ShowS
[FunctionCallingConfig] -> ShowS
FunctionCallingConfig -> [Char]
(Int -> FunctionCallingConfig -> ShowS)
-> (FunctionCallingConfig -> [Char])
-> ([FunctionCallingConfig] -> ShowS)
-> Show FunctionCallingConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionCallingConfig -> ShowS
showsPrec :: Int -> FunctionCallingConfig -> ShowS
$cshow :: FunctionCallingConfig -> [Char]
show :: FunctionCallingConfig -> [Char]
$cshowList :: [FunctionCallingConfig] -> ShowS
showList :: [FunctionCallingConfig] -> ShowS
P.Show, FunctionCallingConfig -> FunctionCallingConfig -> Bool
(FunctionCallingConfig -> FunctionCallingConfig -> Bool)
-> (FunctionCallingConfig -> FunctionCallingConfig -> Bool)
-> Eq FunctionCallingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionCallingConfig -> FunctionCallingConfig -> Bool
== :: FunctionCallingConfig -> FunctionCallingConfig -> Bool
$c/= :: FunctionCallingConfig -> FunctionCallingConfig -> Bool
/= :: FunctionCallingConfig -> FunctionCallingConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON FunctionCallingConfig
instance A.FromJSON FunctionCallingConfig where
  parseJSON :: Value -> Parser FunctionCallingConfig
parseJSON = [Char]
-> (Object -> Parser FunctionCallingConfig)
-> Value
-> Parser FunctionCallingConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"FunctionCallingConfig" ((Object -> Parser FunctionCallingConfig)
 -> Value -> Parser FunctionCallingConfig)
-> (Object -> Parser FunctionCallingConfig)
-> Value
-> Parser FunctionCallingConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe E'Mode2 -> Maybe [Text] -> FunctionCallingConfig
FunctionCallingConfig
      (Maybe E'Mode2 -> Maybe [Text] -> FunctionCallingConfig)
-> Parser (Maybe E'Mode2)
-> Parser (Maybe [Text] -> FunctionCallingConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe E'Mode2)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mode")
      Parser (Maybe [Text] -> FunctionCallingConfig)
-> Parser (Maybe [Text]) -> Parser FunctionCallingConfig
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"allowedFunctionNames")

-- | ToJSON FunctionCallingConfig
instance A.ToJSON FunctionCallingConfig where
  toJSON :: FunctionCallingConfig -> Value
toJSON FunctionCallingConfig {Maybe [Text]
Maybe E'Mode2
functionCallingConfigMode :: FunctionCallingConfig -> Maybe E'Mode2
functionCallingConfigAllowedFunctionNames :: FunctionCallingConfig -> Maybe [Text]
functionCallingConfigMode :: Maybe E'Mode2
functionCallingConfigAllowedFunctionNames :: Maybe [Text]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"mode" Key -> Maybe E'Mode2 -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'Mode2
functionCallingConfigMode
      , Key
"allowedFunctionNames" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
functionCallingConfigAllowedFunctionNames
      ]

-- | Construct a value of type 'FunctionCallingConfig' (by applying it's required fields, if any)
mkFunctionCallingConfig ::
  FunctionCallingConfig
mkFunctionCallingConfig :: FunctionCallingConfig
mkFunctionCallingConfig =
  FunctionCallingConfig
    { functionCallingConfigMode :: Maybe E'Mode2
functionCallingConfigMode = Maybe E'Mode2
forall a. Maybe a
Nothing
    , functionCallingConfigAllowedFunctionNames :: Maybe [Text]
functionCallingConfigAllowedFunctionNames = Maybe [Text]
forall a. Maybe a
Nothing
    }

-- ** FunctionDeclaration

{- | FunctionDeclaration
Structured representation of a function declaration as defined by the [OpenAPI 3.03 specification](https://spec.openapis.org/oas/v3.0.3). Included in this declaration are the function name and parameters. This FunctionDeclaration is a representation of a block of code that can be used as a `Tool` by the model and executed by the client.
-}
data FunctionDeclaration = FunctionDeclaration
  { FunctionDeclaration -> Maybe Schema
functionDeclarationParameters :: !(Maybe Schema)
  -- ^ "parameters" - Optional. Describes the parameters to this function. Reflects the Open API 3.03 Parameter Object string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter.
  , FunctionDeclaration -> Text
functionDeclarationName :: !(Text)
  -- ^ /Required/ "name" - Required. The name of the function. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63.
  , FunctionDeclaration -> Maybe E'Behavior
functionDeclarationBehavior :: !(Maybe E'Behavior)
  -- ^ "behavior" - Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
  , FunctionDeclaration -> Text
functionDeclarationDescription :: !(Text)
  -- ^ /Required/ "description" - Required. A brief description of the function.
  , FunctionDeclaration -> Maybe Schema
functionDeclarationResponse :: !(Maybe Schema)
  -- ^ "response" - Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function.
  , FunctionDeclaration -> Maybe [Char]
functionDeclarationResponseJsonSchema :: !(Maybe String)
  -- ^ "responseJsonSchema" - Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function.  This field is mutually exclusive with &#x60;response&#x60;.
  , FunctionDeclaration -> Maybe [Char]
functionDeclarationParametersJsonSchema :: !(Maybe String)
  -- ^ "parametersJsonSchema" - Optional. Describes the parameters to the function in JSON Schema format. The schema must describe an object where the properties are the parameters to the function. For example:  &#x60;&#x60;&#x60; {   \&quot;type\&quot;: \&quot;object\&quot;,   \&quot;properties\&quot;: {     \&quot;name\&quot;: { \&quot;type\&quot;: \&quot;string\&quot; },     \&quot;age\&quot;: { \&quot;type\&quot;: \&quot;integer\&quot; }   },   \&quot;additionalProperties\&quot;: false,   \&quot;required\&quot;: [\&quot;name\&quot;, \&quot;age\&quot;],   \&quot;propertyOrdering\&quot;: [\&quot;name\&quot;, \&quot;age\&quot;] } &#x60;&#x60;&#x60;  This field is mutually exclusive with &#x60;parameters&#x60;.
  }
  deriving (Int -> FunctionDeclaration -> ShowS
[FunctionDeclaration] -> ShowS
FunctionDeclaration -> [Char]
(Int -> FunctionDeclaration -> ShowS)
-> (FunctionDeclaration -> [Char])
-> ([FunctionDeclaration] -> ShowS)
-> Show FunctionDeclaration
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionDeclaration -> ShowS
showsPrec :: Int -> FunctionDeclaration -> ShowS
$cshow :: FunctionDeclaration -> [Char]
show :: FunctionDeclaration -> [Char]
$cshowList :: [FunctionDeclaration] -> ShowS
showList :: [FunctionDeclaration] -> ShowS
P.Show, FunctionDeclaration -> FunctionDeclaration -> Bool
(FunctionDeclaration -> FunctionDeclaration -> Bool)
-> (FunctionDeclaration -> FunctionDeclaration -> Bool)
-> Eq FunctionDeclaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionDeclaration -> FunctionDeclaration -> Bool
== :: FunctionDeclaration -> FunctionDeclaration -> Bool
$c/= :: FunctionDeclaration -> FunctionDeclaration -> Bool
/= :: FunctionDeclaration -> FunctionDeclaration -> Bool
P.Eq, P.Typeable)

-- | FromJSON FunctionDeclaration
instance A.FromJSON FunctionDeclaration where
  parseJSON :: Value -> Parser FunctionDeclaration
parseJSON = [Char]
-> (Object -> Parser FunctionDeclaration)
-> Value
-> Parser FunctionDeclaration
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"FunctionDeclaration" ((Object -> Parser FunctionDeclaration)
 -> Value -> Parser FunctionDeclaration)
-> (Object -> Parser FunctionDeclaration)
-> Value
-> Parser FunctionDeclaration
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Schema
-> Text
-> Maybe E'Behavior
-> Text
-> Maybe Schema
-> Maybe [Char]
-> Maybe [Char]
-> FunctionDeclaration
FunctionDeclaration
      (Maybe Schema
 -> Text
 -> Maybe E'Behavior
 -> Text
 -> Maybe Schema
 -> Maybe [Char]
 -> Maybe [Char]
 -> FunctionDeclaration)
-> Parser (Maybe Schema)
-> Parser
     (Text
      -> Maybe E'Behavior
      -> Text
      -> Maybe Schema
      -> Maybe [Char]
      -> Maybe [Char]
      -> FunctionDeclaration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Schema)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"parameters")
      Parser
  (Text
   -> Maybe E'Behavior
   -> Text
   -> Maybe Schema
   -> Maybe [Char]
   -> Maybe [Char]
   -> FunctionDeclaration)
-> Parser Text
-> Parser
     (Maybe E'Behavior
      -> Text
      -> Maybe Schema
      -> Maybe [Char]
      -> Maybe [Char]
      -> FunctionDeclaration)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name")
      Parser
  (Maybe E'Behavior
   -> Text
   -> Maybe Schema
   -> Maybe [Char]
   -> Maybe [Char]
   -> FunctionDeclaration)
-> Parser (Maybe E'Behavior)
-> Parser
     (Text
      -> Maybe Schema
      -> Maybe [Char]
      -> Maybe [Char]
      -> FunctionDeclaration)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'Behavior)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"behavior")
      Parser
  (Text
   -> Maybe Schema
   -> Maybe [Char]
   -> Maybe [Char]
   -> FunctionDeclaration)
-> Parser Text
-> Parser
     (Maybe Schema
      -> Maybe [Char] -> Maybe [Char] -> FunctionDeclaration)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"description")
      Parser
  (Maybe Schema
   -> Maybe [Char] -> Maybe [Char] -> FunctionDeclaration)
-> Parser (Maybe Schema)
-> Parser (Maybe [Char] -> Maybe [Char] -> FunctionDeclaration)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Schema)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"response")
      Parser (Maybe [Char] -> Maybe [Char] -> FunctionDeclaration)
-> Parser (Maybe [Char])
-> Parser (Maybe [Char] -> FunctionDeclaration)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Char])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"responseJsonSchema")
      Parser (Maybe [Char] -> FunctionDeclaration)
-> Parser (Maybe [Char]) -> Parser FunctionDeclaration
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Char])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"parametersJsonSchema")

-- | ToJSON FunctionDeclaration
instance A.ToJSON FunctionDeclaration where
  toJSON :: FunctionDeclaration -> Value
toJSON FunctionDeclaration {Maybe [Char]
Maybe E'Behavior
Maybe Schema
Text
functionDeclarationParameters :: FunctionDeclaration -> Maybe Schema
functionDeclarationName :: FunctionDeclaration -> Text
functionDeclarationBehavior :: FunctionDeclaration -> Maybe E'Behavior
functionDeclarationDescription :: FunctionDeclaration -> Text
functionDeclarationResponse :: FunctionDeclaration -> Maybe Schema
functionDeclarationResponseJsonSchema :: FunctionDeclaration -> Maybe [Char]
functionDeclarationParametersJsonSchema :: FunctionDeclaration -> Maybe [Char]
functionDeclarationParameters :: Maybe Schema
functionDeclarationName :: Text
functionDeclarationBehavior :: Maybe E'Behavior
functionDeclarationDescription :: Text
functionDeclarationResponse :: Maybe Schema
functionDeclarationResponseJsonSchema :: Maybe [Char]
functionDeclarationParametersJsonSchema :: Maybe [Char]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"parameters" Key -> Maybe Schema -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Schema
functionDeclarationParameters
      , Key
"name" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
functionDeclarationName
      , Key
"behavior" Key -> Maybe E'Behavior -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'Behavior
functionDeclarationBehavior
      , Key
"description" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
functionDeclarationDescription
      , Key
"response" Key -> Maybe Schema -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Schema
functionDeclarationResponse
      , Key
"responseJsonSchema" Key -> Maybe [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Char]
functionDeclarationResponseJsonSchema
      , Key
"parametersJsonSchema" Key -> Maybe [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Char]
functionDeclarationParametersJsonSchema
      ]

-- | Construct a value of type 'FunctionDeclaration' (by applying it's required fields, if any)
mkFunctionDeclaration ::
  -- | 'functionDeclarationName': Required. The name of the function. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63.
  Text ->
  -- | 'functionDeclarationDescription': Required. A brief description of the function.
  Text ->
  FunctionDeclaration
mkFunctionDeclaration :: Text -> Text -> FunctionDeclaration
mkFunctionDeclaration Text
functionDeclarationName Text
functionDeclarationDescription =
  FunctionDeclaration
    { functionDeclarationParameters :: Maybe Schema
functionDeclarationParameters = Maybe Schema
forall a. Maybe a
Nothing
    , Text
functionDeclarationName :: Text
functionDeclarationName :: Text
functionDeclarationName
    , functionDeclarationBehavior :: Maybe E'Behavior
functionDeclarationBehavior = Maybe E'Behavior
forall a. Maybe a
Nothing
    , Text
functionDeclarationDescription :: Text
functionDeclarationDescription :: Text
functionDeclarationDescription
    , functionDeclarationResponse :: Maybe Schema
functionDeclarationResponse = Maybe Schema
forall a. Maybe a
Nothing
    , functionDeclarationResponseJsonSchema :: Maybe [Char]
functionDeclarationResponseJsonSchema = Maybe [Char]
forall a. Maybe a
Nothing
    , functionDeclarationParametersJsonSchema :: Maybe [Char]
functionDeclarationParametersJsonSchema = Maybe [Char]
forall a. Maybe a
Nothing
    }

-- ** FunctionResponse

{- | FunctionResponse
The result output from a `FunctionCall` that contains a string representing the `FunctionDeclaration.name` and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a`FunctionCall` made based on model prediction.
-}
data FunctionResponse = FunctionResponse
  { FunctionResponse -> Maybe E'Scheduling
functionResponseScheduling :: !(Maybe E'Scheduling)
  -- ^ "scheduling" - Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
  , FunctionResponse -> Maybe Text
functionResponseId :: !(Maybe Text)
  -- ^ "id" - Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call &#x60;id&#x60;.
  , FunctionResponse -> Maybe Bool
functionResponseWillContinue :: !(Maybe Bool)
  -- ^ "willContinue" - Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty &#x60;response&#x60; with &#x60;will_continue&#x3D;False&#x60; to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set &#x60;scheduling&#x60; to &#x60;SILENT&#x60;.
  , FunctionResponse -> Text
functionResponseName :: !(Text)
  -- ^ /Required/ "name" - Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63.
  , FunctionResponse -> Map [Char] [Char]
functionResponseResponse :: !((Map.Map String String))
  -- ^ /Required/ "response" - Required. The function response in JSON object format.
  }
  deriving (Int -> FunctionResponse -> ShowS
[FunctionResponse] -> ShowS
FunctionResponse -> [Char]
(Int -> FunctionResponse -> ShowS)
-> (FunctionResponse -> [Char])
-> ([FunctionResponse] -> ShowS)
-> Show FunctionResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FunctionResponse -> ShowS
showsPrec :: Int -> FunctionResponse -> ShowS
$cshow :: FunctionResponse -> [Char]
show :: FunctionResponse -> [Char]
$cshowList :: [FunctionResponse] -> ShowS
showList :: [FunctionResponse] -> ShowS
P.Show, FunctionResponse -> FunctionResponse -> Bool
(FunctionResponse -> FunctionResponse -> Bool)
-> (FunctionResponse -> FunctionResponse -> Bool)
-> Eq FunctionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FunctionResponse -> FunctionResponse -> Bool
== :: FunctionResponse -> FunctionResponse -> Bool
$c/= :: FunctionResponse -> FunctionResponse -> Bool
/= :: FunctionResponse -> FunctionResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON FunctionResponse
instance A.FromJSON FunctionResponse where
  parseJSON :: Value -> Parser FunctionResponse
parseJSON = [Char]
-> (Object -> Parser FunctionResponse)
-> Value
-> Parser FunctionResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"FunctionResponse" ((Object -> Parser FunctionResponse)
 -> Value -> Parser FunctionResponse)
-> (Object -> Parser FunctionResponse)
-> Value
-> Parser FunctionResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe E'Scheduling
-> Maybe Text
-> Maybe Bool
-> Text
-> Map [Char] [Char]
-> FunctionResponse
FunctionResponse
      (Maybe E'Scheduling
 -> Maybe Text
 -> Maybe Bool
 -> Text
 -> Map [Char] [Char]
 -> FunctionResponse)
-> Parser (Maybe E'Scheduling)
-> Parser
     (Maybe Text
      -> Maybe Bool -> Text -> Map [Char] [Char] -> FunctionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe E'Scheduling)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"scheduling")
      Parser
  (Maybe Text
   -> Maybe Bool -> Text -> Map [Char] [Char] -> FunctionResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Text -> Map [Char] [Char] -> FunctionResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"id")
      Parser
  (Maybe Bool -> Text -> Map [Char] [Char] -> FunctionResponse)
-> Parser (Maybe Bool)
-> Parser (Text -> Map [Char] [Char] -> FunctionResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"willContinue")
      Parser (Text -> Map [Char] [Char] -> FunctionResponse)
-> Parser Text -> Parser (Map [Char] [Char] -> FunctionResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name")
      Parser (Map [Char] [Char] -> FunctionResponse)
-> Parser (Map [Char] [Char]) -> Parser FunctionResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Map [Char] [Char])
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"response")

-- | ToJSON FunctionResponse
instance A.ToJSON FunctionResponse where
  toJSON :: FunctionResponse -> Value
toJSON FunctionResponse {Maybe Bool
Maybe Text
Maybe E'Scheduling
Text
Map [Char] [Char]
functionResponseScheduling :: FunctionResponse -> Maybe E'Scheduling
functionResponseId :: FunctionResponse -> Maybe Text
functionResponseWillContinue :: FunctionResponse -> Maybe Bool
functionResponseName :: FunctionResponse -> Text
functionResponseResponse :: FunctionResponse -> Map [Char] [Char]
functionResponseScheduling :: Maybe E'Scheduling
functionResponseId :: Maybe Text
functionResponseWillContinue :: Maybe Bool
functionResponseName :: Text
functionResponseResponse :: Map [Char] [Char]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"scheduling" Key -> Maybe E'Scheduling -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'Scheduling
functionResponseScheduling
      , Key
"id" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
functionResponseId
      , Key
"willContinue" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
functionResponseWillContinue
      , Key
"name" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
functionResponseName
      , Key
"response" Key -> Map [Char] [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Map [Char] [Char]
functionResponseResponse
      ]

-- | Construct a value of type 'FunctionResponse' (by applying it's required fields, if any)
mkFunctionResponse ::
  -- | 'functionResponseName': Required. The name of the function to call. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 63.
  Text ->
  -- | 'functionResponseResponse': Required. The function response in JSON object format.
  (Map.Map String String) ->
  FunctionResponse
mkFunctionResponse :: Text -> Map [Char] [Char] -> FunctionResponse
mkFunctionResponse Text
functionResponseName Map [Char] [Char]
functionResponseResponse =
  FunctionResponse
    { functionResponseScheduling :: Maybe E'Scheduling
functionResponseScheduling = Maybe E'Scheduling
forall a. Maybe a
Nothing
    , functionResponseId :: Maybe Text
functionResponseId = Maybe Text
forall a. Maybe a
Nothing
    , functionResponseWillContinue :: Maybe Bool
functionResponseWillContinue = Maybe Bool
forall a. Maybe a
Nothing
    , Text
functionResponseName :: Text
functionResponseName :: Text
functionResponseName
    , Map [Char] [Char]
functionResponseResponse :: Map [Char] [Char]
functionResponseResponse :: Map [Char] [Char]
functionResponseResponse
    }

-- ** GenerateAnswerRequest

{- | GenerateAnswerRequest
Request to generate a grounded answer from the `Model`.
-}
data GenerateAnswerRequest = GenerateAnswerRequest
  { GenerateAnswerRequest -> Maybe SemanticRetrieverConfig
generateAnswerRequestSemanticRetriever :: !(Maybe SemanticRetrieverConfig)
  -- ^ "semanticRetriever" - Content retrieved from resources created via the Semantic Retriever API.
  , GenerateAnswerRequest -> Maybe Float
generateAnswerRequestTemperature :: !(Maybe Float)
  -- ^ "temperature" - Optional. Controls the randomness of the output.  Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model. A low temperature (~0.2) is usually recommended for Attributed-Question-Answering use cases.
  , GenerateAnswerRequest -> E'AnswerStyle
generateAnswerRequestAnswerStyle :: !(E'AnswerStyle)
  -- ^ /Required/ "answerStyle" - Required. Style in which answers should be returned.
  , GenerateAnswerRequest -> [Content]
generateAnswerRequestContents :: !([Content])
  -- ^ /Required/ "contents" - Required. The content of the current conversation with the &#x60;Model&#x60;. For single-turn queries, this is a single question to answer. For multi-turn queries, this is a repeated field that contains conversation history and the last &#x60;Content&#x60; in the list containing the question.  Note: &#x60;GenerateAnswer&#x60; only supports queries in English.
  , GenerateAnswerRequest -> Maybe [SafetySetting]
generateAnswerRequestSafetySettings :: !(Maybe [SafetySetting])
  -- ^ "safetySettings" - Optional. A list of unique &#x60;SafetySetting&#x60; instances for blocking unsafe content.  This will be enforced on the &#x60;GenerateAnswerRequest.contents&#x60; and &#x60;GenerateAnswerResponse.candidate&#x60;. There should not be more than one setting for each &#x60;SafetyCategory&#x60; type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each &#x60;SafetyCategory&#x60; specified in the safety_settings. If there is no &#x60;SafetySetting&#x60; for a given &#x60;SafetyCategory&#x60; provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT are supported. Refer to the [guide](https://ai.google.dev/gemini-api/docs/safety-settings) for detailed information on available safety settings. Also refer to the [Safety guidance](https://ai.google.dev/gemini-api/docs/safety-guidance) to learn how to incorporate safety considerations in your AI applications.
  , GenerateAnswerRequest -> Maybe GroundingPassages
generateAnswerRequestInlinePassages :: !(Maybe GroundingPassages)
  -- ^ "inlinePassages" - Passages provided inline with the request.
  }
  deriving (Int -> GenerateAnswerRequest -> ShowS
[GenerateAnswerRequest] -> ShowS
GenerateAnswerRequest -> [Char]
(Int -> GenerateAnswerRequest -> ShowS)
-> (GenerateAnswerRequest -> [Char])
-> ([GenerateAnswerRequest] -> ShowS)
-> Show GenerateAnswerRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateAnswerRequest -> ShowS
showsPrec :: Int -> GenerateAnswerRequest -> ShowS
$cshow :: GenerateAnswerRequest -> [Char]
show :: GenerateAnswerRequest -> [Char]
$cshowList :: [GenerateAnswerRequest] -> ShowS
showList :: [GenerateAnswerRequest] -> ShowS
P.Show, GenerateAnswerRequest -> GenerateAnswerRequest -> Bool
(GenerateAnswerRequest -> GenerateAnswerRequest -> Bool)
-> (GenerateAnswerRequest -> GenerateAnswerRequest -> Bool)
-> Eq GenerateAnswerRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateAnswerRequest -> GenerateAnswerRequest -> Bool
== :: GenerateAnswerRequest -> GenerateAnswerRequest -> Bool
$c/= :: GenerateAnswerRequest -> GenerateAnswerRequest -> Bool
/= :: GenerateAnswerRequest -> GenerateAnswerRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateAnswerRequest
instance A.FromJSON GenerateAnswerRequest where
  parseJSON :: Value -> Parser GenerateAnswerRequest
parseJSON = [Char]
-> (Object -> Parser GenerateAnswerRequest)
-> Value
-> Parser GenerateAnswerRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateAnswerRequest" ((Object -> Parser GenerateAnswerRequest)
 -> Value -> Parser GenerateAnswerRequest)
-> (Object -> Parser GenerateAnswerRequest)
-> Value
-> Parser GenerateAnswerRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe SemanticRetrieverConfig
-> Maybe Float
-> E'AnswerStyle
-> [Content]
-> Maybe [SafetySetting]
-> Maybe GroundingPassages
-> GenerateAnswerRequest
GenerateAnswerRequest
      (Maybe SemanticRetrieverConfig
 -> Maybe Float
 -> E'AnswerStyle
 -> [Content]
 -> Maybe [SafetySetting]
 -> Maybe GroundingPassages
 -> GenerateAnswerRequest)
-> Parser (Maybe SemanticRetrieverConfig)
-> Parser
     (Maybe Float
      -> E'AnswerStyle
      -> [Content]
      -> Maybe [SafetySetting]
      -> Maybe GroundingPassages
      -> GenerateAnswerRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe SemanticRetrieverConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"semanticRetriever")
      Parser
  (Maybe Float
   -> E'AnswerStyle
   -> [Content]
   -> Maybe [SafetySetting]
   -> Maybe GroundingPassages
   -> GenerateAnswerRequest)
-> Parser (Maybe Float)
-> Parser
     (E'AnswerStyle
      -> [Content]
      -> Maybe [SafetySetting]
      -> Maybe GroundingPassages
      -> GenerateAnswerRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"temperature")
      Parser
  (E'AnswerStyle
   -> [Content]
   -> Maybe [SafetySetting]
   -> Maybe GroundingPassages
   -> GenerateAnswerRequest)
-> Parser E'AnswerStyle
-> Parser
     ([Content]
      -> Maybe [SafetySetting]
      -> Maybe GroundingPassages
      -> GenerateAnswerRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser E'AnswerStyle
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"answerStyle")
      Parser
  ([Content]
   -> Maybe [SafetySetting]
   -> Maybe GroundingPassages
   -> GenerateAnswerRequest)
-> Parser [Content]
-> Parser
     (Maybe [SafetySetting]
      -> Maybe GroundingPassages -> GenerateAnswerRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser [Content]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"contents")
      Parser
  (Maybe [SafetySetting]
   -> Maybe GroundingPassages -> GenerateAnswerRequest)
-> Parser (Maybe [SafetySetting])
-> Parser (Maybe GroundingPassages -> GenerateAnswerRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [SafetySetting])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetySettings")
      Parser (Maybe GroundingPassages -> GenerateAnswerRequest)
-> Parser (Maybe GroundingPassages) -> Parser GenerateAnswerRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe GroundingPassages)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"inlinePassages")

-- | ToJSON GenerateAnswerRequest
instance A.ToJSON GenerateAnswerRequest where
  toJSON :: GenerateAnswerRequest -> Value
toJSON GenerateAnswerRequest {[Content]
Maybe Float
Maybe [SafetySetting]
Maybe GroundingPassages
Maybe SemanticRetrieverConfig
E'AnswerStyle
generateAnswerRequestSemanticRetriever :: GenerateAnswerRequest -> Maybe SemanticRetrieverConfig
generateAnswerRequestTemperature :: GenerateAnswerRequest -> Maybe Float
generateAnswerRequestAnswerStyle :: GenerateAnswerRequest -> E'AnswerStyle
generateAnswerRequestContents :: GenerateAnswerRequest -> [Content]
generateAnswerRequestSafetySettings :: GenerateAnswerRequest -> Maybe [SafetySetting]
generateAnswerRequestInlinePassages :: GenerateAnswerRequest -> Maybe GroundingPassages
generateAnswerRequestSemanticRetriever :: Maybe SemanticRetrieverConfig
generateAnswerRequestTemperature :: Maybe Float
generateAnswerRequestAnswerStyle :: E'AnswerStyle
generateAnswerRequestContents :: [Content]
generateAnswerRequestSafetySettings :: Maybe [SafetySetting]
generateAnswerRequestInlinePassages :: Maybe GroundingPassages
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"semanticRetriever" Key -> Maybe SemanticRetrieverConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe SemanticRetrieverConfig
generateAnswerRequestSemanticRetriever
      , Key
"temperature" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generateAnswerRequestTemperature
      , Key
"answerStyle" Key -> E'AnswerStyle -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= E'AnswerStyle
generateAnswerRequestAnswerStyle
      , Key
"contents" Key -> [Content] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Content]
generateAnswerRequestContents
      , Key
"safetySettings" Key -> Maybe [SafetySetting] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetySetting]
generateAnswerRequestSafetySettings
      , Key
"inlinePassages" Key -> Maybe GroundingPassages -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GroundingPassages
generateAnswerRequestInlinePassages
      ]

-- | Construct a value of type 'GenerateAnswerRequest' (by applying it's required fields, if any)
mkGenerateAnswerRequest ::
  -- | 'generateAnswerRequestAnswerStyle': Required. Style in which answers should be returned.
  E'AnswerStyle ->
  -- | 'generateAnswerRequestContents': Required. The content of the current conversation with the `Model`. For single-turn queries, this is a single question to answer. For multi-turn queries, this is a repeated field that contains conversation history and the last `Content` in the list containing the question.  Note: `GenerateAnswer` only supports queries in English.
  [Content] ->
  GenerateAnswerRequest
mkGenerateAnswerRequest :: E'AnswerStyle -> [Content] -> GenerateAnswerRequest
mkGenerateAnswerRequest E'AnswerStyle
generateAnswerRequestAnswerStyle [Content]
generateAnswerRequestContents =
  GenerateAnswerRequest
    { generateAnswerRequestSemanticRetriever :: Maybe SemanticRetrieverConfig
generateAnswerRequestSemanticRetriever = Maybe SemanticRetrieverConfig
forall a. Maybe a
Nothing
    , generateAnswerRequestTemperature :: Maybe Float
generateAnswerRequestTemperature = Maybe Float
forall a. Maybe a
Nothing
    , E'AnswerStyle
generateAnswerRequestAnswerStyle :: E'AnswerStyle
generateAnswerRequestAnswerStyle :: E'AnswerStyle
generateAnswerRequestAnswerStyle
    , [Content]
generateAnswerRequestContents :: [Content]
generateAnswerRequestContents :: [Content]
generateAnswerRequestContents
    , generateAnswerRequestSafetySettings :: Maybe [SafetySetting]
generateAnswerRequestSafetySettings = Maybe [SafetySetting]
forall a. Maybe a
Nothing
    , generateAnswerRequestInlinePassages :: Maybe GroundingPassages
generateAnswerRequestInlinePassages = Maybe GroundingPassages
forall a. Maybe a
Nothing
    }

-- ** GenerateAnswerResponse

{- | GenerateAnswerResponse
Response from the model for a grounded answer.
-}
data GenerateAnswerResponse = GenerateAnswerResponse
  { GenerateAnswerResponse -> Maybe Candidate
generateAnswerResponseAnswer :: !(Maybe Candidate)
  -- ^ "answer" - Candidate answer from the model.  Note: The model *always* attempts to provide a grounded answer, even when the answer is unlikely to be answerable from the given passages. In that case, a low-quality or ungrounded answer may be provided, along with a low &#x60;answerable_probability&#x60;.
  , GenerateAnswerResponse -> Maybe InputFeedback
generateAnswerResponseInputFeedback :: !(Maybe InputFeedback)
  -- ^ /ReadOnly/ "inputFeedback" - Output only. Feedback related to the input data used to answer the question, as opposed to the model-generated response to the question.  The input data can be one or more of the following:  - Question specified by the last entry in &#x60;GenerateAnswerRequest.content&#x60; - Conversation history specified by the other entries in &#x60;GenerateAnswerRequest.content&#x60; - Grounding sources (&#x60;GenerateAnswerRequest.semantic_retriever&#x60; or &#x60;GenerateAnswerRequest.inline_passages&#x60;)
  , GenerateAnswerResponse -> Maybe Float
generateAnswerResponseAnswerableProbability :: !(Maybe Float)
  -- ^ /ReadOnly/ "answerableProbability" - Output only. The model&#39;s estimate of the probability that its answer is correct and grounded in the input passages.  A low &#x60;answerable_probability&#x60; indicates that the answer might not be grounded in the sources.  When &#x60;answerable_probability&#x60; is low, you may want to:  * Display a message to the effect of \&quot;We couldn’t answer that question\&quot; to the user. * Fall back to a general-purpose LLM that answers the question from world knowledge. The threshold and nature of such fallbacks will depend on individual use cases. &#x60;0.5&#x60; is a good starting threshold.
  }
  deriving (Int -> GenerateAnswerResponse -> ShowS
[GenerateAnswerResponse] -> ShowS
GenerateAnswerResponse -> [Char]
(Int -> GenerateAnswerResponse -> ShowS)
-> (GenerateAnswerResponse -> [Char])
-> ([GenerateAnswerResponse] -> ShowS)
-> Show GenerateAnswerResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateAnswerResponse -> ShowS
showsPrec :: Int -> GenerateAnswerResponse -> ShowS
$cshow :: GenerateAnswerResponse -> [Char]
show :: GenerateAnswerResponse -> [Char]
$cshowList :: [GenerateAnswerResponse] -> ShowS
showList :: [GenerateAnswerResponse] -> ShowS
P.Show, GenerateAnswerResponse -> GenerateAnswerResponse -> Bool
(GenerateAnswerResponse -> GenerateAnswerResponse -> Bool)
-> (GenerateAnswerResponse -> GenerateAnswerResponse -> Bool)
-> Eq GenerateAnswerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateAnswerResponse -> GenerateAnswerResponse -> Bool
== :: GenerateAnswerResponse -> GenerateAnswerResponse -> Bool
$c/= :: GenerateAnswerResponse -> GenerateAnswerResponse -> Bool
/= :: GenerateAnswerResponse -> GenerateAnswerResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateAnswerResponse
instance A.FromJSON GenerateAnswerResponse where
  parseJSON :: Value -> Parser GenerateAnswerResponse
parseJSON = [Char]
-> (Object -> Parser GenerateAnswerResponse)
-> Value
-> Parser GenerateAnswerResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateAnswerResponse" ((Object -> Parser GenerateAnswerResponse)
 -> Value -> Parser GenerateAnswerResponse)
-> (Object -> Parser GenerateAnswerResponse)
-> Value
-> Parser GenerateAnswerResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Candidate
-> Maybe InputFeedback -> Maybe Float -> GenerateAnswerResponse
GenerateAnswerResponse
      (Maybe Candidate
 -> Maybe InputFeedback -> Maybe Float -> GenerateAnswerResponse)
-> Parser (Maybe Candidate)
-> Parser
     (Maybe InputFeedback -> Maybe Float -> GenerateAnswerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Candidate)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"answer")
      Parser
  (Maybe InputFeedback -> Maybe Float -> GenerateAnswerResponse)
-> Parser (Maybe InputFeedback)
-> Parser (Maybe Float -> GenerateAnswerResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe InputFeedback)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"inputFeedback")
      Parser (Maybe Float -> GenerateAnswerResponse)
-> Parser (Maybe Float) -> Parser GenerateAnswerResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"answerableProbability")

-- | ToJSON GenerateAnswerResponse
instance A.ToJSON GenerateAnswerResponse where
  toJSON :: GenerateAnswerResponse -> Value
toJSON GenerateAnswerResponse {Maybe Float
Maybe Candidate
Maybe InputFeedback
generateAnswerResponseAnswer :: GenerateAnswerResponse -> Maybe Candidate
generateAnswerResponseInputFeedback :: GenerateAnswerResponse -> Maybe InputFeedback
generateAnswerResponseAnswerableProbability :: GenerateAnswerResponse -> Maybe Float
generateAnswerResponseAnswer :: Maybe Candidate
generateAnswerResponseInputFeedback :: Maybe InputFeedback
generateAnswerResponseAnswerableProbability :: Maybe Float
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"answer" Key -> Maybe Candidate -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Candidate
generateAnswerResponseAnswer
      , Key
"inputFeedback" Key -> Maybe InputFeedback -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe InputFeedback
generateAnswerResponseInputFeedback
      , Key
"answerableProbability" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generateAnswerResponseAnswerableProbability
      ]

-- | Construct a value of type 'GenerateAnswerResponse' (by applying it's required fields, if any)
mkGenerateAnswerResponse ::
  GenerateAnswerResponse
mkGenerateAnswerResponse :: GenerateAnswerResponse
mkGenerateAnswerResponse =
  GenerateAnswerResponse
    { generateAnswerResponseAnswer :: Maybe Candidate
generateAnswerResponseAnswer = Maybe Candidate
forall a. Maybe a
Nothing
    , generateAnswerResponseInputFeedback :: Maybe InputFeedback
generateAnswerResponseInputFeedback = Maybe InputFeedback
forall a. Maybe a
Nothing
    , generateAnswerResponseAnswerableProbability :: Maybe Float
generateAnswerResponseAnswerableProbability = Maybe Float
forall a. Maybe a
Nothing
    }

-- ** GenerateContentRequest

{- | GenerateContentRequest
Request to generate a completion from the model. NEXT ID: 13
-}
data GenerateContentRequest = GenerateContentRequest
  { GenerateContentRequest -> Maybe ToolConfig
generateContentRequestToolConfig :: !(Maybe ToolConfig)
  -- ^ "toolConfig" - Optional. Tool configuration for any &#x60;Tool&#x60; specified in the request. Refer to the [Function calling guide](https://ai.google.dev/gemini-api/docs/function-calling#function_calling_mode) for a usage example.
  , GenerateContentRequest -> Maybe [Tool]
generateContentRequestTools :: !(Maybe [Tool])
  -- ^ "tools" - Optional. A list of &#x60;Tools&#x60; the &#x60;Model&#x60; may use to generate the next response.  A &#x60;Tool&#x60; is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the &#x60;Model&#x60;. Supported &#x60;Tool&#x60;s are &#x60;Function&#x60; and &#x60;code_execution&#x60;. Refer to the [Function calling](https://ai.google.dev/gemini-api/docs/function-calling) and the [Code execution](https://ai.google.dev/gemini-api/docs/code-execution) guides to learn more.
  , GenerateContentRequest -> [Content]
generateContentRequestContents :: !([Content])
  -- ^ /Required/ "contents" - Required. The content of the current conversation with the model.  For single-turn queries, this is a single instance. For multi-turn queries like [chat](https://ai.google.dev/gemini-api/docs/text-generation#chat), this is a repeated field that contains the conversation history and the latest request.
  , GenerateContentRequest -> Maybe Content
generateContentRequestSystemInstruction :: !(Maybe Content)
  -- ^ "systemInstruction" - Optional. Developer set [system instruction(s)](https://ai.google.dev/gemini-api/docs/system-instructions). Currently, text only.
  , GenerateContentRequest -> Maybe Text
generateContentRequestCachedContent :: !(Maybe Text)
  -- ^ "cachedContent" - Optional. The name of the content [cached](https://ai.google.dev/gemini-api/docs/caching) to use as context to serve the prediction. Format: &#x60;cachedContents/{cachedContent}&#x60;
  , GenerateContentRequest -> Maybe [SafetySetting]
generateContentRequestSafetySettings :: !(Maybe [SafetySetting])
  -- ^ "safetySettings" - Optional. A list of unique &#x60;SafetySetting&#x60; instances for blocking unsafe content.  This will be enforced on the &#x60;GenerateContentRequest.contents&#x60; and &#x60;GenerateContentResponse.candidates&#x60;. There should not be more than one setting for each &#x60;SafetyCategory&#x60; type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each &#x60;SafetyCategory&#x60; specified in the safety_settings. If there is no &#x60;SafetySetting&#x60; for a given &#x60;SafetyCategory&#x60; provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_CIVIC_INTEGRITY are supported. Refer to the [guide](https://ai.google.dev/gemini-api/docs/safety-settings) for detailed information on available safety settings. Also refer to the [Safety guidance](https://ai.google.dev/gemini-api/docs/safety-guidance) to learn how to incorporate safety considerations in your AI applications.
  , GenerateContentRequest -> Text
generateContentRequestModel :: !(Text)
  -- ^ /Required/ "model" - Required. The name of the &#x60;Model&#x60; to use for generating the completion.  Format: &#x60;models/{model}&#x60;.
  , GenerateContentRequest -> Maybe GenerationConfig
generateContentRequestGenerationConfig :: !(Maybe GenerationConfig)
  -- ^ "generationConfig" - Optional. Configuration options for model generation and outputs.
  }
  deriving (Int -> GenerateContentRequest -> ShowS
[GenerateContentRequest] -> ShowS
GenerateContentRequest -> [Char]
(Int -> GenerateContentRequest -> ShowS)
-> (GenerateContentRequest -> [Char])
-> ([GenerateContentRequest] -> ShowS)
-> Show GenerateContentRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateContentRequest -> ShowS
showsPrec :: Int -> GenerateContentRequest -> ShowS
$cshow :: GenerateContentRequest -> [Char]
show :: GenerateContentRequest -> [Char]
$cshowList :: [GenerateContentRequest] -> ShowS
showList :: [GenerateContentRequest] -> ShowS
P.Show, GenerateContentRequest -> GenerateContentRequest -> Bool
(GenerateContentRequest -> GenerateContentRequest -> Bool)
-> (GenerateContentRequest -> GenerateContentRequest -> Bool)
-> Eq GenerateContentRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateContentRequest -> GenerateContentRequest -> Bool
== :: GenerateContentRequest -> GenerateContentRequest -> Bool
$c/= :: GenerateContentRequest -> GenerateContentRequest -> Bool
/= :: GenerateContentRequest -> GenerateContentRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateContentRequest
instance A.FromJSON GenerateContentRequest where
  parseJSON :: Value -> Parser GenerateContentRequest
parseJSON = [Char]
-> (Object -> Parser GenerateContentRequest)
-> Value
-> Parser GenerateContentRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateContentRequest" ((Object -> Parser GenerateContentRequest)
 -> Value -> Parser GenerateContentRequest)
-> (Object -> Parser GenerateContentRequest)
-> Value
-> Parser GenerateContentRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe ToolConfig
-> Maybe [Tool]
-> [Content]
-> Maybe Content
-> Maybe Text
-> Maybe [SafetySetting]
-> Text
-> Maybe GenerationConfig
-> GenerateContentRequest
GenerateContentRequest
      (Maybe ToolConfig
 -> Maybe [Tool]
 -> [Content]
 -> Maybe Content
 -> Maybe Text
 -> Maybe [SafetySetting]
 -> Text
 -> Maybe GenerationConfig
 -> GenerateContentRequest)
-> Parser (Maybe ToolConfig)
-> Parser
     (Maybe [Tool]
      -> [Content]
      -> Maybe Content
      -> Maybe Text
      -> Maybe [SafetySetting]
      -> Text
      -> Maybe GenerationConfig
      -> GenerateContentRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe ToolConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"toolConfig")
      Parser
  (Maybe [Tool]
   -> [Content]
   -> Maybe Content
   -> Maybe Text
   -> Maybe [SafetySetting]
   -> Text
   -> Maybe GenerationConfig
   -> GenerateContentRequest)
-> Parser (Maybe [Tool])
-> Parser
     ([Content]
      -> Maybe Content
      -> Maybe Text
      -> Maybe [SafetySetting]
      -> Text
      -> Maybe GenerationConfig
      -> GenerateContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Tool])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tools")
      Parser
  ([Content]
   -> Maybe Content
   -> Maybe Text
   -> Maybe [SafetySetting]
   -> Text
   -> Maybe GenerationConfig
   -> GenerateContentRequest)
-> Parser [Content]
-> Parser
     (Maybe Content
      -> Maybe Text
      -> Maybe [SafetySetting]
      -> Text
      -> Maybe GenerationConfig
      -> GenerateContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser [Content]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"contents")
      Parser
  (Maybe Content
   -> Maybe Text
   -> Maybe [SafetySetting]
   -> Text
   -> Maybe GenerationConfig
   -> GenerateContentRequest)
-> Parser (Maybe Content)
-> Parser
     (Maybe Text
      -> Maybe [SafetySetting]
      -> Text
      -> Maybe GenerationConfig
      -> GenerateContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Content)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"systemInstruction")
      Parser
  (Maybe Text
   -> Maybe [SafetySetting]
   -> Text
   -> Maybe GenerationConfig
   -> GenerateContentRequest)
-> Parser (Maybe Text)
-> Parser
     (Maybe [SafetySetting]
      -> Text -> Maybe GenerationConfig -> GenerateContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"cachedContent")
      Parser
  (Maybe [SafetySetting]
   -> Text -> Maybe GenerationConfig -> GenerateContentRequest)
-> Parser (Maybe [SafetySetting])
-> Parser
     (Text -> Maybe GenerationConfig -> GenerateContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [SafetySetting])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetySettings")
      Parser (Text -> Maybe GenerationConfig -> GenerateContentRequest)
-> Parser Text
-> Parser (Maybe GenerationConfig -> GenerateContentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"model")
      Parser (Maybe GenerationConfig -> GenerateContentRequest)
-> Parser (Maybe GenerationConfig) -> Parser GenerateContentRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe GenerationConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"generationConfig")

-- | ToJSON GenerateContentRequest
instance A.ToJSON GenerateContentRequest where
  toJSON :: GenerateContentRequest -> Value
toJSON GenerateContentRequest {[Content]
Maybe [SafetySetting]
Maybe [Tool]
Maybe Text
Maybe Content
Maybe GenerationConfig
Maybe ToolConfig
Text
generateContentRequestToolConfig :: GenerateContentRequest -> Maybe ToolConfig
generateContentRequestTools :: GenerateContentRequest -> Maybe [Tool]
generateContentRequestContents :: GenerateContentRequest -> [Content]
generateContentRequestSystemInstruction :: GenerateContentRequest -> Maybe Content
generateContentRequestCachedContent :: GenerateContentRequest -> Maybe Text
generateContentRequestSafetySettings :: GenerateContentRequest -> Maybe [SafetySetting]
generateContentRequestModel :: GenerateContentRequest -> Text
generateContentRequestGenerationConfig :: GenerateContentRequest -> Maybe GenerationConfig
generateContentRequestToolConfig :: Maybe ToolConfig
generateContentRequestTools :: Maybe [Tool]
generateContentRequestContents :: [Content]
generateContentRequestSystemInstruction :: Maybe Content
generateContentRequestCachedContent :: Maybe Text
generateContentRequestSafetySettings :: Maybe [SafetySetting]
generateContentRequestModel :: Text
generateContentRequestGenerationConfig :: Maybe GenerationConfig
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"toolConfig" Key -> Maybe ToolConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ToolConfig
generateContentRequestToolConfig
      , Key
"tools" Key -> Maybe [Tool] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Tool]
generateContentRequestTools
      , Key
"contents" Key -> [Content] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Content]
generateContentRequestContents
      , Key
"systemInstruction" Key -> Maybe Content -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Content
generateContentRequestSystemInstruction
      , Key
"cachedContent" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
generateContentRequestCachedContent
      , Key
"safetySettings" Key -> Maybe [SafetySetting] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetySetting]
generateContentRequestSafetySettings
      , Key
"model" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
generateContentRequestModel
      , Key
"generationConfig" Key -> Maybe GenerationConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GenerationConfig
generateContentRequestGenerationConfig
      ]

-- | Construct a value of type 'GenerateContentRequest' (by applying it's required fields, if any)
mkGenerateContentRequest ::
  -- | 'generateContentRequestContents': Required. The content of the current conversation with the model.  For single-turn queries, this is a single instance. For multi-turn queries like [chat](https://ai.google.dev/gemini-api/docs/text-generation#chat), this is a repeated field that contains the conversation history and the latest request.
  [Content] ->
  -- | 'generateContentRequestModel': Required. The name of the `Model` to use for generating the completion.  Format: `models/{model}`.
  Text ->
  GenerateContentRequest
mkGenerateContentRequest :: [Content] -> Text -> GenerateContentRequest
mkGenerateContentRequest [Content]
generateContentRequestContents Text
generateContentRequestModel =
  GenerateContentRequest
    { generateContentRequestToolConfig :: Maybe ToolConfig
generateContentRequestToolConfig = Maybe ToolConfig
forall a. Maybe a
Nothing
    , generateContentRequestTools :: Maybe [Tool]
generateContentRequestTools = Maybe [Tool]
forall a. Maybe a
Nothing
    , [Content]
generateContentRequestContents :: [Content]
generateContentRequestContents :: [Content]
generateContentRequestContents
    , generateContentRequestSystemInstruction :: Maybe Content
generateContentRequestSystemInstruction = Maybe Content
forall a. Maybe a
Nothing
    , generateContentRequestCachedContent :: Maybe Text
generateContentRequestCachedContent = Maybe Text
forall a. Maybe a
Nothing
    , generateContentRequestSafetySettings :: Maybe [SafetySetting]
generateContentRequestSafetySettings = Maybe [SafetySetting]
forall a. Maybe a
Nothing
    , Text
generateContentRequestModel :: Text
generateContentRequestModel :: Text
generateContentRequestModel
    , generateContentRequestGenerationConfig :: Maybe GenerationConfig
generateContentRequestGenerationConfig = Maybe GenerationConfig
forall a. Maybe a
Nothing
    }

-- ** GenerateContentResponse

{- | GenerateContentResponse
Response from the model supporting multiple candidate responses.  Safety ratings and content filtering are reported for both prompt in `GenerateContentResponse.prompt_feedback` and for each candidate in `finish_reason` and in `safety_ratings`. The API:  - Returns either all requested candidates or none of them  - Returns no candidates at all only if there was something wrong with the    prompt (check `prompt_feedback`)  - Reports feedback on each candidate in `finish_reason` and    `safety_ratings`.
-}
data GenerateContentResponse = GenerateContentResponse
  { GenerateContentResponse -> Maybe [Candidate]
generateContentResponseCandidates :: !(Maybe [Candidate])
  -- ^ "candidates" - Candidate responses from the model.
  , GenerateContentResponse -> Maybe UsageMetadata
generateContentResponseUsageMetadata :: !(Maybe UsageMetadata)
  -- ^ /ReadOnly/ "usageMetadata" - Output only. Metadata on the generation requests&#39; token usage.
  , GenerateContentResponse -> Maybe Text
generateContentResponseModelVersion :: !(Maybe Text)
  -- ^ /ReadOnly/ "modelVersion" - Output only. The model version used to generate the response.
  , GenerateContentResponse -> Maybe PromptFeedback
generateContentResponsePromptFeedback :: !(Maybe PromptFeedback)
  -- ^ "promptFeedback" - Returns the prompt&#39;s feedback related to the content filters.
  , GenerateContentResponse -> Maybe Text
generateContentResponseResponseId :: !(Maybe Text)
  -- ^ /ReadOnly/ "responseId" - Output only. response_id is used to identify each response.
  }
  deriving (Int -> GenerateContentResponse -> ShowS
[GenerateContentResponse] -> ShowS
GenerateContentResponse -> [Char]
(Int -> GenerateContentResponse -> ShowS)
-> (GenerateContentResponse -> [Char])
-> ([GenerateContentResponse] -> ShowS)
-> Show GenerateContentResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateContentResponse -> ShowS
showsPrec :: Int -> GenerateContentResponse -> ShowS
$cshow :: GenerateContentResponse -> [Char]
show :: GenerateContentResponse -> [Char]
$cshowList :: [GenerateContentResponse] -> ShowS
showList :: [GenerateContentResponse] -> ShowS
P.Show, GenerateContentResponse -> GenerateContentResponse -> Bool
(GenerateContentResponse -> GenerateContentResponse -> Bool)
-> (GenerateContentResponse -> GenerateContentResponse -> Bool)
-> Eq GenerateContentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateContentResponse -> GenerateContentResponse -> Bool
== :: GenerateContentResponse -> GenerateContentResponse -> Bool
$c/= :: GenerateContentResponse -> GenerateContentResponse -> Bool
/= :: GenerateContentResponse -> GenerateContentResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateContentResponse
instance A.FromJSON GenerateContentResponse where
  parseJSON :: Value -> Parser GenerateContentResponse
parseJSON = [Char]
-> (Object -> Parser GenerateContentResponse)
-> Value
-> Parser GenerateContentResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateContentResponse" ((Object -> Parser GenerateContentResponse)
 -> Value -> Parser GenerateContentResponse)
-> (Object -> Parser GenerateContentResponse)
-> Value
-> Parser GenerateContentResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Candidate]
-> Maybe UsageMetadata
-> Maybe Text
-> Maybe PromptFeedback
-> Maybe Text
-> GenerateContentResponse
GenerateContentResponse
      (Maybe [Candidate]
 -> Maybe UsageMetadata
 -> Maybe Text
 -> Maybe PromptFeedback
 -> Maybe Text
 -> GenerateContentResponse)
-> Parser (Maybe [Candidate])
-> Parser
     (Maybe UsageMetadata
      -> Maybe Text
      -> Maybe PromptFeedback
      -> Maybe Text
      -> GenerateContentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Candidate])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidates")
      Parser
  (Maybe UsageMetadata
   -> Maybe Text
   -> Maybe PromptFeedback
   -> Maybe Text
   -> GenerateContentResponse)
-> Parser (Maybe UsageMetadata)
-> Parser
     (Maybe Text
      -> Maybe PromptFeedback -> Maybe Text -> GenerateContentResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe UsageMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"usageMetadata")
      Parser
  (Maybe Text
   -> Maybe PromptFeedback -> Maybe Text -> GenerateContentResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe PromptFeedback -> Maybe Text -> GenerateContentResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"modelVersion")
      Parser
  (Maybe PromptFeedback -> Maybe Text -> GenerateContentResponse)
-> Parser (Maybe PromptFeedback)
-> Parser (Maybe Text -> GenerateContentResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe PromptFeedback)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"promptFeedback")
      Parser (Maybe Text -> GenerateContentResponse)
-> Parser (Maybe Text) -> Parser GenerateContentResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"responseId")

-- | ToJSON GenerateContentResponse
instance A.ToJSON GenerateContentResponse where
  toJSON :: GenerateContentResponse -> Value
toJSON GenerateContentResponse {Maybe [Candidate]
Maybe Text
Maybe PromptFeedback
Maybe UsageMetadata
generateContentResponseCandidates :: GenerateContentResponse -> Maybe [Candidate]
generateContentResponseUsageMetadata :: GenerateContentResponse -> Maybe UsageMetadata
generateContentResponseModelVersion :: GenerateContentResponse -> Maybe Text
generateContentResponsePromptFeedback :: GenerateContentResponse -> Maybe PromptFeedback
generateContentResponseResponseId :: GenerateContentResponse -> Maybe Text
generateContentResponseCandidates :: Maybe [Candidate]
generateContentResponseUsageMetadata :: Maybe UsageMetadata
generateContentResponseModelVersion :: Maybe Text
generateContentResponsePromptFeedback :: Maybe PromptFeedback
generateContentResponseResponseId :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"candidates" Key -> Maybe [Candidate] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Candidate]
generateContentResponseCandidates
      , Key
"usageMetadata" Key -> Maybe UsageMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe UsageMetadata
generateContentResponseUsageMetadata
      , Key
"modelVersion" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
generateContentResponseModelVersion
      , Key
"promptFeedback" Key -> Maybe PromptFeedback -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe PromptFeedback
generateContentResponsePromptFeedback
      , Key
"responseId" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
generateContentResponseResponseId
      ]

-- | Construct a value of type 'GenerateContentResponse' (by applying it's required fields, if any)
mkGenerateContentResponse ::
  GenerateContentResponse
mkGenerateContentResponse :: GenerateContentResponse
mkGenerateContentResponse =
  GenerateContentResponse
    { generateContentResponseCandidates :: Maybe [Candidate]
generateContentResponseCandidates = Maybe [Candidate]
forall a. Maybe a
Nothing
    , generateContentResponseUsageMetadata :: Maybe UsageMetadata
generateContentResponseUsageMetadata = Maybe UsageMetadata
forall a. Maybe a
Nothing
    , generateContentResponseModelVersion :: Maybe Text
generateContentResponseModelVersion = Maybe Text
forall a. Maybe a
Nothing
    , generateContentResponsePromptFeedback :: Maybe PromptFeedback
generateContentResponsePromptFeedback = Maybe PromptFeedback
forall a. Maybe a
Nothing
    , generateContentResponseResponseId :: Maybe Text
generateContentResponseResponseId = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** GenerateMessageRequest

{- | GenerateMessageRequest
Request to generate a message response from the model.
-}
data GenerateMessageRequest = GenerateMessageRequest
  { GenerateMessageRequest -> Maybe Float
generateMessageRequestTemperature :: !(Maybe Float)
  -- ^ "temperature" - Optional. Controls the randomness of the output.  Values can range over &#x60;[0.0,1.0]&#x60;, inclusive. A value closer to &#x60;1.0&#x60; will produce responses that are more varied, while a value closer to &#x60;0.0&#x60; will typically result in less surprising responses from the model.
  , GenerateMessageRequest -> Maybe Float
generateMessageRequestTopP :: !(Maybe Float)
  -- ^ "topP" - Optional. The maximum cumulative probability of tokens to consider when sampling.  The model uses combined Top-k and nucleus sampling.  Nucleus sampling considers the smallest set of tokens whose probability sum is at least &#x60;top_p&#x60;.
  , GenerateMessageRequest -> Maybe Int
generateMessageRequestCandidateCount :: !(Maybe Int)
  -- ^ "candidateCount" - Optional. The number of generated response messages to return.  This value must be between &#x60;[1, 8]&#x60;, inclusive. If unset, this will default to &#x60;1&#x60;.
  , GenerateMessageRequest -> Maybe Int
generateMessageRequestTopK :: !(Maybe Int)
  -- ^ "topK" - Optional. The maximum number of tokens to consider when sampling.  The model uses combined Top-k and nucleus sampling.  Top-k sampling considers the set of &#x60;top_k&#x60; most probable tokens.
  , GenerateMessageRequest -> MessagePrompt
generateMessageRequestPrompt :: !(MessagePrompt)
  -- ^ /Required/ "prompt" - Required. The structured textual input given to the model as a prompt.  Given a prompt, the model will return what it predicts is the next message in the discussion.
  }
  deriving (Int -> GenerateMessageRequest -> ShowS
[GenerateMessageRequest] -> ShowS
GenerateMessageRequest -> [Char]
(Int -> GenerateMessageRequest -> ShowS)
-> (GenerateMessageRequest -> [Char])
-> ([GenerateMessageRequest] -> ShowS)
-> Show GenerateMessageRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateMessageRequest -> ShowS
showsPrec :: Int -> GenerateMessageRequest -> ShowS
$cshow :: GenerateMessageRequest -> [Char]
show :: GenerateMessageRequest -> [Char]
$cshowList :: [GenerateMessageRequest] -> ShowS
showList :: [GenerateMessageRequest] -> ShowS
P.Show, GenerateMessageRequest -> GenerateMessageRequest -> Bool
(GenerateMessageRequest -> GenerateMessageRequest -> Bool)
-> (GenerateMessageRequest -> GenerateMessageRequest -> Bool)
-> Eq GenerateMessageRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateMessageRequest -> GenerateMessageRequest -> Bool
== :: GenerateMessageRequest -> GenerateMessageRequest -> Bool
$c/= :: GenerateMessageRequest -> GenerateMessageRequest -> Bool
/= :: GenerateMessageRequest -> GenerateMessageRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateMessageRequest
instance A.FromJSON GenerateMessageRequest where
  parseJSON :: Value -> Parser GenerateMessageRequest
parseJSON = [Char]
-> (Object -> Parser GenerateMessageRequest)
-> Value
-> Parser GenerateMessageRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateMessageRequest" ((Object -> Parser GenerateMessageRequest)
 -> Value -> Parser GenerateMessageRequest)
-> (Object -> Parser GenerateMessageRequest)
-> Value
-> Parser GenerateMessageRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Float
-> Maybe Float
-> Maybe Int
-> Maybe Int
-> MessagePrompt
-> GenerateMessageRequest
GenerateMessageRequest
      (Maybe Float
 -> Maybe Float
 -> Maybe Int
 -> Maybe Int
 -> MessagePrompt
 -> GenerateMessageRequest)
-> Parser (Maybe Float)
-> Parser
     (Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> MessagePrompt
      -> GenerateMessageRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"temperature")
      Parser
  (Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> MessagePrompt
   -> GenerateMessageRequest)
-> Parser (Maybe Float)
-> Parser
     (Maybe Int -> Maybe Int -> MessagePrompt -> GenerateMessageRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topP")
      Parser
  (Maybe Int -> Maybe Int -> MessagePrompt -> GenerateMessageRequest)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> MessagePrompt -> GenerateMessageRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidateCount")
      Parser (Maybe Int -> MessagePrompt -> GenerateMessageRequest)
-> Parser (Maybe Int)
-> Parser (MessagePrompt -> GenerateMessageRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topK")
      Parser (MessagePrompt -> GenerateMessageRequest)
-> Parser MessagePrompt -> Parser GenerateMessageRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser MessagePrompt
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"prompt")

-- | ToJSON GenerateMessageRequest
instance A.ToJSON GenerateMessageRequest where
  toJSON :: GenerateMessageRequest -> Value
toJSON GenerateMessageRequest {Maybe Float
Maybe Int
MessagePrompt
generateMessageRequestTemperature :: GenerateMessageRequest -> Maybe Float
generateMessageRequestTopP :: GenerateMessageRequest -> Maybe Float
generateMessageRequestCandidateCount :: GenerateMessageRequest -> Maybe Int
generateMessageRequestTopK :: GenerateMessageRequest -> Maybe Int
generateMessageRequestPrompt :: GenerateMessageRequest -> MessagePrompt
generateMessageRequestTemperature :: Maybe Float
generateMessageRequestTopP :: Maybe Float
generateMessageRequestCandidateCount :: Maybe Int
generateMessageRequestTopK :: Maybe Int
generateMessageRequestPrompt :: MessagePrompt
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"temperature" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generateMessageRequestTemperature
      , Key
"topP" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generateMessageRequestTopP
      , Key
"candidateCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generateMessageRequestCandidateCount
      , Key
"topK" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generateMessageRequestTopK
      , Key
"prompt" Key -> MessagePrompt -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= MessagePrompt
generateMessageRequestPrompt
      ]

-- | Construct a value of type 'GenerateMessageRequest' (by applying it's required fields, if any)
mkGenerateMessageRequest ::
  -- | 'generateMessageRequestPrompt': Required. The structured textual input given to the model as a prompt.  Given a prompt, the model will return what it predicts is the next message in the discussion.
  MessagePrompt ->
  GenerateMessageRequest
mkGenerateMessageRequest :: MessagePrompt -> GenerateMessageRequest
mkGenerateMessageRequest MessagePrompt
generateMessageRequestPrompt =
  GenerateMessageRequest
    { generateMessageRequestTemperature :: Maybe Float
generateMessageRequestTemperature = Maybe Float
forall a. Maybe a
Nothing
    , generateMessageRequestTopP :: Maybe Float
generateMessageRequestTopP = Maybe Float
forall a. Maybe a
Nothing
    , generateMessageRequestCandidateCount :: Maybe Int
generateMessageRequestCandidateCount = Maybe Int
forall a. Maybe a
Nothing
    , generateMessageRequestTopK :: Maybe Int
generateMessageRequestTopK = Maybe Int
forall a. Maybe a
Nothing
    , MessagePrompt
generateMessageRequestPrompt :: MessagePrompt
generateMessageRequestPrompt :: MessagePrompt
generateMessageRequestPrompt
    }

-- ** GenerateMessageResponse

{- | GenerateMessageResponse
The response from the model.  This includes candidate messages and conversation history in the form of chronologically-ordered messages.
-}
data GenerateMessageResponse = GenerateMessageResponse
  { GenerateMessageResponse -> Maybe [Message]
generateMessageResponseCandidates :: !(Maybe [Message])
  -- ^ "candidates" - Candidate response messages from the model.
  , GenerateMessageResponse -> Maybe [Message]
generateMessageResponseMessages :: !(Maybe [Message])
  -- ^ "messages" - The conversation history used by the model.
  , GenerateMessageResponse -> Maybe [ContentFilter]
generateMessageResponseFilters :: !(Maybe [ContentFilter])
  -- ^ "filters" - A set of content filtering metadata for the prompt and response text.  This indicates which &#x60;SafetyCategory&#x60;(s) blocked a candidate from this response, the lowest &#x60;HarmProbability&#x60; that triggered a block, and the HarmThreshold setting for that category.
  }
  deriving (Int -> GenerateMessageResponse -> ShowS
[GenerateMessageResponse] -> ShowS
GenerateMessageResponse -> [Char]
(Int -> GenerateMessageResponse -> ShowS)
-> (GenerateMessageResponse -> [Char])
-> ([GenerateMessageResponse] -> ShowS)
-> Show GenerateMessageResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateMessageResponse -> ShowS
showsPrec :: Int -> GenerateMessageResponse -> ShowS
$cshow :: GenerateMessageResponse -> [Char]
show :: GenerateMessageResponse -> [Char]
$cshowList :: [GenerateMessageResponse] -> ShowS
showList :: [GenerateMessageResponse] -> ShowS
P.Show, GenerateMessageResponse -> GenerateMessageResponse -> Bool
(GenerateMessageResponse -> GenerateMessageResponse -> Bool)
-> (GenerateMessageResponse -> GenerateMessageResponse -> Bool)
-> Eq GenerateMessageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateMessageResponse -> GenerateMessageResponse -> Bool
== :: GenerateMessageResponse -> GenerateMessageResponse -> Bool
$c/= :: GenerateMessageResponse -> GenerateMessageResponse -> Bool
/= :: GenerateMessageResponse -> GenerateMessageResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateMessageResponse
instance A.FromJSON GenerateMessageResponse where
  parseJSON :: Value -> Parser GenerateMessageResponse
parseJSON = [Char]
-> (Object -> Parser GenerateMessageResponse)
-> Value
-> Parser GenerateMessageResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateMessageResponse" ((Object -> Parser GenerateMessageResponse)
 -> Value -> Parser GenerateMessageResponse)
-> (Object -> Parser GenerateMessageResponse)
-> Value
-> Parser GenerateMessageResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Message]
-> Maybe [Message]
-> Maybe [ContentFilter]
-> GenerateMessageResponse
GenerateMessageResponse
      (Maybe [Message]
 -> Maybe [Message]
 -> Maybe [ContentFilter]
 -> GenerateMessageResponse)
-> Parser (Maybe [Message])
-> Parser
     (Maybe [Message]
      -> Maybe [ContentFilter] -> GenerateMessageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Message])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidates")
      Parser
  (Maybe [Message]
   -> Maybe [ContentFilter] -> GenerateMessageResponse)
-> Parser (Maybe [Message])
-> Parser (Maybe [ContentFilter] -> GenerateMessageResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Message])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"messages")
      Parser (Maybe [ContentFilter] -> GenerateMessageResponse)
-> Parser (Maybe [ContentFilter]) -> Parser GenerateMessageResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [ContentFilter])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"filters")

-- | ToJSON GenerateMessageResponse
instance A.ToJSON GenerateMessageResponse where
  toJSON :: GenerateMessageResponse -> Value
toJSON GenerateMessageResponse {Maybe [ContentFilter]
Maybe [Message]
generateMessageResponseCandidates :: GenerateMessageResponse -> Maybe [Message]
generateMessageResponseMessages :: GenerateMessageResponse -> Maybe [Message]
generateMessageResponseFilters :: GenerateMessageResponse -> Maybe [ContentFilter]
generateMessageResponseCandidates :: Maybe [Message]
generateMessageResponseMessages :: Maybe [Message]
generateMessageResponseFilters :: Maybe [ContentFilter]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"candidates" Key -> Maybe [Message] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Message]
generateMessageResponseCandidates
      , Key
"messages" Key -> Maybe [Message] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Message]
generateMessageResponseMessages
      , Key
"filters" Key -> Maybe [ContentFilter] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ContentFilter]
generateMessageResponseFilters
      ]

-- | Construct a value of type 'GenerateMessageResponse' (by applying it's required fields, if any)
mkGenerateMessageResponse ::
  GenerateMessageResponse
mkGenerateMessageResponse :: GenerateMessageResponse
mkGenerateMessageResponse =
  GenerateMessageResponse
    { generateMessageResponseCandidates :: Maybe [Message]
generateMessageResponseCandidates = Maybe [Message]
forall a. Maybe a
Nothing
    , generateMessageResponseMessages :: Maybe [Message]
generateMessageResponseMessages = Maybe [Message]
forall a. Maybe a
Nothing
    , generateMessageResponseFilters :: Maybe [ContentFilter]
generateMessageResponseFilters = Maybe [ContentFilter]
forall a. Maybe a
Nothing
    }

-- ** GenerateTextRequest

{- | GenerateTextRequest
Request to generate a text completion response from the model.
-}
data GenerateTextRequest = GenerateTextRequest
  { GenerateTextRequest -> Maybe [Text]
generateTextRequestStopSequences :: !(Maybe [Text])
  -- ^ "stopSequences" - The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a stop sequence. The stop sequence will not be included as part of the response.
  , GenerateTextRequest -> TextPrompt
generateTextRequestPrompt :: !(TextPrompt)
  -- ^ /Required/ "prompt" - Required. The free-form input text given to the model as a prompt.  Given a prompt, the model will generate a TextCompletion response it predicts as the completion of the input text.
  , GenerateTextRequest -> Maybe Int
generateTextRequestMaxOutputTokens :: !(Maybe Int)
  -- ^ "maxOutputTokens" - Optional. The maximum number of tokens to include in a candidate.  If unset, this will default to output_token_limit specified in the &#x60;Model&#x60; specification.
  , GenerateTextRequest -> Maybe [SafetySetting]
generateTextRequestSafetySettings :: !(Maybe [SafetySetting])
  -- ^ "safetySettings" - Optional. A list of unique &#x60;SafetySetting&#x60; instances for blocking unsafe content.  that will be enforced on the &#x60;GenerateTextRequest.prompt&#x60; and &#x60;GenerateTextResponse.candidates&#x60;. There should not be more than one setting for each &#x60;SafetyCategory&#x60; type. The API will block any prompts and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each &#x60;SafetyCategory&#x60; specified in the safety_settings. If there is no &#x60;SafetySetting&#x60; for a given &#x60;SafetyCategory&#x60; provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_DEROGATORY, HARM_CATEGORY_TOXICITY, HARM_CATEGORY_VIOLENCE, HARM_CATEGORY_SEXUAL, HARM_CATEGORY_MEDICAL, HARM_CATEGORY_DANGEROUS are supported in text service.
  , GenerateTextRequest -> Maybe Float
generateTextRequestTemperature :: !(Maybe Float)
  -- ^ "temperature" - Optional. Controls the randomness of the output. Note: The default value varies by model, see the &#x60;Model.temperature&#x60; attribute of the &#x60;Model&#x60; returned the &#x60;getModel&#x60; function.  Values can range from [0.0,1.0], inclusive. A value closer to 1.0 will produce responses that are more varied and creative, while a value closer to 0.0 will typically result in more straightforward responses from the model.
  , GenerateTextRequest -> Maybe Int
generateTextRequestTopK :: !(Maybe Int)
  -- ^ "topK" - Optional. The maximum number of tokens to consider when sampling.  The model uses combined Top-k and nucleus sampling.  Top-k sampling considers the set of &#x60;top_k&#x60; most probable tokens. Defaults to 40.  Note: The default value varies by model, see the &#x60;Model.top_k&#x60; attribute of the &#x60;Model&#x60; returned the &#x60;getModel&#x60; function.
  , GenerateTextRequest -> Maybe Float
generateTextRequestTopP :: !(Maybe Float)
  -- ^ "topP" - Optional. The maximum cumulative probability of tokens to consider when sampling.  The model uses combined Top-k and nucleus sampling.  Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits number of tokens based on the cumulative probability.  Note: The default value varies by model, see the &#x60;Model.top_p&#x60; attribute of the &#x60;Model&#x60; returned the &#x60;getModel&#x60; function.
  , GenerateTextRequest -> Maybe Int
generateTextRequestCandidateCount :: !(Maybe Int)
  -- ^ "candidateCount" - Optional. Number of generated responses to return.  This value must be between [1, 8], inclusive. If unset, this will default to 1.
  }
  deriving (Int -> GenerateTextRequest -> ShowS
[GenerateTextRequest] -> ShowS
GenerateTextRequest -> [Char]
(Int -> GenerateTextRequest -> ShowS)
-> (GenerateTextRequest -> [Char])
-> ([GenerateTextRequest] -> ShowS)
-> Show GenerateTextRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateTextRequest -> ShowS
showsPrec :: Int -> GenerateTextRequest -> ShowS
$cshow :: GenerateTextRequest -> [Char]
show :: GenerateTextRequest -> [Char]
$cshowList :: [GenerateTextRequest] -> ShowS
showList :: [GenerateTextRequest] -> ShowS
P.Show, GenerateTextRequest -> GenerateTextRequest -> Bool
(GenerateTextRequest -> GenerateTextRequest -> Bool)
-> (GenerateTextRequest -> GenerateTextRequest -> Bool)
-> Eq GenerateTextRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateTextRequest -> GenerateTextRequest -> Bool
== :: GenerateTextRequest -> GenerateTextRequest -> Bool
$c/= :: GenerateTextRequest -> GenerateTextRequest -> Bool
/= :: GenerateTextRequest -> GenerateTextRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateTextRequest
instance A.FromJSON GenerateTextRequest where
  parseJSON :: Value -> Parser GenerateTextRequest
parseJSON = [Char]
-> (Object -> Parser GenerateTextRequest)
-> Value
-> Parser GenerateTextRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateTextRequest" ((Object -> Parser GenerateTextRequest)
 -> Value -> Parser GenerateTextRequest)
-> (Object -> Parser GenerateTextRequest)
-> Value
-> Parser GenerateTextRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Text]
-> TextPrompt
-> Maybe Int
-> Maybe [SafetySetting]
-> Maybe Float
-> Maybe Int
-> Maybe Float
-> Maybe Int
-> GenerateTextRequest
GenerateTextRequest
      (Maybe [Text]
 -> TextPrompt
 -> Maybe Int
 -> Maybe [SafetySetting]
 -> Maybe Float
 -> Maybe Int
 -> Maybe Float
 -> Maybe Int
 -> GenerateTextRequest)
-> Parser (Maybe [Text])
-> Parser
     (TextPrompt
      -> Maybe Int
      -> Maybe [SafetySetting]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Float
      -> Maybe Int
      -> GenerateTextRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"stopSequences")
      Parser
  (TextPrompt
   -> Maybe Int
   -> Maybe [SafetySetting]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Float
   -> Maybe Int
   -> GenerateTextRequest)
-> Parser TextPrompt
-> Parser
     (Maybe Int
      -> Maybe [SafetySetting]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Float
      -> Maybe Int
      -> GenerateTextRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser TextPrompt
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"prompt")
      Parser
  (Maybe Int
   -> Maybe [SafetySetting]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Float
   -> Maybe Int
   -> GenerateTextRequest)
-> Parser (Maybe Int)
-> Parser
     (Maybe [SafetySetting]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Float
      -> Maybe Int
      -> GenerateTextRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxOutputTokens")
      Parser
  (Maybe [SafetySetting]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Float
   -> Maybe Int
   -> GenerateTextRequest)
-> Parser (Maybe [SafetySetting])
-> Parser
     (Maybe Float
      -> Maybe Int -> Maybe Float -> Maybe Int -> GenerateTextRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [SafetySetting])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetySettings")
      Parser
  (Maybe Float
   -> Maybe Int -> Maybe Float -> Maybe Int -> GenerateTextRequest)
-> Parser (Maybe Float)
-> Parser
     (Maybe Int -> Maybe Float -> Maybe Int -> GenerateTextRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"temperature")
      Parser
  (Maybe Int -> Maybe Float -> Maybe Int -> GenerateTextRequest)
-> Parser (Maybe Int)
-> Parser (Maybe Float -> Maybe Int -> GenerateTextRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topK")
      Parser (Maybe Float -> Maybe Int -> GenerateTextRequest)
-> Parser (Maybe Float)
-> Parser (Maybe Int -> GenerateTextRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topP")
      Parser (Maybe Int -> GenerateTextRequest)
-> Parser (Maybe Int) -> Parser GenerateTextRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidateCount")

-- | ToJSON GenerateTextRequest
instance A.ToJSON GenerateTextRequest where
  toJSON :: GenerateTextRequest -> Value
toJSON GenerateTextRequest {Maybe Float
Maybe Int
Maybe [Text]
Maybe [SafetySetting]
TextPrompt
generateTextRequestStopSequences :: GenerateTextRequest -> Maybe [Text]
generateTextRequestPrompt :: GenerateTextRequest -> TextPrompt
generateTextRequestMaxOutputTokens :: GenerateTextRequest -> Maybe Int
generateTextRequestSafetySettings :: GenerateTextRequest -> Maybe [SafetySetting]
generateTextRequestTemperature :: GenerateTextRequest -> Maybe Float
generateTextRequestTopK :: GenerateTextRequest -> Maybe Int
generateTextRequestTopP :: GenerateTextRequest -> Maybe Float
generateTextRequestCandidateCount :: GenerateTextRequest -> Maybe Int
generateTextRequestStopSequences :: Maybe [Text]
generateTextRequestPrompt :: TextPrompt
generateTextRequestMaxOutputTokens :: Maybe Int
generateTextRequestSafetySettings :: Maybe [SafetySetting]
generateTextRequestTemperature :: Maybe Float
generateTextRequestTopK :: Maybe Int
generateTextRequestTopP :: Maybe Float
generateTextRequestCandidateCount :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"stopSequences" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
generateTextRequestStopSequences
      , Key
"prompt" Key -> TextPrompt -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TextPrompt
generateTextRequestPrompt
      , Key
"maxOutputTokens" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generateTextRequestMaxOutputTokens
      , Key
"safetySettings" Key -> Maybe [SafetySetting] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetySetting]
generateTextRequestSafetySettings
      , Key
"temperature" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generateTextRequestTemperature
      , Key
"topK" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generateTextRequestTopK
      , Key
"topP" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generateTextRequestTopP
      , Key
"candidateCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generateTextRequestCandidateCount
      ]

-- | Construct a value of type 'GenerateTextRequest' (by applying it's required fields, if any)
mkGenerateTextRequest ::
  -- | 'generateTextRequestPrompt': Required. The free-form input text given to the model as a prompt.  Given a prompt, the model will generate a TextCompletion response it predicts as the completion of the input text.
  TextPrompt ->
  GenerateTextRequest
mkGenerateTextRequest :: TextPrompt -> GenerateTextRequest
mkGenerateTextRequest TextPrompt
generateTextRequestPrompt =
  GenerateTextRequest
    { generateTextRequestStopSequences :: Maybe [Text]
generateTextRequestStopSequences = Maybe [Text]
forall a. Maybe a
Nothing
    , TextPrompt
generateTextRequestPrompt :: TextPrompt
generateTextRequestPrompt :: TextPrompt
generateTextRequestPrompt
    , generateTextRequestMaxOutputTokens :: Maybe Int
generateTextRequestMaxOutputTokens = Maybe Int
forall a. Maybe a
Nothing
    , generateTextRequestSafetySettings :: Maybe [SafetySetting]
generateTextRequestSafetySettings = Maybe [SafetySetting]
forall a. Maybe a
Nothing
    , generateTextRequestTemperature :: Maybe Float
generateTextRequestTemperature = Maybe Float
forall a. Maybe a
Nothing
    , generateTextRequestTopK :: Maybe Int
generateTextRequestTopK = Maybe Int
forall a. Maybe a
Nothing
    , generateTextRequestTopP :: Maybe Float
generateTextRequestTopP = Maybe Float
forall a. Maybe a
Nothing
    , generateTextRequestCandidateCount :: Maybe Int
generateTextRequestCandidateCount = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** GenerateTextResponse

{- | GenerateTextResponse
The response from the model, including candidate completions.
-}
data GenerateTextResponse = GenerateTextResponse
  { GenerateTextResponse -> Maybe [SafetyFeedback]
generateTextResponseSafetyFeedback :: !(Maybe [SafetyFeedback])
  -- ^ "safetyFeedback" - Returns any safety feedback related to content filtering.
  , GenerateTextResponse -> Maybe [TextCompletion]
generateTextResponseCandidates :: !(Maybe [TextCompletion])
  -- ^ "candidates" - Candidate responses from the model.
  , GenerateTextResponse -> Maybe [ContentFilter]
generateTextResponseFilters :: !(Maybe [ContentFilter])
  -- ^ "filters" - A set of content filtering metadata for the prompt and response text.  This indicates which &#x60;SafetyCategory&#x60;(s) blocked a candidate from this response, the lowest &#x60;HarmProbability&#x60; that triggered a block, and the HarmThreshold setting for that category. This indicates the smallest change to the &#x60;SafetySettings&#x60; that would be necessary to unblock at least 1 response.  The blocking is configured by the &#x60;SafetySettings&#x60; in the request (or the default &#x60;SafetySettings&#x60; of the API).
  }
  deriving (Int -> GenerateTextResponse -> ShowS
[GenerateTextResponse] -> ShowS
GenerateTextResponse -> [Char]
(Int -> GenerateTextResponse -> ShowS)
-> (GenerateTextResponse -> [Char])
-> ([GenerateTextResponse] -> ShowS)
-> Show GenerateTextResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateTextResponse -> ShowS
showsPrec :: Int -> GenerateTextResponse -> ShowS
$cshow :: GenerateTextResponse -> [Char]
show :: GenerateTextResponse -> [Char]
$cshowList :: [GenerateTextResponse] -> ShowS
showList :: [GenerateTextResponse] -> ShowS
P.Show, GenerateTextResponse -> GenerateTextResponse -> Bool
(GenerateTextResponse -> GenerateTextResponse -> Bool)
-> (GenerateTextResponse -> GenerateTextResponse -> Bool)
-> Eq GenerateTextResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateTextResponse -> GenerateTextResponse -> Bool
== :: GenerateTextResponse -> GenerateTextResponse -> Bool
$c/= :: GenerateTextResponse -> GenerateTextResponse -> Bool
/= :: GenerateTextResponse -> GenerateTextResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateTextResponse
instance A.FromJSON GenerateTextResponse where
  parseJSON :: Value -> Parser GenerateTextResponse
parseJSON = [Char]
-> (Object -> Parser GenerateTextResponse)
-> Value
-> Parser GenerateTextResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateTextResponse" ((Object -> Parser GenerateTextResponse)
 -> Value -> Parser GenerateTextResponse)
-> (Object -> Parser GenerateTextResponse)
-> Value
-> Parser GenerateTextResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [SafetyFeedback]
-> Maybe [TextCompletion]
-> Maybe [ContentFilter]
-> GenerateTextResponse
GenerateTextResponse
      (Maybe [SafetyFeedback]
 -> Maybe [TextCompletion]
 -> Maybe [ContentFilter]
 -> GenerateTextResponse)
-> Parser (Maybe [SafetyFeedback])
-> Parser
     (Maybe [TextCompletion]
      -> Maybe [ContentFilter] -> GenerateTextResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [SafetyFeedback])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetyFeedback")
      Parser
  (Maybe [TextCompletion]
   -> Maybe [ContentFilter] -> GenerateTextResponse)
-> Parser (Maybe [TextCompletion])
-> Parser (Maybe [ContentFilter] -> GenerateTextResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [TextCompletion])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidates")
      Parser (Maybe [ContentFilter] -> GenerateTextResponse)
-> Parser (Maybe [ContentFilter]) -> Parser GenerateTextResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [ContentFilter])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"filters")

-- | ToJSON GenerateTextResponse
instance A.ToJSON GenerateTextResponse where
  toJSON :: GenerateTextResponse -> Value
toJSON GenerateTextResponse {Maybe [ContentFilter]
Maybe [SafetyFeedback]
Maybe [TextCompletion]
generateTextResponseSafetyFeedback :: GenerateTextResponse -> Maybe [SafetyFeedback]
generateTextResponseCandidates :: GenerateTextResponse -> Maybe [TextCompletion]
generateTextResponseFilters :: GenerateTextResponse -> Maybe [ContentFilter]
generateTextResponseSafetyFeedback :: Maybe [SafetyFeedback]
generateTextResponseCandidates :: Maybe [TextCompletion]
generateTextResponseFilters :: Maybe [ContentFilter]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"safetyFeedback" Key -> Maybe [SafetyFeedback] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetyFeedback]
generateTextResponseSafetyFeedback
      , Key
"candidates" Key -> Maybe [TextCompletion] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [TextCompletion]
generateTextResponseCandidates
      , Key
"filters" Key -> Maybe [ContentFilter] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ContentFilter]
generateTextResponseFilters
      ]

-- | Construct a value of type 'GenerateTextResponse' (by applying it's required fields, if any)
mkGenerateTextResponse ::
  GenerateTextResponse
mkGenerateTextResponse :: GenerateTextResponse
mkGenerateTextResponse =
  GenerateTextResponse
    { generateTextResponseSafetyFeedback :: Maybe [SafetyFeedback]
generateTextResponseSafetyFeedback = Maybe [SafetyFeedback]
forall a. Maybe a
Nothing
    , generateTextResponseCandidates :: Maybe [TextCompletion]
generateTextResponseCandidates = Maybe [TextCompletion]
forall a. Maybe a
Nothing
    , generateTextResponseFilters :: Maybe [ContentFilter]
generateTextResponseFilters = Maybe [ContentFilter]
forall a. Maybe a
Nothing
    }

-- ** GenerateVideoResponse

{- | GenerateVideoResponse
Veo response.
-}
data GenerateVideoResponse = GenerateVideoResponse
  { GenerateVideoResponse -> Maybe [Media]
generateVideoResponseGeneratedSamples :: !(Maybe [Media])
  -- ^ "generatedSamples" - The generated samples.
  , GenerateVideoResponse -> Maybe Int
generateVideoResponseRaiMediaFilteredCount :: !(Maybe Int)
  -- ^ "raiMediaFilteredCount" - Returns if any videos were filtered due to RAI policies.
  , GenerateVideoResponse -> Maybe [Text]
generateVideoResponseRaiMediaFilteredReasons :: !(Maybe [Text])
  -- ^ "raiMediaFilteredReasons" - Returns rai failure reasons if any.
  }
  deriving (Int -> GenerateVideoResponse -> ShowS
[GenerateVideoResponse] -> ShowS
GenerateVideoResponse -> [Char]
(Int -> GenerateVideoResponse -> ShowS)
-> (GenerateVideoResponse -> [Char])
-> ([GenerateVideoResponse] -> ShowS)
-> Show GenerateVideoResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerateVideoResponse -> ShowS
showsPrec :: Int -> GenerateVideoResponse -> ShowS
$cshow :: GenerateVideoResponse -> [Char]
show :: GenerateVideoResponse -> [Char]
$cshowList :: [GenerateVideoResponse] -> ShowS
showList :: [GenerateVideoResponse] -> ShowS
P.Show, GenerateVideoResponse -> GenerateVideoResponse -> Bool
(GenerateVideoResponse -> GenerateVideoResponse -> Bool)
-> (GenerateVideoResponse -> GenerateVideoResponse -> Bool)
-> Eq GenerateVideoResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerateVideoResponse -> GenerateVideoResponse -> Bool
== :: GenerateVideoResponse -> GenerateVideoResponse -> Bool
$c/= :: GenerateVideoResponse -> GenerateVideoResponse -> Bool
/= :: GenerateVideoResponse -> GenerateVideoResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerateVideoResponse
instance A.FromJSON GenerateVideoResponse where
  parseJSON :: Value -> Parser GenerateVideoResponse
parseJSON = [Char]
-> (Object -> Parser GenerateVideoResponse)
-> Value
-> Parser GenerateVideoResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerateVideoResponse" ((Object -> Parser GenerateVideoResponse)
 -> Value -> Parser GenerateVideoResponse)
-> (Object -> Parser GenerateVideoResponse)
-> Value
-> Parser GenerateVideoResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Media] -> Maybe Int -> Maybe [Text] -> GenerateVideoResponse
GenerateVideoResponse
      (Maybe [Media]
 -> Maybe Int -> Maybe [Text] -> GenerateVideoResponse)
-> Parser (Maybe [Media])
-> Parser (Maybe Int -> Maybe [Text] -> GenerateVideoResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Media])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"generatedSamples")
      Parser (Maybe Int -> Maybe [Text] -> GenerateVideoResponse)
-> Parser (Maybe Int)
-> Parser (Maybe [Text] -> GenerateVideoResponse)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"raiMediaFilteredCount")
      Parser (Maybe [Text] -> GenerateVideoResponse)
-> Parser (Maybe [Text]) -> Parser GenerateVideoResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"raiMediaFilteredReasons")

-- | ToJSON GenerateVideoResponse
instance A.ToJSON GenerateVideoResponse where
  toJSON :: GenerateVideoResponse -> Value
toJSON GenerateVideoResponse {Maybe Int
Maybe [Text]
Maybe [Media]
generateVideoResponseGeneratedSamples :: GenerateVideoResponse -> Maybe [Media]
generateVideoResponseRaiMediaFilteredCount :: GenerateVideoResponse -> Maybe Int
generateVideoResponseRaiMediaFilteredReasons :: GenerateVideoResponse -> Maybe [Text]
generateVideoResponseGeneratedSamples :: Maybe [Media]
generateVideoResponseRaiMediaFilteredCount :: Maybe Int
generateVideoResponseRaiMediaFilteredReasons :: Maybe [Text]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"generatedSamples" Key -> Maybe [Media] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Media]
generateVideoResponseGeneratedSamples
      , Key
"raiMediaFilteredCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generateVideoResponseRaiMediaFilteredCount
      , Key
"raiMediaFilteredReasons" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
generateVideoResponseRaiMediaFilteredReasons
      ]

-- | Construct a value of type 'GenerateVideoResponse' (by applying it's required fields, if any)
mkGenerateVideoResponse ::
  GenerateVideoResponse
mkGenerateVideoResponse :: GenerateVideoResponse
mkGenerateVideoResponse =
  GenerateVideoResponse
    { generateVideoResponseGeneratedSamples :: Maybe [Media]
generateVideoResponseGeneratedSamples = Maybe [Media]
forall a. Maybe a
Nothing
    , generateVideoResponseRaiMediaFilteredCount :: Maybe Int
generateVideoResponseRaiMediaFilteredCount = Maybe Int
forall a. Maybe a
Nothing
    , generateVideoResponseRaiMediaFilteredReasons :: Maybe [Text]
generateVideoResponseRaiMediaFilteredReasons = Maybe [Text]
forall a. Maybe a
Nothing
    }

-- ** GeneratedFile

{- | GeneratedFile
A file generated on behalf of a user.
-}
data GeneratedFile = GeneratedFile
  { GeneratedFile -> Maybe Status
generatedFileError :: !(Maybe Status)
  -- ^ "error" - Error details if the GeneratedFile ends up in the STATE_FAILED state.
  , GeneratedFile -> Maybe Text
generatedFileName :: !(Maybe Text)
  -- ^ "name" - Identifier. The name of the generated file. Example: &#x60;generatedFiles/abc-123&#x60;
  , GeneratedFile -> Maybe E'State2
generatedFileState :: !(Maybe E'State2)
  -- ^ /ReadOnly/ "state" - Output only. The state of the GeneratedFile.
  , GeneratedFile -> Maybe Text
generatedFileMimeType :: !(Maybe Text)
  -- ^ "mimeType" - MIME type of the generatedFile.
  }
  deriving (Int -> GeneratedFile -> ShowS
[GeneratedFile] -> ShowS
GeneratedFile -> [Char]
(Int -> GeneratedFile -> ShowS)
-> (GeneratedFile -> [Char])
-> ([GeneratedFile] -> ShowS)
-> Show GeneratedFile
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GeneratedFile -> ShowS
showsPrec :: Int -> GeneratedFile -> ShowS
$cshow :: GeneratedFile -> [Char]
show :: GeneratedFile -> [Char]
$cshowList :: [GeneratedFile] -> ShowS
showList :: [GeneratedFile] -> ShowS
P.Show, GeneratedFile -> GeneratedFile -> Bool
(GeneratedFile -> GeneratedFile -> Bool)
-> (GeneratedFile -> GeneratedFile -> Bool) -> Eq GeneratedFile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GeneratedFile -> GeneratedFile -> Bool
== :: GeneratedFile -> GeneratedFile -> Bool
$c/= :: GeneratedFile -> GeneratedFile -> Bool
/= :: GeneratedFile -> GeneratedFile -> Bool
P.Eq, P.Typeable)

-- | FromJSON GeneratedFile
instance A.FromJSON GeneratedFile where
  parseJSON :: Value -> Parser GeneratedFile
parseJSON = [Char]
-> (Object -> Parser GeneratedFile)
-> Value
-> Parser GeneratedFile
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GeneratedFile" ((Object -> Parser GeneratedFile) -> Value -> Parser GeneratedFile)
-> (Object -> Parser GeneratedFile)
-> Value
-> Parser GeneratedFile
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Status
-> Maybe Text -> Maybe E'State2 -> Maybe Text -> GeneratedFile
GeneratedFile
      (Maybe Status
 -> Maybe Text -> Maybe E'State2 -> Maybe Text -> GeneratedFile)
-> Parser (Maybe Status)
-> Parser
     (Maybe Text -> Maybe E'State2 -> Maybe Text -> GeneratedFile)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"error")
      Parser
  (Maybe Text -> Maybe E'State2 -> Maybe Text -> GeneratedFile)
-> Parser (Maybe Text)
-> Parser (Maybe E'State2 -> Maybe Text -> GeneratedFile)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser (Maybe E'State2 -> Maybe Text -> GeneratedFile)
-> Parser (Maybe E'State2) -> Parser (Maybe Text -> GeneratedFile)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'State2)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"state")
      Parser (Maybe Text -> GeneratedFile)
-> Parser (Maybe Text) -> Parser GeneratedFile
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mimeType")

-- | ToJSON GeneratedFile
instance A.ToJSON GeneratedFile where
  toJSON :: GeneratedFile -> Value
toJSON GeneratedFile {Maybe Text
Maybe E'State2
Maybe Status
generatedFileError :: GeneratedFile -> Maybe Status
generatedFileName :: GeneratedFile -> Maybe Text
generatedFileState :: GeneratedFile -> Maybe E'State2
generatedFileMimeType :: GeneratedFile -> Maybe Text
generatedFileError :: Maybe Status
generatedFileName :: Maybe Text
generatedFileState :: Maybe E'State2
generatedFileMimeType :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"error" Key -> Maybe Status -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Status
generatedFileError
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
generatedFileName
      , Key
"state" Key -> Maybe E'State2 -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'State2
generatedFileState
      , Key
"mimeType" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
generatedFileMimeType
      ]

-- | Construct a value of type 'GeneratedFile' (by applying it's required fields, if any)
mkGeneratedFile ::
  GeneratedFile
mkGeneratedFile :: GeneratedFile
mkGeneratedFile =
  GeneratedFile
    { generatedFileError :: Maybe Status
generatedFileError = Maybe Status
forall a. Maybe a
Nothing
    , generatedFileName :: Maybe Text
generatedFileName = Maybe Text
forall a. Maybe a
Nothing
    , generatedFileState :: Maybe E'State2
generatedFileState = Maybe E'State2
forall a. Maybe a
Nothing
    , generatedFileMimeType :: Maybe Text
generatedFileMimeType = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** GenerationConfig

{- | GenerationConfig
Configuration options for model generation and outputs. Not all parameters are configurable for every model.
-}
data GenerationConfig = GenerationConfig
  { GenerationConfig -> Maybe Schema
generationConfigResponseSchema :: !(Maybe Schema)
  -- ^ "responseSchema" - Optional. Output schema of the generated candidate text. Schemas must be a subset of the [OpenAPI schema](https://spec.openapis.org/oas/v3.0.3#schema) and can be objects, primitives or arrays.  If set, a compatible &#x60;response_mime_type&#x60; must also be set. Compatible MIME types: &#x60;application/json&#x60;: Schema for JSON response. Refer to the [JSON text generation guide](https://ai.google.dev/gemini-api/docs/json-mode) for more details.
  , GenerationConfig -> Maybe ThinkingConfig
generationConfigThinkingConfig :: !(Maybe ThinkingConfig)
  -- ^ "thinkingConfig" - Optional. Config for thinking features. An error will be returned if this field is set for models that don&#39;t support thinking.
  , GenerationConfig -> Maybe Int
generationConfigLogprobs :: !(Maybe Int)
  -- ^ "logprobs" - Optional. Only valid if response_logprobs&#x3D;True. This sets the number of top logprobs to return at each decoding step in the Candidate.logprobs_result.
  , GenerationConfig -> Maybe E'MediaResolution
generationConfigMediaResolution :: !(Maybe E'MediaResolution)
  -- ^ "mediaResolution" - Optional. If specified, the media resolution specified will be used.
  , GenerationConfig -> Maybe [Text]
generationConfigStopSequences :: !(Maybe [Text])
  -- ^ "stopSequences" - Optional. The set of character sequences (up to 5) that will stop output generation. If specified, the API will stop at the first appearance of a &#x60;stop_sequence&#x60;. The stop sequence will not be included as part of the response.
  , GenerationConfig -> Maybe SpeechConfig
generationConfigSpeechConfig :: !(Maybe SpeechConfig)
  -- ^ "speechConfig" - Optional. The speech generation config.
  , GenerationConfig -> Maybe [Char]
generationConfigResponseJsonSchema :: !(Maybe String)
  -- ^ "responseJsonSchema" - Optional. Output schema of the generated response. This is an alternative to &#x60;response_schema&#x60; that accepts [JSON Schema](https://json-schema.org/).  If set, &#x60;response_schema&#x60; must be omitted, but &#x60;response_mime_type&#x60; is required.  While the full JSON Schema may be sent, not all features are supported. Specifically, only the following properties are supported:  - &#x60;$id&#x60; - &#x60;$defs&#x60; - &#x60;$ref&#x60; - &#x60;$anchor&#x60; - &#x60;type&#x60; - &#x60;format&#x60; - &#x60;title&#x60; - &#x60;description&#x60; - &#x60;enum&#x60; (for strings and numbers) - &#x60;items&#x60; - &#x60;prefixItems&#x60; - &#x60;minItems&#x60; - &#x60;maxItems&#x60; - &#x60;minimum&#x60; - &#x60;maximum&#x60; - &#x60;anyOf&#x60; - &#x60;oneOf&#x60; (interpreted the same as &#x60;anyOf&#x60;) - &#x60;properties&#x60; - &#x60;additionalProperties&#x60; - &#x60;required&#x60;  The non-standard &#x60;propertyOrdering&#x60; property may also be set.  Cyclic references are unrolled to a limited degree and, as such, may only be used within non-required properties. (Nullable properties are not sufficient.) If &#x60;$ref&#x60; is set on a sub-schema, no other properties, except for than those starting as a &#x60;$&#x60;, may be set.
  , GenerationConfig -> Maybe Float
generationConfigPresencePenalty :: !(Maybe Float)
  -- ^ "presencePenalty" - Optional. Presence penalty applied to the next token&#39;s logprobs if the token has already been seen in the response.  This penalty is binary on/off and not dependant on the number of times the token is used (after the first). Use frequency_penalty for a penalty that increases with each use.  A positive penalty will discourage the use of tokens that have already been used in the response, increasing the vocabulary.  A negative penalty will encourage the use of tokens that have already been used in the response, decreasing the vocabulary.
  , GenerationConfig -> Maybe Float
generationConfigTopP :: !(Maybe Float)
  -- ^ "topP" - Optional. The maximum cumulative probability of tokens to consider when sampling.  The model uses combined Top-k and Top-p (nucleus) sampling.  Tokens are sorted based on their assigned probabilities so that only the most likely tokens are considered. Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits the number of tokens based on the cumulative probability.  Note: The default value varies by &#x60;Model&#x60; and is specified by the&#x60;Model.top_p&#x60; attribute returned from the &#x60;getModel&#x60; function. An empty &#x60;top_k&#x60; attribute indicates that the model doesn&#39;t apply top-k sampling and doesn&#39;t allow setting &#x60;top_k&#x60; on requests.
  , GenerationConfig -> Maybe Float
generationConfigTemperature :: !(Maybe Float)
  -- ^ "temperature" - Optional. Controls the randomness of the output.  Note: The default value varies by model, see the &#x60;Model.temperature&#x60; attribute of the &#x60;Model&#x60; returned from the &#x60;getModel&#x60; function.  Values can range from [0.0, 2.0].
  , GenerationConfig -> Maybe Int
generationConfigTopK :: !(Maybe Int)
  -- ^ "topK" - Optional. The maximum number of tokens to consider when sampling.  Gemini models use Top-p (nucleus) sampling or a combination of Top-k and nucleus sampling. Top-k sampling considers the set of &#x60;top_k&#x60; most probable tokens. Models running with nucleus sampling don&#39;t allow top_k setting.  Note: The default value varies by &#x60;Model&#x60; and is specified by the&#x60;Model.top_p&#x60; attribute returned from the &#x60;getModel&#x60; function. An empty &#x60;top_k&#x60; attribute indicates that the model doesn&#39;t apply top-k sampling and doesn&#39;t allow setting &#x60;top_k&#x60; on requests.
  , GenerationConfig -> Maybe Int
generationConfigCandidateCount :: !(Maybe Int)
  -- ^ "candidateCount" - Optional. Number of generated responses to return. If unset, this will default to 1. Please note that this doesn&#39;t work for previous generation models (Gemini 1.0 family)
  , GenerationConfig -> Maybe Bool
generationConfigEnableEnhancedCivicAnswers :: !(Maybe Bool)
  -- ^ "enableEnhancedCivicAnswers" - Optional. Enables enhanced civic answers. It may not be available for all models.
  , GenerationConfig -> Maybe Bool
generationConfigResponseLogprobs :: !(Maybe Bool)
  -- ^ "responseLogprobs" - Optional. If true, export the logprobs results in response.
  , GenerationConfig -> Maybe [E'ResponseModalities]
generationConfigResponseModalities :: !(Maybe [E'ResponseModalities])
  -- ^ "responseModalities" - Optional. The requested modalities of the response. Represents the set of modalities that the model can return, and should be expected in the response. This is an exact match to the modalities of the response.  A model may have multiple combinations of supported modalities. If the requested modalities do not match any of the supported combinations, an error will be returned.  An empty list is equivalent to requesting only text.
  , GenerationConfig -> Maybe Float
generationConfigFrequencyPenalty :: !(Maybe Float)
  -- ^ "frequencyPenalty" - Optional. Frequency penalty applied to the next token&#39;s logprobs, multiplied by the number of times each token has been seen in the respponse so far.  A positive penalty will discourage the use of tokens that have already been used, proportional to the number of times the token has been used: The more a token is used, the more difficult it is for the model to use that token again increasing the vocabulary of responses.  Caution: A _negative_ penalty will encourage the model to reuse tokens proportional to the number of times the token has been used. Small negative values will reduce the vocabulary of a response. Larger negative values will cause the model to start repeating a common token  until it hits the max_output_tokens limit.
  , GenerationConfig -> Maybe Int
generationConfigSeed :: !(Maybe Int)
  -- ^ "seed" - Optional. Seed used in decoding. If not set, the request uses a randomly generated seed.
  , GenerationConfig -> Maybe Int
generationConfigMaxOutputTokens :: !(Maybe Int)
  -- ^ "maxOutputTokens" - Optional. The maximum number of tokens to include in a response candidate.  Note: The default value varies by model, see the &#x60;Model.output_token_limit&#x60; attribute of the &#x60;Model&#x60; returned from the &#x60;getModel&#x60; function.
  , GenerationConfig -> Maybe Text
generationConfigResponseMimeType :: !(Maybe Text)
  -- ^ "responseMimeType" - Optional. MIME type of the generated candidate text. Supported MIME types are: &#x60;text/plain&#x60;: (default) Text output. &#x60;application/json&#x60;: JSON response in the response candidates. &#x60;text/x.enum&#x60;: ENUM as a string response in the response candidates. Refer to the [docs](https://ai.google.dev/gemini-api/docs/prompting_with_media#plain_text_formats) for a list of all supported text MIME types.
  }
  deriving (Int -> GenerationConfig -> ShowS
[GenerationConfig] -> ShowS
GenerationConfig -> [Char]
(Int -> GenerationConfig -> ShowS)
-> (GenerationConfig -> [Char])
-> ([GenerationConfig] -> ShowS)
-> Show GenerationConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GenerationConfig -> ShowS
showsPrec :: Int -> GenerationConfig -> ShowS
$cshow :: GenerationConfig -> [Char]
show :: GenerationConfig -> [Char]
$cshowList :: [GenerationConfig] -> ShowS
showList :: [GenerationConfig] -> ShowS
P.Show, GenerationConfig -> GenerationConfig -> Bool
(GenerationConfig -> GenerationConfig -> Bool)
-> (GenerationConfig -> GenerationConfig -> Bool)
-> Eq GenerationConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GenerationConfig -> GenerationConfig -> Bool
== :: GenerationConfig -> GenerationConfig -> Bool
$c/= :: GenerationConfig -> GenerationConfig -> Bool
/= :: GenerationConfig -> GenerationConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON GenerationConfig
instance A.FromJSON GenerationConfig where
  parseJSON :: Value -> Parser GenerationConfig
parseJSON = [Char]
-> (Object -> Parser GenerationConfig)
-> Value
-> Parser GenerationConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GenerationConfig" ((Object -> Parser GenerationConfig)
 -> Value -> Parser GenerationConfig)
-> (Object -> Parser GenerationConfig)
-> Value
-> Parser GenerationConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Schema
-> Maybe ThinkingConfig
-> Maybe Int
-> Maybe E'MediaResolution
-> Maybe [Text]
-> Maybe SpeechConfig
-> Maybe [Char]
-> Maybe Float
-> Maybe Float
-> Maybe Float
-> Maybe Int
-> Maybe Int
-> Maybe Bool
-> Maybe Bool
-> Maybe [E'ResponseModalities]
-> Maybe Float
-> Maybe Int
-> Maybe Int
-> Maybe Text
-> GenerationConfig
GenerationConfig
      (Maybe Schema
 -> Maybe ThinkingConfig
 -> Maybe Int
 -> Maybe E'MediaResolution
 -> Maybe [Text]
 -> Maybe SpeechConfig
 -> Maybe [Char]
 -> Maybe Float
 -> Maybe Float
 -> Maybe Float
 -> Maybe Int
 -> Maybe Int
 -> Maybe Bool
 -> Maybe Bool
 -> Maybe [E'ResponseModalities]
 -> Maybe Float
 -> Maybe Int
 -> Maybe Int
 -> Maybe Text
 -> GenerationConfig)
-> Parser (Maybe Schema)
-> Parser
     (Maybe ThinkingConfig
      -> Maybe Int
      -> Maybe E'MediaResolution
      -> Maybe [Text]
      -> Maybe SpeechConfig
      -> Maybe [Char]
      -> Maybe Float
      -> Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Schema)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"responseSchema")
      Parser
  (Maybe ThinkingConfig
   -> Maybe Int
   -> Maybe E'MediaResolution
   -> Maybe [Text]
   -> Maybe SpeechConfig
   -> Maybe [Char]
   -> Maybe Float
   -> Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe ThinkingConfig)
-> Parser
     (Maybe Int
      -> Maybe E'MediaResolution
      -> Maybe [Text]
      -> Maybe SpeechConfig
      -> Maybe [Char]
      -> Maybe Float
      -> Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe ThinkingConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"thinkingConfig")
      Parser
  (Maybe Int
   -> Maybe E'MediaResolution
   -> Maybe [Text]
   -> Maybe SpeechConfig
   -> Maybe [Char]
   -> Maybe Float
   -> Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Int)
-> Parser
     (Maybe E'MediaResolution
      -> Maybe [Text]
      -> Maybe SpeechConfig
      -> Maybe [Char]
      -> Maybe Float
      -> Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"logprobs")
      Parser
  (Maybe E'MediaResolution
   -> Maybe [Text]
   -> Maybe SpeechConfig
   -> Maybe [Char]
   -> Maybe Float
   -> Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe E'MediaResolution)
-> Parser
     (Maybe [Text]
      -> Maybe SpeechConfig
      -> Maybe [Char]
      -> Maybe Float
      -> Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'MediaResolution)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"mediaResolution")
      Parser
  (Maybe [Text]
   -> Maybe SpeechConfig
   -> Maybe [Char]
   -> Maybe Float
   -> Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe [Text])
-> Parser
     (Maybe SpeechConfig
      -> Maybe [Char]
      -> Maybe Float
      -> Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"stopSequences")
      Parser
  (Maybe SpeechConfig
   -> Maybe [Char]
   -> Maybe Float
   -> Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe SpeechConfig)
-> Parser
     (Maybe [Char]
      -> Maybe Float
      -> Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe SpeechConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"speechConfig")
      Parser
  (Maybe [Char]
   -> Maybe Float
   -> Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe [Char])
-> Parser
     (Maybe Float
      -> Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Char])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"responseJsonSchema")
      Parser
  (Maybe Float
   -> Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Float)
-> Parser
     (Maybe Float
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"presencePenalty")
      Parser
  (Maybe Float
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Float)
-> Parser
     (Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topP")
      Parser
  (Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Float)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"temperature")
      Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topK")
      Parser
  (Maybe Int
   -> Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidateCount")
      Parser
  (Maybe Bool
   -> Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Bool
      -> Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"enableEnhancedCivicAnswers")
      Parser
  (Maybe Bool
   -> Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [E'ResponseModalities]
      -> Maybe Float
      -> Maybe Int
      -> Maybe Int
      -> Maybe Text
      -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"responseLogprobs")
      Parser
  (Maybe [E'ResponseModalities]
   -> Maybe Float
   -> Maybe Int
   -> Maybe Int
   -> Maybe Text
   -> GenerationConfig)
-> Parser (Maybe [E'ResponseModalities])
-> Parser
     (Maybe Float
      -> Maybe Int -> Maybe Int -> Maybe Text -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [E'ResponseModalities])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"responseModalities")
      Parser
  (Maybe Float
   -> Maybe Int -> Maybe Int -> Maybe Text -> GenerationConfig)
-> Parser (Maybe Float)
-> Parser
     (Maybe Int -> Maybe Int -> Maybe Text -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"frequencyPenalty")
      Parser (Maybe Int -> Maybe Int -> Maybe Text -> GenerationConfig)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Text -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"seed")
      Parser (Maybe Int -> Maybe Text -> GenerationConfig)
-> Parser (Maybe Int) -> Parser (Maybe Text -> GenerationConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxOutputTokens")
      Parser (Maybe Text -> GenerationConfig)
-> Parser (Maybe Text) -> Parser GenerationConfig
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"responseMimeType")

-- | ToJSON GenerationConfig
instance A.ToJSON GenerationConfig where
  toJSON :: GenerationConfig -> Value
toJSON GenerationConfig {Maybe Bool
Maybe Float
Maybe Int
Maybe [Char]
Maybe [Text]
Maybe [E'ResponseModalities]
Maybe Text
Maybe E'MediaResolution
Maybe Schema
Maybe SpeechConfig
Maybe ThinkingConfig
generationConfigResponseSchema :: GenerationConfig -> Maybe Schema
generationConfigThinkingConfig :: GenerationConfig -> Maybe ThinkingConfig
generationConfigLogprobs :: GenerationConfig -> Maybe Int
generationConfigMediaResolution :: GenerationConfig -> Maybe E'MediaResolution
generationConfigStopSequences :: GenerationConfig -> Maybe [Text]
generationConfigSpeechConfig :: GenerationConfig -> Maybe SpeechConfig
generationConfigResponseJsonSchema :: GenerationConfig -> Maybe [Char]
generationConfigPresencePenalty :: GenerationConfig -> Maybe Float
generationConfigTopP :: GenerationConfig -> Maybe Float
generationConfigTemperature :: GenerationConfig -> Maybe Float
generationConfigTopK :: GenerationConfig -> Maybe Int
generationConfigCandidateCount :: GenerationConfig -> Maybe Int
generationConfigEnableEnhancedCivicAnswers :: GenerationConfig -> Maybe Bool
generationConfigResponseLogprobs :: GenerationConfig -> Maybe Bool
generationConfigResponseModalities :: GenerationConfig -> Maybe [E'ResponseModalities]
generationConfigFrequencyPenalty :: GenerationConfig -> Maybe Float
generationConfigSeed :: GenerationConfig -> Maybe Int
generationConfigMaxOutputTokens :: GenerationConfig -> Maybe Int
generationConfigResponseMimeType :: GenerationConfig -> Maybe Text
generationConfigResponseSchema :: Maybe Schema
generationConfigThinkingConfig :: Maybe ThinkingConfig
generationConfigLogprobs :: Maybe Int
generationConfigMediaResolution :: Maybe E'MediaResolution
generationConfigStopSequences :: Maybe [Text]
generationConfigSpeechConfig :: Maybe SpeechConfig
generationConfigResponseJsonSchema :: Maybe [Char]
generationConfigPresencePenalty :: Maybe Float
generationConfigTopP :: Maybe Float
generationConfigTemperature :: Maybe Float
generationConfigTopK :: Maybe Int
generationConfigCandidateCount :: Maybe Int
generationConfigEnableEnhancedCivicAnswers :: Maybe Bool
generationConfigResponseLogprobs :: Maybe Bool
generationConfigResponseModalities :: Maybe [E'ResponseModalities]
generationConfigFrequencyPenalty :: Maybe Float
generationConfigSeed :: Maybe Int
generationConfigMaxOutputTokens :: Maybe Int
generationConfigResponseMimeType :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"responseSchema" Key -> Maybe Schema -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Schema
generationConfigResponseSchema
      , Key
"thinkingConfig" Key -> Maybe ThinkingConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ThinkingConfig
generationConfigThinkingConfig
      , Key
"logprobs" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generationConfigLogprobs
      , Key
"mediaResolution" Key -> Maybe E'MediaResolution -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'MediaResolution
generationConfigMediaResolution
      , Key
"stopSequences" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
generationConfigStopSequences
      , Key
"speechConfig" Key -> Maybe SpeechConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe SpeechConfig
generationConfigSpeechConfig
      , Key
"responseJsonSchema" Key -> Maybe [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Char]
generationConfigResponseJsonSchema
      , Key
"presencePenalty" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generationConfigPresencePenalty
      , Key
"topP" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generationConfigTopP
      , Key
"temperature" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generationConfigTemperature
      , Key
"topK" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generationConfigTopK
      , Key
"candidateCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generationConfigCandidateCount
      , Key
"enableEnhancedCivicAnswers" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
generationConfigEnableEnhancedCivicAnswers
      , Key
"responseLogprobs" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
generationConfigResponseLogprobs
      , Key
"responseModalities" Key -> Maybe [E'ResponseModalities] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [E'ResponseModalities]
generationConfigResponseModalities
      , Key
"frequencyPenalty" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
generationConfigFrequencyPenalty
      , Key
"seed" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generationConfigSeed
      , Key
"maxOutputTokens" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
generationConfigMaxOutputTokens
      , Key
"responseMimeType" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
generationConfigResponseMimeType
      ]

-- | Construct a value of type 'GenerationConfig' (by applying it's required fields, if any)
mkGenerationConfig ::
  GenerationConfig
mkGenerationConfig :: GenerationConfig
mkGenerationConfig =
  GenerationConfig
    { generationConfigResponseSchema :: Maybe Schema
generationConfigResponseSchema = Maybe Schema
forall a. Maybe a
Nothing
    , generationConfigThinkingConfig :: Maybe ThinkingConfig
generationConfigThinkingConfig = Maybe ThinkingConfig
forall a. Maybe a
Nothing
    , generationConfigLogprobs :: Maybe Int
generationConfigLogprobs = Maybe Int
forall a. Maybe a
Nothing
    , generationConfigMediaResolution :: Maybe E'MediaResolution
generationConfigMediaResolution = Maybe E'MediaResolution
forall a. Maybe a
Nothing
    , generationConfigStopSequences :: Maybe [Text]
generationConfigStopSequences = Maybe [Text]
forall a. Maybe a
Nothing
    , generationConfigSpeechConfig :: Maybe SpeechConfig
generationConfigSpeechConfig = Maybe SpeechConfig
forall a. Maybe a
Nothing
    , generationConfigResponseJsonSchema :: Maybe [Char]
generationConfigResponseJsonSchema = Maybe [Char]
forall a. Maybe a
Nothing
    , generationConfigPresencePenalty :: Maybe Float
generationConfigPresencePenalty = Maybe Float
forall a. Maybe a
Nothing
    , generationConfigTopP :: Maybe Float
generationConfigTopP = Maybe Float
forall a. Maybe a
Nothing
    , generationConfigTemperature :: Maybe Float
generationConfigTemperature = Maybe Float
forall a. Maybe a
Nothing
    , generationConfigTopK :: Maybe Int
generationConfigTopK = Maybe Int
forall a. Maybe a
Nothing
    , generationConfigCandidateCount :: Maybe Int
generationConfigCandidateCount = Maybe Int
forall a. Maybe a
Nothing
    , generationConfigEnableEnhancedCivicAnswers :: Maybe Bool
generationConfigEnableEnhancedCivicAnswers = Maybe Bool
forall a. Maybe a
Nothing
    , generationConfigResponseLogprobs :: Maybe Bool
generationConfigResponseLogprobs = Maybe Bool
forall a. Maybe a
Nothing
    , generationConfigResponseModalities :: Maybe [E'ResponseModalities]
generationConfigResponseModalities = Maybe [E'ResponseModalities]
forall a. Maybe a
Nothing
    , generationConfigFrequencyPenalty :: Maybe Float
generationConfigFrequencyPenalty = Maybe Float
forall a. Maybe a
Nothing
    , generationConfigSeed :: Maybe Int
generationConfigSeed = Maybe Int
forall a. Maybe a
Nothing
    , generationConfigMaxOutputTokens :: Maybe Int
generationConfigMaxOutputTokens = Maybe Int
forall a. Maybe a
Nothing
    , generationConfigResponseMimeType :: Maybe Text
generationConfigResponseMimeType = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** GoogleSearch

{- | GoogleSearch
GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
-}
data GoogleSearch = GoogleSearch
  { GoogleSearch -> Maybe Interval
googleSearchTimeRangeFilter :: !(Maybe Interval)
  -- ^ "timeRangeFilter" - Optional. Filter search results to a specific time range. If customers set a start time, they must set an end time (and vice versa).
  }
  deriving (Int -> GoogleSearch -> ShowS
[GoogleSearch] -> ShowS
GoogleSearch -> [Char]
(Int -> GoogleSearch -> ShowS)
-> (GoogleSearch -> [Char])
-> ([GoogleSearch] -> ShowS)
-> Show GoogleSearch
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GoogleSearch -> ShowS
showsPrec :: Int -> GoogleSearch -> ShowS
$cshow :: GoogleSearch -> [Char]
show :: GoogleSearch -> [Char]
$cshowList :: [GoogleSearch] -> ShowS
showList :: [GoogleSearch] -> ShowS
P.Show, GoogleSearch -> GoogleSearch -> Bool
(GoogleSearch -> GoogleSearch -> Bool)
-> (GoogleSearch -> GoogleSearch -> Bool) -> Eq GoogleSearch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GoogleSearch -> GoogleSearch -> Bool
== :: GoogleSearch -> GoogleSearch -> Bool
$c/= :: GoogleSearch -> GoogleSearch -> Bool
/= :: GoogleSearch -> GoogleSearch -> Bool
P.Eq, P.Typeable)

-- | FromJSON GoogleSearch
instance A.FromJSON GoogleSearch where
  parseJSON :: Value -> Parser GoogleSearch
parseJSON = [Char]
-> (Object -> Parser GoogleSearch) -> Value -> Parser GoogleSearch
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GoogleSearch" ((Object -> Parser GoogleSearch) -> Value -> Parser GoogleSearch)
-> (Object -> Parser GoogleSearch) -> Value -> Parser GoogleSearch
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Interval -> GoogleSearch
GoogleSearch
      (Maybe Interval -> GoogleSearch)
-> Parser (Maybe Interval) -> Parser GoogleSearch
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Interval)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"timeRangeFilter")

-- | ToJSON GoogleSearch
instance A.ToJSON GoogleSearch where
  toJSON :: GoogleSearch -> Value
toJSON GoogleSearch {Maybe Interval
googleSearchTimeRangeFilter :: GoogleSearch -> Maybe Interval
googleSearchTimeRangeFilter :: Maybe Interval
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"timeRangeFilter" Key -> Maybe Interval -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Interval
googleSearchTimeRangeFilter
      ]

-- | Construct a value of type 'GoogleSearch' (by applying it's required fields, if any)
mkGoogleSearch ::
  GoogleSearch
mkGoogleSearch :: GoogleSearch
mkGoogleSearch =
  GoogleSearch
    { googleSearchTimeRangeFilter :: Maybe Interval
googleSearchTimeRangeFilter = Maybe Interval
forall a. Maybe a
Nothing
    }

-- ** GoogleSearchRetrieval

{- | GoogleSearchRetrieval
Tool to retrieve public web data for grounding, powered by Google.
-}
data GoogleSearchRetrieval = GoogleSearchRetrieval
  { GoogleSearchRetrieval -> Maybe DynamicRetrievalConfig
googleSearchRetrievalDynamicRetrievalConfig :: !(Maybe DynamicRetrievalConfig)
  -- ^ "dynamicRetrievalConfig" - Specifies the dynamic retrieval configuration for the given source.
  }
  deriving (Int -> GoogleSearchRetrieval -> ShowS
[GoogleSearchRetrieval] -> ShowS
GoogleSearchRetrieval -> [Char]
(Int -> GoogleSearchRetrieval -> ShowS)
-> (GoogleSearchRetrieval -> [Char])
-> ([GoogleSearchRetrieval] -> ShowS)
-> Show GoogleSearchRetrieval
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GoogleSearchRetrieval -> ShowS
showsPrec :: Int -> GoogleSearchRetrieval -> ShowS
$cshow :: GoogleSearchRetrieval -> [Char]
show :: GoogleSearchRetrieval -> [Char]
$cshowList :: [GoogleSearchRetrieval] -> ShowS
showList :: [GoogleSearchRetrieval] -> ShowS
P.Show, GoogleSearchRetrieval -> GoogleSearchRetrieval -> Bool
(GoogleSearchRetrieval -> GoogleSearchRetrieval -> Bool)
-> (GoogleSearchRetrieval -> GoogleSearchRetrieval -> Bool)
-> Eq GoogleSearchRetrieval
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GoogleSearchRetrieval -> GoogleSearchRetrieval -> Bool
== :: GoogleSearchRetrieval -> GoogleSearchRetrieval -> Bool
$c/= :: GoogleSearchRetrieval -> GoogleSearchRetrieval -> Bool
/= :: GoogleSearchRetrieval -> GoogleSearchRetrieval -> Bool
P.Eq, P.Typeable)

-- | FromJSON GoogleSearchRetrieval
instance A.FromJSON GoogleSearchRetrieval where
  parseJSON :: Value -> Parser GoogleSearchRetrieval
parseJSON = [Char]
-> (Object -> Parser GoogleSearchRetrieval)
-> Value
-> Parser GoogleSearchRetrieval
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GoogleSearchRetrieval" ((Object -> Parser GoogleSearchRetrieval)
 -> Value -> Parser GoogleSearchRetrieval)
-> (Object -> Parser GoogleSearchRetrieval)
-> Value
-> Parser GoogleSearchRetrieval
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe DynamicRetrievalConfig -> GoogleSearchRetrieval
GoogleSearchRetrieval
      (Maybe DynamicRetrievalConfig -> GoogleSearchRetrieval)
-> Parser (Maybe DynamicRetrievalConfig)
-> Parser GoogleSearchRetrieval
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe DynamicRetrievalConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"dynamicRetrievalConfig")

-- | ToJSON GoogleSearchRetrieval
instance A.ToJSON GoogleSearchRetrieval where
  toJSON :: GoogleSearchRetrieval -> Value
toJSON GoogleSearchRetrieval {Maybe DynamicRetrievalConfig
googleSearchRetrievalDynamicRetrievalConfig :: GoogleSearchRetrieval -> Maybe DynamicRetrievalConfig
googleSearchRetrievalDynamicRetrievalConfig :: Maybe DynamicRetrievalConfig
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"dynamicRetrievalConfig" Key -> Maybe DynamicRetrievalConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DynamicRetrievalConfig
googleSearchRetrievalDynamicRetrievalConfig
      ]

-- | Construct a value of type 'GoogleSearchRetrieval' (by applying it's required fields, if any)
mkGoogleSearchRetrieval ::
  GoogleSearchRetrieval
mkGoogleSearchRetrieval :: GoogleSearchRetrieval
mkGoogleSearchRetrieval =
  GoogleSearchRetrieval
    { googleSearchRetrievalDynamicRetrievalConfig :: Maybe DynamicRetrievalConfig
googleSearchRetrievalDynamicRetrievalConfig = Maybe DynamicRetrievalConfig
forall a. Maybe a
Nothing
    }

-- ** GroundingAttribution

{- | GroundingAttribution
Attribution for a source that contributed to an answer.
-}
data GroundingAttribution = GroundingAttribution
  { GroundingAttribution -> Maybe AttributionSourceId
groundingAttributionSourceId :: !(Maybe AttributionSourceId)
  -- ^ /ReadOnly/ "sourceId" - Output only. Identifier for the source contributing to this attribution.
  , GroundingAttribution -> Maybe Content
groundingAttributionContent :: !(Maybe Content)
  -- ^ "content" - Grounding source content that makes up this attribution.
  }
  deriving (Int -> GroundingAttribution -> ShowS
[GroundingAttribution] -> ShowS
GroundingAttribution -> [Char]
(Int -> GroundingAttribution -> ShowS)
-> (GroundingAttribution -> [Char])
-> ([GroundingAttribution] -> ShowS)
-> Show GroundingAttribution
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroundingAttribution -> ShowS
showsPrec :: Int -> GroundingAttribution -> ShowS
$cshow :: GroundingAttribution -> [Char]
show :: GroundingAttribution -> [Char]
$cshowList :: [GroundingAttribution] -> ShowS
showList :: [GroundingAttribution] -> ShowS
P.Show, GroundingAttribution -> GroundingAttribution -> Bool
(GroundingAttribution -> GroundingAttribution -> Bool)
-> (GroundingAttribution -> GroundingAttribution -> Bool)
-> Eq GroundingAttribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroundingAttribution -> GroundingAttribution -> Bool
== :: GroundingAttribution -> GroundingAttribution -> Bool
$c/= :: GroundingAttribution -> GroundingAttribution -> Bool
/= :: GroundingAttribution -> GroundingAttribution -> Bool
P.Eq, P.Typeable)

-- | FromJSON GroundingAttribution
instance A.FromJSON GroundingAttribution where
  parseJSON :: Value -> Parser GroundingAttribution
parseJSON = [Char]
-> (Object -> Parser GroundingAttribution)
-> Value
-> Parser GroundingAttribution
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GroundingAttribution" ((Object -> Parser GroundingAttribution)
 -> Value -> Parser GroundingAttribution)
-> (Object -> Parser GroundingAttribution)
-> Value
-> Parser GroundingAttribution
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe AttributionSourceId -> Maybe Content -> GroundingAttribution
GroundingAttribution
      (Maybe AttributionSourceId
 -> Maybe Content -> GroundingAttribution)
-> Parser (Maybe AttributionSourceId)
-> Parser (Maybe Content -> GroundingAttribution)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe AttributionSourceId)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"sourceId")
      Parser (Maybe Content -> GroundingAttribution)
-> Parser (Maybe Content) -> Parser GroundingAttribution
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Content)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"content")

-- | ToJSON GroundingAttribution
instance A.ToJSON GroundingAttribution where
  toJSON :: GroundingAttribution -> Value
toJSON GroundingAttribution {Maybe AttributionSourceId
Maybe Content
groundingAttributionSourceId :: GroundingAttribution -> Maybe AttributionSourceId
groundingAttributionContent :: GroundingAttribution -> Maybe Content
groundingAttributionSourceId :: Maybe AttributionSourceId
groundingAttributionContent :: Maybe Content
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"sourceId" Key -> Maybe AttributionSourceId -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe AttributionSourceId
groundingAttributionSourceId
      , Key
"content" Key -> Maybe Content -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Content
groundingAttributionContent
      ]

-- | Construct a value of type 'GroundingAttribution' (by applying it's required fields, if any)
mkGroundingAttribution ::
  GroundingAttribution
mkGroundingAttribution :: GroundingAttribution
mkGroundingAttribution =
  GroundingAttribution
    { groundingAttributionSourceId :: Maybe AttributionSourceId
groundingAttributionSourceId = Maybe AttributionSourceId
forall a. Maybe a
Nothing
    , groundingAttributionContent :: Maybe Content
groundingAttributionContent = Maybe Content
forall a. Maybe a
Nothing
    }

-- ** GroundingChunk

{- | GroundingChunk
Grounding chunk.
-}
data GroundingChunk = GroundingChunk
  { GroundingChunk -> Maybe Web
groundingChunkWeb :: !(Maybe Web)
  -- ^ "web" - Grounding chunk from the web.
  }
  deriving (Int -> GroundingChunk -> ShowS
[GroundingChunk] -> ShowS
GroundingChunk -> [Char]
(Int -> GroundingChunk -> ShowS)
-> (GroundingChunk -> [Char])
-> ([GroundingChunk] -> ShowS)
-> Show GroundingChunk
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroundingChunk -> ShowS
showsPrec :: Int -> GroundingChunk -> ShowS
$cshow :: GroundingChunk -> [Char]
show :: GroundingChunk -> [Char]
$cshowList :: [GroundingChunk] -> ShowS
showList :: [GroundingChunk] -> ShowS
P.Show, GroundingChunk -> GroundingChunk -> Bool
(GroundingChunk -> GroundingChunk -> Bool)
-> (GroundingChunk -> GroundingChunk -> Bool) -> Eq GroundingChunk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroundingChunk -> GroundingChunk -> Bool
== :: GroundingChunk -> GroundingChunk -> Bool
$c/= :: GroundingChunk -> GroundingChunk -> Bool
/= :: GroundingChunk -> GroundingChunk -> Bool
P.Eq, P.Typeable)

-- | FromJSON GroundingChunk
instance A.FromJSON GroundingChunk where
  parseJSON :: Value -> Parser GroundingChunk
parseJSON = [Char]
-> (Object -> Parser GroundingChunk)
-> Value
-> Parser GroundingChunk
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GroundingChunk" ((Object -> Parser GroundingChunk)
 -> Value -> Parser GroundingChunk)
-> (Object -> Parser GroundingChunk)
-> Value
-> Parser GroundingChunk
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Web -> GroundingChunk
GroundingChunk
      (Maybe Web -> GroundingChunk)
-> Parser (Maybe Web) -> Parser GroundingChunk
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Web)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"web")

-- | ToJSON GroundingChunk
instance A.ToJSON GroundingChunk where
  toJSON :: GroundingChunk -> Value
toJSON GroundingChunk {Maybe Web
groundingChunkWeb :: GroundingChunk -> Maybe Web
groundingChunkWeb :: Maybe Web
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"web" Key -> Maybe Web -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Web
groundingChunkWeb
      ]

-- | Construct a value of type 'GroundingChunk' (by applying it's required fields, if any)
mkGroundingChunk ::
  GroundingChunk
mkGroundingChunk :: GroundingChunk
mkGroundingChunk =
  GroundingChunk
    { groundingChunkWeb :: Maybe Web
groundingChunkWeb = Maybe Web
forall a. Maybe a
Nothing
    }

-- ** GroundingMetadata

{- | GroundingMetadata
Metadata returned to client when grounding is enabled.
-}
data GroundingMetadata = GroundingMetadata
  { GroundingMetadata -> Maybe RetrievalMetadata
groundingMetadataRetrievalMetadata :: !(Maybe RetrievalMetadata)
  -- ^ "retrievalMetadata" - Metadata related to retrieval in the grounding flow.
  , GroundingMetadata -> Maybe [Text]
groundingMetadataWebSearchQueries :: !(Maybe [Text])
  -- ^ "webSearchQueries" - Web search queries for the following-up web search.
  , GroundingMetadata -> Maybe [GroundingChunk]
groundingMetadataGroundingChunks :: !(Maybe [GroundingChunk])
  -- ^ "groundingChunks" - List of supporting references retrieved from specified grounding source.
  , GroundingMetadata -> Maybe SearchEntryPoint
groundingMetadataSearchEntryPoint :: !(Maybe SearchEntryPoint)
  -- ^ "searchEntryPoint" - Optional. Google search entry for the following-up web searches.
  , GroundingMetadata -> Maybe [GroundingSupport]
groundingMetadataGroundingSupports :: !(Maybe [GroundingSupport])
  -- ^ "groundingSupports" - List of grounding support.
  }
  deriving (Int -> GroundingMetadata -> ShowS
[GroundingMetadata] -> ShowS
GroundingMetadata -> [Char]
(Int -> GroundingMetadata -> ShowS)
-> (GroundingMetadata -> [Char])
-> ([GroundingMetadata] -> ShowS)
-> Show GroundingMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroundingMetadata -> ShowS
showsPrec :: Int -> GroundingMetadata -> ShowS
$cshow :: GroundingMetadata -> [Char]
show :: GroundingMetadata -> [Char]
$cshowList :: [GroundingMetadata] -> ShowS
showList :: [GroundingMetadata] -> ShowS
P.Show, GroundingMetadata -> GroundingMetadata -> Bool
(GroundingMetadata -> GroundingMetadata -> Bool)
-> (GroundingMetadata -> GroundingMetadata -> Bool)
-> Eq GroundingMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroundingMetadata -> GroundingMetadata -> Bool
== :: GroundingMetadata -> GroundingMetadata -> Bool
$c/= :: GroundingMetadata -> GroundingMetadata -> Bool
/= :: GroundingMetadata -> GroundingMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON GroundingMetadata
instance A.FromJSON GroundingMetadata where
  parseJSON :: Value -> Parser GroundingMetadata
parseJSON = [Char]
-> (Object -> Parser GroundingMetadata)
-> Value
-> Parser GroundingMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GroundingMetadata" ((Object -> Parser GroundingMetadata)
 -> Value -> Parser GroundingMetadata)
-> (Object -> Parser GroundingMetadata)
-> Value
-> Parser GroundingMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe RetrievalMetadata
-> Maybe [Text]
-> Maybe [GroundingChunk]
-> Maybe SearchEntryPoint
-> Maybe [GroundingSupport]
-> GroundingMetadata
GroundingMetadata
      (Maybe RetrievalMetadata
 -> Maybe [Text]
 -> Maybe [GroundingChunk]
 -> Maybe SearchEntryPoint
 -> Maybe [GroundingSupport]
 -> GroundingMetadata)
-> Parser (Maybe RetrievalMetadata)
-> Parser
     (Maybe [Text]
      -> Maybe [GroundingChunk]
      -> Maybe SearchEntryPoint
      -> Maybe [GroundingSupport]
      -> GroundingMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe RetrievalMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"retrievalMetadata")
      Parser
  (Maybe [Text]
   -> Maybe [GroundingChunk]
   -> Maybe SearchEntryPoint
   -> Maybe [GroundingSupport]
   -> GroundingMetadata)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [GroundingChunk]
      -> Maybe SearchEntryPoint
      -> Maybe [GroundingSupport]
      -> GroundingMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"webSearchQueries")
      Parser
  (Maybe [GroundingChunk]
   -> Maybe SearchEntryPoint
   -> Maybe [GroundingSupport]
   -> GroundingMetadata)
-> Parser (Maybe [GroundingChunk])
-> Parser
     (Maybe SearchEntryPoint
      -> Maybe [GroundingSupport] -> GroundingMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [GroundingChunk])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"groundingChunks")
      Parser
  (Maybe SearchEntryPoint
   -> Maybe [GroundingSupport] -> GroundingMetadata)
-> Parser (Maybe SearchEntryPoint)
-> Parser (Maybe [GroundingSupport] -> GroundingMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe SearchEntryPoint)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"searchEntryPoint")
      Parser (Maybe [GroundingSupport] -> GroundingMetadata)
-> Parser (Maybe [GroundingSupport]) -> Parser GroundingMetadata
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [GroundingSupport])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"groundingSupports")

-- | ToJSON GroundingMetadata
instance A.ToJSON GroundingMetadata where
  toJSON :: GroundingMetadata -> Value
toJSON GroundingMetadata {Maybe [Text]
Maybe [GroundingChunk]
Maybe [GroundingSupport]
Maybe RetrievalMetadata
Maybe SearchEntryPoint
groundingMetadataRetrievalMetadata :: GroundingMetadata -> Maybe RetrievalMetadata
groundingMetadataWebSearchQueries :: GroundingMetadata -> Maybe [Text]
groundingMetadataGroundingChunks :: GroundingMetadata -> Maybe [GroundingChunk]
groundingMetadataSearchEntryPoint :: GroundingMetadata -> Maybe SearchEntryPoint
groundingMetadataGroundingSupports :: GroundingMetadata -> Maybe [GroundingSupport]
groundingMetadataRetrievalMetadata :: Maybe RetrievalMetadata
groundingMetadataWebSearchQueries :: Maybe [Text]
groundingMetadataGroundingChunks :: Maybe [GroundingChunk]
groundingMetadataSearchEntryPoint :: Maybe SearchEntryPoint
groundingMetadataGroundingSupports :: Maybe [GroundingSupport]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"retrievalMetadata" Key -> Maybe RetrievalMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe RetrievalMetadata
groundingMetadataRetrievalMetadata
      , Key
"webSearchQueries" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
groundingMetadataWebSearchQueries
      , Key
"groundingChunks" Key -> Maybe [GroundingChunk] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [GroundingChunk]
groundingMetadataGroundingChunks
      , Key
"searchEntryPoint" Key -> Maybe SearchEntryPoint -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe SearchEntryPoint
groundingMetadataSearchEntryPoint
      , Key
"groundingSupports" Key -> Maybe [GroundingSupport] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [GroundingSupport]
groundingMetadataGroundingSupports
      ]

-- | Construct a value of type 'GroundingMetadata' (by applying it's required fields, if any)
mkGroundingMetadata ::
  GroundingMetadata
mkGroundingMetadata :: GroundingMetadata
mkGroundingMetadata =
  GroundingMetadata
    { groundingMetadataRetrievalMetadata :: Maybe RetrievalMetadata
groundingMetadataRetrievalMetadata = Maybe RetrievalMetadata
forall a. Maybe a
Nothing
    , groundingMetadataWebSearchQueries :: Maybe [Text]
groundingMetadataWebSearchQueries = Maybe [Text]
forall a. Maybe a
Nothing
    , groundingMetadataGroundingChunks :: Maybe [GroundingChunk]
groundingMetadataGroundingChunks = Maybe [GroundingChunk]
forall a. Maybe a
Nothing
    , groundingMetadataSearchEntryPoint :: Maybe SearchEntryPoint
groundingMetadataSearchEntryPoint = Maybe SearchEntryPoint
forall a. Maybe a
Nothing
    , groundingMetadataGroundingSupports :: Maybe [GroundingSupport]
groundingMetadataGroundingSupports = Maybe [GroundingSupport]
forall a. Maybe a
Nothing
    }

-- ** GroundingPassage

{- | GroundingPassage
Passage included inline with a grounding configuration.
-}
data GroundingPassage = GroundingPassage
  { GroundingPassage -> Maybe Content
groundingPassageContent :: !(Maybe Content)
  -- ^ "content" - Content of the passage.
  , GroundingPassage -> Maybe Text
groundingPassageId :: !(Maybe Text)
  -- ^ "id" - Identifier for the passage for attributing this passage in grounded answers.
  }
  deriving (Int -> GroundingPassage -> ShowS
[GroundingPassage] -> ShowS
GroundingPassage -> [Char]
(Int -> GroundingPassage -> ShowS)
-> (GroundingPassage -> [Char])
-> ([GroundingPassage] -> ShowS)
-> Show GroundingPassage
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroundingPassage -> ShowS
showsPrec :: Int -> GroundingPassage -> ShowS
$cshow :: GroundingPassage -> [Char]
show :: GroundingPassage -> [Char]
$cshowList :: [GroundingPassage] -> ShowS
showList :: [GroundingPassage] -> ShowS
P.Show, GroundingPassage -> GroundingPassage -> Bool
(GroundingPassage -> GroundingPassage -> Bool)
-> (GroundingPassage -> GroundingPassage -> Bool)
-> Eq GroundingPassage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroundingPassage -> GroundingPassage -> Bool
== :: GroundingPassage -> GroundingPassage -> Bool
$c/= :: GroundingPassage -> GroundingPassage -> Bool
/= :: GroundingPassage -> GroundingPassage -> Bool
P.Eq, P.Typeable)

-- | FromJSON GroundingPassage
instance A.FromJSON GroundingPassage where
  parseJSON :: Value -> Parser GroundingPassage
parseJSON = [Char]
-> (Object -> Parser GroundingPassage)
-> Value
-> Parser GroundingPassage
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GroundingPassage" ((Object -> Parser GroundingPassage)
 -> Value -> Parser GroundingPassage)
-> (Object -> Parser GroundingPassage)
-> Value
-> Parser GroundingPassage
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Content -> Maybe Text -> GroundingPassage
GroundingPassage
      (Maybe Content -> Maybe Text -> GroundingPassage)
-> Parser (Maybe Content)
-> Parser (Maybe Text -> GroundingPassage)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Content)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"content")
      Parser (Maybe Text -> GroundingPassage)
-> Parser (Maybe Text) -> Parser GroundingPassage
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"id")

-- | ToJSON GroundingPassage
instance A.ToJSON GroundingPassage where
  toJSON :: GroundingPassage -> Value
toJSON GroundingPassage {Maybe Text
Maybe Content
groundingPassageContent :: GroundingPassage -> Maybe Content
groundingPassageId :: GroundingPassage -> Maybe Text
groundingPassageContent :: Maybe Content
groundingPassageId :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"content" Key -> Maybe Content -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Content
groundingPassageContent
      , Key
"id" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
groundingPassageId
      ]

-- | Construct a value of type 'GroundingPassage' (by applying it's required fields, if any)
mkGroundingPassage ::
  GroundingPassage
mkGroundingPassage :: GroundingPassage
mkGroundingPassage =
  GroundingPassage
    { groundingPassageContent :: Maybe Content
groundingPassageContent = Maybe Content
forall a. Maybe a
Nothing
    , groundingPassageId :: Maybe Text
groundingPassageId = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** GroundingPassageId

{- | GroundingPassageId
Identifier for a part within a `GroundingPassage`.
-}
data GroundingPassageId = GroundingPassageId
  { GroundingPassageId -> Maybe Text
groundingPassageIdPassageId :: !(Maybe Text)
  -- ^ /ReadOnly/ "passageId" - Output only. ID of the passage matching the &#x60;GenerateAnswerRequest&#x60;&#39;s &#x60;GroundingPassage.id&#x60;.
  , GroundingPassageId -> Maybe Int
groundingPassageIdPartIndex :: !(Maybe Int)
  -- ^ /ReadOnly/ "partIndex" - Output only. Index of the part within the &#x60;GenerateAnswerRequest&#x60;&#39;s &#x60;GroundingPassage.content&#x60;.
  }
  deriving (Int -> GroundingPassageId -> ShowS
[GroundingPassageId] -> ShowS
GroundingPassageId -> [Char]
(Int -> GroundingPassageId -> ShowS)
-> (GroundingPassageId -> [Char])
-> ([GroundingPassageId] -> ShowS)
-> Show GroundingPassageId
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroundingPassageId -> ShowS
showsPrec :: Int -> GroundingPassageId -> ShowS
$cshow :: GroundingPassageId -> [Char]
show :: GroundingPassageId -> [Char]
$cshowList :: [GroundingPassageId] -> ShowS
showList :: [GroundingPassageId] -> ShowS
P.Show, GroundingPassageId -> GroundingPassageId -> Bool
(GroundingPassageId -> GroundingPassageId -> Bool)
-> (GroundingPassageId -> GroundingPassageId -> Bool)
-> Eq GroundingPassageId
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroundingPassageId -> GroundingPassageId -> Bool
== :: GroundingPassageId -> GroundingPassageId -> Bool
$c/= :: GroundingPassageId -> GroundingPassageId -> Bool
/= :: GroundingPassageId -> GroundingPassageId -> Bool
P.Eq, P.Typeable)

-- | FromJSON GroundingPassageId
instance A.FromJSON GroundingPassageId where
  parseJSON :: Value -> Parser GroundingPassageId
parseJSON = [Char]
-> (Object -> Parser GroundingPassageId)
-> Value
-> Parser GroundingPassageId
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GroundingPassageId" ((Object -> Parser GroundingPassageId)
 -> Value -> Parser GroundingPassageId)
-> (Object -> Parser GroundingPassageId)
-> Value
-> Parser GroundingPassageId
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe Int -> GroundingPassageId
GroundingPassageId
      (Maybe Text -> Maybe Int -> GroundingPassageId)
-> Parser (Maybe Text) -> Parser (Maybe Int -> GroundingPassageId)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"passageId")
      Parser (Maybe Int -> GroundingPassageId)
-> Parser (Maybe Int) -> Parser GroundingPassageId
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"partIndex")

-- | ToJSON GroundingPassageId
instance A.ToJSON GroundingPassageId where
  toJSON :: GroundingPassageId -> Value
toJSON GroundingPassageId {Maybe Int
Maybe Text
groundingPassageIdPassageId :: GroundingPassageId -> Maybe Text
groundingPassageIdPartIndex :: GroundingPassageId -> Maybe Int
groundingPassageIdPassageId :: Maybe Text
groundingPassageIdPartIndex :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"passageId" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
groundingPassageIdPassageId
      , Key
"partIndex" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
groundingPassageIdPartIndex
      ]

-- | Construct a value of type 'GroundingPassageId' (by applying it's required fields, if any)
mkGroundingPassageId ::
  GroundingPassageId
mkGroundingPassageId :: GroundingPassageId
mkGroundingPassageId =
  GroundingPassageId
    { groundingPassageIdPassageId :: Maybe Text
groundingPassageIdPassageId = Maybe Text
forall a. Maybe a
Nothing
    , groundingPassageIdPartIndex :: Maybe Int
groundingPassageIdPartIndex = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** GroundingPassages

{- | GroundingPassages
A repeated list of passages.
-}
data GroundingPassages = GroundingPassages
  { GroundingPassages -> Maybe [GroundingPassage]
groundingPassagesPassages :: !(Maybe [GroundingPassage])
  -- ^ "passages" - List of passages.
  }
  deriving (Int -> GroundingPassages -> ShowS
[GroundingPassages] -> ShowS
GroundingPassages -> [Char]
(Int -> GroundingPassages -> ShowS)
-> (GroundingPassages -> [Char])
-> ([GroundingPassages] -> ShowS)
-> Show GroundingPassages
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroundingPassages -> ShowS
showsPrec :: Int -> GroundingPassages -> ShowS
$cshow :: GroundingPassages -> [Char]
show :: GroundingPassages -> [Char]
$cshowList :: [GroundingPassages] -> ShowS
showList :: [GroundingPassages] -> ShowS
P.Show, GroundingPassages -> GroundingPassages -> Bool
(GroundingPassages -> GroundingPassages -> Bool)
-> (GroundingPassages -> GroundingPassages -> Bool)
-> Eq GroundingPassages
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroundingPassages -> GroundingPassages -> Bool
== :: GroundingPassages -> GroundingPassages -> Bool
$c/= :: GroundingPassages -> GroundingPassages -> Bool
/= :: GroundingPassages -> GroundingPassages -> Bool
P.Eq, P.Typeable)

-- | FromJSON GroundingPassages
instance A.FromJSON GroundingPassages where
  parseJSON :: Value -> Parser GroundingPassages
parseJSON = [Char]
-> (Object -> Parser GroundingPassages)
-> Value
-> Parser GroundingPassages
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GroundingPassages" ((Object -> Parser GroundingPassages)
 -> Value -> Parser GroundingPassages)
-> (Object -> Parser GroundingPassages)
-> Value
-> Parser GroundingPassages
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [GroundingPassage] -> GroundingPassages
GroundingPassages
      (Maybe [GroundingPassage] -> GroundingPassages)
-> Parser (Maybe [GroundingPassage]) -> Parser GroundingPassages
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [GroundingPassage])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"passages")

-- | ToJSON GroundingPassages
instance A.ToJSON GroundingPassages where
  toJSON :: GroundingPassages -> Value
toJSON GroundingPassages {Maybe [GroundingPassage]
groundingPassagesPassages :: GroundingPassages -> Maybe [GroundingPassage]
groundingPassagesPassages :: Maybe [GroundingPassage]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"passages" Key -> Maybe [GroundingPassage] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [GroundingPassage]
groundingPassagesPassages
      ]

-- | Construct a value of type 'GroundingPassages' (by applying it's required fields, if any)
mkGroundingPassages ::
  GroundingPassages
mkGroundingPassages :: GroundingPassages
mkGroundingPassages =
  GroundingPassages
    { groundingPassagesPassages :: Maybe [GroundingPassage]
groundingPassagesPassages = Maybe [GroundingPassage]
forall a. Maybe a
Nothing
    }

-- ** GroundingSupport

{- | GroundingSupport
Grounding support.
-}
data GroundingSupport = GroundingSupport
  { GroundingSupport -> Maybe [Float]
groundingSupportConfidenceScores :: !(Maybe [Float])
  -- ^ "confidenceScores" - Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. This list must have the same size as the grounding_chunk_indices.
  , GroundingSupport -> Maybe [Int]
groundingSupportGroundingChunkIndices :: !(Maybe [Int])
  -- ^ "groundingChunkIndices" - A list of indices (into &#39;grounding_chunk&#39;) specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the retrieved content attributed to the claim.
  , GroundingSupport -> Maybe Segment
groundingSupportSegment :: !(Maybe Segment)
  -- ^ "segment" - Segment of the content this support belongs to.
  }
  deriving (Int -> GroundingSupport -> ShowS
[GroundingSupport] -> ShowS
GroundingSupport -> [Char]
(Int -> GroundingSupport -> ShowS)
-> (GroundingSupport -> [Char])
-> ([GroundingSupport] -> ShowS)
-> Show GroundingSupport
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GroundingSupport -> ShowS
showsPrec :: Int -> GroundingSupport -> ShowS
$cshow :: GroundingSupport -> [Char]
show :: GroundingSupport -> [Char]
$cshowList :: [GroundingSupport] -> ShowS
showList :: [GroundingSupport] -> ShowS
P.Show, GroundingSupport -> GroundingSupport -> Bool
(GroundingSupport -> GroundingSupport -> Bool)
-> (GroundingSupport -> GroundingSupport -> Bool)
-> Eq GroundingSupport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GroundingSupport -> GroundingSupport -> Bool
== :: GroundingSupport -> GroundingSupport -> Bool
$c/= :: GroundingSupport -> GroundingSupport -> Bool
/= :: GroundingSupport -> GroundingSupport -> Bool
P.Eq, P.Typeable)

-- | FromJSON GroundingSupport
instance A.FromJSON GroundingSupport where
  parseJSON :: Value -> Parser GroundingSupport
parseJSON = [Char]
-> (Object -> Parser GroundingSupport)
-> Value
-> Parser GroundingSupport
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"GroundingSupport" ((Object -> Parser GroundingSupport)
 -> Value -> Parser GroundingSupport)
-> (Object -> Parser GroundingSupport)
-> Value
-> Parser GroundingSupport
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Float] -> Maybe [Int] -> Maybe Segment -> GroundingSupport
GroundingSupport
      (Maybe [Float] -> Maybe [Int] -> Maybe Segment -> GroundingSupport)
-> Parser (Maybe [Float])
-> Parser (Maybe [Int] -> Maybe Segment -> GroundingSupport)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Float])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"confidenceScores")
      Parser (Maybe [Int] -> Maybe Segment -> GroundingSupport)
-> Parser (Maybe [Int])
-> Parser (Maybe Segment -> GroundingSupport)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Int])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"groundingChunkIndices")
      Parser (Maybe Segment -> GroundingSupport)
-> Parser (Maybe Segment) -> Parser GroundingSupport
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Segment)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"segment")

-- | ToJSON GroundingSupport
instance A.ToJSON GroundingSupport where
  toJSON :: GroundingSupport -> Value
toJSON GroundingSupport {Maybe [Float]
Maybe [Int]
Maybe Segment
groundingSupportConfidenceScores :: GroundingSupport -> Maybe [Float]
groundingSupportGroundingChunkIndices :: GroundingSupport -> Maybe [Int]
groundingSupportSegment :: GroundingSupport -> Maybe Segment
groundingSupportConfidenceScores :: Maybe [Float]
groundingSupportGroundingChunkIndices :: Maybe [Int]
groundingSupportSegment :: Maybe Segment
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"confidenceScores" Key -> Maybe [Float] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Float]
groundingSupportConfidenceScores
      , Key
"groundingChunkIndices" Key -> Maybe [Int] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Int]
groundingSupportGroundingChunkIndices
      , Key
"segment" Key -> Maybe Segment -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Segment
groundingSupportSegment
      ]

-- | Construct a value of type 'GroundingSupport' (by applying it's required fields, if any)
mkGroundingSupport ::
  GroundingSupport
mkGroundingSupport :: GroundingSupport
mkGroundingSupport =
  GroundingSupport
    { groundingSupportConfidenceScores :: Maybe [Float]
groundingSupportConfidenceScores = Maybe [Float]
forall a. Maybe a
Nothing
    , groundingSupportGroundingChunkIndices :: Maybe [Int]
groundingSupportGroundingChunkIndices = Maybe [Int]
forall a. Maybe a
Nothing
    , groundingSupportSegment :: Maybe Segment
groundingSupportSegment = Maybe Segment
forall a. Maybe a
Nothing
    }

-- ** Hyperparameters

{- | Hyperparameters
Hyperparameters controlling the tuning process. Read more at https://ai.google.dev/docs/model_tuning_guidance
-}
data Hyperparameters = Hyperparameters
  { Hyperparameters -> Maybe Int
hyperparametersEpochCount :: !(Maybe Int)
  -- ^ "epochCount" - Immutable. The number of training epochs. An epoch is one pass through the training data. If not set, a default of 5 will be used.
  , Hyperparameters -> Maybe Float
hyperparametersLearningRate :: !(Maybe Float)
  -- ^ "learningRate" - Optional. Immutable. The learning rate hyperparameter for tuning. If not set, a default of 0.001 or 0.0002 will be calculated based on the number of training examples.
  , Hyperparameters -> Maybe Float
hyperparametersLearningRateMultiplier :: !(Maybe Float)
  -- ^ "learningRateMultiplier" - Optional. Immutable. The learning rate multiplier is used to calculate a final learning_rate based on the default (recommended) value. Actual learning rate :&#x3D; learning_rate_multiplier * default learning rate Default learning rate is dependent on base model and dataset size. If not set, a default of 1.0 will be used.
  , Hyperparameters -> Maybe Int
hyperparametersBatchSize :: !(Maybe Int)
  -- ^ "batchSize" - Immutable. The batch size hyperparameter for tuning. If not set, a default of 4 or 16 will be used based on the number of training examples.
  }
  deriving (Int -> Hyperparameters -> ShowS
[Hyperparameters] -> ShowS
Hyperparameters -> [Char]
(Int -> Hyperparameters -> ShowS)
-> (Hyperparameters -> [Char])
-> ([Hyperparameters] -> ShowS)
-> Show Hyperparameters
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Hyperparameters -> ShowS
showsPrec :: Int -> Hyperparameters -> ShowS
$cshow :: Hyperparameters -> [Char]
show :: Hyperparameters -> [Char]
$cshowList :: [Hyperparameters] -> ShowS
showList :: [Hyperparameters] -> ShowS
P.Show, Hyperparameters -> Hyperparameters -> Bool
(Hyperparameters -> Hyperparameters -> Bool)
-> (Hyperparameters -> Hyperparameters -> Bool)
-> Eq Hyperparameters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Hyperparameters -> Hyperparameters -> Bool
== :: Hyperparameters -> Hyperparameters -> Bool
$c/= :: Hyperparameters -> Hyperparameters -> Bool
/= :: Hyperparameters -> Hyperparameters -> Bool
P.Eq, P.Typeable)

-- | FromJSON Hyperparameters
instance A.FromJSON Hyperparameters where
  parseJSON :: Value -> Parser Hyperparameters
parseJSON = [Char]
-> (Object -> Parser Hyperparameters)
-> Value
-> Parser Hyperparameters
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Hyperparameters" ((Object -> Parser Hyperparameters)
 -> Value -> Parser Hyperparameters)
-> (Object -> Parser Hyperparameters)
-> Value
-> Parser Hyperparameters
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int
-> Maybe Float -> Maybe Float -> Maybe Int -> Hyperparameters
Hyperparameters
      (Maybe Int
 -> Maybe Float -> Maybe Float -> Maybe Int -> Hyperparameters)
-> Parser (Maybe Int)
-> Parser
     (Maybe Float -> Maybe Float -> Maybe Int -> Hyperparameters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"epochCount")
      Parser (Maybe Float -> Maybe Float -> Maybe Int -> Hyperparameters)
-> Parser (Maybe Float)
-> Parser (Maybe Float -> Maybe Int -> Hyperparameters)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"learningRate")
      Parser (Maybe Float -> Maybe Int -> Hyperparameters)
-> Parser (Maybe Float) -> Parser (Maybe Int -> Hyperparameters)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"learningRateMultiplier")
      Parser (Maybe Int -> Hyperparameters)
-> Parser (Maybe Int) -> Parser Hyperparameters
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"batchSize")

-- | ToJSON Hyperparameters
instance A.ToJSON Hyperparameters where
  toJSON :: Hyperparameters -> Value
toJSON Hyperparameters {Maybe Float
Maybe Int
hyperparametersEpochCount :: Hyperparameters -> Maybe Int
hyperparametersLearningRate :: Hyperparameters -> Maybe Float
hyperparametersLearningRateMultiplier :: Hyperparameters -> Maybe Float
hyperparametersBatchSize :: Hyperparameters -> Maybe Int
hyperparametersEpochCount :: Maybe Int
hyperparametersLearningRate :: Maybe Float
hyperparametersLearningRateMultiplier :: Maybe Float
hyperparametersBatchSize :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"epochCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
hyperparametersEpochCount
      , Key
"learningRate" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
hyperparametersLearningRate
      , Key
"learningRateMultiplier" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
hyperparametersLearningRateMultiplier
      , Key
"batchSize" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
hyperparametersBatchSize
      ]

-- | Construct a value of type 'Hyperparameters' (by applying it's required fields, if any)
mkHyperparameters ::
  Hyperparameters
mkHyperparameters :: Hyperparameters
mkHyperparameters =
  Hyperparameters
    { hyperparametersEpochCount :: Maybe Int
hyperparametersEpochCount = Maybe Int
forall a. Maybe a
Nothing
    , hyperparametersLearningRate :: Maybe Float
hyperparametersLearningRate = Maybe Float
forall a. Maybe a
Nothing
    , hyperparametersLearningRateMultiplier :: Maybe Float
hyperparametersLearningRateMultiplier = Maybe Float
forall a. Maybe a
Nothing
    , hyperparametersBatchSize :: Maybe Int
hyperparametersBatchSize = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** InputFeedback

{- | InputFeedback
Feedback related to the input data used to answer the question, as opposed to the model-generated response to the question.
-}
data InputFeedback = InputFeedback
  { InputFeedback -> Maybe [SafetyRating]
inputFeedbackSafetyRatings :: !(Maybe [SafetyRating])
  -- ^ "safetyRatings" - Ratings for safety of the input. There is at most one rating per category.
  , InputFeedback -> Maybe E'BlockReason2
inputFeedbackBlockReason :: !(Maybe E'BlockReason2)
  -- ^ "blockReason" - Optional. If set, the input was blocked and no candidates are returned. Rephrase the input.
  }
  deriving (Int -> InputFeedback -> ShowS
[InputFeedback] -> ShowS
InputFeedback -> [Char]
(Int -> InputFeedback -> ShowS)
-> (InputFeedback -> [Char])
-> ([InputFeedback] -> ShowS)
-> Show InputFeedback
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InputFeedback -> ShowS
showsPrec :: Int -> InputFeedback -> ShowS
$cshow :: InputFeedback -> [Char]
show :: InputFeedback -> [Char]
$cshowList :: [InputFeedback] -> ShowS
showList :: [InputFeedback] -> ShowS
P.Show, InputFeedback -> InputFeedback -> Bool
(InputFeedback -> InputFeedback -> Bool)
-> (InputFeedback -> InputFeedback -> Bool) -> Eq InputFeedback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InputFeedback -> InputFeedback -> Bool
== :: InputFeedback -> InputFeedback -> Bool
$c/= :: InputFeedback -> InputFeedback -> Bool
/= :: InputFeedback -> InputFeedback -> Bool
P.Eq, P.Typeable)

-- | FromJSON InputFeedback
instance A.FromJSON InputFeedback where
  parseJSON :: Value -> Parser InputFeedback
parseJSON = [Char]
-> (Object -> Parser InputFeedback)
-> Value
-> Parser InputFeedback
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"InputFeedback" ((Object -> Parser InputFeedback) -> Value -> Parser InputFeedback)
-> (Object -> Parser InputFeedback)
-> Value
-> Parser InputFeedback
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [SafetyRating] -> Maybe E'BlockReason2 -> InputFeedback
InputFeedback
      (Maybe [SafetyRating] -> Maybe E'BlockReason2 -> InputFeedback)
-> Parser (Maybe [SafetyRating])
-> Parser (Maybe E'BlockReason2 -> InputFeedback)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [SafetyRating])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetyRatings")
      Parser (Maybe E'BlockReason2 -> InputFeedback)
-> Parser (Maybe E'BlockReason2) -> Parser InputFeedback
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'BlockReason2)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"blockReason")

-- | ToJSON InputFeedback
instance A.ToJSON InputFeedback where
  toJSON :: InputFeedback -> Value
toJSON InputFeedback {Maybe [SafetyRating]
Maybe E'BlockReason2
inputFeedbackSafetyRatings :: InputFeedback -> Maybe [SafetyRating]
inputFeedbackBlockReason :: InputFeedback -> Maybe E'BlockReason2
inputFeedbackSafetyRatings :: Maybe [SafetyRating]
inputFeedbackBlockReason :: Maybe E'BlockReason2
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"safetyRatings" Key -> Maybe [SafetyRating] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetyRating]
inputFeedbackSafetyRatings
      , Key
"blockReason" Key -> Maybe E'BlockReason2 -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'BlockReason2
inputFeedbackBlockReason
      ]

-- | Construct a value of type 'InputFeedback' (by applying it's required fields, if any)
mkInputFeedback ::
  InputFeedback
mkInputFeedback :: InputFeedback
mkInputFeedback =
  InputFeedback
    { inputFeedbackSafetyRatings :: Maybe [SafetyRating]
inputFeedbackSafetyRatings = Maybe [SafetyRating]
forall a. Maybe a
Nothing
    , inputFeedbackBlockReason :: Maybe E'BlockReason2
inputFeedbackBlockReason = Maybe E'BlockReason2
forall a. Maybe a
Nothing
    }

-- ** Interval

{- | Interval
Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive).  The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time.
-}
data Interval = Interval
  { Interval -> Maybe DateTime
intervalStartTime :: !(Maybe DateTime)
  -- ^ "startTime" - Optional. Inclusive start of the interval.  If specified, a Timestamp matching this interval will have to be the same or after the start.
  , Interval -> Maybe DateTime
intervalEndTime :: !(Maybe DateTime)
  -- ^ "endTime" - Optional. Exclusive end of the interval.  If specified, a Timestamp matching this interval will have to be before the end.
  }
  deriving (Int -> Interval -> ShowS
[Interval] -> ShowS
Interval -> [Char]
(Int -> Interval -> ShowS)
-> (Interval -> [Char]) -> ([Interval] -> ShowS) -> Show Interval
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Interval -> ShowS
showsPrec :: Int -> Interval -> ShowS
$cshow :: Interval -> [Char]
show :: Interval -> [Char]
$cshowList :: [Interval] -> ShowS
showList :: [Interval] -> ShowS
P.Show, Interval -> Interval -> Bool
(Interval -> Interval -> Bool)
-> (Interval -> Interval -> Bool) -> Eq Interval
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Interval -> Interval -> Bool
== :: Interval -> Interval -> Bool
$c/= :: Interval -> Interval -> Bool
/= :: Interval -> Interval -> Bool
P.Eq, P.Typeable)

-- | FromJSON Interval
instance A.FromJSON Interval where
  parseJSON :: Value -> Parser Interval
parseJSON = [Char] -> (Object -> Parser Interval) -> Value -> Parser Interval
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Interval" ((Object -> Parser Interval) -> Value -> Parser Interval)
-> (Object -> Parser Interval) -> Value -> Parser Interval
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe DateTime -> Maybe DateTime -> Interval
Interval
      (Maybe DateTime -> Maybe DateTime -> Interval)
-> Parser (Maybe DateTime) -> Parser (Maybe DateTime -> Interval)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"startTime")
      Parser (Maybe DateTime -> Interval)
-> Parser (Maybe DateTime) -> Parser Interval
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"endTime")

-- | ToJSON Interval
instance A.ToJSON Interval where
  toJSON :: Interval -> Value
toJSON Interval {Maybe DateTime
intervalStartTime :: Interval -> Maybe DateTime
intervalEndTime :: Interval -> Maybe DateTime
intervalStartTime :: Maybe DateTime
intervalEndTime :: Maybe DateTime
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"startTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
intervalStartTime
      , Key
"endTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
intervalEndTime
      ]

-- | Construct a value of type 'Interval' (by applying it's required fields, if any)
mkInterval ::
  Interval
mkInterval :: Interval
mkInterval =
  Interval
    { intervalStartTime :: Maybe DateTime
intervalStartTime = Maybe DateTime
forall a. Maybe a
Nothing
    , intervalEndTime :: Maybe DateTime
intervalEndTime = Maybe DateTime
forall a. Maybe a
Nothing
    }

-- ** ListCachedContentsResponse

{- | ListCachedContentsResponse
Response with CachedContents list.
-}
data ListCachedContentsResponse = ListCachedContentsResponse
  { ListCachedContentsResponse -> Maybe Text
listCachedContentsResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token, which can be sent as &#x60;page_token&#x60; to retrieve the next page. If this field is omitted, there are no subsequent pages.
  , ListCachedContentsResponse -> Maybe [CachedContent]
listCachedContentsResponseCachedContents :: !(Maybe [CachedContent])
  -- ^ "cachedContents" - List of cached contents.
  }
  deriving (Int -> ListCachedContentsResponse -> ShowS
[ListCachedContentsResponse] -> ShowS
ListCachedContentsResponse -> [Char]
(Int -> ListCachedContentsResponse -> ShowS)
-> (ListCachedContentsResponse -> [Char])
-> ([ListCachedContentsResponse] -> ShowS)
-> Show ListCachedContentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListCachedContentsResponse -> ShowS
showsPrec :: Int -> ListCachedContentsResponse -> ShowS
$cshow :: ListCachedContentsResponse -> [Char]
show :: ListCachedContentsResponse -> [Char]
$cshowList :: [ListCachedContentsResponse] -> ShowS
showList :: [ListCachedContentsResponse] -> ShowS
P.Show, ListCachedContentsResponse -> ListCachedContentsResponse -> Bool
(ListCachedContentsResponse -> ListCachedContentsResponse -> Bool)
-> (ListCachedContentsResponse
    -> ListCachedContentsResponse -> Bool)
-> Eq ListCachedContentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListCachedContentsResponse -> ListCachedContentsResponse -> Bool
== :: ListCachedContentsResponse -> ListCachedContentsResponse -> Bool
$c/= :: ListCachedContentsResponse -> ListCachedContentsResponse -> Bool
/= :: ListCachedContentsResponse -> ListCachedContentsResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListCachedContentsResponse
instance A.FromJSON ListCachedContentsResponse where
  parseJSON :: Value -> Parser ListCachedContentsResponse
parseJSON = [Char]
-> (Object -> Parser ListCachedContentsResponse)
-> Value
-> Parser ListCachedContentsResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListCachedContentsResponse" ((Object -> Parser ListCachedContentsResponse)
 -> Value -> Parser ListCachedContentsResponse)
-> (Object -> Parser ListCachedContentsResponse)
-> Value
-> Parser ListCachedContentsResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe [CachedContent] -> ListCachedContentsResponse
ListCachedContentsResponse
      (Maybe Text -> Maybe [CachedContent] -> ListCachedContentsResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [CachedContent] -> ListCachedContentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")
      Parser (Maybe [CachedContent] -> ListCachedContentsResponse)
-> Parser (Maybe [CachedContent])
-> Parser ListCachedContentsResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [CachedContent])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"cachedContents")

-- | ToJSON ListCachedContentsResponse
instance A.ToJSON ListCachedContentsResponse where
  toJSON :: ListCachedContentsResponse -> Value
toJSON ListCachedContentsResponse {Maybe [CachedContent]
Maybe Text
listCachedContentsResponseNextPageToken :: ListCachedContentsResponse -> Maybe Text
listCachedContentsResponseCachedContents :: ListCachedContentsResponse -> Maybe [CachedContent]
listCachedContentsResponseNextPageToken :: Maybe Text
listCachedContentsResponseCachedContents :: Maybe [CachedContent]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listCachedContentsResponseNextPageToken
      , Key
"cachedContents" Key -> Maybe [CachedContent] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [CachedContent]
listCachedContentsResponseCachedContents
      ]

-- | Construct a value of type 'ListCachedContentsResponse' (by applying it's required fields, if any)
mkListCachedContentsResponse ::
  ListCachedContentsResponse
mkListCachedContentsResponse :: ListCachedContentsResponse
mkListCachedContentsResponse =
  ListCachedContentsResponse
    { listCachedContentsResponseNextPageToken :: Maybe Text
listCachedContentsResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    , listCachedContentsResponseCachedContents :: Maybe [CachedContent]
listCachedContentsResponseCachedContents = Maybe [CachedContent]
forall a. Maybe a
Nothing
    }

-- ** ListChunksResponse

{- | ListChunksResponse
Response from `ListChunks` containing a paginated list of `Chunk`s. The `Chunk`s are sorted by ascending `chunk.create_time`.
-}
data ListChunksResponse = ListChunksResponse
  { ListChunksResponse -> Maybe Text
listChunksResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token, which can be sent as &#x60;page_token&#x60; to retrieve the next page. If this field is omitted, there are no more pages.
  , ListChunksResponse -> Maybe [Chunk]
listChunksResponseChunks :: !(Maybe [Chunk])
  -- ^ "chunks" - The returned &#x60;Chunk&#x60;s.
  }
  deriving (Int -> ListChunksResponse -> ShowS
[ListChunksResponse] -> ShowS
ListChunksResponse -> [Char]
(Int -> ListChunksResponse -> ShowS)
-> (ListChunksResponse -> [Char])
-> ([ListChunksResponse] -> ShowS)
-> Show ListChunksResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListChunksResponse -> ShowS
showsPrec :: Int -> ListChunksResponse -> ShowS
$cshow :: ListChunksResponse -> [Char]
show :: ListChunksResponse -> [Char]
$cshowList :: [ListChunksResponse] -> ShowS
showList :: [ListChunksResponse] -> ShowS
P.Show, ListChunksResponse -> ListChunksResponse -> Bool
(ListChunksResponse -> ListChunksResponse -> Bool)
-> (ListChunksResponse -> ListChunksResponse -> Bool)
-> Eq ListChunksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListChunksResponse -> ListChunksResponse -> Bool
== :: ListChunksResponse -> ListChunksResponse -> Bool
$c/= :: ListChunksResponse -> ListChunksResponse -> Bool
/= :: ListChunksResponse -> ListChunksResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListChunksResponse
instance A.FromJSON ListChunksResponse where
  parseJSON :: Value -> Parser ListChunksResponse
parseJSON = [Char]
-> (Object -> Parser ListChunksResponse)
-> Value
-> Parser ListChunksResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListChunksResponse" ((Object -> Parser ListChunksResponse)
 -> Value -> Parser ListChunksResponse)
-> (Object -> Parser ListChunksResponse)
-> Value
-> Parser ListChunksResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe [Chunk] -> ListChunksResponse
ListChunksResponse
      (Maybe Text -> Maybe [Chunk] -> ListChunksResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [Chunk] -> ListChunksResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")
      Parser (Maybe [Chunk] -> ListChunksResponse)
-> Parser (Maybe [Chunk]) -> Parser ListChunksResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Chunk])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"chunks")

-- | ToJSON ListChunksResponse
instance A.ToJSON ListChunksResponse where
  toJSON :: ListChunksResponse -> Value
toJSON ListChunksResponse {Maybe [Chunk]
Maybe Text
listChunksResponseNextPageToken :: ListChunksResponse -> Maybe Text
listChunksResponseChunks :: ListChunksResponse -> Maybe [Chunk]
listChunksResponseNextPageToken :: Maybe Text
listChunksResponseChunks :: Maybe [Chunk]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listChunksResponseNextPageToken
      , Key
"chunks" Key -> Maybe [Chunk] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Chunk]
listChunksResponseChunks
      ]

-- | Construct a value of type 'ListChunksResponse' (by applying it's required fields, if any)
mkListChunksResponse ::
  ListChunksResponse
mkListChunksResponse :: ListChunksResponse
mkListChunksResponse =
  ListChunksResponse
    { listChunksResponseNextPageToken :: Maybe Text
listChunksResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    , listChunksResponseChunks :: Maybe [Chunk]
listChunksResponseChunks = Maybe [Chunk]
forall a. Maybe a
Nothing
    }

-- ** ListCorporaResponse

{- | ListCorporaResponse
Response from `ListCorpora` containing a paginated list of `Corpora`. The results are sorted by ascending `corpus.create_time`.
-}
data ListCorporaResponse = ListCorporaResponse
  { ListCorporaResponse -> Maybe [Corpus]
listCorporaResponseCorpora :: !(Maybe [Corpus])
  -- ^ "corpora" - The returned corpora.
  , ListCorporaResponse -> Maybe Text
listCorporaResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token, which can be sent as &#x60;page_token&#x60; to retrieve the next page. If this field is omitted, there are no more pages.
  }
  deriving (Int -> ListCorporaResponse -> ShowS
[ListCorporaResponse] -> ShowS
ListCorporaResponse -> [Char]
(Int -> ListCorporaResponse -> ShowS)
-> (ListCorporaResponse -> [Char])
-> ([ListCorporaResponse] -> ShowS)
-> Show ListCorporaResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListCorporaResponse -> ShowS
showsPrec :: Int -> ListCorporaResponse -> ShowS
$cshow :: ListCorporaResponse -> [Char]
show :: ListCorporaResponse -> [Char]
$cshowList :: [ListCorporaResponse] -> ShowS
showList :: [ListCorporaResponse] -> ShowS
P.Show, ListCorporaResponse -> ListCorporaResponse -> Bool
(ListCorporaResponse -> ListCorporaResponse -> Bool)
-> (ListCorporaResponse -> ListCorporaResponse -> Bool)
-> Eq ListCorporaResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListCorporaResponse -> ListCorporaResponse -> Bool
== :: ListCorporaResponse -> ListCorporaResponse -> Bool
$c/= :: ListCorporaResponse -> ListCorporaResponse -> Bool
/= :: ListCorporaResponse -> ListCorporaResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListCorporaResponse
instance A.FromJSON ListCorporaResponse where
  parseJSON :: Value -> Parser ListCorporaResponse
parseJSON = [Char]
-> (Object -> Parser ListCorporaResponse)
-> Value
-> Parser ListCorporaResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListCorporaResponse" ((Object -> Parser ListCorporaResponse)
 -> Value -> Parser ListCorporaResponse)
-> (Object -> Parser ListCorporaResponse)
-> Value
-> Parser ListCorporaResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Corpus] -> Maybe Text -> ListCorporaResponse
ListCorporaResponse
      (Maybe [Corpus] -> Maybe Text -> ListCorporaResponse)
-> Parser (Maybe [Corpus])
-> Parser (Maybe Text -> ListCorporaResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Corpus])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"corpora")
      Parser (Maybe Text -> ListCorporaResponse)
-> Parser (Maybe Text) -> Parser ListCorporaResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")

-- | ToJSON ListCorporaResponse
instance A.ToJSON ListCorporaResponse where
  toJSON :: ListCorporaResponse -> Value
toJSON ListCorporaResponse {Maybe [Corpus]
Maybe Text
listCorporaResponseCorpora :: ListCorporaResponse -> Maybe [Corpus]
listCorporaResponseNextPageToken :: ListCorporaResponse -> Maybe Text
listCorporaResponseCorpora :: Maybe [Corpus]
listCorporaResponseNextPageToken :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"corpora" Key -> Maybe [Corpus] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Corpus]
listCorporaResponseCorpora
      , Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listCorporaResponseNextPageToken
      ]

-- | Construct a value of type 'ListCorporaResponse' (by applying it's required fields, if any)
mkListCorporaResponse ::
  ListCorporaResponse
mkListCorporaResponse :: ListCorporaResponse
mkListCorporaResponse =
  ListCorporaResponse
    { listCorporaResponseCorpora :: Maybe [Corpus]
listCorporaResponseCorpora = Maybe [Corpus]
forall a. Maybe a
Nothing
    , listCorporaResponseNextPageToken :: Maybe Text
listCorporaResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** ListDocumentsResponse

{- | ListDocumentsResponse
Response from `ListDocuments` containing a paginated list of `Document`s. The `Document`s are sorted by ascending `document.create_time`.
-}
data ListDocumentsResponse = ListDocumentsResponse
  { ListDocumentsResponse -> Maybe Text
listDocumentsResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token, which can be sent as &#x60;page_token&#x60; to retrieve the next page. If this field is omitted, there are no more pages.
  , ListDocumentsResponse -> Maybe [Document]
listDocumentsResponseDocuments :: !(Maybe [Document])
  -- ^ "documents" - The returned &#x60;Document&#x60;s.
  }
  deriving (Int -> ListDocumentsResponse -> ShowS
[ListDocumentsResponse] -> ShowS
ListDocumentsResponse -> [Char]
(Int -> ListDocumentsResponse -> ShowS)
-> (ListDocumentsResponse -> [Char])
-> ([ListDocumentsResponse] -> ShowS)
-> Show ListDocumentsResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListDocumentsResponse -> ShowS
showsPrec :: Int -> ListDocumentsResponse -> ShowS
$cshow :: ListDocumentsResponse -> [Char]
show :: ListDocumentsResponse -> [Char]
$cshowList :: [ListDocumentsResponse] -> ShowS
showList :: [ListDocumentsResponse] -> ShowS
P.Show, ListDocumentsResponse -> ListDocumentsResponse -> Bool
(ListDocumentsResponse -> ListDocumentsResponse -> Bool)
-> (ListDocumentsResponse -> ListDocumentsResponse -> Bool)
-> Eq ListDocumentsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListDocumentsResponse -> ListDocumentsResponse -> Bool
== :: ListDocumentsResponse -> ListDocumentsResponse -> Bool
$c/= :: ListDocumentsResponse -> ListDocumentsResponse -> Bool
/= :: ListDocumentsResponse -> ListDocumentsResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListDocumentsResponse
instance A.FromJSON ListDocumentsResponse where
  parseJSON :: Value -> Parser ListDocumentsResponse
parseJSON = [Char]
-> (Object -> Parser ListDocumentsResponse)
-> Value
-> Parser ListDocumentsResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListDocumentsResponse" ((Object -> Parser ListDocumentsResponse)
 -> Value -> Parser ListDocumentsResponse)
-> (Object -> Parser ListDocumentsResponse)
-> Value
-> Parser ListDocumentsResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe [Document] -> ListDocumentsResponse
ListDocumentsResponse
      (Maybe Text -> Maybe [Document] -> ListDocumentsResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [Document] -> ListDocumentsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")
      Parser (Maybe [Document] -> ListDocumentsResponse)
-> Parser (Maybe [Document]) -> Parser ListDocumentsResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Document])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"documents")

-- | ToJSON ListDocumentsResponse
instance A.ToJSON ListDocumentsResponse where
  toJSON :: ListDocumentsResponse -> Value
toJSON ListDocumentsResponse {Maybe [Document]
Maybe Text
listDocumentsResponseNextPageToken :: ListDocumentsResponse -> Maybe Text
listDocumentsResponseDocuments :: ListDocumentsResponse -> Maybe [Document]
listDocumentsResponseNextPageToken :: Maybe Text
listDocumentsResponseDocuments :: Maybe [Document]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listDocumentsResponseNextPageToken
      , Key
"documents" Key -> Maybe [Document] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Document]
listDocumentsResponseDocuments
      ]

-- | Construct a value of type 'ListDocumentsResponse' (by applying it's required fields, if any)
mkListDocumentsResponse ::
  ListDocumentsResponse
mkListDocumentsResponse :: ListDocumentsResponse
mkListDocumentsResponse =
  ListDocumentsResponse
    { listDocumentsResponseNextPageToken :: Maybe Text
listDocumentsResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    , listDocumentsResponseDocuments :: Maybe [Document]
listDocumentsResponseDocuments = Maybe [Document]
forall a. Maybe a
Nothing
    }

-- ** ListFilesResponse

{- | ListFilesResponse
Response for `ListFiles`.
-}
data ListFilesResponse = ListFilesResponse
  { ListFilesResponse -> Maybe Text
listFilesResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token that can be sent as a &#x60;page_token&#x60; into a subsequent &#x60;ListFiles&#x60; call.
  , ListFilesResponse -> Maybe [File]
listFilesResponseFiles :: !(Maybe [File])
  -- ^ "files" - The list of &#x60;File&#x60;s.
  }
  deriving (Int -> ListFilesResponse -> ShowS
[ListFilesResponse] -> ShowS
ListFilesResponse -> [Char]
(Int -> ListFilesResponse -> ShowS)
-> (ListFilesResponse -> [Char])
-> ([ListFilesResponse] -> ShowS)
-> Show ListFilesResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListFilesResponse -> ShowS
showsPrec :: Int -> ListFilesResponse -> ShowS
$cshow :: ListFilesResponse -> [Char]
show :: ListFilesResponse -> [Char]
$cshowList :: [ListFilesResponse] -> ShowS
showList :: [ListFilesResponse] -> ShowS
P.Show, ListFilesResponse -> ListFilesResponse -> Bool
(ListFilesResponse -> ListFilesResponse -> Bool)
-> (ListFilesResponse -> ListFilesResponse -> Bool)
-> Eq ListFilesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListFilesResponse -> ListFilesResponse -> Bool
== :: ListFilesResponse -> ListFilesResponse -> Bool
$c/= :: ListFilesResponse -> ListFilesResponse -> Bool
/= :: ListFilesResponse -> ListFilesResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListFilesResponse
instance A.FromJSON ListFilesResponse where
  parseJSON :: Value -> Parser ListFilesResponse
parseJSON = [Char]
-> (Object -> Parser ListFilesResponse)
-> Value
-> Parser ListFilesResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListFilesResponse" ((Object -> Parser ListFilesResponse)
 -> Value -> Parser ListFilesResponse)
-> (Object -> Parser ListFilesResponse)
-> Value
-> Parser ListFilesResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe [File] -> ListFilesResponse
ListFilesResponse
      (Maybe Text -> Maybe [File] -> ListFilesResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [File] -> ListFilesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")
      Parser (Maybe [File] -> ListFilesResponse)
-> Parser (Maybe [File]) -> Parser ListFilesResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [File])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"files")

-- | ToJSON ListFilesResponse
instance A.ToJSON ListFilesResponse where
  toJSON :: ListFilesResponse -> Value
toJSON ListFilesResponse {Maybe [File]
Maybe Text
listFilesResponseNextPageToken :: ListFilesResponse -> Maybe Text
listFilesResponseFiles :: ListFilesResponse -> Maybe [File]
listFilesResponseNextPageToken :: Maybe Text
listFilesResponseFiles :: Maybe [File]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listFilesResponseNextPageToken
      , Key
"files" Key -> Maybe [File] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [File]
listFilesResponseFiles
      ]

-- | Construct a value of type 'ListFilesResponse' (by applying it's required fields, if any)
mkListFilesResponse ::
  ListFilesResponse
mkListFilesResponse :: ListFilesResponse
mkListFilesResponse =
  ListFilesResponse
    { listFilesResponseNextPageToken :: Maybe Text
listFilesResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    , listFilesResponseFiles :: Maybe [File]
listFilesResponseFiles = Maybe [File]
forall a. Maybe a
Nothing
    }

-- ** ListGeneratedFilesResponse

{- | ListGeneratedFilesResponse
Response for `ListGeneratedFiles`.
-}
data ListGeneratedFilesResponse = ListGeneratedFilesResponse
  { ListGeneratedFilesResponse -> Maybe Text
listGeneratedFilesResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token that can be sent as a &#x60;page_token&#x60; into a subsequent &#x60;ListGeneratedFiles&#x60; call.
  , ListGeneratedFilesResponse -> Maybe [GeneratedFile]
listGeneratedFilesResponseGeneratedFiles :: !(Maybe [GeneratedFile])
  -- ^ "generatedFiles" - The list of &#x60;GeneratedFile&#x60;s.
  }
  deriving (Int -> ListGeneratedFilesResponse -> ShowS
[ListGeneratedFilesResponse] -> ShowS
ListGeneratedFilesResponse -> [Char]
(Int -> ListGeneratedFilesResponse -> ShowS)
-> (ListGeneratedFilesResponse -> [Char])
-> ([ListGeneratedFilesResponse] -> ShowS)
-> Show ListGeneratedFilesResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListGeneratedFilesResponse -> ShowS
showsPrec :: Int -> ListGeneratedFilesResponse -> ShowS
$cshow :: ListGeneratedFilesResponse -> [Char]
show :: ListGeneratedFilesResponse -> [Char]
$cshowList :: [ListGeneratedFilesResponse] -> ShowS
showList :: [ListGeneratedFilesResponse] -> ShowS
P.Show, ListGeneratedFilesResponse -> ListGeneratedFilesResponse -> Bool
(ListGeneratedFilesResponse -> ListGeneratedFilesResponse -> Bool)
-> (ListGeneratedFilesResponse
    -> ListGeneratedFilesResponse -> Bool)
-> Eq ListGeneratedFilesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListGeneratedFilesResponse -> ListGeneratedFilesResponse -> Bool
== :: ListGeneratedFilesResponse -> ListGeneratedFilesResponse -> Bool
$c/= :: ListGeneratedFilesResponse -> ListGeneratedFilesResponse -> Bool
/= :: ListGeneratedFilesResponse -> ListGeneratedFilesResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListGeneratedFilesResponse
instance A.FromJSON ListGeneratedFilesResponse where
  parseJSON :: Value -> Parser ListGeneratedFilesResponse
parseJSON = [Char]
-> (Object -> Parser ListGeneratedFilesResponse)
-> Value
-> Parser ListGeneratedFilesResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListGeneratedFilesResponse" ((Object -> Parser ListGeneratedFilesResponse)
 -> Value -> Parser ListGeneratedFilesResponse)
-> (Object -> Parser ListGeneratedFilesResponse)
-> Value
-> Parser ListGeneratedFilesResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe [GeneratedFile] -> ListGeneratedFilesResponse
ListGeneratedFilesResponse
      (Maybe Text -> Maybe [GeneratedFile] -> ListGeneratedFilesResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [GeneratedFile] -> ListGeneratedFilesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")
      Parser (Maybe [GeneratedFile] -> ListGeneratedFilesResponse)
-> Parser (Maybe [GeneratedFile])
-> Parser ListGeneratedFilesResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [GeneratedFile])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"generatedFiles")

-- | ToJSON ListGeneratedFilesResponse
instance A.ToJSON ListGeneratedFilesResponse where
  toJSON :: ListGeneratedFilesResponse -> Value
toJSON ListGeneratedFilesResponse {Maybe [GeneratedFile]
Maybe Text
listGeneratedFilesResponseNextPageToken :: ListGeneratedFilesResponse -> Maybe Text
listGeneratedFilesResponseGeneratedFiles :: ListGeneratedFilesResponse -> Maybe [GeneratedFile]
listGeneratedFilesResponseNextPageToken :: Maybe Text
listGeneratedFilesResponseGeneratedFiles :: Maybe [GeneratedFile]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listGeneratedFilesResponseNextPageToken
      , Key
"generatedFiles" Key -> Maybe [GeneratedFile] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [GeneratedFile]
listGeneratedFilesResponseGeneratedFiles
      ]

-- | Construct a value of type 'ListGeneratedFilesResponse' (by applying it's required fields, if any)
mkListGeneratedFilesResponse ::
  ListGeneratedFilesResponse
mkListGeneratedFilesResponse :: ListGeneratedFilesResponse
mkListGeneratedFilesResponse =
  ListGeneratedFilesResponse
    { listGeneratedFilesResponseNextPageToken :: Maybe Text
listGeneratedFilesResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    , listGeneratedFilesResponseGeneratedFiles :: Maybe [GeneratedFile]
listGeneratedFilesResponseGeneratedFiles = Maybe [GeneratedFile]
forall a. Maybe a
Nothing
    }

-- ** ListModelsResponse

{- | ListModelsResponse
Response from `ListModel` containing a paginated list of Models.
-}
data ListModelsResponse = ListModelsResponse
  { ListModelsResponse -> Maybe [Model]
listModelsResponseModels :: !(Maybe [Model])
  -- ^ "models" - The returned Models.
  , ListModelsResponse -> Maybe Text
listModelsResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token, which can be sent as &#x60;page_token&#x60; to retrieve the next page.  If this field is omitted, there are no more pages.
  }
  deriving (Int -> ListModelsResponse -> ShowS
[ListModelsResponse] -> ShowS
ListModelsResponse -> [Char]
(Int -> ListModelsResponse -> ShowS)
-> (ListModelsResponse -> [Char])
-> ([ListModelsResponse] -> ShowS)
-> Show ListModelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListModelsResponse -> ShowS
showsPrec :: Int -> ListModelsResponse -> ShowS
$cshow :: ListModelsResponse -> [Char]
show :: ListModelsResponse -> [Char]
$cshowList :: [ListModelsResponse] -> ShowS
showList :: [ListModelsResponse] -> ShowS
P.Show, ListModelsResponse -> ListModelsResponse -> Bool
(ListModelsResponse -> ListModelsResponse -> Bool)
-> (ListModelsResponse -> ListModelsResponse -> Bool)
-> Eq ListModelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListModelsResponse -> ListModelsResponse -> Bool
== :: ListModelsResponse -> ListModelsResponse -> Bool
$c/= :: ListModelsResponse -> ListModelsResponse -> Bool
/= :: ListModelsResponse -> ListModelsResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListModelsResponse
instance A.FromJSON ListModelsResponse where
  parseJSON :: Value -> Parser ListModelsResponse
parseJSON = [Char]
-> (Object -> Parser ListModelsResponse)
-> Value
-> Parser ListModelsResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListModelsResponse" ((Object -> Parser ListModelsResponse)
 -> Value -> Parser ListModelsResponse)
-> (Object -> Parser ListModelsResponse)
-> Value
-> Parser ListModelsResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Model] -> Maybe Text -> ListModelsResponse
ListModelsResponse
      (Maybe [Model] -> Maybe Text -> ListModelsResponse)
-> Parser (Maybe [Model])
-> Parser (Maybe Text -> ListModelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Model])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"models")
      Parser (Maybe Text -> ListModelsResponse)
-> Parser (Maybe Text) -> Parser ListModelsResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")

-- | ToJSON ListModelsResponse
instance A.ToJSON ListModelsResponse where
  toJSON :: ListModelsResponse -> Value
toJSON ListModelsResponse {Maybe [Model]
Maybe Text
listModelsResponseModels :: ListModelsResponse -> Maybe [Model]
listModelsResponseNextPageToken :: ListModelsResponse -> Maybe Text
listModelsResponseModels :: Maybe [Model]
listModelsResponseNextPageToken :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"models" Key -> Maybe [Model] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Model]
listModelsResponseModels
      , Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listModelsResponseNextPageToken
      ]

-- | Construct a value of type 'ListModelsResponse' (by applying it's required fields, if any)
mkListModelsResponse ::
  ListModelsResponse
mkListModelsResponse :: ListModelsResponse
mkListModelsResponse =
  ListModelsResponse
    { listModelsResponseModels :: Maybe [Model]
listModelsResponseModels = Maybe [Model]
forall a. Maybe a
Nothing
    , listModelsResponseNextPageToken :: Maybe Text
listModelsResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** ListOperationsResponse

{- | ListOperationsResponse
The response message for Operations.ListOperations.
-}
data ListOperationsResponse = ListOperationsResponse
  { ListOperationsResponse -> Maybe Text
listOperationsResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - The standard List next-page token.
  , ListOperationsResponse -> Maybe [Operation]
listOperationsResponseOperations :: !(Maybe [Operation])
  -- ^ "operations" - A list of operations that matches the specified filter in the request.
  }
  deriving (Int -> ListOperationsResponse -> ShowS
[ListOperationsResponse] -> ShowS
ListOperationsResponse -> [Char]
(Int -> ListOperationsResponse -> ShowS)
-> (ListOperationsResponse -> [Char])
-> ([ListOperationsResponse] -> ShowS)
-> Show ListOperationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListOperationsResponse -> ShowS
showsPrec :: Int -> ListOperationsResponse -> ShowS
$cshow :: ListOperationsResponse -> [Char]
show :: ListOperationsResponse -> [Char]
$cshowList :: [ListOperationsResponse] -> ShowS
showList :: [ListOperationsResponse] -> ShowS
P.Show, ListOperationsResponse -> ListOperationsResponse -> Bool
(ListOperationsResponse -> ListOperationsResponse -> Bool)
-> (ListOperationsResponse -> ListOperationsResponse -> Bool)
-> Eq ListOperationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListOperationsResponse -> ListOperationsResponse -> Bool
== :: ListOperationsResponse -> ListOperationsResponse -> Bool
$c/= :: ListOperationsResponse -> ListOperationsResponse -> Bool
/= :: ListOperationsResponse -> ListOperationsResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListOperationsResponse
instance A.FromJSON ListOperationsResponse where
  parseJSON :: Value -> Parser ListOperationsResponse
parseJSON = [Char]
-> (Object -> Parser ListOperationsResponse)
-> Value
-> Parser ListOperationsResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListOperationsResponse" ((Object -> Parser ListOperationsResponse)
 -> Value -> Parser ListOperationsResponse)
-> (Object -> Parser ListOperationsResponse)
-> Value
-> Parser ListOperationsResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe [Operation] -> ListOperationsResponse
ListOperationsResponse
      (Maybe Text -> Maybe [Operation] -> ListOperationsResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [Operation] -> ListOperationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")
      Parser (Maybe [Operation] -> ListOperationsResponse)
-> Parser (Maybe [Operation]) -> Parser ListOperationsResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Operation])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"operations")

-- | ToJSON ListOperationsResponse
instance A.ToJSON ListOperationsResponse where
  toJSON :: ListOperationsResponse -> Value
toJSON ListOperationsResponse {Maybe [Operation]
Maybe Text
listOperationsResponseNextPageToken :: ListOperationsResponse -> Maybe Text
listOperationsResponseOperations :: ListOperationsResponse -> Maybe [Operation]
listOperationsResponseNextPageToken :: Maybe Text
listOperationsResponseOperations :: Maybe [Operation]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listOperationsResponseNextPageToken
      , Key
"operations" Key -> Maybe [Operation] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Operation]
listOperationsResponseOperations
      ]

-- | Construct a value of type 'ListOperationsResponse' (by applying it's required fields, if any)
mkListOperationsResponse ::
  ListOperationsResponse
mkListOperationsResponse :: ListOperationsResponse
mkListOperationsResponse =
  ListOperationsResponse
    { listOperationsResponseNextPageToken :: Maybe Text
listOperationsResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    , listOperationsResponseOperations :: Maybe [Operation]
listOperationsResponseOperations = Maybe [Operation]
forall a. Maybe a
Nothing
    }

-- ** ListPermissionsResponse

{- | ListPermissionsResponse
Response from `ListPermissions` containing a paginated list of permissions.
-}
data ListPermissionsResponse = ListPermissionsResponse
  { ListPermissionsResponse -> Maybe [Permission]
listPermissionsResponsePermissions :: !(Maybe [Permission])
  -- ^ "permissions" - Returned permissions.
  , ListPermissionsResponse -> Maybe Text
listPermissionsResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token, which can be sent as &#x60;page_token&#x60; to retrieve the next page.  If this field is omitted, there are no more pages.
  }
  deriving (Int -> ListPermissionsResponse -> ShowS
[ListPermissionsResponse] -> ShowS
ListPermissionsResponse -> [Char]
(Int -> ListPermissionsResponse -> ShowS)
-> (ListPermissionsResponse -> [Char])
-> ([ListPermissionsResponse] -> ShowS)
-> Show ListPermissionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListPermissionsResponse -> ShowS
showsPrec :: Int -> ListPermissionsResponse -> ShowS
$cshow :: ListPermissionsResponse -> [Char]
show :: ListPermissionsResponse -> [Char]
$cshowList :: [ListPermissionsResponse] -> ShowS
showList :: [ListPermissionsResponse] -> ShowS
P.Show, ListPermissionsResponse -> ListPermissionsResponse -> Bool
(ListPermissionsResponse -> ListPermissionsResponse -> Bool)
-> (ListPermissionsResponse -> ListPermissionsResponse -> Bool)
-> Eq ListPermissionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
== :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
$c/= :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
/= :: ListPermissionsResponse -> ListPermissionsResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListPermissionsResponse
instance A.FromJSON ListPermissionsResponse where
  parseJSON :: Value -> Parser ListPermissionsResponse
parseJSON = [Char]
-> (Object -> Parser ListPermissionsResponse)
-> Value
-> Parser ListPermissionsResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListPermissionsResponse" ((Object -> Parser ListPermissionsResponse)
 -> Value -> Parser ListPermissionsResponse)
-> (Object -> Parser ListPermissionsResponse)
-> Value
-> Parser ListPermissionsResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Permission] -> Maybe Text -> ListPermissionsResponse
ListPermissionsResponse
      (Maybe [Permission] -> Maybe Text -> ListPermissionsResponse)
-> Parser (Maybe [Permission])
-> Parser (Maybe Text -> ListPermissionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Permission])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"permissions")
      Parser (Maybe Text -> ListPermissionsResponse)
-> Parser (Maybe Text) -> Parser ListPermissionsResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")

-- | ToJSON ListPermissionsResponse
instance A.ToJSON ListPermissionsResponse where
  toJSON :: ListPermissionsResponse -> Value
toJSON ListPermissionsResponse {Maybe [Permission]
Maybe Text
listPermissionsResponsePermissions :: ListPermissionsResponse -> Maybe [Permission]
listPermissionsResponseNextPageToken :: ListPermissionsResponse -> Maybe Text
listPermissionsResponsePermissions :: Maybe [Permission]
listPermissionsResponseNextPageToken :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"permissions" Key -> Maybe [Permission] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Permission]
listPermissionsResponsePermissions
      , Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listPermissionsResponseNextPageToken
      ]

-- | Construct a value of type 'ListPermissionsResponse' (by applying it's required fields, if any)
mkListPermissionsResponse ::
  ListPermissionsResponse
mkListPermissionsResponse :: ListPermissionsResponse
mkListPermissionsResponse =
  ListPermissionsResponse
    { listPermissionsResponsePermissions :: Maybe [Permission]
listPermissionsResponsePermissions = Maybe [Permission]
forall a. Maybe a
Nothing
    , listPermissionsResponseNextPageToken :: Maybe Text
listPermissionsResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** ListTunedModelsResponse

{- | ListTunedModelsResponse
Response from `ListTunedModels` containing a paginated list of Models.
-}
data ListTunedModelsResponse = ListTunedModelsResponse
  { ListTunedModelsResponse -> Maybe Text
listTunedModelsResponseNextPageToken :: !(Maybe Text)
  -- ^ "nextPageToken" - A token, which can be sent as &#x60;page_token&#x60; to retrieve the next page.  If this field is omitted, there are no more pages.
  , ListTunedModelsResponse -> Maybe [TunedModel]
listTunedModelsResponseTunedModels :: !(Maybe [TunedModel])
  -- ^ "tunedModels" - The returned Models.
  }
  deriving (Int -> ListTunedModelsResponse -> ShowS
[ListTunedModelsResponse] -> ShowS
ListTunedModelsResponse -> [Char]
(Int -> ListTunedModelsResponse -> ShowS)
-> (ListTunedModelsResponse -> [Char])
-> ([ListTunedModelsResponse] -> ShowS)
-> Show ListTunedModelsResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ListTunedModelsResponse -> ShowS
showsPrec :: Int -> ListTunedModelsResponse -> ShowS
$cshow :: ListTunedModelsResponse -> [Char]
show :: ListTunedModelsResponse -> [Char]
$cshowList :: [ListTunedModelsResponse] -> ShowS
showList :: [ListTunedModelsResponse] -> ShowS
P.Show, ListTunedModelsResponse -> ListTunedModelsResponse -> Bool
(ListTunedModelsResponse -> ListTunedModelsResponse -> Bool)
-> (ListTunedModelsResponse -> ListTunedModelsResponse -> Bool)
-> Eq ListTunedModelsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ListTunedModelsResponse -> ListTunedModelsResponse -> Bool
== :: ListTunedModelsResponse -> ListTunedModelsResponse -> Bool
$c/= :: ListTunedModelsResponse -> ListTunedModelsResponse -> Bool
/= :: ListTunedModelsResponse -> ListTunedModelsResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON ListTunedModelsResponse
instance A.FromJSON ListTunedModelsResponse where
  parseJSON :: Value -> Parser ListTunedModelsResponse
parseJSON = [Char]
-> (Object -> Parser ListTunedModelsResponse)
-> Value
-> Parser ListTunedModelsResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ListTunedModelsResponse" ((Object -> Parser ListTunedModelsResponse)
 -> Value -> Parser ListTunedModelsResponse)
-> (Object -> Parser ListTunedModelsResponse)
-> Value
-> Parser ListTunedModelsResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe [TunedModel] -> ListTunedModelsResponse
ListTunedModelsResponse
      (Maybe Text -> Maybe [TunedModel] -> ListTunedModelsResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [TunedModel] -> ListTunedModelsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nextPageToken")
      Parser (Maybe [TunedModel] -> ListTunedModelsResponse)
-> Parser (Maybe [TunedModel]) -> Parser ListTunedModelsResponse
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [TunedModel])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tunedModels")

-- | ToJSON ListTunedModelsResponse
instance A.ToJSON ListTunedModelsResponse where
  toJSON :: ListTunedModelsResponse -> Value
toJSON ListTunedModelsResponse {Maybe [TunedModel]
Maybe Text
listTunedModelsResponseNextPageToken :: ListTunedModelsResponse -> Maybe Text
listTunedModelsResponseTunedModels :: ListTunedModelsResponse -> Maybe [TunedModel]
listTunedModelsResponseNextPageToken :: Maybe Text
listTunedModelsResponseTunedModels :: Maybe [TunedModel]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"nextPageToken" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
listTunedModelsResponseNextPageToken
      , Key
"tunedModels" Key -> Maybe [TunedModel] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [TunedModel]
listTunedModelsResponseTunedModels
      ]

-- | Construct a value of type 'ListTunedModelsResponse' (by applying it's required fields, if any)
mkListTunedModelsResponse ::
  ListTunedModelsResponse
mkListTunedModelsResponse :: ListTunedModelsResponse
mkListTunedModelsResponse =
  ListTunedModelsResponse
    { listTunedModelsResponseNextPageToken :: Maybe Text
listTunedModelsResponseNextPageToken = Maybe Text
forall a. Maybe a
Nothing
    , listTunedModelsResponseTunedModels :: Maybe [TunedModel]
listTunedModelsResponseTunedModels = Maybe [TunedModel]
forall a. Maybe a
Nothing
    }

-- ** LogprobsResult

{- | LogprobsResult
Logprobs Result
-}
data LogprobsResult = LogprobsResult
  { LogprobsResult -> Maybe [LogprobsResultCandidate]
logprobsResultChosenCandidates :: !(Maybe [LogprobsResultCandidate])
  -- ^ "chosenCandidates" - Length &#x3D; total number of decoding steps. The chosen candidates may or may not be in top_candidates.
  , LogprobsResult -> Maybe [TopCandidates]
logprobsResultTopCandidates :: !(Maybe [TopCandidates])
  -- ^ "topCandidates" - Length &#x3D; total number of decoding steps.
  }
  deriving (Int -> LogprobsResult -> ShowS
[LogprobsResult] -> ShowS
LogprobsResult -> [Char]
(Int -> LogprobsResult -> ShowS)
-> (LogprobsResult -> [Char])
-> ([LogprobsResult] -> ShowS)
-> Show LogprobsResult
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LogprobsResult -> ShowS
showsPrec :: Int -> LogprobsResult -> ShowS
$cshow :: LogprobsResult -> [Char]
show :: LogprobsResult -> [Char]
$cshowList :: [LogprobsResult] -> ShowS
showList :: [LogprobsResult] -> ShowS
P.Show, LogprobsResult -> LogprobsResult -> Bool
(LogprobsResult -> LogprobsResult -> Bool)
-> (LogprobsResult -> LogprobsResult -> Bool) -> Eq LogprobsResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LogprobsResult -> LogprobsResult -> Bool
== :: LogprobsResult -> LogprobsResult -> Bool
$c/= :: LogprobsResult -> LogprobsResult -> Bool
/= :: LogprobsResult -> LogprobsResult -> Bool
P.Eq, P.Typeable)

-- | FromJSON LogprobsResult
instance A.FromJSON LogprobsResult where
  parseJSON :: Value -> Parser LogprobsResult
parseJSON = [Char]
-> (Object -> Parser LogprobsResult)
-> Value
-> Parser LogprobsResult
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"LogprobsResult" ((Object -> Parser LogprobsResult)
 -> Value -> Parser LogprobsResult)
-> (Object -> Parser LogprobsResult)
-> Value
-> Parser LogprobsResult
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [LogprobsResultCandidate]
-> Maybe [TopCandidates] -> LogprobsResult
LogprobsResult
      (Maybe [LogprobsResultCandidate]
 -> Maybe [TopCandidates] -> LogprobsResult)
-> Parser (Maybe [LogprobsResultCandidate])
-> Parser (Maybe [TopCandidates] -> LogprobsResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [LogprobsResultCandidate])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"chosenCandidates")
      Parser (Maybe [TopCandidates] -> LogprobsResult)
-> Parser (Maybe [TopCandidates]) -> Parser LogprobsResult
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [TopCandidates])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topCandidates")

-- | ToJSON LogprobsResult
instance A.ToJSON LogprobsResult where
  toJSON :: LogprobsResult -> Value
toJSON LogprobsResult {Maybe [LogprobsResultCandidate]
Maybe [TopCandidates]
logprobsResultChosenCandidates :: LogprobsResult -> Maybe [LogprobsResultCandidate]
logprobsResultTopCandidates :: LogprobsResult -> Maybe [TopCandidates]
logprobsResultChosenCandidates :: Maybe [LogprobsResultCandidate]
logprobsResultTopCandidates :: Maybe [TopCandidates]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"chosenCandidates" Key -> Maybe [LogprobsResultCandidate] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [LogprobsResultCandidate]
logprobsResultChosenCandidates
      , Key
"topCandidates" Key -> Maybe [TopCandidates] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [TopCandidates]
logprobsResultTopCandidates
      ]

-- | Construct a value of type 'LogprobsResult' (by applying it's required fields, if any)
mkLogprobsResult ::
  LogprobsResult
mkLogprobsResult :: LogprobsResult
mkLogprobsResult =
  LogprobsResult
    { logprobsResultChosenCandidates :: Maybe [LogprobsResultCandidate]
logprobsResultChosenCandidates = Maybe [LogprobsResultCandidate]
forall a. Maybe a
Nothing
    , logprobsResultTopCandidates :: Maybe [TopCandidates]
logprobsResultTopCandidates = Maybe [TopCandidates]
forall a. Maybe a
Nothing
    }

-- ** LogprobsResultCandidate

{- | LogprobsResultCandidate
Candidate for the logprobs token and score.
-}
data LogprobsResultCandidate = LogprobsResultCandidate
  { LogprobsResultCandidate -> Maybe Float
logprobsResultCandidateLogProbability :: !(Maybe Float)
  -- ^ "logProbability" - The candidate&#39;s log probability.
  , LogprobsResultCandidate -> Maybe Int
logprobsResultCandidateTokenId :: !(Maybe Int)
  -- ^ "tokenId" - The candidate’s token id value.
  , LogprobsResultCandidate -> Maybe Text
logprobsResultCandidateToken :: !(Maybe Text)
  -- ^ "token" - The candidate’s token string value.
  }
  deriving (Int -> LogprobsResultCandidate -> ShowS
[LogprobsResultCandidate] -> ShowS
LogprobsResultCandidate -> [Char]
(Int -> LogprobsResultCandidate -> ShowS)
-> (LogprobsResultCandidate -> [Char])
-> ([LogprobsResultCandidate] -> ShowS)
-> Show LogprobsResultCandidate
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LogprobsResultCandidate -> ShowS
showsPrec :: Int -> LogprobsResultCandidate -> ShowS
$cshow :: LogprobsResultCandidate -> [Char]
show :: LogprobsResultCandidate -> [Char]
$cshowList :: [LogprobsResultCandidate] -> ShowS
showList :: [LogprobsResultCandidate] -> ShowS
P.Show, LogprobsResultCandidate -> LogprobsResultCandidate -> Bool
(LogprobsResultCandidate -> LogprobsResultCandidate -> Bool)
-> (LogprobsResultCandidate -> LogprobsResultCandidate -> Bool)
-> Eq LogprobsResultCandidate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LogprobsResultCandidate -> LogprobsResultCandidate -> Bool
== :: LogprobsResultCandidate -> LogprobsResultCandidate -> Bool
$c/= :: LogprobsResultCandidate -> LogprobsResultCandidate -> Bool
/= :: LogprobsResultCandidate -> LogprobsResultCandidate -> Bool
P.Eq, P.Typeable)

-- | FromJSON LogprobsResultCandidate
instance A.FromJSON LogprobsResultCandidate where
  parseJSON :: Value -> Parser LogprobsResultCandidate
parseJSON = [Char]
-> (Object -> Parser LogprobsResultCandidate)
-> Value
-> Parser LogprobsResultCandidate
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"LogprobsResultCandidate" ((Object -> Parser LogprobsResultCandidate)
 -> Value -> Parser LogprobsResultCandidate)
-> (Object -> Parser LogprobsResultCandidate)
-> Value
-> Parser LogprobsResultCandidate
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Float -> Maybe Int -> Maybe Text -> LogprobsResultCandidate
LogprobsResultCandidate
      (Maybe Float -> Maybe Int -> Maybe Text -> LogprobsResultCandidate)
-> Parser (Maybe Float)
-> Parser (Maybe Int -> Maybe Text -> LogprobsResultCandidate)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"logProbability")
      Parser (Maybe Int -> Maybe Text -> LogprobsResultCandidate)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> LogprobsResultCandidate)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tokenId")
      Parser (Maybe Text -> LogprobsResultCandidate)
-> Parser (Maybe Text) -> Parser LogprobsResultCandidate
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"token")

-- | ToJSON LogprobsResultCandidate
instance A.ToJSON LogprobsResultCandidate where
  toJSON :: LogprobsResultCandidate -> Value
toJSON LogprobsResultCandidate {Maybe Float
Maybe Int
Maybe Text
logprobsResultCandidateLogProbability :: LogprobsResultCandidate -> Maybe Float
logprobsResultCandidateTokenId :: LogprobsResultCandidate -> Maybe Int
logprobsResultCandidateToken :: LogprobsResultCandidate -> Maybe Text
logprobsResultCandidateLogProbability :: Maybe Float
logprobsResultCandidateTokenId :: Maybe Int
logprobsResultCandidateToken :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"logProbability" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
logprobsResultCandidateLogProbability
      , Key
"tokenId" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
logprobsResultCandidateTokenId
      , Key
"token" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
logprobsResultCandidateToken
      ]

-- | Construct a value of type 'LogprobsResultCandidate' (by applying it's required fields, if any)
mkLogprobsResultCandidate ::
  LogprobsResultCandidate
mkLogprobsResultCandidate :: LogprobsResultCandidate
mkLogprobsResultCandidate =
  LogprobsResultCandidate
    { logprobsResultCandidateLogProbability :: Maybe Float
logprobsResultCandidateLogProbability = Maybe Float
forall a. Maybe a
Nothing
    , logprobsResultCandidateTokenId :: Maybe Int
logprobsResultCandidateTokenId = Maybe Int
forall a. Maybe a
Nothing
    , logprobsResultCandidateToken :: Maybe Text
logprobsResultCandidateToken = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** Media

{- | Media
A proto encapsulate various type of media.
-}
data Media = Media
  { Media -> Maybe Video
mediaVideo :: !(Maybe Video)
  -- ^ "video" - Video as the only one for now.  This is mimicking Vertex proto.
  }
  deriving (Int -> Media -> ShowS
[Media] -> ShowS
Media -> [Char]
(Int -> Media -> ShowS)
-> (Media -> [Char]) -> ([Media] -> ShowS) -> Show Media
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Media -> ShowS
showsPrec :: Int -> Media -> ShowS
$cshow :: Media -> [Char]
show :: Media -> [Char]
$cshowList :: [Media] -> ShowS
showList :: [Media] -> ShowS
P.Show, Media -> Media -> Bool
(Media -> Media -> Bool) -> (Media -> Media -> Bool) -> Eq Media
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Media -> Media -> Bool
== :: Media -> Media -> Bool
$c/= :: Media -> Media -> Bool
/= :: Media -> Media -> Bool
P.Eq, P.Typeable)

-- | FromJSON Media
instance A.FromJSON Media where
  parseJSON :: Value -> Parser Media
parseJSON = [Char] -> (Object -> Parser Media) -> Value -> Parser Media
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Media" ((Object -> Parser Media) -> Value -> Parser Media)
-> (Object -> Parser Media) -> Value -> Parser Media
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Video -> Media
Media
      (Maybe Video -> Media) -> Parser (Maybe Video) -> Parser Media
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Video)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"video")

-- | ToJSON Media
instance A.ToJSON Media where
  toJSON :: Media -> Value
toJSON Media {Maybe Video
mediaVideo :: Media -> Maybe Video
mediaVideo :: Maybe Video
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"video" Key -> Maybe Video -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Video
mediaVideo
      ]

-- | Construct a value of type 'Media' (by applying it's required fields, if any)
mkMedia ::
  Media
mkMedia :: Media
mkMedia =
  Media
    { mediaVideo :: Maybe Video
mediaVideo = Maybe Video
forall a. Maybe a
Nothing
    }

-- ** Message

{- | Message
The base unit of structured text.  A `Message` includes an `author` and the `content` of the `Message`.  The `author` is used to tag messages when they are fed to the model as text.
-}
data Message = Message
  { Message -> Maybe CitationMetadata
messageCitationMetadata :: !(Maybe CitationMetadata)
  -- ^ /ReadOnly/ "citationMetadata" - Output only. Citation information for model-generated &#x60;content&#x60; in this &#x60;Message&#x60;.  If this &#x60;Message&#x60; was generated as output from the model, this field may be populated with attribution information for any text included in the &#x60;content&#x60;. This field is used only on output.
  , Message -> Maybe Text
messageAuthor :: !(Maybe Text)
  -- ^ "author" - Optional. The author of this Message.  This serves as a key for tagging the content of this Message when it is fed to the model as text.  The author can be any alphanumeric string.
  , Message -> Text
messageContent :: !(Text)
  -- ^ /Required/ "content" - Required. The text content of the structured &#x60;Message&#x60;.
  }
  deriving (Int -> Message -> ShowS
[Message] -> ShowS
Message -> [Char]
(Int -> Message -> ShowS)
-> (Message -> [Char]) -> ([Message] -> ShowS) -> Show Message
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Message -> ShowS
showsPrec :: Int -> Message -> ShowS
$cshow :: Message -> [Char]
show :: Message -> [Char]
$cshowList :: [Message] -> ShowS
showList :: [Message] -> ShowS
P.Show, Message -> Message -> Bool
(Message -> Message -> Bool)
-> (Message -> Message -> Bool) -> Eq Message
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Message -> Message -> Bool
== :: Message -> Message -> Bool
$c/= :: Message -> Message -> Bool
/= :: Message -> Message -> Bool
P.Eq, P.Typeable)

-- | FromJSON Message
instance A.FromJSON Message where
  parseJSON :: Value -> Parser Message
parseJSON = [Char] -> (Object -> Parser Message) -> Value -> Parser Message
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Message" ((Object -> Parser Message) -> Value -> Parser Message)
-> (Object -> Parser Message) -> Value -> Parser Message
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe CitationMetadata -> Maybe Text -> Text -> Message
Message
      (Maybe CitationMetadata -> Maybe Text -> Text -> Message)
-> Parser (Maybe CitationMetadata)
-> Parser (Maybe Text -> Text -> Message)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe CitationMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"citationMetadata")
      Parser (Maybe Text -> Text -> Message)
-> Parser (Maybe Text) -> Parser (Text -> Message)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"author")
      Parser (Text -> Message) -> Parser Text -> Parser Message
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"content")

-- | ToJSON Message
instance A.ToJSON Message where
  toJSON :: Message -> Value
toJSON Message {Maybe Text
Maybe CitationMetadata
Text
messageCitationMetadata :: Message -> Maybe CitationMetadata
messageAuthor :: Message -> Maybe Text
messageContent :: Message -> Text
messageCitationMetadata :: Maybe CitationMetadata
messageAuthor :: Maybe Text
messageContent :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"citationMetadata" Key -> Maybe CitationMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe CitationMetadata
messageCitationMetadata
      , Key
"author" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
messageAuthor
      , Key
"content" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
messageContent
      ]

-- | Construct a value of type 'Message' (by applying it's required fields, if any)
mkMessage ::
  -- | 'messageContent': Required. The text content of the structured `Message`.
  Text ->
  Message
mkMessage :: Text -> Message
mkMessage Text
messageContent =
  Message
    { messageCitationMetadata :: Maybe CitationMetadata
messageCitationMetadata = Maybe CitationMetadata
forall a. Maybe a
Nothing
    , messageAuthor :: Maybe Text
messageAuthor = Maybe Text
forall a. Maybe a
Nothing
    , Text
messageContent :: Text
messageContent :: Text
messageContent
    }

-- ** MessagePrompt

{- | MessagePrompt
All of the structured input text passed to the model as a prompt.  A `MessagePrompt` contains a structured set of fields that provide context for the conversation, examples of user input/model output message pairs that prime the model to respond in different ways, and the conversation history or list of messages representing the alternating turns of the conversation between the user and the model.
-}
data MessagePrompt = MessagePrompt
  { MessagePrompt -> Maybe Text
messagePromptContext :: !(Maybe Text)
  -- ^ "context" - Optional. Text that should be provided to the model first to ground the response.  If not empty, this &#x60;context&#x60; will be given to the model first before the &#x60;examples&#x60; and &#x60;messages&#x60;. When using a &#x60;context&#x60; be sure to provide it with every request to maintain continuity.  This field can be a description of your prompt to the model to help provide context and guide the responses. Examples: \&quot;Translate the phrase from English to French.\&quot; or \&quot;Given a statement, classify the sentiment as happy, sad or neutral.\&quot;  Anything included in this field will take precedence over message history if the total input size exceeds the model&#39;s &#x60;input_token_limit&#x60; and the input request is truncated.
  , MessagePrompt -> [Message]
messagePromptMessages :: !([Message])
  -- ^ /Required/ "messages" - Required. A snapshot of the recent conversation history sorted chronologically.  Turns alternate between two authors.  If the total input size exceeds the model&#39;s &#x60;input_token_limit&#x60; the input will be truncated: The oldest items will be dropped from &#x60;messages&#x60;.
  , MessagePrompt -> Maybe [Example]
messagePromptExamples :: !(Maybe [Example])
  -- ^ "examples" - Optional. Examples of what the model should generate.  This includes both user input and the response that the model should emulate.  These &#x60;examples&#x60; are treated identically to conversation messages except that they take precedence over the history in &#x60;messages&#x60;: If the total input size exceeds the model&#39;s &#x60;input_token_limit&#x60; the input will be truncated. Items will be dropped from &#x60;messages&#x60; before &#x60;examples&#x60;.
  }
  deriving (Int -> MessagePrompt -> ShowS
[MessagePrompt] -> ShowS
MessagePrompt -> [Char]
(Int -> MessagePrompt -> ShowS)
-> (MessagePrompt -> [Char])
-> ([MessagePrompt] -> ShowS)
-> Show MessagePrompt
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MessagePrompt -> ShowS
showsPrec :: Int -> MessagePrompt -> ShowS
$cshow :: MessagePrompt -> [Char]
show :: MessagePrompt -> [Char]
$cshowList :: [MessagePrompt] -> ShowS
showList :: [MessagePrompt] -> ShowS
P.Show, MessagePrompt -> MessagePrompt -> Bool
(MessagePrompt -> MessagePrompt -> Bool)
-> (MessagePrompt -> MessagePrompt -> Bool) -> Eq MessagePrompt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MessagePrompt -> MessagePrompt -> Bool
== :: MessagePrompt -> MessagePrompt -> Bool
$c/= :: MessagePrompt -> MessagePrompt -> Bool
/= :: MessagePrompt -> MessagePrompt -> Bool
P.Eq, P.Typeable)

-- | FromJSON MessagePrompt
instance A.FromJSON MessagePrompt where
  parseJSON :: Value -> Parser MessagePrompt
parseJSON = [Char]
-> (Object -> Parser MessagePrompt)
-> Value
-> Parser MessagePrompt
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"MessagePrompt" ((Object -> Parser MessagePrompt) -> Value -> Parser MessagePrompt)
-> (Object -> Parser MessagePrompt)
-> Value
-> Parser MessagePrompt
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> [Message] -> Maybe [Example] -> MessagePrompt
MessagePrompt
      (Maybe Text -> [Message] -> Maybe [Example] -> MessagePrompt)
-> Parser (Maybe Text)
-> Parser ([Message] -> Maybe [Example] -> MessagePrompt)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"context")
      Parser ([Message] -> Maybe [Example] -> MessagePrompt)
-> Parser [Message] -> Parser (Maybe [Example] -> MessagePrompt)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser [Message]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"messages")
      Parser (Maybe [Example] -> MessagePrompt)
-> Parser (Maybe [Example]) -> Parser MessagePrompt
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Example])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"examples")

-- | ToJSON MessagePrompt
instance A.ToJSON MessagePrompt where
  toJSON :: MessagePrompt -> Value
toJSON MessagePrompt {[Message]
Maybe [Example]
Maybe Text
messagePromptContext :: MessagePrompt -> Maybe Text
messagePromptMessages :: MessagePrompt -> [Message]
messagePromptExamples :: MessagePrompt -> Maybe [Example]
messagePromptContext :: Maybe Text
messagePromptMessages :: [Message]
messagePromptExamples :: Maybe [Example]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"context" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
messagePromptContext
      , Key
"messages" Key -> [Message] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Message]
messagePromptMessages
      , Key
"examples" Key -> Maybe [Example] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Example]
messagePromptExamples
      ]

-- | Construct a value of type 'MessagePrompt' (by applying it's required fields, if any)
mkMessagePrompt ::
  -- | 'messagePromptMessages': Required. A snapshot of the recent conversation history sorted chronologically.  Turns alternate between two authors.  If the total input size exceeds the model's `input_token_limit` the input will be truncated: The oldest items will be dropped from `messages`.
  [Message] ->
  MessagePrompt
mkMessagePrompt :: [Message] -> MessagePrompt
mkMessagePrompt [Message]
messagePromptMessages =
  MessagePrompt
    { messagePromptContext :: Maybe Text
messagePromptContext = Maybe Text
forall a. Maybe a
Nothing
    , [Message]
messagePromptMessages :: [Message]
messagePromptMessages :: [Message]
messagePromptMessages
    , messagePromptExamples :: Maybe [Example]
messagePromptExamples = Maybe [Example]
forall a. Maybe a
Nothing
    }

-- ** MetadataFilter

{- | MetadataFilter
User provided filter to limit retrieval based on `Chunk` or `Document` level metadata values. Example (genre = drama OR genre = action):   key = \"document.custom_metadata.genre\"   conditions = [{string_value = \"drama\", operation = EQUAL},                 {string_value = \"action\", operation = EQUAL}]
-}
data MetadataFilter = MetadataFilter
  { MetadataFilter -> [Condition]
metadataFilterConditions :: !([Condition])
  -- ^ /Required/ "conditions" - Required. The &#x60;Condition&#x60;s for the given key that will trigger this filter. Multiple &#x60;Condition&#x60;s are joined by logical ORs.
  , MetadataFilter -> Text
metadataFilterKey :: !(Text)
  -- ^ /Required/ "key" - Required. The key of the metadata to filter on.
  }
  deriving (Int -> MetadataFilter -> ShowS
[MetadataFilter] -> ShowS
MetadataFilter -> [Char]
(Int -> MetadataFilter -> ShowS)
-> (MetadataFilter -> [Char])
-> ([MetadataFilter] -> ShowS)
-> Show MetadataFilter
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MetadataFilter -> ShowS
showsPrec :: Int -> MetadataFilter -> ShowS
$cshow :: MetadataFilter -> [Char]
show :: MetadataFilter -> [Char]
$cshowList :: [MetadataFilter] -> ShowS
showList :: [MetadataFilter] -> ShowS
P.Show, MetadataFilter -> MetadataFilter -> Bool
(MetadataFilter -> MetadataFilter -> Bool)
-> (MetadataFilter -> MetadataFilter -> Bool) -> Eq MetadataFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MetadataFilter -> MetadataFilter -> Bool
== :: MetadataFilter -> MetadataFilter -> Bool
$c/= :: MetadataFilter -> MetadataFilter -> Bool
/= :: MetadataFilter -> MetadataFilter -> Bool
P.Eq, P.Typeable)

-- | FromJSON MetadataFilter
instance A.FromJSON MetadataFilter where
  parseJSON :: Value -> Parser MetadataFilter
parseJSON = [Char]
-> (Object -> Parser MetadataFilter)
-> Value
-> Parser MetadataFilter
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"MetadataFilter" ((Object -> Parser MetadataFilter)
 -> Value -> Parser MetadataFilter)
-> (Object -> Parser MetadataFilter)
-> Value
-> Parser MetadataFilter
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    [Condition] -> Text -> MetadataFilter
MetadataFilter
      ([Condition] -> Text -> MetadataFilter)
-> Parser [Condition] -> Parser (Text -> MetadataFilter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser [Condition]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"conditions")
      Parser (Text -> MetadataFilter)
-> Parser Text -> Parser MetadataFilter
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"key")

-- | ToJSON MetadataFilter
instance A.ToJSON MetadataFilter where
  toJSON :: MetadataFilter -> Value
toJSON MetadataFilter {[Condition]
Text
metadataFilterConditions :: MetadataFilter -> [Condition]
metadataFilterKey :: MetadataFilter -> Text
metadataFilterConditions :: [Condition]
metadataFilterKey :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"conditions" Key -> [Condition] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [Condition]
metadataFilterConditions
      , Key
"key" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
metadataFilterKey
      ]

-- | Construct a value of type 'MetadataFilter' (by applying it's required fields, if any)
mkMetadataFilter ::
  -- | 'metadataFilterConditions': Required. The `Condition`s for the given key that will trigger this filter. Multiple `Condition`s are joined by logical ORs.
  [Condition] ->
  -- | 'metadataFilterKey': Required. The key of the metadata to filter on.
  Text ->
  MetadataFilter
mkMetadataFilter :: [Condition] -> Text -> MetadataFilter
mkMetadataFilter [Condition]
metadataFilterConditions Text
metadataFilterKey =
  MetadataFilter
    { [Condition]
metadataFilterConditions :: [Condition]
metadataFilterConditions :: [Condition]
metadataFilterConditions
    , Text
metadataFilterKey :: Text
metadataFilterKey :: Text
metadataFilterKey
    }

-- ** ModalityTokenCount

{- | ModalityTokenCount
Represents token counting info for a single modality.
-}
data ModalityTokenCount = ModalityTokenCount
  { ModalityTokenCount -> Maybe Int
modalityTokenCountTokenCount :: !(Maybe Int)
  -- ^ "tokenCount" - Number of tokens.
  , ModalityTokenCount -> Maybe Modality
modalityTokenCountModality :: !(Maybe Modality)
  -- ^ "modality" - The modality associated with this token count.
  }
  deriving (Int -> ModalityTokenCount -> ShowS
[ModalityTokenCount] -> ShowS
ModalityTokenCount -> [Char]
(Int -> ModalityTokenCount -> ShowS)
-> (ModalityTokenCount -> [Char])
-> ([ModalityTokenCount] -> ShowS)
-> Show ModalityTokenCount
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ModalityTokenCount -> ShowS
showsPrec :: Int -> ModalityTokenCount -> ShowS
$cshow :: ModalityTokenCount -> [Char]
show :: ModalityTokenCount -> [Char]
$cshowList :: [ModalityTokenCount] -> ShowS
showList :: [ModalityTokenCount] -> ShowS
P.Show, ModalityTokenCount -> ModalityTokenCount -> Bool
(ModalityTokenCount -> ModalityTokenCount -> Bool)
-> (ModalityTokenCount -> ModalityTokenCount -> Bool)
-> Eq ModalityTokenCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ModalityTokenCount -> ModalityTokenCount -> Bool
== :: ModalityTokenCount -> ModalityTokenCount -> Bool
$c/= :: ModalityTokenCount -> ModalityTokenCount -> Bool
/= :: ModalityTokenCount -> ModalityTokenCount -> Bool
P.Eq, P.Typeable)

-- | FromJSON ModalityTokenCount
instance A.FromJSON ModalityTokenCount where
  parseJSON :: Value -> Parser ModalityTokenCount
parseJSON = [Char]
-> (Object -> Parser ModalityTokenCount)
-> Value
-> Parser ModalityTokenCount
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ModalityTokenCount" ((Object -> Parser ModalityTokenCount)
 -> Value -> Parser ModalityTokenCount)
-> (Object -> Parser ModalityTokenCount)
-> Value
-> Parser ModalityTokenCount
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int -> Maybe Modality -> ModalityTokenCount
ModalityTokenCount
      (Maybe Int -> Maybe Modality -> ModalityTokenCount)
-> Parser (Maybe Int)
-> Parser (Maybe Modality -> ModalityTokenCount)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tokenCount")
      Parser (Maybe Modality -> ModalityTokenCount)
-> Parser (Maybe Modality) -> Parser ModalityTokenCount
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Modality)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"modality")

-- | ToJSON ModalityTokenCount
instance A.ToJSON ModalityTokenCount where
  toJSON :: ModalityTokenCount -> Value
toJSON ModalityTokenCount {Maybe Int
Maybe Modality
modalityTokenCountTokenCount :: ModalityTokenCount -> Maybe Int
modalityTokenCountModality :: ModalityTokenCount -> Maybe Modality
modalityTokenCountTokenCount :: Maybe Int
modalityTokenCountModality :: Maybe Modality
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"tokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
modalityTokenCountTokenCount
      , Key
"modality" Key -> Maybe Modality -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Modality
modalityTokenCountModality
      ]

-- | Construct a value of type 'ModalityTokenCount' (by applying it's required fields, if any)
mkModalityTokenCount ::
  ModalityTokenCount
mkModalityTokenCount :: ModalityTokenCount
mkModalityTokenCount =
  ModalityTokenCount
    { modalityTokenCountTokenCount :: Maybe Int
modalityTokenCountTokenCount = Maybe Int
forall a. Maybe a
Nothing
    , modalityTokenCountModality :: Maybe Modality
modalityTokenCountModality = Maybe Modality
forall a. Maybe a
Nothing
    }

-- ** Model

{- | Model
Information about a Generative Language Model.
-}
data Model = Model
  { Model -> Maybe Int
modelTopK :: !(Maybe Int)
  -- ^ "topK" - For Top-k sampling.  Top-k sampling considers the set of &#x60;top_k&#x60; most probable tokens. This value specifies default to be used by the backend while making the call to the model. If empty, indicates the model doesn&#39;t use top-k sampling, and &#x60;top_k&#x60; isn&#39;t allowed as a generation parameter.
  , Model -> Text
modelName :: !(Text)
  -- ^ /Required/ "name" - Required. The resource name of the &#x60;Model&#x60;. Refer to [Model variants](https://ai.google.dev/gemini-api/docs/models/gemini#model-variations) for all allowed values.  Format: &#x60;models/{model}&#x60; with a &#x60;{model}&#x60; naming convention of:  * \&quot;{base_model_id}-{version}\&quot;  Examples:  * &#x60;models/gemini-1.5-flash-001&#x60;
  , Model -> Text
modelBaseModelId :: !(Text)
  -- ^ /Required/ "baseModelId" - Required. The name of the base model, pass this to the generation request.  Examples:  * &#x60;gemini-1.5-flash&#x60;
  , Model -> Text
modelVersion :: !(Text)
  -- ^ /Required/ "version" - Required. The version number of the model.  This represents the major version (&#x60;1.0&#x60; or &#x60;1.5&#x60;)
  , Model -> Maybe Int
modelInputTokenLimit :: !(Maybe Int)
  -- ^ "inputTokenLimit" - Maximum number of input tokens allowed for this model.
  , Model -> Maybe Float
modelTopP :: !(Maybe Float)
  -- ^ "topP" - For [Nucleus sampling](https://ai.google.dev/gemini-api/docs/prompting-strategies#top-p).  Nucleus sampling considers the smallest set of tokens whose probability sum is at least &#x60;top_p&#x60;. This value specifies default to be used by the backend while making the call to the model.
  , Model -> Maybe [Text]
modelSupportedGenerationMethods :: !(Maybe [Text])
  -- ^ "supportedGenerationMethods" - The model&#39;s supported generation methods.  The corresponding API method names are defined as Pascal case strings, such as &#x60;generateMessage&#x60; and &#x60;generateContent&#x60;.
  , Model -> Maybe Float
modelTemperature :: !(Maybe Float)
  -- ^ "temperature" - Controls the randomness of the output.  Values can range over &#x60;[0.0,max_temperature]&#x60;, inclusive. A higher value will produce responses that are more varied, while a value closer to &#x60;0.0&#x60; will typically result in less surprising responses from the model. This value specifies default to be used by the backend while making the call to the model.
  , Model -> Maybe Text
modelDisplayName :: !(Maybe Text)
  -- ^ "displayName" - The human-readable name of the model. E.g. \&quot;Gemini 1.5 Flash\&quot;.  The name can be up to 128 characters long and can consist of any UTF-8 characters.
  , Model -> Maybe Text
modelDescription :: !(Maybe Text)
  -- ^ "description" - A short description of the model.
  , Model -> Maybe Float
modelMaxTemperature :: !(Maybe Float)
  -- ^ "maxTemperature" - The maximum temperature this model can use.
  , Model -> Maybe Int
modelOutputTokenLimit :: !(Maybe Int)
  -- ^ "outputTokenLimit" - Maximum number of output tokens available for this model.
  }
  deriving (Int -> Model -> ShowS
[Model] -> ShowS
Model -> [Char]
(Int -> Model -> ShowS)
-> (Model -> [Char]) -> ([Model] -> ShowS) -> Show Model
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Model -> ShowS
showsPrec :: Int -> Model -> ShowS
$cshow :: Model -> [Char]
show :: Model -> [Char]
$cshowList :: [Model] -> ShowS
showList :: [Model] -> ShowS
P.Show, Model -> Model -> Bool
(Model -> Model -> Bool) -> (Model -> Model -> Bool) -> Eq Model
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Model -> Model -> Bool
== :: Model -> Model -> Bool
$c/= :: Model -> Model -> Bool
/= :: Model -> Model -> Bool
P.Eq, P.Typeable)

-- | FromJSON Model
instance A.FromJSON Model where
  parseJSON :: Value -> Parser Model
parseJSON = [Char] -> (Object -> Parser Model) -> Value -> Parser Model
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Model" ((Object -> Parser Model) -> Value -> Parser Model)
-> (Object -> Parser Model) -> Value -> Parser Model
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int
-> Text
-> Text
-> Text
-> Maybe Int
-> Maybe Float
-> Maybe [Text]
-> Maybe Float
-> Maybe Text
-> Maybe Text
-> Maybe Float
-> Maybe Int
-> Model
Model
      (Maybe Int
 -> Text
 -> Text
 -> Text
 -> Maybe Int
 -> Maybe Float
 -> Maybe [Text]
 -> Maybe Float
 -> Maybe Text
 -> Maybe Text
 -> Maybe Float
 -> Maybe Int
 -> Model)
-> Parser (Maybe Int)
-> Parser
     (Text
      -> Text
      -> Text
      -> Maybe Int
      -> Maybe Float
      -> Maybe [Text]
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Model)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topK")
      Parser
  (Text
   -> Text
   -> Text
   -> Maybe Int
   -> Maybe Float
   -> Maybe [Text]
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Model)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> Maybe Int
      -> Maybe Float
      -> Maybe [Text]
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"name")
      Parser
  (Text
   -> Text
   -> Maybe Int
   -> Maybe Float
   -> Maybe [Text]
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Model)
-> Parser Text
-> Parser
     (Text
      -> Maybe Int
      -> Maybe Float
      -> Maybe [Text]
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"baseModelId")
      Parser
  (Text
   -> Maybe Int
   -> Maybe Float
   -> Maybe [Text]
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Model)
-> Parser Text
-> Parser
     (Maybe Int
      -> Maybe Float
      -> Maybe [Text]
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"version")
      Parser
  (Maybe Int
   -> Maybe Float
   -> Maybe [Text]
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Model)
-> Parser (Maybe Int)
-> Parser
     (Maybe Float
      -> Maybe [Text]
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"inputTokenLimit")
      Parser
  (Maybe Float
   -> Maybe [Text]
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Model)
-> Parser (Maybe Float)
-> Parser
     (Maybe [Text]
      -> Maybe Float
      -> Maybe Text
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topP")
      Parser
  (Maybe [Text]
   -> Maybe Float
   -> Maybe Text
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Model)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Float
      -> Maybe Text -> Maybe Text -> Maybe Float -> Maybe Int -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"supportedGenerationMethods")
      Parser
  (Maybe Float
   -> Maybe Text -> Maybe Text -> Maybe Float -> Maybe Int -> Model)
-> Parser (Maybe Float)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Float -> Maybe Int -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"temperature")
      Parser
  (Maybe Text -> Maybe Text -> Maybe Float -> Maybe Int -> Model)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Float -> Maybe Int -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"displayName")
      Parser (Maybe Text -> Maybe Float -> Maybe Int -> Model)
-> Parser (Maybe Text)
-> Parser (Maybe Float -> Maybe Int -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description")
      Parser (Maybe Float -> Maybe Int -> Model)
-> Parser (Maybe Float) -> Parser (Maybe Int -> Model)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxTemperature")
      Parser (Maybe Int -> Model) -> Parser (Maybe Int) -> Parser Model
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"outputTokenLimit")

-- | ToJSON Model
instance A.ToJSON Model where
  toJSON :: Model -> Value
toJSON Model {Maybe Float
Maybe Int
Maybe [Text]
Maybe Text
Text
modelTopK :: Model -> Maybe Int
modelName :: Model -> Text
modelBaseModelId :: Model -> Text
modelVersion :: Model -> Text
modelInputTokenLimit :: Model -> Maybe Int
modelTopP :: Model -> Maybe Float
modelSupportedGenerationMethods :: Model -> Maybe [Text]
modelTemperature :: Model -> Maybe Float
modelDisplayName :: Model -> Maybe Text
modelDescription :: Model -> Maybe Text
modelMaxTemperature :: Model -> Maybe Float
modelOutputTokenLimit :: Model -> Maybe Int
modelTopK :: Maybe Int
modelName :: Text
modelBaseModelId :: Text
modelVersion :: Text
modelInputTokenLimit :: Maybe Int
modelTopP :: Maybe Float
modelSupportedGenerationMethods :: Maybe [Text]
modelTemperature :: Maybe Float
modelDisplayName :: Maybe Text
modelDescription :: Maybe Text
modelMaxTemperature :: Maybe Float
modelOutputTokenLimit :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"topK" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
modelTopK
      , Key
"name" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
modelName
      , Key
"baseModelId" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
modelBaseModelId
      , Key
"version" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
modelVersion
      , Key
"inputTokenLimit" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
modelInputTokenLimit
      , Key
"topP" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
modelTopP
      , Key
"supportedGenerationMethods" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
modelSupportedGenerationMethods
      , Key
"temperature" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
modelTemperature
      , Key
"displayName" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
modelDisplayName
      , Key
"description" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
modelDescription
      , Key
"maxTemperature" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
modelMaxTemperature
      , Key
"outputTokenLimit" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
modelOutputTokenLimit
      ]

-- | Construct a value of type 'Model' (by applying it's required fields, if any)
mkModel ::
  -- | 'modelName': Required. The resource name of the `Model`. Refer to [Model variants](https://ai.google.dev/gemini-api/docs/models/gemini#model-variations) for all allowed values.  Format: `models/{model}` with a `{model}` naming convention of:  * \"{base_model_id}-{version}\"  Examples:  * `models/gemini-1.5-flash-001`
  Text ->
  -- | 'modelBaseModelId': Required. The name of the base model, pass this to the generation request.  Examples:  * `gemini-1.5-flash`
  Text ->
  -- | 'modelVersion': Required. The version number of the model.  This represents the major version (`1.0` or `1.5`)
  Text ->
  Model
mkModel :: Text -> Text -> Text -> Model
mkModel Text
modelName Text
modelBaseModelId Text
modelVersion =
  Model
    { modelTopK :: Maybe Int
modelTopK = Maybe Int
forall a. Maybe a
Nothing
    , Text
modelName :: Text
modelName :: Text
modelName
    , Text
modelBaseModelId :: Text
modelBaseModelId :: Text
modelBaseModelId
    , Text
modelVersion :: Text
modelVersion :: Text
modelVersion
    , modelInputTokenLimit :: Maybe Int
modelInputTokenLimit = Maybe Int
forall a. Maybe a
Nothing
    , modelTopP :: Maybe Float
modelTopP = Maybe Float
forall a. Maybe a
Nothing
    , modelSupportedGenerationMethods :: Maybe [Text]
modelSupportedGenerationMethods = Maybe [Text]
forall a. Maybe a
Nothing
    , modelTemperature :: Maybe Float
modelTemperature = Maybe Float
forall a. Maybe a
Nothing
    , modelDisplayName :: Maybe Text
modelDisplayName = Maybe Text
forall a. Maybe a
Nothing
    , modelDescription :: Maybe Text
modelDescription = Maybe Text
forall a. Maybe a
Nothing
    , modelMaxTemperature :: Maybe Float
modelMaxTemperature = Maybe Float
forall a. Maybe a
Nothing
    , modelOutputTokenLimit :: Maybe Int
modelOutputTokenLimit = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** MultiSpeakerVoiceConfig

{- | MultiSpeakerVoiceConfig
The configuration for the multi-speaker setup.
-}
data MultiSpeakerVoiceConfig = MultiSpeakerVoiceConfig
  { MultiSpeakerVoiceConfig -> [SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs :: !([SpeakerVoiceConfig])
  -- ^ /Required/ "speakerVoiceConfigs" - Required. All the enabled speaker voices.
  }
  deriving (Int -> MultiSpeakerVoiceConfig -> ShowS
[MultiSpeakerVoiceConfig] -> ShowS
MultiSpeakerVoiceConfig -> [Char]
(Int -> MultiSpeakerVoiceConfig -> ShowS)
-> (MultiSpeakerVoiceConfig -> [Char])
-> ([MultiSpeakerVoiceConfig] -> ShowS)
-> Show MultiSpeakerVoiceConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MultiSpeakerVoiceConfig -> ShowS
showsPrec :: Int -> MultiSpeakerVoiceConfig -> ShowS
$cshow :: MultiSpeakerVoiceConfig -> [Char]
show :: MultiSpeakerVoiceConfig -> [Char]
$cshowList :: [MultiSpeakerVoiceConfig] -> ShowS
showList :: [MultiSpeakerVoiceConfig] -> ShowS
P.Show, MultiSpeakerVoiceConfig -> MultiSpeakerVoiceConfig -> Bool
(MultiSpeakerVoiceConfig -> MultiSpeakerVoiceConfig -> Bool)
-> (MultiSpeakerVoiceConfig -> MultiSpeakerVoiceConfig -> Bool)
-> Eq MultiSpeakerVoiceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MultiSpeakerVoiceConfig -> MultiSpeakerVoiceConfig -> Bool
== :: MultiSpeakerVoiceConfig -> MultiSpeakerVoiceConfig -> Bool
$c/= :: MultiSpeakerVoiceConfig -> MultiSpeakerVoiceConfig -> Bool
/= :: MultiSpeakerVoiceConfig -> MultiSpeakerVoiceConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON MultiSpeakerVoiceConfig
instance A.FromJSON MultiSpeakerVoiceConfig where
  parseJSON :: Value -> Parser MultiSpeakerVoiceConfig
parseJSON = [Char]
-> (Object -> Parser MultiSpeakerVoiceConfig)
-> Value
-> Parser MultiSpeakerVoiceConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"MultiSpeakerVoiceConfig" ((Object -> Parser MultiSpeakerVoiceConfig)
 -> Value -> Parser MultiSpeakerVoiceConfig)
-> (Object -> Parser MultiSpeakerVoiceConfig)
-> Value
-> Parser MultiSpeakerVoiceConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    [SpeakerVoiceConfig] -> MultiSpeakerVoiceConfig
MultiSpeakerVoiceConfig
      ([SpeakerVoiceConfig] -> MultiSpeakerVoiceConfig)
-> Parser [SpeakerVoiceConfig] -> Parser MultiSpeakerVoiceConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser [SpeakerVoiceConfig]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"speakerVoiceConfigs")

-- | ToJSON MultiSpeakerVoiceConfig
instance A.ToJSON MultiSpeakerVoiceConfig where
  toJSON :: MultiSpeakerVoiceConfig -> Value
toJSON MultiSpeakerVoiceConfig {[SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs :: MultiSpeakerVoiceConfig -> [SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs :: [SpeakerVoiceConfig]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"speakerVoiceConfigs" Key -> [SpeakerVoiceConfig] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs
      ]

-- | Construct a value of type 'MultiSpeakerVoiceConfig' (by applying it's required fields, if any)
mkMultiSpeakerVoiceConfig ::
  -- | 'multiSpeakerVoiceConfigSpeakerVoiceConfigs': Required. All the enabled speaker voices.
  [SpeakerVoiceConfig] ->
  MultiSpeakerVoiceConfig
mkMultiSpeakerVoiceConfig :: [SpeakerVoiceConfig] -> MultiSpeakerVoiceConfig
mkMultiSpeakerVoiceConfig [SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs =
  MultiSpeakerVoiceConfig
    { [SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs :: [SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs :: [SpeakerVoiceConfig]
multiSpeakerVoiceConfigSpeakerVoiceConfigs
    }

-- ** Operation

{- | Operation
This resource represents a long-running operation that is the result of a network API call.
-}
data Operation = Operation
  { Operation -> Maybe Bool
operationDone :: !(Maybe Bool)
  -- ^ "done" - If the value is &#x60;false&#x60;, it means the operation is still in progress. If &#x60;true&#x60;, the operation is completed, and either &#x60;error&#x60; or &#x60;response&#x60; is available.
  , Operation -> Maybe Text
operationName :: !(Maybe Text)
  -- ^ "name" - The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the &#x60;name&#x60; should be a resource name ending with &#x60;operations/{unique_id}&#x60;.
  , Operation -> Maybe Status
operationError :: !(Maybe Status)
  -- ^ "error" - The error result of the operation in case of failure or cancellation.
  , Operation -> Maybe (Map [Char] [Char])
operationMetadata :: !(Maybe (Map.Map String String))
  -- ^ "metadata" - Service-specific metadata associated with the operation.  It typically contains progress information and common metadata such as create time. Some services might not provide such metadata.  Any method that returns a long-running operation should document the metadata type, if any.
  , Operation -> Maybe (Map [Char] [Char])
operationResponse :: !(Maybe (Map.Map String String))
  -- ^ "response" - The normal, successful response of the operation.  If the original method returns no data on success, such as &#x60;Delete&#x60;, the response is &#x60;google.protobuf.Empty&#x60;.  If the original method is standard &#x60;Get&#x60;/&#x60;Create&#x60;/&#x60;Update&#x60;, the response should be the resource.  For other methods, the response should have the type &#x60;XxxResponse&#x60;, where &#x60;Xxx&#x60; is the original method name.  For example, if the original method name is &#x60;TakeSnapshot()&#x60;, the inferred response type is &#x60;TakeSnapshotResponse&#x60;.
  }
  deriving (Int -> Operation -> ShowS
[Operation] -> ShowS
Operation -> [Char]
(Int -> Operation -> ShowS)
-> (Operation -> [Char])
-> ([Operation] -> ShowS)
-> Show Operation
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Operation -> ShowS
showsPrec :: Int -> Operation -> ShowS
$cshow :: Operation -> [Char]
show :: Operation -> [Char]
$cshowList :: [Operation] -> ShowS
showList :: [Operation] -> ShowS
P.Show, Operation -> Operation -> Bool
(Operation -> Operation -> Bool)
-> (Operation -> Operation -> Bool) -> Eq Operation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Operation -> Operation -> Bool
== :: Operation -> Operation -> Bool
$c/= :: Operation -> Operation -> Bool
/= :: Operation -> Operation -> Bool
P.Eq, P.Typeable)

-- | FromJSON Operation
instance A.FromJSON Operation where
  parseJSON :: Value -> Parser Operation
parseJSON = [Char] -> (Object -> Parser Operation) -> Value -> Parser Operation
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Operation" ((Object -> Parser Operation) -> Value -> Parser Operation)
-> (Object -> Parser Operation) -> Value -> Parser Operation
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Bool
-> Maybe Text
-> Maybe Status
-> Maybe (Map [Char] [Char])
-> Maybe (Map [Char] [Char])
-> Operation
Operation
      (Maybe Bool
 -> Maybe Text
 -> Maybe Status
 -> Maybe (Map [Char] [Char])
 -> Maybe (Map [Char] [Char])
 -> Operation)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Status
      -> Maybe (Map [Char] [Char])
      -> Maybe (Map [Char] [Char])
      -> Operation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"done")
      Parser
  (Maybe Text
   -> Maybe Status
   -> Maybe (Map [Char] [Char])
   -> Maybe (Map [Char] [Char])
   -> Operation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Status
      -> Maybe (Map [Char] [Char])
      -> Maybe (Map [Char] [Char])
      -> Operation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser
  (Maybe Status
   -> Maybe (Map [Char] [Char])
   -> Maybe (Map [Char] [Char])
   -> Operation)
-> Parser (Maybe Status)
-> Parser
     (Maybe (Map [Char] [Char])
      -> Maybe (Map [Char] [Char]) -> Operation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"error")
      Parser
  (Maybe (Map [Char] [Char])
   -> Maybe (Map [Char] [Char]) -> Operation)
-> Parser (Maybe (Map [Char] [Char]))
-> Parser (Maybe (Map [Char] [Char]) -> Operation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe (Map [Char] [Char]))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"metadata")
      Parser (Maybe (Map [Char] [Char]) -> Operation)
-> Parser (Maybe (Map [Char] [Char])) -> Parser Operation
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe (Map [Char] [Char]))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"response")

-- | ToJSON Operation
instance A.ToJSON Operation where
  toJSON :: Operation -> Value
toJSON Operation {Maybe Bool
Maybe Text
Maybe (Map [Char] [Char])
Maybe Status
operationDone :: Operation -> Maybe Bool
operationName :: Operation -> Maybe Text
operationError :: Operation -> Maybe Status
operationMetadata :: Operation -> Maybe (Map [Char] [Char])
operationResponse :: Operation -> Maybe (Map [Char] [Char])
operationDone :: Maybe Bool
operationName :: Maybe Text
operationError :: Maybe Status
operationMetadata :: Maybe (Map [Char] [Char])
operationResponse :: Maybe (Map [Char] [Char])
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"done" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
operationDone
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
operationName
      , Key
"error" Key -> Maybe Status -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Status
operationError
      , Key
"metadata" Key -> Maybe (Map [Char] [Char]) -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe (Map [Char] [Char])
operationMetadata
      , Key
"response" Key -> Maybe (Map [Char] [Char]) -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe (Map [Char] [Char])
operationResponse
      ]

-- | Construct a value of type 'Operation' (by applying it's required fields, if any)
mkOperation ::
  Operation
mkOperation :: Operation
mkOperation =
  Operation
    { operationDone :: Maybe Bool
operationDone = Maybe Bool
forall a. Maybe a
Nothing
    , operationName :: Maybe Text
operationName = Maybe Text
forall a. Maybe a
Nothing
    , operationError :: Maybe Status
operationError = Maybe Status
forall a. Maybe a
Nothing
    , operationMetadata :: Maybe (Map [Char] [Char])
operationMetadata = Maybe (Map [Char] [Char])
forall a. Maybe a
Nothing
    , operationResponse :: Maybe (Map [Char] [Char])
operationResponse = Maybe (Map [Char] [Char])
forall a. Maybe a
Nothing
    }

-- ** Part

{- | Part
A datatype containing media that is part of a multi-part `Content` message.  A `Part` consists of data which has an associated datatype. A `Part` can only contain one of the accepted types in `Part.data`.  A `Part` must have a fixed IANA MIME type identifying the type and subtype of the media if the `inline_data` field is filled with raw bytes.
-}
data Part = Part
  { Part -> Maybe Blob
partInlineData :: !(Maybe Blob)
  -- ^ "inlineData" - Inline media bytes.
  , Part -> Maybe FunctionResponse
partFunctionResponse :: !(Maybe FunctionResponse)
  -- ^ "functionResponse" - The result output of a &#x60;FunctionCall&#x60; that contains a string representing the &#x60;FunctionDeclaration.name&#x60; and a structured JSON object containing any output from the function is used as context to the model.
  , Part -> Maybe CodeExecutionResult
partCodeExecutionResult :: !(Maybe CodeExecutionResult)
  -- ^ "codeExecutionResult" - Result of executing the &#x60;ExecutableCode&#x60;.
  , Part -> Maybe FileData
partFileData :: !(Maybe FileData)
  -- ^ "fileData" - URI based data.
  , Part -> Maybe ExecutableCode
partExecutableCode :: !(Maybe ExecutableCode)
  -- ^ "executableCode" - Code generated by the model that is meant to be executed.
  , Part -> Maybe VideoMetadata
partVideoMetadata :: !(Maybe VideoMetadata)
  -- ^ "videoMetadata" - Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data.
  , Part -> Maybe Bool
partThought :: !(Maybe Bool)
  -- ^ "thought" - Optional. Indicates if the part is thought from the model.
  , Part -> Maybe Text
partText :: !(Maybe Text)
  -- ^ "text" - Inline text.
  , Part -> Maybe ByteArray
partThoughtSignature :: !(Maybe ByteArray)
  -- ^ "thoughtSignature" - Optional. An opaque signature for the thought so it can be reused in subsequent requests.
  , Part -> Maybe FunctionCall
partFunctionCall :: !(Maybe FunctionCall)
  -- ^ "functionCall" - A predicted &#x60;FunctionCall&#x60; returned from the model that contains a string representing the &#x60;FunctionDeclaration.name&#x60; with the arguments and their values.
  }
  deriving (Int -> Part -> ShowS
[Part] -> ShowS
Part -> [Char]
(Int -> Part -> ShowS)
-> (Part -> [Char]) -> ([Part] -> ShowS) -> Show Part
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Part -> ShowS
showsPrec :: Int -> Part -> ShowS
$cshow :: Part -> [Char]
show :: Part -> [Char]
$cshowList :: [Part] -> ShowS
showList :: [Part] -> ShowS
P.Show, Part -> Part -> Bool
(Part -> Part -> Bool) -> (Part -> Part -> Bool) -> Eq Part
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Part -> Part -> Bool
== :: Part -> Part -> Bool
$c/= :: Part -> Part -> Bool
/= :: Part -> Part -> Bool
P.Eq, P.Typeable)

-- | FromJSON Part
instance A.FromJSON Part where
  parseJSON :: Value -> Parser Part
parseJSON = [Char] -> (Object -> Parser Part) -> Value -> Parser Part
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Part" ((Object -> Parser Part) -> Value -> Parser Part)
-> (Object -> Parser Part) -> Value -> Parser Part
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Blob
-> Maybe FunctionResponse
-> Maybe CodeExecutionResult
-> Maybe FileData
-> Maybe ExecutableCode
-> Maybe VideoMetadata
-> Maybe Bool
-> Maybe Text
-> Maybe ByteArray
-> Maybe FunctionCall
-> Part
Part
      (Maybe Blob
 -> Maybe FunctionResponse
 -> Maybe CodeExecutionResult
 -> Maybe FileData
 -> Maybe ExecutableCode
 -> Maybe VideoMetadata
 -> Maybe Bool
 -> Maybe Text
 -> Maybe ByteArray
 -> Maybe FunctionCall
 -> Part)
-> Parser (Maybe Blob)
-> Parser
     (Maybe FunctionResponse
      -> Maybe CodeExecutionResult
      -> Maybe FileData
      -> Maybe ExecutableCode
      -> Maybe VideoMetadata
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe FunctionCall
      -> Part)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Blob)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"inlineData")
      Parser
  (Maybe FunctionResponse
   -> Maybe CodeExecutionResult
   -> Maybe FileData
   -> Maybe ExecutableCode
   -> Maybe VideoMetadata
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe FunctionCall
   -> Part)
-> Parser (Maybe FunctionResponse)
-> Parser
     (Maybe CodeExecutionResult
      -> Maybe FileData
      -> Maybe ExecutableCode
      -> Maybe VideoMetadata
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe FunctionCall
      -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe FunctionResponse)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"functionResponse")
      Parser
  (Maybe CodeExecutionResult
   -> Maybe FileData
   -> Maybe ExecutableCode
   -> Maybe VideoMetadata
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe FunctionCall
   -> Part)
-> Parser (Maybe CodeExecutionResult)
-> Parser
     (Maybe FileData
      -> Maybe ExecutableCode
      -> Maybe VideoMetadata
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe FunctionCall
      -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe CodeExecutionResult)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"codeExecutionResult")
      Parser
  (Maybe FileData
   -> Maybe ExecutableCode
   -> Maybe VideoMetadata
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe FunctionCall
   -> Part)
-> Parser (Maybe FileData)
-> Parser
     (Maybe ExecutableCode
      -> Maybe VideoMetadata
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe FunctionCall
      -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe FileData)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"fileData")
      Parser
  (Maybe ExecutableCode
   -> Maybe VideoMetadata
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe FunctionCall
   -> Part)
-> Parser (Maybe ExecutableCode)
-> Parser
     (Maybe VideoMetadata
      -> Maybe Bool
      -> Maybe Text
      -> Maybe ByteArray
      -> Maybe FunctionCall
      -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe ExecutableCode)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"executableCode")
      Parser
  (Maybe VideoMetadata
   -> Maybe Bool
   -> Maybe Text
   -> Maybe ByteArray
   -> Maybe FunctionCall
   -> Part)
-> Parser (Maybe VideoMetadata)
-> Parser
     (Maybe Bool
      -> Maybe Text -> Maybe ByteArray -> Maybe FunctionCall -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe VideoMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"videoMetadata")
      Parser
  (Maybe Bool
   -> Maybe Text -> Maybe ByteArray -> Maybe FunctionCall -> Part)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text -> Maybe ByteArray -> Maybe FunctionCall -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"thought")
      Parser
  (Maybe Text -> Maybe ByteArray -> Maybe FunctionCall -> Part)
-> Parser (Maybe Text)
-> Parser (Maybe ByteArray -> Maybe FunctionCall -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"text")
      Parser (Maybe ByteArray -> Maybe FunctionCall -> Part)
-> Parser (Maybe ByteArray) -> Parser (Maybe FunctionCall -> Part)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe ByteArray)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"thoughtSignature")
      Parser (Maybe FunctionCall -> Part)
-> Parser (Maybe FunctionCall) -> Parser Part
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe FunctionCall)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"functionCall")

-- | ToJSON Part
instance A.ToJSON Part where
  toJSON :: Part -> Value
toJSON Part {Maybe Bool
Maybe Text
Maybe ByteArray
Maybe Blob
Maybe CodeExecutionResult
Maybe ExecutableCode
Maybe FileData
Maybe FunctionCall
Maybe FunctionResponse
Maybe VideoMetadata
partInlineData :: Part -> Maybe Blob
partFunctionResponse :: Part -> Maybe FunctionResponse
partCodeExecutionResult :: Part -> Maybe CodeExecutionResult
partFileData :: Part -> Maybe FileData
partExecutableCode :: Part -> Maybe ExecutableCode
partVideoMetadata :: Part -> Maybe VideoMetadata
partThought :: Part -> Maybe Bool
partText :: Part -> Maybe Text
partThoughtSignature :: Part -> Maybe ByteArray
partFunctionCall :: Part -> Maybe FunctionCall
partInlineData :: Maybe Blob
partFunctionResponse :: Maybe FunctionResponse
partCodeExecutionResult :: Maybe CodeExecutionResult
partFileData :: Maybe FileData
partExecutableCode :: Maybe ExecutableCode
partVideoMetadata :: Maybe VideoMetadata
partThought :: Maybe Bool
partText :: Maybe Text
partThoughtSignature :: Maybe ByteArray
partFunctionCall :: Maybe FunctionCall
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"inlineData" Key -> Maybe Blob -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Blob
partInlineData
      , Key
"functionResponse" Key -> Maybe FunctionResponse -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe FunctionResponse
partFunctionResponse
      , Key
"codeExecutionResult" Key -> Maybe CodeExecutionResult -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe CodeExecutionResult
partCodeExecutionResult
      , Key
"fileData" Key -> Maybe FileData -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe FileData
partFileData
      , Key
"executableCode" Key -> Maybe ExecutableCode -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ExecutableCode
partExecutableCode
      , Key
"videoMetadata" Key -> Maybe VideoMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe VideoMetadata
partVideoMetadata
      , Key
"thought" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
partThought
      , Key
"text" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
partText
      , Key
"thoughtSignature" Key -> Maybe ByteArray -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ByteArray
partThoughtSignature
      , Key
"functionCall" Key -> Maybe FunctionCall -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe FunctionCall
partFunctionCall
      ]

-- | Construct a value of type 'Part' (by applying it's required fields, if any)
mkPart ::
  Part
mkPart :: Part
mkPart =
  Part
    { partInlineData :: Maybe Blob
partInlineData = Maybe Blob
forall a. Maybe a
Nothing
    , partFunctionResponse :: Maybe FunctionResponse
partFunctionResponse = Maybe FunctionResponse
forall a. Maybe a
Nothing
    , partCodeExecutionResult :: Maybe CodeExecutionResult
partCodeExecutionResult = Maybe CodeExecutionResult
forall a. Maybe a
Nothing
    , partFileData :: Maybe FileData
partFileData = Maybe FileData
forall a. Maybe a
Nothing
    , partExecutableCode :: Maybe ExecutableCode
partExecutableCode = Maybe ExecutableCode
forall a. Maybe a
Nothing
    , partVideoMetadata :: Maybe VideoMetadata
partVideoMetadata = Maybe VideoMetadata
forall a. Maybe a
Nothing
    , partThought :: Maybe Bool
partThought = Maybe Bool
forall a. Maybe a
Nothing
    , partText :: Maybe Text
partText = Maybe Text
forall a. Maybe a
Nothing
    , partThoughtSignature :: Maybe ByteArray
partThoughtSignature = Maybe ByteArray
forall a. Maybe a
Nothing
    , partFunctionCall :: Maybe FunctionCall
partFunctionCall = Maybe FunctionCall
forall a. Maybe a
Nothing
    }

-- ** Permission

{- | Permission
Permission resource grants user, group or the rest of the world access to the PaLM API resource (e.g. a tuned model, corpus).  A role is a collection of permitted operations that allows users to perform specific actions on PaLM API resources. To make them available to users, groups, or service accounts, you assign roles. When you assign a role, you grant permissions that the role contains.  There are three concentric roles. Each role is a superset of the previous role's permitted operations:  - reader can use the resource (e.g. tuned model, corpus) for inference - writer has reader's permissions and additionally can edit and share - owner has writer's permissions and additionally can delete
-}
data Permission = Permission
  { Permission -> Maybe Text
permissionName :: !(Maybe Text)
  -- ^ /ReadOnly/ "name" - Output only. Identifier. The permission name. A unique name will be generated on create. Examples:     tunedModels/{tuned_model}/permissions/{permission}     corpora/{corpus}/permissions/{permission} Output only.
  , Permission -> Maybe E'GranteeType
permissionGranteeType :: !(Maybe E'GranteeType)
  -- ^ "granteeType" - Optional. Immutable. The type of the grantee.
  , Permission -> E'Role
permissionRole :: !(E'Role)
  -- ^ /Required/ "role" - Required. The role granted by this permission.
  , Permission -> Maybe Text
permissionEmailAddress :: !(Maybe Text)
  -- ^ "emailAddress" - Optional. Immutable. The email address of the user of group which this permission refers. Field is not set when permission&#39;s grantee type is EVERYONE.
  }
  deriving (Int -> Permission -> ShowS
[Permission] -> ShowS
Permission -> [Char]
(Int -> Permission -> ShowS)
-> (Permission -> [Char])
-> ([Permission] -> ShowS)
-> Show Permission
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Permission -> ShowS
showsPrec :: Int -> Permission -> ShowS
$cshow :: Permission -> [Char]
show :: Permission -> [Char]
$cshowList :: [Permission] -> ShowS
showList :: [Permission] -> ShowS
P.Show, Permission -> Permission -> Bool
(Permission -> Permission -> Bool)
-> (Permission -> Permission -> Bool) -> Eq Permission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Permission -> Permission -> Bool
== :: Permission -> Permission -> Bool
$c/= :: Permission -> Permission -> Bool
/= :: Permission -> Permission -> Bool
P.Eq, P.Typeable)

-- | FromJSON Permission
instance A.FromJSON Permission where
  parseJSON :: Value -> Parser Permission
parseJSON = [Char]
-> (Object -> Parser Permission) -> Value -> Parser Permission
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Permission" ((Object -> Parser Permission) -> Value -> Parser Permission)
-> (Object -> Parser Permission) -> Value -> Parser Permission
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text
-> Maybe E'GranteeType -> E'Role -> Maybe Text -> Permission
Permission
      (Maybe Text
 -> Maybe E'GranteeType -> E'Role -> Maybe Text -> Permission)
-> Parser (Maybe Text)
-> Parser
     (Maybe E'GranteeType -> E'Role -> Maybe Text -> Permission)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser (Maybe E'GranteeType -> E'Role -> Maybe Text -> Permission)
-> Parser (Maybe E'GranteeType)
-> Parser (E'Role -> Maybe Text -> Permission)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'GranteeType)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"granteeType")
      Parser (E'Role -> Maybe Text -> Permission)
-> Parser E'Role -> Parser (Maybe Text -> Permission)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser E'Role
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"role")
      Parser (Maybe Text -> Permission)
-> Parser (Maybe Text) -> Parser Permission
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"emailAddress")

-- | ToJSON Permission
instance A.ToJSON Permission where
  toJSON :: Permission -> Value
toJSON Permission {Maybe Text
Maybe E'GranteeType
E'Role
permissionName :: Permission -> Maybe Text
permissionGranteeType :: Permission -> Maybe E'GranteeType
permissionRole :: Permission -> E'Role
permissionEmailAddress :: Permission -> Maybe Text
permissionName :: Maybe Text
permissionGranteeType :: Maybe E'GranteeType
permissionRole :: E'Role
permissionEmailAddress :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
permissionName
      , Key
"granteeType" Key -> Maybe E'GranteeType -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'GranteeType
permissionGranteeType
      , Key
"role" Key -> E'Role -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= E'Role
permissionRole
      , Key
"emailAddress" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
permissionEmailAddress
      ]

-- | Construct a value of type 'Permission' (by applying it's required fields, if any)
mkPermission ::
  -- | 'permissionRole': Required. The role granted by this permission.
  E'Role ->
  Permission
mkPermission :: E'Role -> Permission
mkPermission E'Role
permissionRole =
  Permission
    { permissionName :: Maybe Text
permissionName = Maybe Text
forall a. Maybe a
Nothing
    , permissionGranteeType :: Maybe E'GranteeType
permissionGranteeType = Maybe E'GranteeType
forall a. Maybe a
Nothing
    , E'Role
permissionRole :: E'Role
permissionRole :: E'Role
permissionRole
    , permissionEmailAddress :: Maybe Text
permissionEmailAddress = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** PrebuiltVoiceConfig

{- | PrebuiltVoiceConfig
The configuration for the prebuilt speaker to use.
-}
data PrebuiltVoiceConfig = PrebuiltVoiceConfig
  { PrebuiltVoiceConfig -> Maybe Text
prebuiltVoiceConfigVoiceName :: !(Maybe Text)
  -- ^ "voiceName" - The name of the preset voice to use.
  }
  deriving (Int -> PrebuiltVoiceConfig -> ShowS
[PrebuiltVoiceConfig] -> ShowS
PrebuiltVoiceConfig -> [Char]
(Int -> PrebuiltVoiceConfig -> ShowS)
-> (PrebuiltVoiceConfig -> [Char])
-> ([PrebuiltVoiceConfig] -> ShowS)
-> Show PrebuiltVoiceConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PrebuiltVoiceConfig -> ShowS
showsPrec :: Int -> PrebuiltVoiceConfig -> ShowS
$cshow :: PrebuiltVoiceConfig -> [Char]
show :: PrebuiltVoiceConfig -> [Char]
$cshowList :: [PrebuiltVoiceConfig] -> ShowS
showList :: [PrebuiltVoiceConfig] -> ShowS
P.Show, PrebuiltVoiceConfig -> PrebuiltVoiceConfig -> Bool
(PrebuiltVoiceConfig -> PrebuiltVoiceConfig -> Bool)
-> (PrebuiltVoiceConfig -> PrebuiltVoiceConfig -> Bool)
-> Eq PrebuiltVoiceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PrebuiltVoiceConfig -> PrebuiltVoiceConfig -> Bool
== :: PrebuiltVoiceConfig -> PrebuiltVoiceConfig -> Bool
$c/= :: PrebuiltVoiceConfig -> PrebuiltVoiceConfig -> Bool
/= :: PrebuiltVoiceConfig -> PrebuiltVoiceConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON PrebuiltVoiceConfig
instance A.FromJSON PrebuiltVoiceConfig where
  parseJSON :: Value -> Parser PrebuiltVoiceConfig
parseJSON = [Char]
-> (Object -> Parser PrebuiltVoiceConfig)
-> Value
-> Parser PrebuiltVoiceConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"PrebuiltVoiceConfig" ((Object -> Parser PrebuiltVoiceConfig)
 -> Value -> Parser PrebuiltVoiceConfig)
-> (Object -> Parser PrebuiltVoiceConfig)
-> Value
-> Parser PrebuiltVoiceConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> PrebuiltVoiceConfig
PrebuiltVoiceConfig
      (Maybe Text -> PrebuiltVoiceConfig)
-> Parser (Maybe Text) -> Parser PrebuiltVoiceConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"voiceName")

-- | ToJSON PrebuiltVoiceConfig
instance A.ToJSON PrebuiltVoiceConfig where
  toJSON :: PrebuiltVoiceConfig -> Value
toJSON PrebuiltVoiceConfig {Maybe Text
prebuiltVoiceConfigVoiceName :: PrebuiltVoiceConfig -> Maybe Text
prebuiltVoiceConfigVoiceName :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"voiceName" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
prebuiltVoiceConfigVoiceName
      ]

-- | Construct a value of type 'PrebuiltVoiceConfig' (by applying it's required fields, if any)
mkPrebuiltVoiceConfig ::
  PrebuiltVoiceConfig
mkPrebuiltVoiceConfig :: PrebuiltVoiceConfig
mkPrebuiltVoiceConfig =
  PrebuiltVoiceConfig
    { prebuiltVoiceConfigVoiceName :: Maybe Text
prebuiltVoiceConfigVoiceName = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** PredictLongRunningOperation

{- | PredictLongRunningOperation
This resource represents a long-running operation where metadata and response fields are strongly typed.
-}
data PredictLongRunningOperation = PredictLongRunningOperation
  { PredictLongRunningOperation -> Maybe Bool
predictLongRunningOperationDone :: !(Maybe Bool)
  -- ^ "done" - If the value is &#x60;false&#x60;, it means the operation is still in progress. If &#x60;true&#x60;, the operation is completed, and either &#x60;error&#x60; or &#x60;response&#x60; is available.
  , PredictLongRunningOperation -> Maybe Text
predictLongRunningOperationName :: !(Maybe Text)
  -- ^ "name" - The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the &#x60;name&#x60; should be a resource name ending with &#x60;operations/{unique_id}&#x60;.
  , PredictLongRunningOperation -> Maybe Status
predictLongRunningOperationError :: !(Maybe Status)
  -- ^ "error" - The error result of the operation in case of failure or cancellation.
  , PredictLongRunningOperation -> Maybe Value
predictLongRunningOperationMetadata :: !(Maybe A.Value)
  -- ^ "metadata" - Metadata for PredictLongRunning long running operations.
  , PredictLongRunningOperation -> Maybe PredictLongRunningResponse
predictLongRunningOperationResponse :: !(Maybe PredictLongRunningResponse)
  -- ^ "response"
  }
  deriving (Int -> PredictLongRunningOperation -> ShowS
[PredictLongRunningOperation] -> ShowS
PredictLongRunningOperation -> [Char]
(Int -> PredictLongRunningOperation -> ShowS)
-> (PredictLongRunningOperation -> [Char])
-> ([PredictLongRunningOperation] -> ShowS)
-> Show PredictLongRunningOperation
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PredictLongRunningOperation -> ShowS
showsPrec :: Int -> PredictLongRunningOperation -> ShowS
$cshow :: PredictLongRunningOperation -> [Char]
show :: PredictLongRunningOperation -> [Char]
$cshowList :: [PredictLongRunningOperation] -> ShowS
showList :: [PredictLongRunningOperation] -> ShowS
P.Show, PredictLongRunningOperation -> PredictLongRunningOperation -> Bool
(PredictLongRunningOperation
 -> PredictLongRunningOperation -> Bool)
-> (PredictLongRunningOperation
    -> PredictLongRunningOperation -> Bool)
-> Eq PredictLongRunningOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PredictLongRunningOperation -> PredictLongRunningOperation -> Bool
== :: PredictLongRunningOperation -> PredictLongRunningOperation -> Bool
$c/= :: PredictLongRunningOperation -> PredictLongRunningOperation -> Bool
/= :: PredictLongRunningOperation -> PredictLongRunningOperation -> Bool
P.Eq, P.Typeable)

-- | FromJSON PredictLongRunningOperation
instance A.FromJSON PredictLongRunningOperation where
  parseJSON :: Value -> Parser PredictLongRunningOperation
parseJSON = [Char]
-> (Object -> Parser PredictLongRunningOperation)
-> Value
-> Parser PredictLongRunningOperation
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"PredictLongRunningOperation" ((Object -> Parser PredictLongRunningOperation)
 -> Value -> Parser PredictLongRunningOperation)
-> (Object -> Parser PredictLongRunningOperation)
-> Value
-> Parser PredictLongRunningOperation
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Bool
-> Maybe Text
-> Maybe Status
-> Maybe Value
-> Maybe PredictLongRunningResponse
-> PredictLongRunningOperation
PredictLongRunningOperation
      (Maybe Bool
 -> Maybe Text
 -> Maybe Status
 -> Maybe Value
 -> Maybe PredictLongRunningResponse
 -> PredictLongRunningOperation)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text
      -> Maybe Status
      -> Maybe Value
      -> Maybe PredictLongRunningResponse
      -> PredictLongRunningOperation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"done")
      Parser
  (Maybe Text
   -> Maybe Status
   -> Maybe Value
   -> Maybe PredictLongRunningResponse
   -> PredictLongRunningOperation)
-> Parser (Maybe Text)
-> Parser
     (Maybe Status
      -> Maybe Value
      -> Maybe PredictLongRunningResponse
      -> PredictLongRunningOperation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser
  (Maybe Status
   -> Maybe Value
   -> Maybe PredictLongRunningResponse
   -> PredictLongRunningOperation)
-> Parser (Maybe Status)
-> Parser
     (Maybe Value
      -> Maybe PredictLongRunningResponse -> PredictLongRunningOperation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Status)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"error")
      Parser
  (Maybe Value
   -> Maybe PredictLongRunningResponse -> PredictLongRunningOperation)
-> Parser (Maybe Value)
-> Parser
     (Maybe PredictLongRunningResponse -> PredictLongRunningOperation)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"metadata")
      Parser
  (Maybe PredictLongRunningResponse -> PredictLongRunningOperation)
-> Parser (Maybe PredictLongRunningResponse)
-> Parser PredictLongRunningOperation
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe PredictLongRunningResponse)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"response")

-- | ToJSON PredictLongRunningOperation
instance A.ToJSON PredictLongRunningOperation where
  toJSON :: PredictLongRunningOperation -> Value
toJSON PredictLongRunningOperation {Maybe Bool
Maybe Value
Maybe Text
Maybe PredictLongRunningResponse
Maybe Status
predictLongRunningOperationDone :: PredictLongRunningOperation -> Maybe Bool
predictLongRunningOperationName :: PredictLongRunningOperation -> Maybe Text
predictLongRunningOperationError :: PredictLongRunningOperation -> Maybe Status
predictLongRunningOperationMetadata :: PredictLongRunningOperation -> Maybe Value
predictLongRunningOperationResponse :: PredictLongRunningOperation -> Maybe PredictLongRunningResponse
predictLongRunningOperationDone :: Maybe Bool
predictLongRunningOperationName :: Maybe Text
predictLongRunningOperationError :: Maybe Status
predictLongRunningOperationMetadata :: Maybe Value
predictLongRunningOperationResponse :: Maybe PredictLongRunningResponse
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"done" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
predictLongRunningOperationDone
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
predictLongRunningOperationName
      , Key
"error" Key -> Maybe Status -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Status
predictLongRunningOperationError
      , Key
"metadata" Key -> Maybe Value -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Value
predictLongRunningOperationMetadata
      , Key
"response" Key -> Maybe PredictLongRunningResponse -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe PredictLongRunningResponse
predictLongRunningOperationResponse
      ]

-- | Construct a value of type 'PredictLongRunningOperation' (by applying it's required fields, if any)
mkPredictLongRunningOperation ::
  PredictLongRunningOperation
mkPredictLongRunningOperation :: PredictLongRunningOperation
mkPredictLongRunningOperation =
  PredictLongRunningOperation
    { predictLongRunningOperationDone :: Maybe Bool
predictLongRunningOperationDone = Maybe Bool
forall a. Maybe a
Nothing
    , predictLongRunningOperationName :: Maybe Text
predictLongRunningOperationName = Maybe Text
forall a. Maybe a
Nothing
    , predictLongRunningOperationError :: Maybe Status
predictLongRunningOperationError = Maybe Status
forall a. Maybe a
Nothing
    , predictLongRunningOperationMetadata :: Maybe Value
predictLongRunningOperationMetadata = Maybe Value
forall a. Maybe a
Nothing
    , predictLongRunningOperationResponse :: Maybe PredictLongRunningResponse
predictLongRunningOperationResponse = Maybe PredictLongRunningResponse
forall a. Maybe a
Nothing
    }

-- ** PredictLongRunningRequest

{- | PredictLongRunningRequest
Request message for [PredictionService.PredictLongRunning].
-}
data PredictLongRunningRequest = PredictLongRunningRequest
  { PredictLongRunningRequest -> Maybe [Char]
predictLongRunningRequestParameters :: !(Maybe String)
  -- ^ "parameters" - Optional. The parameters that govern the prediction call.
  , PredictLongRunningRequest -> [[Char]]
predictLongRunningRequestInstances :: !([String])
  -- ^ /Required/ "instances" - Required. The instances that are the input to the prediction call.
  }
  deriving (Int -> PredictLongRunningRequest -> ShowS
[PredictLongRunningRequest] -> ShowS
PredictLongRunningRequest -> [Char]
(Int -> PredictLongRunningRequest -> ShowS)
-> (PredictLongRunningRequest -> [Char])
-> ([PredictLongRunningRequest] -> ShowS)
-> Show PredictLongRunningRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PredictLongRunningRequest -> ShowS
showsPrec :: Int -> PredictLongRunningRequest -> ShowS
$cshow :: PredictLongRunningRequest -> [Char]
show :: PredictLongRunningRequest -> [Char]
$cshowList :: [PredictLongRunningRequest] -> ShowS
showList :: [PredictLongRunningRequest] -> ShowS
P.Show, PredictLongRunningRequest -> PredictLongRunningRequest -> Bool
(PredictLongRunningRequest -> PredictLongRunningRequest -> Bool)
-> (PredictLongRunningRequest -> PredictLongRunningRequest -> Bool)
-> Eq PredictLongRunningRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PredictLongRunningRequest -> PredictLongRunningRequest -> Bool
== :: PredictLongRunningRequest -> PredictLongRunningRequest -> Bool
$c/= :: PredictLongRunningRequest -> PredictLongRunningRequest -> Bool
/= :: PredictLongRunningRequest -> PredictLongRunningRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON PredictLongRunningRequest
instance A.FromJSON PredictLongRunningRequest where
  parseJSON :: Value -> Parser PredictLongRunningRequest
parseJSON = [Char]
-> (Object -> Parser PredictLongRunningRequest)
-> Value
-> Parser PredictLongRunningRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"PredictLongRunningRequest" ((Object -> Parser PredictLongRunningRequest)
 -> Value -> Parser PredictLongRunningRequest)
-> (Object -> Parser PredictLongRunningRequest)
-> Value
-> Parser PredictLongRunningRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Char] -> [[Char]] -> PredictLongRunningRequest
PredictLongRunningRequest
      (Maybe [Char] -> [[Char]] -> PredictLongRunningRequest)
-> Parser (Maybe [Char])
-> Parser ([[Char]] -> PredictLongRunningRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Char])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"parameters")
      Parser ([[Char]] -> PredictLongRunningRequest)
-> Parser [[Char]] -> Parser PredictLongRunningRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser [[Char]]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"instances")

-- | ToJSON PredictLongRunningRequest
instance A.ToJSON PredictLongRunningRequest where
  toJSON :: PredictLongRunningRequest -> Value
toJSON PredictLongRunningRequest {[[Char]]
Maybe [Char]
predictLongRunningRequestParameters :: PredictLongRunningRequest -> Maybe [Char]
predictLongRunningRequestInstances :: PredictLongRunningRequest -> [[Char]]
predictLongRunningRequestParameters :: Maybe [Char]
predictLongRunningRequestInstances :: [[Char]]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"parameters" Key -> Maybe [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Char]
predictLongRunningRequestParameters
      , Key
"instances" Key -> [[Char]] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [[Char]]
predictLongRunningRequestInstances
      ]

-- | Construct a value of type 'PredictLongRunningRequest' (by applying it's required fields, if any)
mkPredictLongRunningRequest ::
  -- | 'predictLongRunningRequestInstances': Required. The instances that are the input to the prediction call.
  [String] ->
  PredictLongRunningRequest
mkPredictLongRunningRequest :: [[Char]] -> PredictLongRunningRequest
mkPredictLongRunningRequest [[Char]]
predictLongRunningRequestInstances =
  PredictLongRunningRequest
    { predictLongRunningRequestParameters :: Maybe [Char]
predictLongRunningRequestParameters = Maybe [Char]
forall a. Maybe a
Nothing
    , [[Char]]
predictLongRunningRequestInstances :: [[Char]]
predictLongRunningRequestInstances :: [[Char]]
predictLongRunningRequestInstances
    }

-- ** PredictLongRunningResponse

{- | PredictLongRunningResponse
Response message for [PredictionService.PredictLongRunning]
-}
data PredictLongRunningResponse = PredictLongRunningResponse
  { PredictLongRunningResponse -> Maybe GenerateVideoResponse
predictLongRunningResponseGenerateVideoResponse :: !(Maybe GenerateVideoResponse)
  -- ^ "generateVideoResponse" - The response of the video generation prediction.
  }
  deriving (Int -> PredictLongRunningResponse -> ShowS
[PredictLongRunningResponse] -> ShowS
PredictLongRunningResponse -> [Char]
(Int -> PredictLongRunningResponse -> ShowS)
-> (PredictLongRunningResponse -> [Char])
-> ([PredictLongRunningResponse] -> ShowS)
-> Show PredictLongRunningResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PredictLongRunningResponse -> ShowS
showsPrec :: Int -> PredictLongRunningResponse -> ShowS
$cshow :: PredictLongRunningResponse -> [Char]
show :: PredictLongRunningResponse -> [Char]
$cshowList :: [PredictLongRunningResponse] -> ShowS
showList :: [PredictLongRunningResponse] -> ShowS
P.Show, PredictLongRunningResponse -> PredictLongRunningResponse -> Bool
(PredictLongRunningResponse -> PredictLongRunningResponse -> Bool)
-> (PredictLongRunningResponse
    -> PredictLongRunningResponse -> Bool)
-> Eq PredictLongRunningResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PredictLongRunningResponse -> PredictLongRunningResponse -> Bool
== :: PredictLongRunningResponse -> PredictLongRunningResponse -> Bool
$c/= :: PredictLongRunningResponse -> PredictLongRunningResponse -> Bool
/= :: PredictLongRunningResponse -> PredictLongRunningResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON PredictLongRunningResponse
instance A.FromJSON PredictLongRunningResponse where
  parseJSON :: Value -> Parser PredictLongRunningResponse
parseJSON = [Char]
-> (Object -> Parser PredictLongRunningResponse)
-> Value
-> Parser PredictLongRunningResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"PredictLongRunningResponse" ((Object -> Parser PredictLongRunningResponse)
 -> Value -> Parser PredictLongRunningResponse)
-> (Object -> Parser PredictLongRunningResponse)
-> Value
-> Parser PredictLongRunningResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe GenerateVideoResponse -> PredictLongRunningResponse
PredictLongRunningResponse
      (Maybe GenerateVideoResponse -> PredictLongRunningResponse)
-> Parser (Maybe GenerateVideoResponse)
-> Parser PredictLongRunningResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe GenerateVideoResponse)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"generateVideoResponse")

-- | ToJSON PredictLongRunningResponse
instance A.ToJSON PredictLongRunningResponse where
  toJSON :: PredictLongRunningResponse -> Value
toJSON PredictLongRunningResponse {Maybe GenerateVideoResponse
predictLongRunningResponseGenerateVideoResponse :: PredictLongRunningResponse -> Maybe GenerateVideoResponse
predictLongRunningResponseGenerateVideoResponse :: Maybe GenerateVideoResponse
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"generateVideoResponse" Key -> Maybe GenerateVideoResponse -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GenerateVideoResponse
predictLongRunningResponseGenerateVideoResponse
      ]

-- | Construct a value of type 'PredictLongRunningResponse' (by applying it's required fields, if any)
mkPredictLongRunningResponse ::
  PredictLongRunningResponse
mkPredictLongRunningResponse :: PredictLongRunningResponse
mkPredictLongRunningResponse =
  PredictLongRunningResponse
    { predictLongRunningResponseGenerateVideoResponse :: Maybe GenerateVideoResponse
predictLongRunningResponseGenerateVideoResponse = Maybe GenerateVideoResponse
forall a. Maybe a
Nothing
    }

-- ** PredictRequest

{- | PredictRequest
Request message for PredictionService.Predict.
-}
data PredictRequest = PredictRequest
  { PredictRequest -> [[Char]]
predictRequestInstances :: !([String])
  -- ^ /Required/ "instances" - Required. The instances that are the input to the prediction call.
  , PredictRequest -> Maybe [Char]
predictRequestParameters :: !(Maybe String)
  -- ^ "parameters" - Optional. The parameters that govern the prediction call.
  }
  deriving (Int -> PredictRequest -> ShowS
[PredictRequest] -> ShowS
PredictRequest -> [Char]
(Int -> PredictRequest -> ShowS)
-> (PredictRequest -> [Char])
-> ([PredictRequest] -> ShowS)
-> Show PredictRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PredictRequest -> ShowS
showsPrec :: Int -> PredictRequest -> ShowS
$cshow :: PredictRequest -> [Char]
show :: PredictRequest -> [Char]
$cshowList :: [PredictRequest] -> ShowS
showList :: [PredictRequest] -> ShowS
P.Show, PredictRequest -> PredictRequest -> Bool
(PredictRequest -> PredictRequest -> Bool)
-> (PredictRequest -> PredictRequest -> Bool) -> Eq PredictRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PredictRequest -> PredictRequest -> Bool
== :: PredictRequest -> PredictRequest -> Bool
$c/= :: PredictRequest -> PredictRequest -> Bool
/= :: PredictRequest -> PredictRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON PredictRequest
instance A.FromJSON PredictRequest where
  parseJSON :: Value -> Parser PredictRequest
parseJSON = [Char]
-> (Object -> Parser PredictRequest)
-> Value
-> Parser PredictRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"PredictRequest" ((Object -> Parser PredictRequest)
 -> Value -> Parser PredictRequest)
-> (Object -> Parser PredictRequest)
-> Value
-> Parser PredictRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    [[Char]] -> Maybe [Char] -> PredictRequest
PredictRequest
      ([[Char]] -> Maybe [Char] -> PredictRequest)
-> Parser [[Char]] -> Parser (Maybe [Char] -> PredictRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser [[Char]]
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"instances")
      Parser (Maybe [Char] -> PredictRequest)
-> Parser (Maybe [Char]) -> Parser PredictRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Char])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"parameters")

-- | ToJSON PredictRequest
instance A.ToJSON PredictRequest where
  toJSON :: PredictRequest -> Value
toJSON PredictRequest {[[Char]]
Maybe [Char]
predictRequestInstances :: PredictRequest -> [[Char]]
predictRequestParameters :: PredictRequest -> Maybe [Char]
predictRequestInstances :: [[Char]]
predictRequestParameters :: Maybe [Char]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"instances" Key -> [[Char]] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= [[Char]]
predictRequestInstances
      , Key
"parameters" Key -> Maybe [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Char]
predictRequestParameters
      ]

-- | Construct a value of type 'PredictRequest' (by applying it's required fields, if any)
mkPredictRequest ::
  -- | 'predictRequestInstances': Required. The instances that are the input to the prediction call.
  [String] ->
  PredictRequest
mkPredictRequest :: [[Char]] -> PredictRequest
mkPredictRequest [[Char]]
predictRequestInstances =
  PredictRequest
    { [[Char]]
predictRequestInstances :: [[Char]]
predictRequestInstances :: [[Char]]
predictRequestInstances
    , predictRequestParameters :: Maybe [Char]
predictRequestParameters = Maybe [Char]
forall a. Maybe a
Nothing
    }

-- ** PredictResponse

{- | PredictResponse
Response message for [PredictionService.Predict].
-}
data PredictResponse = PredictResponse
  { PredictResponse -> Maybe [[Char]]
predictResponsePredictions :: !(Maybe [String])
  -- ^ "predictions" - The outputs of the prediction call.
  }
  deriving (Int -> PredictResponse -> ShowS
[PredictResponse] -> ShowS
PredictResponse -> [Char]
(Int -> PredictResponse -> ShowS)
-> (PredictResponse -> [Char])
-> ([PredictResponse] -> ShowS)
-> Show PredictResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PredictResponse -> ShowS
showsPrec :: Int -> PredictResponse -> ShowS
$cshow :: PredictResponse -> [Char]
show :: PredictResponse -> [Char]
$cshowList :: [PredictResponse] -> ShowS
showList :: [PredictResponse] -> ShowS
P.Show, PredictResponse -> PredictResponse -> Bool
(PredictResponse -> PredictResponse -> Bool)
-> (PredictResponse -> PredictResponse -> Bool)
-> Eq PredictResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PredictResponse -> PredictResponse -> Bool
== :: PredictResponse -> PredictResponse -> Bool
$c/= :: PredictResponse -> PredictResponse -> Bool
/= :: PredictResponse -> PredictResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON PredictResponse
instance A.FromJSON PredictResponse where
  parseJSON :: Value -> Parser PredictResponse
parseJSON = [Char]
-> (Object -> Parser PredictResponse)
-> Value
-> Parser PredictResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"PredictResponse" ((Object -> Parser PredictResponse)
 -> Value -> Parser PredictResponse)
-> (Object -> Parser PredictResponse)
-> Value
-> Parser PredictResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [[Char]] -> PredictResponse
PredictResponse
      (Maybe [[Char]] -> PredictResponse)
-> Parser (Maybe [[Char]]) -> Parser PredictResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [[Char]])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"predictions")

-- | ToJSON PredictResponse
instance A.ToJSON PredictResponse where
  toJSON :: PredictResponse -> Value
toJSON PredictResponse {Maybe [[Char]]
predictResponsePredictions :: PredictResponse -> Maybe [[Char]]
predictResponsePredictions :: Maybe [[Char]]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"predictions" Key -> Maybe [[Char]] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [[Char]]
predictResponsePredictions
      ]

-- | Construct a value of type 'PredictResponse' (by applying it's required fields, if any)
mkPredictResponse ::
  PredictResponse
mkPredictResponse :: PredictResponse
mkPredictResponse =
  PredictResponse
    { predictResponsePredictions :: Maybe [[Char]]
predictResponsePredictions = Maybe [[Char]]
forall a. Maybe a
Nothing
    }

-- ** PromptFeedback

{- | PromptFeedback
A set of the feedback metadata the prompt specified in `GenerateContentRequest.content`.
-}
data PromptFeedback = PromptFeedback
  { PromptFeedback -> Maybe E'BlockReason
promptFeedbackBlockReason :: !(Maybe E'BlockReason)
  -- ^ "blockReason" - Optional. If set, the prompt was blocked and no candidates are returned. Rephrase the prompt.
  , PromptFeedback -> Maybe [SafetyRating]
promptFeedbackSafetyRatings :: !(Maybe [SafetyRating])
  -- ^ "safetyRatings" - Ratings for safety of the prompt. There is at most one rating per category.
  }
  deriving (Int -> PromptFeedback -> ShowS
[PromptFeedback] -> ShowS
PromptFeedback -> [Char]
(Int -> PromptFeedback -> ShowS)
-> (PromptFeedback -> [Char])
-> ([PromptFeedback] -> ShowS)
-> Show PromptFeedback
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PromptFeedback -> ShowS
showsPrec :: Int -> PromptFeedback -> ShowS
$cshow :: PromptFeedback -> [Char]
show :: PromptFeedback -> [Char]
$cshowList :: [PromptFeedback] -> ShowS
showList :: [PromptFeedback] -> ShowS
P.Show, PromptFeedback -> PromptFeedback -> Bool
(PromptFeedback -> PromptFeedback -> Bool)
-> (PromptFeedback -> PromptFeedback -> Bool) -> Eq PromptFeedback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PromptFeedback -> PromptFeedback -> Bool
== :: PromptFeedback -> PromptFeedback -> Bool
$c/= :: PromptFeedback -> PromptFeedback -> Bool
/= :: PromptFeedback -> PromptFeedback -> Bool
P.Eq, P.Typeable)

-- | FromJSON PromptFeedback
instance A.FromJSON PromptFeedback where
  parseJSON :: Value -> Parser PromptFeedback
parseJSON = [Char]
-> (Object -> Parser PromptFeedback)
-> Value
-> Parser PromptFeedback
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"PromptFeedback" ((Object -> Parser PromptFeedback)
 -> Value -> Parser PromptFeedback)
-> (Object -> Parser PromptFeedback)
-> Value
-> Parser PromptFeedback
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe E'BlockReason -> Maybe [SafetyRating] -> PromptFeedback
PromptFeedback
      (Maybe E'BlockReason -> Maybe [SafetyRating] -> PromptFeedback)
-> Parser (Maybe E'BlockReason)
-> Parser (Maybe [SafetyRating] -> PromptFeedback)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe E'BlockReason)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"blockReason")
      Parser (Maybe [SafetyRating] -> PromptFeedback)
-> Parser (Maybe [SafetyRating]) -> Parser PromptFeedback
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [SafetyRating])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetyRatings")

-- | ToJSON PromptFeedback
instance A.ToJSON PromptFeedback where
  toJSON :: PromptFeedback -> Value
toJSON PromptFeedback {Maybe [SafetyRating]
Maybe E'BlockReason
promptFeedbackBlockReason :: PromptFeedback -> Maybe E'BlockReason
promptFeedbackSafetyRatings :: PromptFeedback -> Maybe [SafetyRating]
promptFeedbackBlockReason :: Maybe E'BlockReason
promptFeedbackSafetyRatings :: Maybe [SafetyRating]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"blockReason" Key -> Maybe E'BlockReason -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'BlockReason
promptFeedbackBlockReason
      , Key
"safetyRatings" Key -> Maybe [SafetyRating] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetyRating]
promptFeedbackSafetyRatings
      ]

-- | Construct a value of type 'PromptFeedback' (by applying it's required fields, if any)
mkPromptFeedback ::
  PromptFeedback
mkPromptFeedback :: PromptFeedback
mkPromptFeedback =
  PromptFeedback
    { promptFeedbackBlockReason :: Maybe E'BlockReason
promptFeedbackBlockReason = Maybe E'BlockReason
forall a. Maybe a
Nothing
    , promptFeedbackSafetyRatings :: Maybe [SafetyRating]
promptFeedbackSafetyRatings = Maybe [SafetyRating]
forall a. Maybe a
Nothing
    }

-- ** QueryCorpusRequest

{- | QueryCorpusRequest
Request for querying a `Corpus`.
-}
data QueryCorpusRequest = QueryCorpusRequest
  { QueryCorpusRequest -> Maybe [MetadataFilter]
queryCorpusRequestMetadataFilters :: !(Maybe [MetadataFilter])
  -- ^ "metadataFilters" - Optional. Filter for &#x60;Chunk&#x60; and &#x60;Document&#x60; metadata. Each &#x60;MetadataFilter&#x60; object should correspond to a unique key. Multiple &#x60;MetadataFilter&#x60; objects are joined by logical \&quot;AND\&quot;s.  Example query at document level: (year &gt;&#x3D; 2020 OR year &lt; 2010) AND (genre &#x3D; drama OR genre &#x3D; action)  &#x60;MetadataFilter&#x60; object list:  metadata_filters &#x3D; [  {key &#x3D; \&quot;document.custom_metadata.year\&quot;   conditions &#x3D; [{int_value &#x3D; 2020, operation &#x3D; GREATER_EQUAL},                 {int_value &#x3D; 2010, operation &#x3D; LESS}]},  {key &#x3D; \&quot;document.custom_metadata.year\&quot;   conditions &#x3D; [{int_value &#x3D; 2020, operation &#x3D; GREATER_EQUAL},                 {int_value &#x3D; 2010, operation &#x3D; LESS}]},  {key &#x3D; \&quot;document.custom_metadata.genre\&quot;   conditions &#x3D; [{string_value &#x3D; \&quot;drama\&quot;, operation &#x3D; EQUAL},                 {string_value &#x3D; \&quot;action\&quot;, operation &#x3D; EQUAL}]}]  Example query at chunk level for a numeric range of values: (year &gt; 2015 AND year &lt;&#x3D; 2020)  &#x60;MetadataFilter&#x60; object list:  metadata_filters &#x3D; [  {key &#x3D; \&quot;chunk.custom_metadata.year\&quot;   conditions &#x3D; [{int_value &#x3D; 2015, operation &#x3D; GREATER}]},  {key &#x3D; \&quot;chunk.custom_metadata.year\&quot;   conditions &#x3D; [{int_value &#x3D; 2020, operation &#x3D; LESS_EQUAL}]}]  Note: \&quot;AND\&quot;s for the same key are only supported for numeric values. String values only support \&quot;OR\&quot;s for the same key.
  , QueryCorpusRequest -> Text
queryCorpusRequestQuery :: !(Text)
  -- ^ /Required/ "query" - Required. Query string to perform semantic search.
  , QueryCorpusRequest -> Maybe Int
queryCorpusRequestResultsCount :: !(Maybe Int)
  -- ^ "resultsCount" - Optional. The maximum number of &#x60;Chunk&#x60;s to return. The service may return fewer &#x60;Chunk&#x60;s.  If unspecified, at most 10 &#x60;Chunk&#x60;s will be returned. The maximum specified result count is 100.
  }
  deriving (Int -> QueryCorpusRequest -> ShowS
[QueryCorpusRequest] -> ShowS
QueryCorpusRequest -> [Char]
(Int -> QueryCorpusRequest -> ShowS)
-> (QueryCorpusRequest -> [Char])
-> ([QueryCorpusRequest] -> ShowS)
-> Show QueryCorpusRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> QueryCorpusRequest -> ShowS
showsPrec :: Int -> QueryCorpusRequest -> ShowS
$cshow :: QueryCorpusRequest -> [Char]
show :: QueryCorpusRequest -> [Char]
$cshowList :: [QueryCorpusRequest] -> ShowS
showList :: [QueryCorpusRequest] -> ShowS
P.Show, QueryCorpusRequest -> QueryCorpusRequest -> Bool
(QueryCorpusRequest -> QueryCorpusRequest -> Bool)
-> (QueryCorpusRequest -> QueryCorpusRequest -> Bool)
-> Eq QueryCorpusRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: QueryCorpusRequest -> QueryCorpusRequest -> Bool
== :: QueryCorpusRequest -> QueryCorpusRequest -> Bool
$c/= :: QueryCorpusRequest -> QueryCorpusRequest -> Bool
/= :: QueryCorpusRequest -> QueryCorpusRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON QueryCorpusRequest
instance A.FromJSON QueryCorpusRequest where
  parseJSON :: Value -> Parser QueryCorpusRequest
parseJSON = [Char]
-> (Object -> Parser QueryCorpusRequest)
-> Value
-> Parser QueryCorpusRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"QueryCorpusRequest" ((Object -> Parser QueryCorpusRequest)
 -> Value -> Parser QueryCorpusRequest)
-> (Object -> Parser QueryCorpusRequest)
-> Value
-> Parser QueryCorpusRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [MetadataFilter] -> Text -> Maybe Int -> QueryCorpusRequest
QueryCorpusRequest
      (Maybe [MetadataFilter] -> Text -> Maybe Int -> QueryCorpusRequest)
-> Parser (Maybe [MetadataFilter])
-> Parser (Text -> Maybe Int -> QueryCorpusRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [MetadataFilter])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"metadataFilters")
      Parser (Text -> Maybe Int -> QueryCorpusRequest)
-> Parser Text -> Parser (Maybe Int -> QueryCorpusRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"query")
      Parser (Maybe Int -> QueryCorpusRequest)
-> Parser (Maybe Int) -> Parser QueryCorpusRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"resultsCount")

-- | ToJSON QueryCorpusRequest
instance A.ToJSON QueryCorpusRequest where
  toJSON :: QueryCorpusRequest -> Value
toJSON QueryCorpusRequest {Maybe Int
Maybe [MetadataFilter]
Text
queryCorpusRequestMetadataFilters :: QueryCorpusRequest -> Maybe [MetadataFilter]
queryCorpusRequestQuery :: QueryCorpusRequest -> Text
queryCorpusRequestResultsCount :: QueryCorpusRequest -> Maybe Int
queryCorpusRequestMetadataFilters :: Maybe [MetadataFilter]
queryCorpusRequestQuery :: Text
queryCorpusRequestResultsCount :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"metadataFilters" Key -> Maybe [MetadataFilter] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [MetadataFilter]
queryCorpusRequestMetadataFilters
      , Key
"query" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
queryCorpusRequestQuery
      , Key
"resultsCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
queryCorpusRequestResultsCount
      ]

-- | Construct a value of type 'QueryCorpusRequest' (by applying it's required fields, if any)
mkQueryCorpusRequest ::
  -- | 'queryCorpusRequestQuery': Required. Query string to perform semantic search.
  Text ->
  QueryCorpusRequest
mkQueryCorpusRequest :: Text -> QueryCorpusRequest
mkQueryCorpusRequest Text
queryCorpusRequestQuery =
  QueryCorpusRequest
    { queryCorpusRequestMetadataFilters :: Maybe [MetadataFilter]
queryCorpusRequestMetadataFilters = Maybe [MetadataFilter]
forall a. Maybe a
Nothing
    , Text
queryCorpusRequestQuery :: Text
queryCorpusRequestQuery :: Text
queryCorpusRequestQuery
    , queryCorpusRequestResultsCount :: Maybe Int
queryCorpusRequestResultsCount = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** QueryCorpusResponse

{- | QueryCorpusResponse
Response from `QueryCorpus` containing a list of relevant chunks.
-}
data QueryCorpusResponse = QueryCorpusResponse
  { QueryCorpusResponse -> Maybe [RelevantChunk]
queryCorpusResponseRelevantChunks :: !(Maybe [RelevantChunk])
  -- ^ "relevantChunks" - The relevant chunks.
  }
  deriving (Int -> QueryCorpusResponse -> ShowS
[QueryCorpusResponse] -> ShowS
QueryCorpusResponse -> [Char]
(Int -> QueryCorpusResponse -> ShowS)
-> (QueryCorpusResponse -> [Char])
-> ([QueryCorpusResponse] -> ShowS)
-> Show QueryCorpusResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> QueryCorpusResponse -> ShowS
showsPrec :: Int -> QueryCorpusResponse -> ShowS
$cshow :: QueryCorpusResponse -> [Char]
show :: QueryCorpusResponse -> [Char]
$cshowList :: [QueryCorpusResponse] -> ShowS
showList :: [QueryCorpusResponse] -> ShowS
P.Show, QueryCorpusResponse -> QueryCorpusResponse -> Bool
(QueryCorpusResponse -> QueryCorpusResponse -> Bool)
-> (QueryCorpusResponse -> QueryCorpusResponse -> Bool)
-> Eq QueryCorpusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: QueryCorpusResponse -> QueryCorpusResponse -> Bool
== :: QueryCorpusResponse -> QueryCorpusResponse -> Bool
$c/= :: QueryCorpusResponse -> QueryCorpusResponse -> Bool
/= :: QueryCorpusResponse -> QueryCorpusResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON QueryCorpusResponse
instance A.FromJSON QueryCorpusResponse where
  parseJSON :: Value -> Parser QueryCorpusResponse
parseJSON = [Char]
-> (Object -> Parser QueryCorpusResponse)
-> Value
-> Parser QueryCorpusResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"QueryCorpusResponse" ((Object -> Parser QueryCorpusResponse)
 -> Value -> Parser QueryCorpusResponse)
-> (Object -> Parser QueryCorpusResponse)
-> Value
-> Parser QueryCorpusResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [RelevantChunk] -> QueryCorpusResponse
QueryCorpusResponse
      (Maybe [RelevantChunk] -> QueryCorpusResponse)
-> Parser (Maybe [RelevantChunk]) -> Parser QueryCorpusResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [RelevantChunk])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"relevantChunks")

-- | ToJSON QueryCorpusResponse
instance A.ToJSON QueryCorpusResponse where
  toJSON :: QueryCorpusResponse -> Value
toJSON QueryCorpusResponse {Maybe [RelevantChunk]
queryCorpusResponseRelevantChunks :: QueryCorpusResponse -> Maybe [RelevantChunk]
queryCorpusResponseRelevantChunks :: Maybe [RelevantChunk]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"relevantChunks" Key -> Maybe [RelevantChunk] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [RelevantChunk]
queryCorpusResponseRelevantChunks
      ]

-- | Construct a value of type 'QueryCorpusResponse' (by applying it's required fields, if any)
mkQueryCorpusResponse ::
  QueryCorpusResponse
mkQueryCorpusResponse :: QueryCorpusResponse
mkQueryCorpusResponse =
  QueryCorpusResponse
    { queryCorpusResponseRelevantChunks :: Maybe [RelevantChunk]
queryCorpusResponseRelevantChunks = Maybe [RelevantChunk]
forall a. Maybe a
Nothing
    }

-- ** QueryDocumentRequest

{- | QueryDocumentRequest
Request for querying a `Document`.
-}
data QueryDocumentRequest = QueryDocumentRequest
  { QueryDocumentRequest -> Text
queryDocumentRequestQuery :: !(Text)
  -- ^ /Required/ "query" - Required. Query string to perform semantic search.
  , QueryDocumentRequest -> Maybe Int
queryDocumentRequestResultsCount :: !(Maybe Int)
  -- ^ "resultsCount" - Optional. The maximum number of &#x60;Chunk&#x60;s to return. The service may return fewer &#x60;Chunk&#x60;s.  If unspecified, at most 10 &#x60;Chunk&#x60;s will be returned. The maximum specified result count is 100.
  , QueryDocumentRequest -> Maybe [MetadataFilter]
queryDocumentRequestMetadataFilters :: !(Maybe [MetadataFilter])
  -- ^ "metadataFilters" - Optional. Filter for &#x60;Chunk&#x60; metadata. Each &#x60;MetadataFilter&#x60; object should correspond to a unique key. Multiple &#x60;MetadataFilter&#x60; objects are joined by logical \&quot;AND\&quot;s.  Note: &#x60;Document&#x60;-level filtering is not supported for this request because a &#x60;Document&#x60; name is already specified.  Example query: (year &gt;&#x3D; 2020 OR year &lt; 2010) AND (genre &#x3D; drama OR genre &#x3D; action)  &#x60;MetadataFilter&#x60; object list:  metadata_filters &#x3D; [  {key &#x3D; \&quot;chunk.custom_metadata.year\&quot;   conditions &#x3D; [{int_value &#x3D; 2020, operation &#x3D; GREATER_EQUAL},                 {int_value &#x3D; 2010, operation &#x3D; LESS}},  {key &#x3D; \&quot;chunk.custom_metadata.genre\&quot;   conditions &#x3D; [{string_value &#x3D; \&quot;drama\&quot;, operation &#x3D; EQUAL},                 {string_value &#x3D; \&quot;action\&quot;, operation &#x3D; EQUAL}}]  Example query for a numeric range of values: (year &gt; 2015 AND year &lt;&#x3D; 2020)  &#x60;MetadataFilter&#x60; object list:  metadata_filters &#x3D; [  {key &#x3D; \&quot;chunk.custom_metadata.year\&quot;   conditions &#x3D; [{int_value &#x3D; 2015, operation &#x3D; GREATER}]},  {key &#x3D; \&quot;chunk.custom_metadata.year\&quot;   conditions &#x3D; [{int_value &#x3D; 2020, operation &#x3D; LESS_EQUAL}]}]  Note: \&quot;AND\&quot;s for the same key are only supported for numeric values. String values only support \&quot;OR\&quot;s for the same key.
  }
  deriving (Int -> QueryDocumentRequest -> ShowS
[QueryDocumentRequest] -> ShowS
QueryDocumentRequest -> [Char]
(Int -> QueryDocumentRequest -> ShowS)
-> (QueryDocumentRequest -> [Char])
-> ([QueryDocumentRequest] -> ShowS)
-> Show QueryDocumentRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> QueryDocumentRequest -> ShowS
showsPrec :: Int -> QueryDocumentRequest -> ShowS
$cshow :: QueryDocumentRequest -> [Char]
show :: QueryDocumentRequest -> [Char]
$cshowList :: [QueryDocumentRequest] -> ShowS
showList :: [QueryDocumentRequest] -> ShowS
P.Show, QueryDocumentRequest -> QueryDocumentRequest -> Bool
(QueryDocumentRequest -> QueryDocumentRequest -> Bool)
-> (QueryDocumentRequest -> QueryDocumentRequest -> Bool)
-> Eq QueryDocumentRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: QueryDocumentRequest -> QueryDocumentRequest -> Bool
== :: QueryDocumentRequest -> QueryDocumentRequest -> Bool
$c/= :: QueryDocumentRequest -> QueryDocumentRequest -> Bool
/= :: QueryDocumentRequest -> QueryDocumentRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON QueryDocumentRequest
instance A.FromJSON QueryDocumentRequest where
  parseJSON :: Value -> Parser QueryDocumentRequest
parseJSON = [Char]
-> (Object -> Parser QueryDocumentRequest)
-> Value
-> Parser QueryDocumentRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"QueryDocumentRequest" ((Object -> Parser QueryDocumentRequest)
 -> Value -> Parser QueryDocumentRequest)
-> (Object -> Parser QueryDocumentRequest)
-> Value
-> Parser QueryDocumentRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Text -> Maybe Int -> Maybe [MetadataFilter] -> QueryDocumentRequest
QueryDocumentRequest
      (Text
 -> Maybe Int -> Maybe [MetadataFilter] -> QueryDocumentRequest)
-> Parser Text
-> Parser
     (Maybe Int -> Maybe [MetadataFilter] -> QueryDocumentRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"query")
      Parser
  (Maybe Int -> Maybe [MetadataFilter] -> QueryDocumentRequest)
-> Parser (Maybe Int)
-> Parser (Maybe [MetadataFilter] -> QueryDocumentRequest)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"resultsCount")
      Parser (Maybe [MetadataFilter] -> QueryDocumentRequest)
-> Parser (Maybe [MetadataFilter]) -> Parser QueryDocumentRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [MetadataFilter])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"metadataFilters")

-- | ToJSON QueryDocumentRequest
instance A.ToJSON QueryDocumentRequest where
  toJSON :: QueryDocumentRequest -> Value
toJSON QueryDocumentRequest {Maybe Int
Maybe [MetadataFilter]
Text
queryDocumentRequestQuery :: QueryDocumentRequest -> Text
queryDocumentRequestResultsCount :: QueryDocumentRequest -> Maybe Int
queryDocumentRequestMetadataFilters :: QueryDocumentRequest -> Maybe [MetadataFilter]
queryDocumentRequestQuery :: Text
queryDocumentRequestResultsCount :: Maybe Int
queryDocumentRequestMetadataFilters :: Maybe [MetadataFilter]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"query" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
queryDocumentRequestQuery
      , Key
"resultsCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
queryDocumentRequestResultsCount
      , Key
"metadataFilters" Key -> Maybe [MetadataFilter] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [MetadataFilter]
queryDocumentRequestMetadataFilters
      ]

-- | Construct a value of type 'QueryDocumentRequest' (by applying it's required fields, if any)
mkQueryDocumentRequest ::
  -- | 'queryDocumentRequestQuery': Required. Query string to perform semantic search.
  Text ->
  QueryDocumentRequest
mkQueryDocumentRequest :: Text -> QueryDocumentRequest
mkQueryDocumentRequest Text
queryDocumentRequestQuery =
  QueryDocumentRequest
    { Text
queryDocumentRequestQuery :: Text
queryDocumentRequestQuery :: Text
queryDocumentRequestQuery
    , queryDocumentRequestResultsCount :: Maybe Int
queryDocumentRequestResultsCount = Maybe Int
forall a. Maybe a
Nothing
    , queryDocumentRequestMetadataFilters :: Maybe [MetadataFilter]
queryDocumentRequestMetadataFilters = Maybe [MetadataFilter]
forall a. Maybe a
Nothing
    }

-- ** QueryDocumentResponse

{- | QueryDocumentResponse
Response from `QueryDocument` containing a list of relevant chunks.
-}
data QueryDocumentResponse = QueryDocumentResponse
  { QueryDocumentResponse -> Maybe [RelevantChunk]
queryDocumentResponseRelevantChunks :: !(Maybe [RelevantChunk])
  -- ^ "relevantChunks" - The returned relevant chunks.
  }
  deriving (Int -> QueryDocumentResponse -> ShowS
[QueryDocumentResponse] -> ShowS
QueryDocumentResponse -> [Char]
(Int -> QueryDocumentResponse -> ShowS)
-> (QueryDocumentResponse -> [Char])
-> ([QueryDocumentResponse] -> ShowS)
-> Show QueryDocumentResponse
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> QueryDocumentResponse -> ShowS
showsPrec :: Int -> QueryDocumentResponse -> ShowS
$cshow :: QueryDocumentResponse -> [Char]
show :: QueryDocumentResponse -> [Char]
$cshowList :: [QueryDocumentResponse] -> ShowS
showList :: [QueryDocumentResponse] -> ShowS
P.Show, QueryDocumentResponse -> QueryDocumentResponse -> Bool
(QueryDocumentResponse -> QueryDocumentResponse -> Bool)
-> (QueryDocumentResponse -> QueryDocumentResponse -> Bool)
-> Eq QueryDocumentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: QueryDocumentResponse -> QueryDocumentResponse -> Bool
== :: QueryDocumentResponse -> QueryDocumentResponse -> Bool
$c/= :: QueryDocumentResponse -> QueryDocumentResponse -> Bool
/= :: QueryDocumentResponse -> QueryDocumentResponse -> Bool
P.Eq, P.Typeable)

-- | FromJSON QueryDocumentResponse
instance A.FromJSON QueryDocumentResponse where
  parseJSON :: Value -> Parser QueryDocumentResponse
parseJSON = [Char]
-> (Object -> Parser QueryDocumentResponse)
-> Value
-> Parser QueryDocumentResponse
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"QueryDocumentResponse" ((Object -> Parser QueryDocumentResponse)
 -> Value -> Parser QueryDocumentResponse)
-> (Object -> Parser QueryDocumentResponse)
-> Value
-> Parser QueryDocumentResponse
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [RelevantChunk] -> QueryDocumentResponse
QueryDocumentResponse
      (Maybe [RelevantChunk] -> QueryDocumentResponse)
-> Parser (Maybe [RelevantChunk]) -> Parser QueryDocumentResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [RelevantChunk])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"relevantChunks")

-- | ToJSON QueryDocumentResponse
instance A.ToJSON QueryDocumentResponse where
  toJSON :: QueryDocumentResponse -> Value
toJSON QueryDocumentResponse {Maybe [RelevantChunk]
queryDocumentResponseRelevantChunks :: QueryDocumentResponse -> Maybe [RelevantChunk]
queryDocumentResponseRelevantChunks :: Maybe [RelevantChunk]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"relevantChunks" Key -> Maybe [RelevantChunk] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [RelevantChunk]
queryDocumentResponseRelevantChunks
      ]

-- | Construct a value of type 'QueryDocumentResponse' (by applying it's required fields, if any)
mkQueryDocumentResponse ::
  QueryDocumentResponse
mkQueryDocumentResponse :: QueryDocumentResponse
mkQueryDocumentResponse =
  QueryDocumentResponse
    { queryDocumentResponseRelevantChunks :: Maybe [RelevantChunk]
queryDocumentResponseRelevantChunks = Maybe [RelevantChunk]
forall a. Maybe a
Nothing
    }

-- ** RelevantChunk

{- | RelevantChunk
The information for a chunk relevant to a query.
-}
data RelevantChunk = RelevantChunk
  { RelevantChunk -> Maybe Chunk
relevantChunkChunk :: !(Maybe Chunk)
  -- ^ "chunk" - &#x60;Chunk&#x60; associated with the query.
  , RelevantChunk -> Maybe Float
relevantChunkChunkRelevanceScore :: !(Maybe Float)
  -- ^ "chunkRelevanceScore" - &#x60;Chunk&#x60; relevance to the query.
  }
  deriving (Int -> RelevantChunk -> ShowS
[RelevantChunk] -> ShowS
RelevantChunk -> [Char]
(Int -> RelevantChunk -> ShowS)
-> (RelevantChunk -> [Char])
-> ([RelevantChunk] -> ShowS)
-> Show RelevantChunk
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RelevantChunk -> ShowS
showsPrec :: Int -> RelevantChunk -> ShowS
$cshow :: RelevantChunk -> [Char]
show :: RelevantChunk -> [Char]
$cshowList :: [RelevantChunk] -> ShowS
showList :: [RelevantChunk] -> ShowS
P.Show, RelevantChunk -> RelevantChunk -> Bool
(RelevantChunk -> RelevantChunk -> Bool)
-> (RelevantChunk -> RelevantChunk -> Bool) -> Eq RelevantChunk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RelevantChunk -> RelevantChunk -> Bool
== :: RelevantChunk -> RelevantChunk -> Bool
$c/= :: RelevantChunk -> RelevantChunk -> Bool
/= :: RelevantChunk -> RelevantChunk -> Bool
P.Eq, P.Typeable)

-- | FromJSON RelevantChunk
instance A.FromJSON RelevantChunk where
  parseJSON :: Value -> Parser RelevantChunk
parseJSON = [Char]
-> (Object -> Parser RelevantChunk)
-> Value
-> Parser RelevantChunk
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"RelevantChunk" ((Object -> Parser RelevantChunk) -> Value -> Parser RelevantChunk)
-> (Object -> Parser RelevantChunk)
-> Value
-> Parser RelevantChunk
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Chunk -> Maybe Float -> RelevantChunk
RelevantChunk
      (Maybe Chunk -> Maybe Float -> RelevantChunk)
-> Parser (Maybe Chunk) -> Parser (Maybe Float -> RelevantChunk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Chunk)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"chunk")
      Parser (Maybe Float -> RelevantChunk)
-> Parser (Maybe Float) -> Parser RelevantChunk
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"chunkRelevanceScore")

-- | ToJSON RelevantChunk
instance A.ToJSON RelevantChunk where
  toJSON :: RelevantChunk -> Value
toJSON RelevantChunk {Maybe Float
Maybe Chunk
relevantChunkChunk :: RelevantChunk -> Maybe Chunk
relevantChunkChunkRelevanceScore :: RelevantChunk -> Maybe Float
relevantChunkChunk :: Maybe Chunk
relevantChunkChunkRelevanceScore :: Maybe Float
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"chunk" Key -> Maybe Chunk -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Chunk
relevantChunkChunk
      , Key
"chunkRelevanceScore" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
relevantChunkChunkRelevanceScore
      ]

-- | Construct a value of type 'RelevantChunk' (by applying it's required fields, if any)
mkRelevantChunk ::
  RelevantChunk
mkRelevantChunk :: RelevantChunk
mkRelevantChunk =
  RelevantChunk
    { relevantChunkChunk :: Maybe Chunk
relevantChunkChunk = Maybe Chunk
forall a. Maybe a
Nothing
    , relevantChunkChunkRelevanceScore :: Maybe Float
relevantChunkChunkRelevanceScore = Maybe Float
forall a. Maybe a
Nothing
    }

-- ** RetrievalMetadata

{- | RetrievalMetadata
Metadata related to retrieval in the grounding flow.
-}
data RetrievalMetadata = RetrievalMetadata
  { RetrievalMetadata -> Maybe Float
retrievalMetadataGoogleSearchDynamicRetrievalScore :: !(Maybe Float)
  -- ^ "googleSearchDynamicRetrievalScore" - Optional. Score indicating how likely information from google search could help answer the prompt. The score is in the range [0, 1], where 0 is the least likely and 1 is the most likely. This score is only populated when google search grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine whether to trigger google search.
  }
  deriving (Int -> RetrievalMetadata -> ShowS
[RetrievalMetadata] -> ShowS
RetrievalMetadata -> [Char]
(Int -> RetrievalMetadata -> ShowS)
-> (RetrievalMetadata -> [Char])
-> ([RetrievalMetadata] -> ShowS)
-> Show RetrievalMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RetrievalMetadata -> ShowS
showsPrec :: Int -> RetrievalMetadata -> ShowS
$cshow :: RetrievalMetadata -> [Char]
show :: RetrievalMetadata -> [Char]
$cshowList :: [RetrievalMetadata] -> ShowS
showList :: [RetrievalMetadata] -> ShowS
P.Show, RetrievalMetadata -> RetrievalMetadata -> Bool
(RetrievalMetadata -> RetrievalMetadata -> Bool)
-> (RetrievalMetadata -> RetrievalMetadata -> Bool)
-> Eq RetrievalMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RetrievalMetadata -> RetrievalMetadata -> Bool
== :: RetrievalMetadata -> RetrievalMetadata -> Bool
$c/= :: RetrievalMetadata -> RetrievalMetadata -> Bool
/= :: RetrievalMetadata -> RetrievalMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON RetrievalMetadata
instance A.FromJSON RetrievalMetadata where
  parseJSON :: Value -> Parser RetrievalMetadata
parseJSON = [Char]
-> (Object -> Parser RetrievalMetadata)
-> Value
-> Parser RetrievalMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"RetrievalMetadata" ((Object -> Parser RetrievalMetadata)
 -> Value -> Parser RetrievalMetadata)
-> (Object -> Parser RetrievalMetadata)
-> Value
-> Parser RetrievalMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Float -> RetrievalMetadata
RetrievalMetadata
      (Maybe Float -> RetrievalMetadata)
-> Parser (Maybe Float) -> Parser RetrievalMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"googleSearchDynamicRetrievalScore")

-- | ToJSON RetrievalMetadata
instance A.ToJSON RetrievalMetadata where
  toJSON :: RetrievalMetadata -> Value
toJSON RetrievalMetadata {Maybe Float
retrievalMetadataGoogleSearchDynamicRetrievalScore :: RetrievalMetadata -> Maybe Float
retrievalMetadataGoogleSearchDynamicRetrievalScore :: Maybe Float
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"googleSearchDynamicRetrievalScore" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
retrievalMetadataGoogleSearchDynamicRetrievalScore
      ]

-- | Construct a value of type 'RetrievalMetadata' (by applying it's required fields, if any)
mkRetrievalMetadata ::
  RetrievalMetadata
mkRetrievalMetadata :: RetrievalMetadata
mkRetrievalMetadata =
  RetrievalMetadata
    { retrievalMetadataGoogleSearchDynamicRetrievalScore :: Maybe Float
retrievalMetadataGoogleSearchDynamicRetrievalScore = Maybe Float
forall a. Maybe a
Nothing
    }

-- ** SafetyFeedback

{- | SafetyFeedback
Safety feedback for an entire request.  This field is populated if content in the input and/or response is blocked due to safety settings. SafetyFeedback may not exist for every HarmCategory. Each SafetyFeedback will return the safety settings used by the request as well as the lowest HarmProbability that should be allowed in order to return a result.
-}
data SafetyFeedback = SafetyFeedback
  { SafetyFeedback -> Maybe SafetySetting
safetyFeedbackSetting :: !(Maybe SafetySetting)
  -- ^ "setting" - Safety settings applied to the request.
  , SafetyFeedback -> Maybe SafetyRating
safetyFeedbackRating :: !(Maybe SafetyRating)
  -- ^ "rating" - Safety rating evaluated from content.
  }
  deriving (Int -> SafetyFeedback -> ShowS
[SafetyFeedback] -> ShowS
SafetyFeedback -> [Char]
(Int -> SafetyFeedback -> ShowS)
-> (SafetyFeedback -> [Char])
-> ([SafetyFeedback] -> ShowS)
-> Show SafetyFeedback
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SafetyFeedback -> ShowS
showsPrec :: Int -> SafetyFeedback -> ShowS
$cshow :: SafetyFeedback -> [Char]
show :: SafetyFeedback -> [Char]
$cshowList :: [SafetyFeedback] -> ShowS
showList :: [SafetyFeedback] -> ShowS
P.Show, SafetyFeedback -> SafetyFeedback -> Bool
(SafetyFeedback -> SafetyFeedback -> Bool)
-> (SafetyFeedback -> SafetyFeedback -> Bool) -> Eq SafetyFeedback
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SafetyFeedback -> SafetyFeedback -> Bool
== :: SafetyFeedback -> SafetyFeedback -> Bool
$c/= :: SafetyFeedback -> SafetyFeedback -> Bool
/= :: SafetyFeedback -> SafetyFeedback -> Bool
P.Eq, P.Typeable)

-- | FromJSON SafetyFeedback
instance A.FromJSON SafetyFeedback where
  parseJSON :: Value -> Parser SafetyFeedback
parseJSON = [Char]
-> (Object -> Parser SafetyFeedback)
-> Value
-> Parser SafetyFeedback
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SafetyFeedback" ((Object -> Parser SafetyFeedback)
 -> Value -> Parser SafetyFeedback)
-> (Object -> Parser SafetyFeedback)
-> Value
-> Parser SafetyFeedback
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe SafetySetting -> Maybe SafetyRating -> SafetyFeedback
SafetyFeedback
      (Maybe SafetySetting -> Maybe SafetyRating -> SafetyFeedback)
-> Parser (Maybe SafetySetting)
-> Parser (Maybe SafetyRating -> SafetyFeedback)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe SafetySetting)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"setting")
      Parser (Maybe SafetyRating -> SafetyFeedback)
-> Parser (Maybe SafetyRating) -> Parser SafetyFeedback
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe SafetyRating)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"rating")

-- | ToJSON SafetyFeedback
instance A.ToJSON SafetyFeedback where
  toJSON :: SafetyFeedback -> Value
toJSON SafetyFeedback {Maybe SafetyRating
Maybe SafetySetting
safetyFeedbackSetting :: SafetyFeedback -> Maybe SafetySetting
safetyFeedbackRating :: SafetyFeedback -> Maybe SafetyRating
safetyFeedbackSetting :: Maybe SafetySetting
safetyFeedbackRating :: Maybe SafetyRating
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"setting" Key -> Maybe SafetySetting -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe SafetySetting
safetyFeedbackSetting
      , Key
"rating" Key -> Maybe SafetyRating -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe SafetyRating
safetyFeedbackRating
      ]

-- | Construct a value of type 'SafetyFeedback' (by applying it's required fields, if any)
mkSafetyFeedback ::
  SafetyFeedback
mkSafetyFeedback :: SafetyFeedback
mkSafetyFeedback =
  SafetyFeedback
    { safetyFeedbackSetting :: Maybe SafetySetting
safetyFeedbackSetting = Maybe SafetySetting
forall a. Maybe a
Nothing
    , safetyFeedbackRating :: Maybe SafetyRating
safetyFeedbackRating = Maybe SafetyRating
forall a. Maybe a
Nothing
    }

-- ** SafetyRating

{- | SafetyRating
Safety rating for a piece of content.  The safety rating contains the category of harm and the harm probability level in that category for a piece of content. Content is classified for safety across a number of harm categories and the probability of the harm classification is included here.
-}
data SafetyRating = SafetyRating
  { SafetyRating -> HarmCategory
safetyRatingCategory :: !(HarmCategory)
  -- ^ /Required/ "category" - Required. The category for this rating.
  , SafetyRating -> Maybe Bool
safetyRatingBlocked :: !(Maybe Bool)
  -- ^ "blocked" - Was this content blocked because of this rating?
  , SafetyRating -> E'Probability
safetyRatingProbability :: !(E'Probability)
  -- ^ /Required/ "probability" - Required. The probability of harm for this content.
  }
  deriving (Int -> SafetyRating -> ShowS
[SafetyRating] -> ShowS
SafetyRating -> [Char]
(Int -> SafetyRating -> ShowS)
-> (SafetyRating -> [Char])
-> ([SafetyRating] -> ShowS)
-> Show SafetyRating
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SafetyRating -> ShowS
showsPrec :: Int -> SafetyRating -> ShowS
$cshow :: SafetyRating -> [Char]
show :: SafetyRating -> [Char]
$cshowList :: [SafetyRating] -> ShowS
showList :: [SafetyRating] -> ShowS
P.Show, SafetyRating -> SafetyRating -> Bool
(SafetyRating -> SafetyRating -> Bool)
-> (SafetyRating -> SafetyRating -> Bool) -> Eq SafetyRating
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SafetyRating -> SafetyRating -> Bool
== :: SafetyRating -> SafetyRating -> Bool
$c/= :: SafetyRating -> SafetyRating -> Bool
/= :: SafetyRating -> SafetyRating -> Bool
P.Eq, P.Typeable)

-- | FromJSON SafetyRating
instance A.FromJSON SafetyRating where
  parseJSON :: Value -> Parser SafetyRating
parseJSON = [Char]
-> (Object -> Parser SafetyRating) -> Value -> Parser SafetyRating
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SafetyRating" ((Object -> Parser SafetyRating) -> Value -> Parser SafetyRating)
-> (Object -> Parser SafetyRating) -> Value -> Parser SafetyRating
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    HarmCategory -> Maybe Bool -> E'Probability -> SafetyRating
SafetyRating
      (HarmCategory -> Maybe Bool -> E'Probability -> SafetyRating)
-> Parser HarmCategory
-> Parser (Maybe Bool -> E'Probability -> SafetyRating)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser HarmCategory
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"category")
      Parser (Maybe Bool -> E'Probability -> SafetyRating)
-> Parser (Maybe Bool) -> Parser (E'Probability -> SafetyRating)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"blocked")
      Parser (E'Probability -> SafetyRating)
-> Parser E'Probability -> Parser SafetyRating
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser E'Probability
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"probability")

-- | ToJSON SafetyRating
instance A.ToJSON SafetyRating where
  toJSON :: SafetyRating -> Value
toJSON SafetyRating {Maybe Bool
E'Probability
HarmCategory
safetyRatingCategory :: SafetyRating -> HarmCategory
safetyRatingBlocked :: SafetyRating -> Maybe Bool
safetyRatingProbability :: SafetyRating -> E'Probability
safetyRatingCategory :: HarmCategory
safetyRatingBlocked :: Maybe Bool
safetyRatingProbability :: E'Probability
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"category" Key -> HarmCategory -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= HarmCategory
safetyRatingCategory
      , Key
"blocked" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
safetyRatingBlocked
      , Key
"probability" Key -> E'Probability -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= E'Probability
safetyRatingProbability
      ]

-- | Construct a value of type 'SafetyRating' (by applying it's required fields, if any)
mkSafetyRating ::
  -- | 'safetyRatingCategory': Required. The category for this rating.
  HarmCategory ->
  -- | 'safetyRatingProbability': Required. The probability of harm for this content.
  E'Probability ->
  SafetyRating
mkSafetyRating :: HarmCategory -> E'Probability -> SafetyRating
mkSafetyRating HarmCategory
safetyRatingCategory E'Probability
safetyRatingProbability =
  SafetyRating
    { HarmCategory
safetyRatingCategory :: HarmCategory
safetyRatingCategory :: HarmCategory
safetyRatingCategory
    , safetyRatingBlocked :: Maybe Bool
safetyRatingBlocked = Maybe Bool
forall a. Maybe a
Nothing
    , E'Probability
safetyRatingProbability :: E'Probability
safetyRatingProbability :: E'Probability
safetyRatingProbability
    }

-- ** SafetySetting

{- | SafetySetting
Safety setting, affecting the safety-blocking behavior.  Passing a safety setting for a category changes the allowed probability that content is blocked.
-}
data SafetySetting = SafetySetting
  { SafetySetting -> E'Threshold
safetySettingThreshold :: !(E'Threshold)
  -- ^ /Required/ "threshold" - Required. Controls the probability threshold at which harm is blocked.
  , SafetySetting -> HarmCategory
safetySettingCategory :: !(HarmCategory)
  -- ^ /Required/ "category" - Required. The category for this setting.
  }
  deriving (Int -> SafetySetting -> ShowS
[SafetySetting] -> ShowS
SafetySetting -> [Char]
(Int -> SafetySetting -> ShowS)
-> (SafetySetting -> [Char])
-> ([SafetySetting] -> ShowS)
-> Show SafetySetting
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SafetySetting -> ShowS
showsPrec :: Int -> SafetySetting -> ShowS
$cshow :: SafetySetting -> [Char]
show :: SafetySetting -> [Char]
$cshowList :: [SafetySetting] -> ShowS
showList :: [SafetySetting] -> ShowS
P.Show, SafetySetting -> SafetySetting -> Bool
(SafetySetting -> SafetySetting -> Bool)
-> (SafetySetting -> SafetySetting -> Bool) -> Eq SafetySetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SafetySetting -> SafetySetting -> Bool
== :: SafetySetting -> SafetySetting -> Bool
$c/= :: SafetySetting -> SafetySetting -> Bool
/= :: SafetySetting -> SafetySetting -> Bool
P.Eq, P.Typeable)

-- | FromJSON SafetySetting
instance A.FromJSON SafetySetting where
  parseJSON :: Value -> Parser SafetySetting
parseJSON = [Char]
-> (Object -> Parser SafetySetting)
-> Value
-> Parser SafetySetting
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SafetySetting" ((Object -> Parser SafetySetting) -> Value -> Parser SafetySetting)
-> (Object -> Parser SafetySetting)
-> Value
-> Parser SafetySetting
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    E'Threshold -> HarmCategory -> SafetySetting
SafetySetting
      (E'Threshold -> HarmCategory -> SafetySetting)
-> Parser E'Threshold -> Parser (HarmCategory -> SafetySetting)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser E'Threshold
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"threshold")
      Parser (HarmCategory -> SafetySetting)
-> Parser HarmCategory -> Parser SafetySetting
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser HarmCategory
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"category")

-- | ToJSON SafetySetting
instance A.ToJSON SafetySetting where
  toJSON :: SafetySetting -> Value
toJSON SafetySetting {E'Threshold
HarmCategory
safetySettingThreshold :: SafetySetting -> E'Threshold
safetySettingCategory :: SafetySetting -> HarmCategory
safetySettingThreshold :: E'Threshold
safetySettingCategory :: HarmCategory
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"threshold" Key -> E'Threshold -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= E'Threshold
safetySettingThreshold
      , Key
"category" Key -> HarmCategory -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= HarmCategory
safetySettingCategory
      ]

-- | Construct a value of type 'SafetySetting' (by applying it's required fields, if any)
mkSafetySetting ::
  -- | 'safetySettingThreshold': Required. Controls the probability threshold at which harm is blocked.
  E'Threshold ->
  -- | 'safetySettingCategory': Required. The category for this setting.
  HarmCategory ->
  SafetySetting
mkSafetySetting :: E'Threshold -> HarmCategory -> SafetySetting
mkSafetySetting E'Threshold
safetySettingThreshold HarmCategory
safetySettingCategory =
  SafetySetting
    { E'Threshold
safetySettingThreshold :: E'Threshold
safetySettingThreshold :: E'Threshold
safetySettingThreshold
    , HarmCategory
safetySettingCategory :: HarmCategory
safetySettingCategory :: HarmCategory
safetySettingCategory
    }

-- ** Schema

{- | Schema
The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema).
-}
data Schema = Schema
  { Schema -> Maybe Schema
schemaItems :: !(Maybe Schema)
  -- ^ "items" - Optional. Schema of the elements of Type.ARRAY.
  , Schema -> Maybe [Schema]
schemaAnyOf :: !(Maybe [Schema])
  -- ^ "anyOf" - Optional. The value should be validated against any (one or more) of the subschemas in the list.
  , Schema -> Maybe Text
schemaMinLength :: !(Maybe Text)
  -- ^ "minLength" - Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING
  , Schema -> Maybe Double
schemaMaximum :: !(Maybe Double)
  -- ^ "maximum" - Optional. Maximum value of the Type.INTEGER and Type.NUMBER
  , Schema -> Maybe [Text]
schemaPropertyOrdering :: !(Maybe [Text])
  -- ^ "propertyOrdering" - Optional. The order of the properties. Not a standard field in open api spec. Used to determine the order of the properties in the response.
  , Schema -> Maybe Bool
schemaNullable :: !(Maybe Bool)
  -- ^ "nullable" - Optional. Indicates if the value may be null.
  , Schema -> Maybe [Text]
schemaRequired :: !(Maybe [Text])
  -- ^ "required" - Optional. Required properties of Type.OBJECT.
  , Schema -> Maybe Text
schemaMinProperties :: !(Maybe Text)
  -- ^ "minProperties" - Optional. Minimum number of the properties for Type.OBJECT.
  , Schema -> Maybe Text
schemaMaxItems :: !(Maybe Text)
  -- ^ "maxItems" - Optional. Maximum number of the elements for Type.ARRAY.
  , Schema -> Maybe [Char]
schemaExample :: !(Maybe String)
  -- ^ "example" - Optional. Example of the object. Will only populated when the object is the root.
  , Schema -> Maybe Text
schemaTitle :: !(Maybe Text)
  -- ^ "title" - Optional. The title of the schema.
  , Schema -> Maybe Text
schemaMinItems :: !(Maybe Text)
  -- ^ "minItems" - Optional. Minimum number of the elements for Type.ARRAY.
  , Schema -> Maybe Text
schemaDescription :: !(Maybe Text)
  -- ^ "description" - Optional. A brief description of the parameter. This could contain examples of use. Parameter description may be formatted as Markdown.
  , Schema -> ModelType
schemaType :: !(ModelType)
  -- ^ /Required/ "type" - Required. Data type.
  , Schema -> Maybe [Char]
schemaDefault :: !(Maybe String)
  -- ^ "default" - Optional. Default value of the field. Per JSON Schema, this field is intended for documentation generators and doesn&#39;t affect validation. Thus it&#39;s included here and ignored so that developers who send schemas with a &#x60;default&#x60; field don&#39;t get unknown-field errors.
  , Schema -> Maybe Double
schemaMinimum :: !(Maybe Double)
  -- ^ "minimum" - Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER
  , Schema -> Maybe Text
schemaPattern :: !(Maybe Text)
  -- ^ "pattern" - Optional. Pattern of the Type.STRING to restrict a string to a regular expression.
  , Schema -> Maybe (Map [Char] Schema)
schemaProperties :: !(Maybe (Map.Map String Schema))
  -- ^ "properties" - Optional. Properties of Type.OBJECT.
  , Schema -> Maybe Text
schemaMaxProperties :: !(Maybe Text)
  -- ^ "maxProperties" - Optional. Maximum number of the properties for Type.OBJECT.
  , Schema -> Maybe Text
schemaFormat :: !(Maybe Text)
  -- ^ "format" - Optional. The format of the data. This is used only for primitive datatypes. Supported formats:  for NUMBER type: float, double  for INTEGER type: int32, int64  for STRING type: enum, date-time
  , Schema -> Maybe [Text]
schemaEnum :: !(Maybe [Text])
  -- ^ "enum" - Optional. Possible values of the element of Type.STRING with enum format. For example we can define an Enum Direction as : {type:STRING, format:enum, enum:[\&quot;EAST\&quot;, NORTH\&quot;, \&quot;SOUTH\&quot;, \&quot;WEST\&quot;]}
  , Schema -> Maybe Text
schemaMaxLength :: !(Maybe Text)
  -- ^ "maxLength" - Optional. Maximum length of the Type.STRING
  }
  deriving (Int -> Schema -> ShowS
[Schema] -> ShowS
Schema -> [Char]
(Int -> Schema -> ShowS)
-> (Schema -> [Char]) -> ([Schema] -> ShowS) -> Show Schema
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Schema -> ShowS
showsPrec :: Int -> Schema -> ShowS
$cshow :: Schema -> [Char]
show :: Schema -> [Char]
$cshowList :: [Schema] -> ShowS
showList :: [Schema] -> ShowS
P.Show, Schema -> Schema -> Bool
(Schema -> Schema -> Bool)
-> (Schema -> Schema -> Bool) -> Eq Schema
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Schema -> Schema -> Bool
== :: Schema -> Schema -> Bool
$c/= :: Schema -> Schema -> Bool
/= :: Schema -> Schema -> Bool
P.Eq, P.Typeable)

-- | FromJSON Schema
instance A.FromJSON Schema where
  parseJSON :: Value -> Parser Schema
parseJSON = [Char] -> (Object -> Parser Schema) -> Value -> Parser Schema
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Schema" ((Object -> Parser Schema) -> Value -> Parser Schema)
-> (Object -> Parser Schema) -> Value -> Parser Schema
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Schema
-> Maybe [Schema]
-> Maybe Text
-> Maybe Double
-> Maybe [Text]
-> Maybe Bool
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe [Char]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ModelType
-> Maybe [Char]
-> Maybe Double
-> Maybe Text
-> Maybe (Map [Char] Schema)
-> Maybe Text
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Schema
Schema
      (Maybe Schema
 -> Maybe [Schema]
 -> Maybe Text
 -> Maybe Double
 -> Maybe [Text]
 -> Maybe Bool
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Char]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ModelType
 -> Maybe [Char]
 -> Maybe Double
 -> Maybe Text
 -> Maybe (Map [Char] Schema)
 -> Maybe Text
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Schema)
-> Parser (Maybe Schema)
-> Parser
     (Maybe [Schema]
      -> Maybe Text
      -> Maybe Double
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Schema)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"items")
      Parser
  (Maybe [Schema]
   -> Maybe Text
   -> Maybe Double
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe [Schema])
-> Parser
     (Maybe Text
      -> Maybe Double
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Schema])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"anyOf")
      Parser
  (Maybe Text
   -> Maybe Double
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Text)
-> Parser
     (Maybe Double
      -> Maybe [Text]
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minLength")
      Parser
  (Maybe Double
   -> Maybe [Text]
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Double)
-> Parser
     (Maybe [Text]
      -> Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maximum")
      Parser
  (Maybe [Text]
   -> Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Bool
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"propertyOrdering")
      Parser
  (Maybe Bool
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Bool)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"nullable")
      Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"required")
      Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minProperties")
      Parser
  (Maybe Text
   -> Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Char]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxItems")
      Parser
  (Maybe [Char]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe [Char])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Char])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"example")
      Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title")
      Parser
  (Maybe Text
   -> Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minItems")
      Parser
  (Maybe Text
   -> ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Text)
-> Parser
     (ModelType
      -> Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description")
      Parser
  (ModelType
   -> Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser ModelType
-> Parser
     (Maybe [Char]
      -> Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser ModelType
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"type")
      Parser
  (Maybe [Char]
   -> Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe [Char])
-> Parser
     (Maybe Double
      -> Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Char])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"default")
      Parser
  (Maybe Double
   -> Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Double)
-> Parser
     (Maybe Text
      -> Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minimum")
      Parser
  (Maybe Text
   -> Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe Text)
-> Parser
     (Maybe (Map [Char] Schema)
      -> Maybe Text
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"pattern")
      Parser
  (Maybe (Map [Char] Schema)
   -> Maybe Text
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Schema)
-> Parser (Maybe (Map [Char] Schema))
-> Parser
     (Maybe Text -> Maybe Text -> Maybe [Text] -> Maybe Text -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe (Map [Char] Schema))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"properties")
      Parser
  (Maybe Text -> Maybe Text -> Maybe [Text] -> Maybe Text -> Schema)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe [Text] -> Maybe Text -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxProperties")
      Parser (Maybe Text -> Maybe [Text] -> Maybe Text -> Schema)
-> Parser (Maybe Text)
-> Parser (Maybe [Text] -> Maybe Text -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"format")
      Parser (Maybe [Text] -> Maybe Text -> Schema)
-> Parser (Maybe [Text]) -> Parser (Maybe Text -> Schema)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"enum")
      Parser (Maybe Text -> Schema)
-> Parser (Maybe Text) -> Parser Schema
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxLength")

-- | ToJSON Schema
instance A.ToJSON Schema where
  toJSON :: Schema -> Value
toJSON Schema {Maybe Bool
Maybe Double
Maybe [Char]
Maybe [Text]
Maybe [Schema]
Maybe Text
Maybe (Map [Char] Schema)
Maybe Schema
ModelType
schemaItems :: Schema -> Maybe Schema
schemaAnyOf :: Schema -> Maybe [Schema]
schemaMinLength :: Schema -> Maybe Text
schemaMaximum :: Schema -> Maybe Double
schemaPropertyOrdering :: Schema -> Maybe [Text]
schemaNullable :: Schema -> Maybe Bool
schemaRequired :: Schema -> Maybe [Text]
schemaMinProperties :: Schema -> Maybe Text
schemaMaxItems :: Schema -> Maybe Text
schemaExample :: Schema -> Maybe [Char]
schemaTitle :: Schema -> Maybe Text
schemaMinItems :: Schema -> Maybe Text
schemaDescription :: Schema -> Maybe Text
schemaType :: Schema -> ModelType
schemaDefault :: Schema -> Maybe [Char]
schemaMinimum :: Schema -> Maybe Double
schemaPattern :: Schema -> Maybe Text
schemaProperties :: Schema -> Maybe (Map [Char] Schema)
schemaMaxProperties :: Schema -> Maybe Text
schemaFormat :: Schema -> Maybe Text
schemaEnum :: Schema -> Maybe [Text]
schemaMaxLength :: Schema -> Maybe Text
schemaItems :: Maybe Schema
schemaAnyOf :: Maybe [Schema]
schemaMinLength :: Maybe Text
schemaMaximum :: Maybe Double
schemaPropertyOrdering :: Maybe [Text]
schemaNullable :: Maybe Bool
schemaRequired :: Maybe [Text]
schemaMinProperties :: Maybe Text
schemaMaxItems :: Maybe Text
schemaExample :: Maybe [Char]
schemaTitle :: Maybe Text
schemaMinItems :: Maybe Text
schemaDescription :: Maybe Text
schemaType :: ModelType
schemaDefault :: Maybe [Char]
schemaMinimum :: Maybe Double
schemaPattern :: Maybe Text
schemaProperties :: Maybe (Map [Char] Schema)
schemaMaxProperties :: Maybe Text
schemaFormat :: Maybe Text
schemaEnum :: Maybe [Text]
schemaMaxLength :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"items" Key -> Maybe Schema -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Schema
schemaItems
      , Key
"anyOf" Key -> Maybe [Schema] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Schema]
schemaAnyOf
      , Key
"minLength" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaMinLength
      , Key
"maximum" Key -> Maybe Double -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Double
schemaMaximum
      , Key
"propertyOrdering" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
schemaPropertyOrdering
      , Key
"nullable" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
schemaNullable
      , Key
"required" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
schemaRequired
      , Key
"minProperties" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaMinProperties
      , Key
"maxItems" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaMaxItems
      , Key
"example" Key -> Maybe [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Char]
schemaExample
      , Key
"title" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaTitle
      , Key
"minItems" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaMinItems
      , Key
"description" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaDescription
      , Key
"type" Key -> ModelType -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= ModelType
schemaType
      , Key
"default" Key -> Maybe [Char] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Char]
schemaDefault
      , Key
"minimum" Key -> Maybe Double -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Double
schemaMinimum
      , Key
"pattern" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaPattern
      , Key
"properties" Key -> Maybe (Map [Char] Schema) -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe (Map [Char] Schema)
schemaProperties
      , Key
"maxProperties" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaMaxProperties
      , Key
"format" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaFormat
      , Key
"enum" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
schemaEnum
      , Key
"maxLength" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
schemaMaxLength
      ]

-- | Construct a value of type 'Schema' (by applying it's required fields, if any)
mkSchema ::
  -- | 'schemaType': Required. Data type.
  ModelType ->
  Schema
mkSchema :: ModelType -> Schema
mkSchema ModelType
schemaType =
  Schema
    { schemaItems :: Maybe Schema
schemaItems = Maybe Schema
forall a. Maybe a
Nothing
    , schemaAnyOf :: Maybe [Schema]
schemaAnyOf = Maybe [Schema]
forall a. Maybe a
Nothing
    , schemaMinLength :: Maybe Text
schemaMinLength = Maybe Text
forall a. Maybe a
Nothing
    , schemaMaximum :: Maybe Double
schemaMaximum = Maybe Double
forall a. Maybe a
Nothing
    , schemaPropertyOrdering :: Maybe [Text]
schemaPropertyOrdering = Maybe [Text]
forall a. Maybe a
Nothing
    , schemaNullable :: Maybe Bool
schemaNullable = Maybe Bool
forall a. Maybe a
Nothing
    , schemaRequired :: Maybe [Text]
schemaRequired = Maybe [Text]
forall a. Maybe a
Nothing
    , schemaMinProperties :: Maybe Text
schemaMinProperties = Maybe Text
forall a. Maybe a
Nothing
    , schemaMaxItems :: Maybe Text
schemaMaxItems = Maybe Text
forall a. Maybe a
Nothing
    , schemaExample :: Maybe [Char]
schemaExample = Maybe [Char]
forall a. Maybe a
Nothing
    , schemaTitle :: Maybe Text
schemaTitle = Maybe Text
forall a. Maybe a
Nothing
    , schemaMinItems :: Maybe Text
schemaMinItems = Maybe Text
forall a. Maybe a
Nothing
    , schemaDescription :: Maybe Text
schemaDescription = Maybe Text
forall a. Maybe a
Nothing
    , ModelType
schemaType :: ModelType
schemaType :: ModelType
schemaType
    , schemaDefault :: Maybe [Char]
schemaDefault = Maybe [Char]
forall a. Maybe a
Nothing
    , schemaMinimum :: Maybe Double
schemaMinimum = Maybe Double
forall a. Maybe a
Nothing
    , schemaPattern :: Maybe Text
schemaPattern = Maybe Text
forall a. Maybe a
Nothing
    , schemaProperties :: Maybe (Map [Char] Schema)
schemaProperties = Maybe (Map [Char] Schema)
forall a. Maybe a
Nothing
    , schemaMaxProperties :: Maybe Text
schemaMaxProperties = Maybe Text
forall a. Maybe a
Nothing
    , schemaFormat :: Maybe Text
schemaFormat = Maybe Text
forall a. Maybe a
Nothing
    , schemaEnum :: Maybe [Text]
schemaEnum = Maybe [Text]
forall a. Maybe a
Nothing
    , schemaMaxLength :: Maybe Text
schemaMaxLength = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** SearchEntryPoint

{- | SearchEntryPoint
Google search entry point.
-}
data SearchEntryPoint = SearchEntryPoint
  { SearchEntryPoint -> Maybe ByteArray
searchEntryPointSdkBlob :: !(Maybe ByteArray)
  -- ^ "sdkBlob" - Optional. Base64 encoded JSON representing array of  tuple.
  , SearchEntryPoint -> Maybe Text
searchEntryPointRenderedContent :: !(Maybe Text)
  -- ^ "renderedContent" - Optional. Web content snippet that can be embedded in a web page or an app webview.
  }
  deriving (Int -> SearchEntryPoint -> ShowS
[SearchEntryPoint] -> ShowS
SearchEntryPoint -> [Char]
(Int -> SearchEntryPoint -> ShowS)
-> (SearchEntryPoint -> [Char])
-> ([SearchEntryPoint] -> ShowS)
-> Show SearchEntryPoint
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SearchEntryPoint -> ShowS
showsPrec :: Int -> SearchEntryPoint -> ShowS
$cshow :: SearchEntryPoint -> [Char]
show :: SearchEntryPoint -> [Char]
$cshowList :: [SearchEntryPoint] -> ShowS
showList :: [SearchEntryPoint] -> ShowS
P.Show, SearchEntryPoint -> SearchEntryPoint -> Bool
(SearchEntryPoint -> SearchEntryPoint -> Bool)
-> (SearchEntryPoint -> SearchEntryPoint -> Bool)
-> Eq SearchEntryPoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SearchEntryPoint -> SearchEntryPoint -> Bool
== :: SearchEntryPoint -> SearchEntryPoint -> Bool
$c/= :: SearchEntryPoint -> SearchEntryPoint -> Bool
/= :: SearchEntryPoint -> SearchEntryPoint -> Bool
P.Eq, P.Typeable)

-- | FromJSON SearchEntryPoint
instance A.FromJSON SearchEntryPoint where
  parseJSON :: Value -> Parser SearchEntryPoint
parseJSON = [Char]
-> (Object -> Parser SearchEntryPoint)
-> Value
-> Parser SearchEntryPoint
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SearchEntryPoint" ((Object -> Parser SearchEntryPoint)
 -> Value -> Parser SearchEntryPoint)
-> (Object -> Parser SearchEntryPoint)
-> Value
-> Parser SearchEntryPoint
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe ByteArray -> Maybe Text -> SearchEntryPoint
SearchEntryPoint
      (Maybe ByteArray -> Maybe Text -> SearchEntryPoint)
-> Parser (Maybe ByteArray)
-> Parser (Maybe Text -> SearchEntryPoint)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe ByteArray)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"sdkBlob")
      Parser (Maybe Text -> SearchEntryPoint)
-> Parser (Maybe Text) -> Parser SearchEntryPoint
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"renderedContent")

-- | ToJSON SearchEntryPoint
instance A.ToJSON SearchEntryPoint where
  toJSON :: SearchEntryPoint -> Value
toJSON SearchEntryPoint {Maybe Text
Maybe ByteArray
searchEntryPointSdkBlob :: SearchEntryPoint -> Maybe ByteArray
searchEntryPointRenderedContent :: SearchEntryPoint -> Maybe Text
searchEntryPointSdkBlob :: Maybe ByteArray
searchEntryPointRenderedContent :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"sdkBlob" Key -> Maybe ByteArray -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ByteArray
searchEntryPointSdkBlob
      , Key
"renderedContent" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
searchEntryPointRenderedContent
      ]

-- | Construct a value of type 'SearchEntryPoint' (by applying it's required fields, if any)
mkSearchEntryPoint ::
  SearchEntryPoint
mkSearchEntryPoint :: SearchEntryPoint
mkSearchEntryPoint =
  SearchEntryPoint
    { searchEntryPointSdkBlob :: Maybe ByteArray
searchEntryPointSdkBlob = Maybe ByteArray
forall a. Maybe a
Nothing
    , searchEntryPointRenderedContent :: Maybe Text
searchEntryPointRenderedContent = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** Segment

{- | Segment
Segment of the content.
-}
data Segment = Segment
  { Segment -> Maybe Int
segmentPartIndex :: !(Maybe Int)
  -- ^ /ReadOnly/ "partIndex" - Output only. The index of a Part object within its parent Content object.
  , Segment -> Maybe Int
segmentStartIndex :: !(Maybe Int)
  -- ^ /ReadOnly/ "startIndex" - Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero.
  , Segment -> Maybe Text
segmentText :: !(Maybe Text)
  -- ^ /ReadOnly/ "text" - Output only. The text corresponding to the segment from the response.
  , Segment -> Maybe Int
segmentEndIndex :: !(Maybe Int)
  -- ^ /ReadOnly/ "endIndex" - Output only. End index in the given Part, measured in bytes. Offset from the start of the Part, exclusive, starting at zero.
  }
  deriving (Int -> Segment -> ShowS
[Segment] -> ShowS
Segment -> [Char]
(Int -> Segment -> ShowS)
-> (Segment -> [Char]) -> ([Segment] -> ShowS) -> Show Segment
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Segment -> ShowS
showsPrec :: Int -> Segment -> ShowS
$cshow :: Segment -> [Char]
show :: Segment -> [Char]
$cshowList :: [Segment] -> ShowS
showList :: [Segment] -> ShowS
P.Show, Segment -> Segment -> Bool
(Segment -> Segment -> Bool)
-> (Segment -> Segment -> Bool) -> Eq Segment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Segment -> Segment -> Bool
== :: Segment -> Segment -> Bool
$c/= :: Segment -> Segment -> Bool
/= :: Segment -> Segment -> Bool
P.Eq, P.Typeable)

-- | FromJSON Segment
instance A.FromJSON Segment where
  parseJSON :: Value -> Parser Segment
parseJSON = [Char] -> (Object -> Parser Segment) -> Value -> Parser Segment
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Segment" ((Object -> Parser Segment) -> Value -> Parser Segment)
-> (Object -> Parser Segment) -> Value -> Parser Segment
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int -> Maybe Int -> Maybe Text -> Maybe Int -> Segment
Segment
      (Maybe Int -> Maybe Int -> Maybe Text -> Maybe Int -> Segment)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe Text -> Maybe Int -> Segment)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"partIndex")
      Parser (Maybe Int -> Maybe Text -> Maybe Int -> Segment)
-> Parser (Maybe Int)
-> Parser (Maybe Text -> Maybe Int -> Segment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"startIndex")
      Parser (Maybe Text -> Maybe Int -> Segment)
-> Parser (Maybe Text) -> Parser (Maybe Int -> Segment)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"text")
      Parser (Maybe Int -> Segment)
-> Parser (Maybe Int) -> Parser Segment
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"endIndex")

-- | ToJSON Segment
instance A.ToJSON Segment where
  toJSON :: Segment -> Value
toJSON Segment {Maybe Int
Maybe Text
segmentPartIndex :: Segment -> Maybe Int
segmentStartIndex :: Segment -> Maybe Int
segmentText :: Segment -> Maybe Text
segmentEndIndex :: Segment -> Maybe Int
segmentPartIndex :: Maybe Int
segmentStartIndex :: Maybe Int
segmentText :: Maybe Text
segmentEndIndex :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"partIndex" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
segmentPartIndex
      , Key
"startIndex" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
segmentStartIndex
      , Key
"text" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
segmentText
      , Key
"endIndex" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
segmentEndIndex
      ]

-- | Construct a value of type 'Segment' (by applying it's required fields, if any)
mkSegment ::
  Segment
mkSegment :: Segment
mkSegment =
  Segment
    { segmentPartIndex :: Maybe Int
segmentPartIndex = Maybe Int
forall a. Maybe a
Nothing
    , segmentStartIndex :: Maybe Int
segmentStartIndex = Maybe Int
forall a. Maybe a
Nothing
    , segmentText :: Maybe Text
segmentText = Maybe Text
forall a. Maybe a
Nothing
    , segmentEndIndex :: Maybe Int
segmentEndIndex = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** SemanticRetrieverChunk

{- | SemanticRetrieverChunk
Identifier for a `Chunk` retrieved via Semantic Retriever specified in the `GenerateAnswerRequest` using `SemanticRetrieverConfig`.
-}
data SemanticRetrieverChunk = SemanticRetrieverChunk
  { SemanticRetrieverChunk -> Maybe Text
semanticRetrieverChunkChunk :: !(Maybe Text)
  -- ^ /ReadOnly/ "chunk" - Output only. Name of the &#x60;Chunk&#x60; containing the attributed text. Example: &#x60;corpora/123/documents/abc/chunks/xyz&#x60;
  , SemanticRetrieverChunk -> Maybe Text
semanticRetrieverChunkSource :: !(Maybe Text)
  -- ^ /ReadOnly/ "source" - Output only. Name of the source matching the request&#39;s &#x60;SemanticRetrieverConfig.source&#x60;. Example: &#x60;corpora/123&#x60; or &#x60;corpora/123/documents/abc&#x60;
  }
  deriving (Int -> SemanticRetrieverChunk -> ShowS
[SemanticRetrieverChunk] -> ShowS
SemanticRetrieverChunk -> [Char]
(Int -> SemanticRetrieverChunk -> ShowS)
-> (SemanticRetrieverChunk -> [Char])
-> ([SemanticRetrieverChunk] -> ShowS)
-> Show SemanticRetrieverChunk
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SemanticRetrieverChunk -> ShowS
showsPrec :: Int -> SemanticRetrieverChunk -> ShowS
$cshow :: SemanticRetrieverChunk -> [Char]
show :: SemanticRetrieverChunk -> [Char]
$cshowList :: [SemanticRetrieverChunk] -> ShowS
showList :: [SemanticRetrieverChunk] -> ShowS
P.Show, SemanticRetrieverChunk -> SemanticRetrieverChunk -> Bool
(SemanticRetrieverChunk -> SemanticRetrieverChunk -> Bool)
-> (SemanticRetrieverChunk -> SemanticRetrieverChunk -> Bool)
-> Eq SemanticRetrieverChunk
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SemanticRetrieverChunk -> SemanticRetrieverChunk -> Bool
== :: SemanticRetrieverChunk -> SemanticRetrieverChunk -> Bool
$c/= :: SemanticRetrieverChunk -> SemanticRetrieverChunk -> Bool
/= :: SemanticRetrieverChunk -> SemanticRetrieverChunk -> Bool
P.Eq, P.Typeable)

-- | FromJSON SemanticRetrieverChunk
instance A.FromJSON SemanticRetrieverChunk where
  parseJSON :: Value -> Parser SemanticRetrieverChunk
parseJSON = [Char]
-> (Object -> Parser SemanticRetrieverChunk)
-> Value
-> Parser SemanticRetrieverChunk
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SemanticRetrieverChunk" ((Object -> Parser SemanticRetrieverChunk)
 -> Value -> Parser SemanticRetrieverChunk)
-> (Object -> Parser SemanticRetrieverChunk)
-> Value
-> Parser SemanticRetrieverChunk
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe Text -> SemanticRetrieverChunk
SemanticRetrieverChunk
      (Maybe Text -> Maybe Text -> SemanticRetrieverChunk)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> SemanticRetrieverChunk)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"chunk")
      Parser (Maybe Text -> SemanticRetrieverChunk)
-> Parser (Maybe Text) -> Parser SemanticRetrieverChunk
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"source")

-- | ToJSON SemanticRetrieverChunk
instance A.ToJSON SemanticRetrieverChunk where
  toJSON :: SemanticRetrieverChunk -> Value
toJSON SemanticRetrieverChunk {Maybe Text
semanticRetrieverChunkChunk :: SemanticRetrieverChunk -> Maybe Text
semanticRetrieverChunkSource :: SemanticRetrieverChunk -> Maybe Text
semanticRetrieverChunkChunk :: Maybe Text
semanticRetrieverChunkSource :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"chunk" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
semanticRetrieverChunkChunk
      , Key
"source" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
semanticRetrieverChunkSource
      ]

-- | Construct a value of type 'SemanticRetrieverChunk' (by applying it's required fields, if any)
mkSemanticRetrieverChunk ::
  SemanticRetrieverChunk
mkSemanticRetrieverChunk :: SemanticRetrieverChunk
mkSemanticRetrieverChunk =
  SemanticRetrieverChunk
    { semanticRetrieverChunkChunk :: Maybe Text
semanticRetrieverChunkChunk = Maybe Text
forall a. Maybe a
Nothing
    , semanticRetrieverChunkSource :: Maybe Text
semanticRetrieverChunkSource = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** SemanticRetrieverConfig

{- | SemanticRetrieverConfig
Configuration for retrieving grounding content from a `Corpus` or `Document` created using the Semantic Retriever API.
-}
data SemanticRetrieverConfig = SemanticRetrieverConfig
  { SemanticRetrieverConfig -> Text
semanticRetrieverConfigSource :: !(Text)
  -- ^ /Required/ "source" - Required. Name of the resource for retrieval. Example: &#x60;corpora/123&#x60; or &#x60;corpora/123/documents/abc&#x60;.
  , SemanticRetrieverConfig -> Content
semanticRetrieverConfigQuery :: !(Content)
  -- ^ /Required/ "query" - Required. Query to use for matching &#x60;Chunk&#x60;s in the given resource by similarity.
  , SemanticRetrieverConfig -> Maybe Int
semanticRetrieverConfigMaxChunksCount :: !(Maybe Int)
  -- ^ "maxChunksCount" - Optional. Maximum number of relevant &#x60;Chunk&#x60;s to retrieve.
  , SemanticRetrieverConfig -> Maybe [MetadataFilter]
semanticRetrieverConfigMetadataFilters :: !(Maybe [MetadataFilter])
  -- ^ "metadataFilters" - Optional. Filters for selecting &#x60;Document&#x60;s and/or &#x60;Chunk&#x60;s from the resource.
  , SemanticRetrieverConfig -> Maybe Float
semanticRetrieverConfigMinimumRelevanceScore :: !(Maybe Float)
  -- ^ "minimumRelevanceScore" - Optional. Minimum relevance score for retrieved relevant &#x60;Chunk&#x60;s.
  }
  deriving (Int -> SemanticRetrieverConfig -> ShowS
[SemanticRetrieverConfig] -> ShowS
SemanticRetrieverConfig -> [Char]
(Int -> SemanticRetrieverConfig -> ShowS)
-> (SemanticRetrieverConfig -> [Char])
-> ([SemanticRetrieverConfig] -> ShowS)
-> Show SemanticRetrieverConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SemanticRetrieverConfig -> ShowS
showsPrec :: Int -> SemanticRetrieverConfig -> ShowS
$cshow :: SemanticRetrieverConfig -> [Char]
show :: SemanticRetrieverConfig -> [Char]
$cshowList :: [SemanticRetrieverConfig] -> ShowS
showList :: [SemanticRetrieverConfig] -> ShowS
P.Show, SemanticRetrieverConfig -> SemanticRetrieverConfig -> Bool
(SemanticRetrieverConfig -> SemanticRetrieverConfig -> Bool)
-> (SemanticRetrieverConfig -> SemanticRetrieverConfig -> Bool)
-> Eq SemanticRetrieverConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SemanticRetrieverConfig -> SemanticRetrieverConfig -> Bool
== :: SemanticRetrieverConfig -> SemanticRetrieverConfig -> Bool
$c/= :: SemanticRetrieverConfig -> SemanticRetrieverConfig -> Bool
/= :: SemanticRetrieverConfig -> SemanticRetrieverConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON SemanticRetrieverConfig
instance A.FromJSON SemanticRetrieverConfig where
  parseJSON :: Value -> Parser SemanticRetrieverConfig
parseJSON = [Char]
-> (Object -> Parser SemanticRetrieverConfig)
-> Value
-> Parser SemanticRetrieverConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SemanticRetrieverConfig" ((Object -> Parser SemanticRetrieverConfig)
 -> Value -> Parser SemanticRetrieverConfig)
-> (Object -> Parser SemanticRetrieverConfig)
-> Value
-> Parser SemanticRetrieverConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Text
-> Content
-> Maybe Int
-> Maybe [MetadataFilter]
-> Maybe Float
-> SemanticRetrieverConfig
SemanticRetrieverConfig
      (Text
 -> Content
 -> Maybe Int
 -> Maybe [MetadataFilter]
 -> Maybe Float
 -> SemanticRetrieverConfig)
-> Parser Text
-> Parser
     (Content
      -> Maybe Int
      -> Maybe [MetadataFilter]
      -> Maybe Float
      -> SemanticRetrieverConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"source")
      Parser
  (Content
   -> Maybe Int
   -> Maybe [MetadataFilter]
   -> Maybe Float
   -> SemanticRetrieverConfig)
-> Parser Content
-> Parser
     (Maybe Int
      -> Maybe [MetadataFilter]
      -> Maybe Float
      -> SemanticRetrieverConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Content
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"query")
      Parser
  (Maybe Int
   -> Maybe [MetadataFilter]
   -> Maybe Float
   -> SemanticRetrieverConfig)
-> Parser (Maybe Int)
-> Parser
     (Maybe [MetadataFilter] -> Maybe Float -> SemanticRetrieverConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"maxChunksCount")
      Parser
  (Maybe [MetadataFilter] -> Maybe Float -> SemanticRetrieverConfig)
-> Parser (Maybe [MetadataFilter])
-> Parser (Maybe Float -> SemanticRetrieverConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [MetadataFilter])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"metadataFilters")
      Parser (Maybe Float -> SemanticRetrieverConfig)
-> Parser (Maybe Float) -> Parser SemanticRetrieverConfig
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"minimumRelevanceScore")

-- | ToJSON SemanticRetrieverConfig
instance A.ToJSON SemanticRetrieverConfig where
  toJSON :: SemanticRetrieverConfig -> Value
toJSON SemanticRetrieverConfig {Maybe Float
Maybe Int
Maybe [MetadataFilter]
Text
Content
semanticRetrieverConfigSource :: SemanticRetrieverConfig -> Text
semanticRetrieverConfigQuery :: SemanticRetrieverConfig -> Content
semanticRetrieverConfigMaxChunksCount :: SemanticRetrieverConfig -> Maybe Int
semanticRetrieverConfigMetadataFilters :: SemanticRetrieverConfig -> Maybe [MetadataFilter]
semanticRetrieverConfigMinimumRelevanceScore :: SemanticRetrieverConfig -> Maybe Float
semanticRetrieverConfigSource :: Text
semanticRetrieverConfigQuery :: Content
semanticRetrieverConfigMaxChunksCount :: Maybe Int
semanticRetrieverConfigMetadataFilters :: Maybe [MetadataFilter]
semanticRetrieverConfigMinimumRelevanceScore :: Maybe Float
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"source" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
semanticRetrieverConfigSource
      , Key
"query" Key -> Content -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Content
semanticRetrieverConfigQuery
      , Key
"maxChunksCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
semanticRetrieverConfigMaxChunksCount
      , Key
"metadataFilters" Key -> Maybe [MetadataFilter] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [MetadataFilter]
semanticRetrieverConfigMetadataFilters
      , Key
"minimumRelevanceScore" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
semanticRetrieverConfigMinimumRelevanceScore
      ]

-- | Construct a value of type 'SemanticRetrieverConfig' (by applying it's required fields, if any)
mkSemanticRetrieverConfig ::
  -- | 'semanticRetrieverConfigSource': Required. Name of the resource for retrieval. Example: `corpora/123` or `corpora/123/documents/abc`.
  Text ->
  -- | 'semanticRetrieverConfigQuery': Required. Query to use for matching `Chunk`s in the given resource by similarity.
  Content ->
  SemanticRetrieverConfig
mkSemanticRetrieverConfig :: Text -> Content -> SemanticRetrieverConfig
mkSemanticRetrieverConfig Text
semanticRetrieverConfigSource Content
semanticRetrieverConfigQuery =
  SemanticRetrieverConfig
    { Text
semanticRetrieverConfigSource :: Text
semanticRetrieverConfigSource :: Text
semanticRetrieverConfigSource
    , Content
semanticRetrieverConfigQuery :: Content
semanticRetrieverConfigQuery :: Content
semanticRetrieverConfigQuery
    , semanticRetrieverConfigMaxChunksCount :: Maybe Int
semanticRetrieverConfigMaxChunksCount = Maybe Int
forall a. Maybe a
Nothing
    , semanticRetrieverConfigMetadataFilters :: Maybe [MetadataFilter]
semanticRetrieverConfigMetadataFilters = Maybe [MetadataFilter]
forall a. Maybe a
Nothing
    , semanticRetrieverConfigMinimumRelevanceScore :: Maybe Float
semanticRetrieverConfigMinimumRelevanceScore = Maybe Float
forall a. Maybe a
Nothing
    }

-- ** SpeakerVoiceConfig

{- | SpeakerVoiceConfig
The configuration for a single speaker in a multi speaker setup.
-}
data SpeakerVoiceConfig = SpeakerVoiceConfig
  { SpeakerVoiceConfig -> VoiceConfig
speakerVoiceConfigVoiceConfig :: !(VoiceConfig)
  -- ^ /Required/ "voiceConfig" - Required. The configuration for the voice to use.
  , SpeakerVoiceConfig -> Text
speakerVoiceConfigSpeaker :: !(Text)
  -- ^ /Required/ "speaker" - Required. The name of the speaker to use. Should be the same as in the prompt.
  }
  deriving (Int -> SpeakerVoiceConfig -> ShowS
[SpeakerVoiceConfig] -> ShowS
SpeakerVoiceConfig -> [Char]
(Int -> SpeakerVoiceConfig -> ShowS)
-> (SpeakerVoiceConfig -> [Char])
-> ([SpeakerVoiceConfig] -> ShowS)
-> Show SpeakerVoiceConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SpeakerVoiceConfig -> ShowS
showsPrec :: Int -> SpeakerVoiceConfig -> ShowS
$cshow :: SpeakerVoiceConfig -> [Char]
show :: SpeakerVoiceConfig -> [Char]
$cshowList :: [SpeakerVoiceConfig] -> ShowS
showList :: [SpeakerVoiceConfig] -> ShowS
P.Show, SpeakerVoiceConfig -> SpeakerVoiceConfig -> Bool
(SpeakerVoiceConfig -> SpeakerVoiceConfig -> Bool)
-> (SpeakerVoiceConfig -> SpeakerVoiceConfig -> Bool)
-> Eq SpeakerVoiceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SpeakerVoiceConfig -> SpeakerVoiceConfig -> Bool
== :: SpeakerVoiceConfig -> SpeakerVoiceConfig -> Bool
$c/= :: SpeakerVoiceConfig -> SpeakerVoiceConfig -> Bool
/= :: SpeakerVoiceConfig -> SpeakerVoiceConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON SpeakerVoiceConfig
instance A.FromJSON SpeakerVoiceConfig where
  parseJSON :: Value -> Parser SpeakerVoiceConfig
parseJSON = [Char]
-> (Object -> Parser SpeakerVoiceConfig)
-> Value
-> Parser SpeakerVoiceConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SpeakerVoiceConfig" ((Object -> Parser SpeakerVoiceConfig)
 -> Value -> Parser SpeakerVoiceConfig)
-> (Object -> Parser SpeakerVoiceConfig)
-> Value
-> Parser SpeakerVoiceConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    VoiceConfig -> Text -> SpeakerVoiceConfig
SpeakerVoiceConfig
      (VoiceConfig -> Text -> SpeakerVoiceConfig)
-> Parser VoiceConfig -> Parser (Text -> SpeakerVoiceConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser VoiceConfig
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"voiceConfig")
      Parser (Text -> SpeakerVoiceConfig)
-> Parser Text -> Parser SpeakerVoiceConfig
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"speaker")

-- | ToJSON SpeakerVoiceConfig
instance A.ToJSON SpeakerVoiceConfig where
  toJSON :: SpeakerVoiceConfig -> Value
toJSON SpeakerVoiceConfig {Text
VoiceConfig
speakerVoiceConfigVoiceConfig :: SpeakerVoiceConfig -> VoiceConfig
speakerVoiceConfigSpeaker :: SpeakerVoiceConfig -> Text
speakerVoiceConfigVoiceConfig :: VoiceConfig
speakerVoiceConfigSpeaker :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"voiceConfig" Key -> VoiceConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= VoiceConfig
speakerVoiceConfigVoiceConfig
      , Key
"speaker" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
speakerVoiceConfigSpeaker
      ]

-- | Construct a value of type 'SpeakerVoiceConfig' (by applying it's required fields, if any)
mkSpeakerVoiceConfig ::
  -- | 'speakerVoiceConfigVoiceConfig': Required. The configuration for the voice to use.
  VoiceConfig ->
  -- | 'speakerVoiceConfigSpeaker': Required. The name of the speaker to use. Should be the same as in the prompt.
  Text ->
  SpeakerVoiceConfig
mkSpeakerVoiceConfig :: VoiceConfig -> Text -> SpeakerVoiceConfig
mkSpeakerVoiceConfig VoiceConfig
speakerVoiceConfigVoiceConfig Text
speakerVoiceConfigSpeaker =
  SpeakerVoiceConfig
    { VoiceConfig
speakerVoiceConfigVoiceConfig :: VoiceConfig
speakerVoiceConfigVoiceConfig :: VoiceConfig
speakerVoiceConfigVoiceConfig
    , Text
speakerVoiceConfigSpeaker :: Text
speakerVoiceConfigSpeaker :: Text
speakerVoiceConfigSpeaker
    }

-- ** SpeechConfig

{- | SpeechConfig
The speech generation config.
-}
data SpeechConfig = SpeechConfig
  { SpeechConfig -> Maybe VoiceConfig
speechConfigVoiceConfig :: !(Maybe VoiceConfig)
  -- ^ "voiceConfig" - The configuration in case of single-voice output.
  , SpeechConfig -> Maybe Text
speechConfigLanguageCode :: !(Maybe Text)
  -- ^ "languageCode" - Optional. Language code (in BCP 47 format, e.g. \&quot;en-US\&quot;) for speech synthesis.  Valid values are: de-DE, en-AU, en-GB, en-IN, en-US, es-US, fr-FR, hi-IN, pt-BR, ar-XA, es-ES, fr-CA, id-ID, it-IT, ja-JP, tr-TR, vi-VN, bn-IN, gu-IN, kn-IN, ml-IN, mr-IN, ta-IN, te-IN, nl-NL, ko-KR, cmn-CN, pl-PL, ru-RU, and th-TH.
  , SpeechConfig -> Maybe MultiSpeakerVoiceConfig
speechConfigMultiSpeakerVoiceConfig :: !(Maybe MultiSpeakerVoiceConfig)
  -- ^ "multiSpeakerVoiceConfig" - Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field.
  }
  deriving (Int -> SpeechConfig -> ShowS
[SpeechConfig] -> ShowS
SpeechConfig -> [Char]
(Int -> SpeechConfig -> ShowS)
-> (SpeechConfig -> [Char])
-> ([SpeechConfig] -> ShowS)
-> Show SpeechConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SpeechConfig -> ShowS
showsPrec :: Int -> SpeechConfig -> ShowS
$cshow :: SpeechConfig -> [Char]
show :: SpeechConfig -> [Char]
$cshowList :: [SpeechConfig] -> ShowS
showList :: [SpeechConfig] -> ShowS
P.Show, SpeechConfig -> SpeechConfig -> Bool
(SpeechConfig -> SpeechConfig -> Bool)
-> (SpeechConfig -> SpeechConfig -> Bool) -> Eq SpeechConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SpeechConfig -> SpeechConfig -> Bool
== :: SpeechConfig -> SpeechConfig -> Bool
$c/= :: SpeechConfig -> SpeechConfig -> Bool
/= :: SpeechConfig -> SpeechConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON SpeechConfig
instance A.FromJSON SpeechConfig where
  parseJSON :: Value -> Parser SpeechConfig
parseJSON = [Char]
-> (Object -> Parser SpeechConfig) -> Value -> Parser SpeechConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"SpeechConfig" ((Object -> Parser SpeechConfig) -> Value -> Parser SpeechConfig)
-> (Object -> Parser SpeechConfig) -> Value -> Parser SpeechConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe VoiceConfig
-> Maybe Text -> Maybe MultiSpeakerVoiceConfig -> SpeechConfig
SpeechConfig
      (Maybe VoiceConfig
 -> Maybe Text -> Maybe MultiSpeakerVoiceConfig -> SpeechConfig)
-> Parser (Maybe VoiceConfig)
-> Parser
     (Maybe Text -> Maybe MultiSpeakerVoiceConfig -> SpeechConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe VoiceConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"voiceConfig")
      Parser
  (Maybe Text -> Maybe MultiSpeakerVoiceConfig -> SpeechConfig)
-> Parser (Maybe Text)
-> Parser (Maybe MultiSpeakerVoiceConfig -> SpeechConfig)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"languageCode")
      Parser (Maybe MultiSpeakerVoiceConfig -> SpeechConfig)
-> Parser (Maybe MultiSpeakerVoiceConfig) -> Parser SpeechConfig
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe MultiSpeakerVoiceConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"multiSpeakerVoiceConfig")

-- | ToJSON SpeechConfig
instance A.ToJSON SpeechConfig where
  toJSON :: SpeechConfig -> Value
toJSON SpeechConfig {Maybe Text
Maybe MultiSpeakerVoiceConfig
Maybe VoiceConfig
speechConfigVoiceConfig :: SpeechConfig -> Maybe VoiceConfig
speechConfigLanguageCode :: SpeechConfig -> Maybe Text
speechConfigMultiSpeakerVoiceConfig :: SpeechConfig -> Maybe MultiSpeakerVoiceConfig
speechConfigVoiceConfig :: Maybe VoiceConfig
speechConfigLanguageCode :: Maybe Text
speechConfigMultiSpeakerVoiceConfig :: Maybe MultiSpeakerVoiceConfig
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"voiceConfig" Key -> Maybe VoiceConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe VoiceConfig
speechConfigVoiceConfig
      , Key
"languageCode" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
speechConfigLanguageCode
      , Key
"multiSpeakerVoiceConfig" Key -> Maybe MultiSpeakerVoiceConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe MultiSpeakerVoiceConfig
speechConfigMultiSpeakerVoiceConfig
      ]

-- | Construct a value of type 'SpeechConfig' (by applying it's required fields, if any)
mkSpeechConfig ::
  SpeechConfig
mkSpeechConfig :: SpeechConfig
mkSpeechConfig =
  SpeechConfig
    { speechConfigVoiceConfig :: Maybe VoiceConfig
speechConfigVoiceConfig = Maybe VoiceConfig
forall a. Maybe a
Nothing
    , speechConfigLanguageCode :: Maybe Text
speechConfigLanguageCode = Maybe Text
forall a. Maybe a
Nothing
    , speechConfigMultiSpeakerVoiceConfig :: Maybe MultiSpeakerVoiceConfig
speechConfigMultiSpeakerVoiceConfig = Maybe MultiSpeakerVoiceConfig
forall a. Maybe a
Nothing
    }

-- ** Status

{- | Status
The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details.  You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
-}
data Status = Status
  { Status -> Maybe Int
statusCode :: !(Maybe Int)
  -- ^ "code" - The status code, which should be an enum value of google.rpc.Code.
  , Status -> Maybe [Map [Char] [Char]]
statusDetails :: !(Maybe [(Map.Map String String)])
  -- ^ "details" - A list of messages that carry the error details.  There is a common set of message types for APIs to use.
  , Status -> Maybe Text
statusMessage :: !(Maybe Text)
  -- ^ "message" - A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  }
  deriving (Int -> Status -> ShowS
[Status] -> ShowS
Status -> [Char]
(Int -> Status -> ShowS)
-> (Status -> [Char]) -> ([Status] -> ShowS) -> Show Status
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Status -> ShowS
showsPrec :: Int -> Status -> ShowS
$cshow :: Status -> [Char]
show :: Status -> [Char]
$cshowList :: [Status] -> ShowS
showList :: [Status] -> ShowS
P.Show, Status -> Status -> Bool
(Status -> Status -> Bool)
-> (Status -> Status -> Bool) -> Eq Status
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Status -> Status -> Bool
== :: Status -> Status -> Bool
$c/= :: Status -> Status -> Bool
/= :: Status -> Status -> Bool
P.Eq, P.Typeable)

-- | FromJSON Status
instance A.FromJSON Status where
  parseJSON :: Value -> Parser Status
parseJSON = [Char] -> (Object -> Parser Status) -> Value -> Parser Status
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Status" ((Object -> Parser Status) -> Value -> Parser Status)
-> (Object -> Parser Status) -> Value -> Parser Status
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int -> Maybe [Map [Char] [Char]] -> Maybe Text -> Status
Status
      (Maybe Int -> Maybe [Map [Char] [Char]] -> Maybe Text -> Status)
-> Parser (Maybe Int)
-> Parser (Maybe [Map [Char] [Char]] -> Maybe Text -> Status)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"code")
      Parser (Maybe [Map [Char] [Char]] -> Maybe Text -> Status)
-> Parser (Maybe [Map [Char] [Char]])
-> Parser (Maybe Text -> Status)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Map [Char] [Char]])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"details")
      Parser (Maybe Text -> Status)
-> Parser (Maybe Text) -> Parser Status
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"message")

-- | ToJSON Status
instance A.ToJSON Status where
  toJSON :: Status -> Value
toJSON Status {Maybe Int
Maybe [Map [Char] [Char]]
Maybe Text
statusCode :: Status -> Maybe Int
statusDetails :: Status -> Maybe [Map [Char] [Char]]
statusMessage :: Status -> Maybe Text
statusCode :: Maybe Int
statusDetails :: Maybe [Map [Char] [Char]]
statusMessage :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"code" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
statusCode
      , Key
"details" Key -> Maybe [Map [Char] [Char]] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Map [Char] [Char]]
statusDetails
      , Key
"message" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
statusMessage
      ]

-- | Construct a value of type 'Status' (by applying it's required fields, if any)
mkStatus ::
  Status
mkStatus :: Status
mkStatus =
  Status
    { statusCode :: Maybe Int
statusCode = Maybe Int
forall a. Maybe a
Nothing
    , statusDetails :: Maybe [Map [Char] [Char]]
statusDetails = Maybe [Map [Char] [Char]]
forall a. Maybe a
Nothing
    , statusMessage :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** StringList

{- | StringList
User provided string values assigned to a single metadata key.
-}
data StringList = StringList
  { StringList -> Maybe [Text]
stringListValues :: !(Maybe [Text])
  -- ^ "values" - The string values of the metadata to store.
  }
  deriving (Int -> StringList -> ShowS
[StringList] -> ShowS
StringList -> [Char]
(Int -> StringList -> ShowS)
-> (StringList -> [Char])
-> ([StringList] -> ShowS)
-> Show StringList
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> StringList -> ShowS
showsPrec :: Int -> StringList -> ShowS
$cshow :: StringList -> [Char]
show :: StringList -> [Char]
$cshowList :: [StringList] -> ShowS
showList :: [StringList] -> ShowS
P.Show, StringList -> StringList -> Bool
(StringList -> StringList -> Bool)
-> (StringList -> StringList -> Bool) -> Eq StringList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: StringList -> StringList -> Bool
== :: StringList -> StringList -> Bool
$c/= :: StringList -> StringList -> Bool
/= :: StringList -> StringList -> Bool
P.Eq, P.Typeable)

-- | FromJSON StringList
instance A.FromJSON StringList where
  parseJSON :: Value -> Parser StringList
parseJSON = [Char]
-> (Object -> Parser StringList) -> Value -> Parser StringList
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"StringList" ((Object -> Parser StringList) -> Value -> Parser StringList)
-> (Object -> Parser StringList) -> Value -> Parser StringList
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [Text] -> StringList
StringList
      (Maybe [Text] -> StringList)
-> Parser (Maybe [Text]) -> Parser StringList
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"values")

-- | ToJSON StringList
instance A.ToJSON StringList where
  toJSON :: StringList -> Value
toJSON StringList {Maybe [Text]
stringListValues :: StringList -> Maybe [Text]
stringListValues :: Maybe [Text]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"values" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
stringListValues
      ]

-- | Construct a value of type 'StringList' (by applying it's required fields, if any)
mkStringList ::
  StringList
mkStringList :: StringList
mkStringList =
  StringList
    { stringListValues :: Maybe [Text]
stringListValues = Maybe [Text]
forall a. Maybe a
Nothing
    }

-- ** TextCompletion

{- | TextCompletion
Output text returned from a model.
-}
data TextCompletion = TextCompletion
  { TextCompletion -> Maybe [SafetyRating]
textCompletionSafetyRatings :: !(Maybe [SafetyRating])
  -- ^ "safetyRatings" - Ratings for the safety of a response.  There is at most one rating per category.
  , TextCompletion -> Maybe Text
textCompletionOutput :: !(Maybe Text)
  -- ^ /ReadOnly/ "output" - Output only. The generated text returned from the model.
  , TextCompletion -> Maybe CitationMetadata
textCompletionCitationMetadata :: !(Maybe CitationMetadata)
  -- ^ /ReadOnly/ "citationMetadata" - Output only. Citation information for model-generated &#x60;output&#x60; in this &#x60;TextCompletion&#x60;.  This field may be populated with attribution information for any text included in the &#x60;output&#x60;.
  }
  deriving (Int -> TextCompletion -> ShowS
[TextCompletion] -> ShowS
TextCompletion -> [Char]
(Int -> TextCompletion -> ShowS)
-> (TextCompletion -> [Char])
-> ([TextCompletion] -> ShowS)
-> Show TextCompletion
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextCompletion -> ShowS
showsPrec :: Int -> TextCompletion -> ShowS
$cshow :: TextCompletion -> [Char]
show :: TextCompletion -> [Char]
$cshowList :: [TextCompletion] -> ShowS
showList :: [TextCompletion] -> ShowS
P.Show, TextCompletion -> TextCompletion -> Bool
(TextCompletion -> TextCompletion -> Bool)
-> (TextCompletion -> TextCompletion -> Bool) -> Eq TextCompletion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextCompletion -> TextCompletion -> Bool
== :: TextCompletion -> TextCompletion -> Bool
$c/= :: TextCompletion -> TextCompletion -> Bool
/= :: TextCompletion -> TextCompletion -> Bool
P.Eq, P.Typeable)

-- | FromJSON TextCompletion
instance A.FromJSON TextCompletion where
  parseJSON :: Value -> Parser TextCompletion
parseJSON = [Char]
-> (Object -> Parser TextCompletion)
-> Value
-> Parser TextCompletion
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TextCompletion" ((Object -> Parser TextCompletion)
 -> Value -> Parser TextCompletion)
-> (Object -> Parser TextCompletion)
-> Value
-> Parser TextCompletion
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [SafetyRating]
-> Maybe Text -> Maybe CitationMetadata -> TextCompletion
TextCompletion
      (Maybe [SafetyRating]
 -> Maybe Text -> Maybe CitationMetadata -> TextCompletion)
-> Parser (Maybe [SafetyRating])
-> Parser (Maybe Text -> Maybe CitationMetadata -> TextCompletion)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [SafetyRating])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"safetyRatings")
      Parser (Maybe Text -> Maybe CitationMetadata -> TextCompletion)
-> Parser (Maybe Text)
-> Parser (Maybe CitationMetadata -> TextCompletion)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"output")
      Parser (Maybe CitationMetadata -> TextCompletion)
-> Parser (Maybe CitationMetadata) -> Parser TextCompletion
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe CitationMetadata)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"citationMetadata")

-- | ToJSON TextCompletion
instance A.ToJSON TextCompletion where
  toJSON :: TextCompletion -> Value
toJSON TextCompletion {Maybe [SafetyRating]
Maybe Text
Maybe CitationMetadata
textCompletionSafetyRatings :: TextCompletion -> Maybe [SafetyRating]
textCompletionOutput :: TextCompletion -> Maybe Text
textCompletionCitationMetadata :: TextCompletion -> Maybe CitationMetadata
textCompletionSafetyRatings :: Maybe [SafetyRating]
textCompletionOutput :: Maybe Text
textCompletionCitationMetadata :: Maybe CitationMetadata
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"safetyRatings" Key -> Maybe [SafetyRating] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [SafetyRating]
textCompletionSafetyRatings
      , Key
"output" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
textCompletionOutput
      , Key
"citationMetadata" Key -> Maybe CitationMetadata -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe CitationMetadata
textCompletionCitationMetadata
      ]

-- | Construct a value of type 'TextCompletion' (by applying it's required fields, if any)
mkTextCompletion ::
  TextCompletion
mkTextCompletion :: TextCompletion
mkTextCompletion =
  TextCompletion
    { textCompletionSafetyRatings :: Maybe [SafetyRating]
textCompletionSafetyRatings = Maybe [SafetyRating]
forall a. Maybe a
Nothing
    , textCompletionOutput :: Maybe Text
textCompletionOutput = Maybe Text
forall a. Maybe a
Nothing
    , textCompletionCitationMetadata :: Maybe CitationMetadata
textCompletionCitationMetadata = Maybe CitationMetadata
forall a. Maybe a
Nothing
    }

-- ** TextPrompt

{- | TextPrompt
Text given to the model as a prompt.  The Model will use this TextPrompt to Generate a text completion.
-}
data TextPrompt = TextPrompt
  { TextPrompt -> Text
textPromptText :: !(Text)
  -- ^ /Required/ "text" - Required. The prompt text.
  }
  deriving (Int -> TextPrompt -> ShowS
[TextPrompt] -> ShowS
TextPrompt -> [Char]
(Int -> TextPrompt -> ShowS)
-> (TextPrompt -> [Char])
-> ([TextPrompt] -> ShowS)
-> Show TextPrompt
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextPrompt -> ShowS
showsPrec :: Int -> TextPrompt -> ShowS
$cshow :: TextPrompt -> [Char]
show :: TextPrompt -> [Char]
$cshowList :: [TextPrompt] -> ShowS
showList :: [TextPrompt] -> ShowS
P.Show, TextPrompt -> TextPrompt -> Bool
(TextPrompt -> TextPrompt -> Bool)
-> (TextPrompt -> TextPrompt -> Bool) -> Eq TextPrompt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextPrompt -> TextPrompt -> Bool
== :: TextPrompt -> TextPrompt -> Bool
$c/= :: TextPrompt -> TextPrompt -> Bool
/= :: TextPrompt -> TextPrompt -> Bool
P.Eq, P.Typeable)

-- | FromJSON TextPrompt
instance A.FromJSON TextPrompt where
  parseJSON :: Value -> Parser TextPrompt
parseJSON = [Char]
-> (Object -> Parser TextPrompt) -> Value -> Parser TextPrompt
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TextPrompt" ((Object -> Parser TextPrompt) -> Value -> Parser TextPrompt)
-> (Object -> Parser TextPrompt) -> Value -> Parser TextPrompt
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Text -> TextPrompt
TextPrompt
      (Text -> TextPrompt) -> Parser Text -> Parser TextPrompt
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"text")

-- | ToJSON TextPrompt
instance A.ToJSON TextPrompt where
  toJSON :: TextPrompt -> Value
toJSON TextPrompt {Text
textPromptText :: TextPrompt -> Text
textPromptText :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"text" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
textPromptText
      ]

-- | Construct a value of type 'TextPrompt' (by applying it's required fields, if any)
mkTextPrompt ::
  -- | 'textPromptText': Required. The prompt text.
  Text ->
  TextPrompt
mkTextPrompt :: Text -> TextPrompt
mkTextPrompt Text
textPromptText =
  TextPrompt
    { Text
textPromptText :: Text
textPromptText :: Text
textPromptText
    }

-- ** ThinkingConfig

{- | ThinkingConfig
Config for thinking features.
-}
data ThinkingConfig = ThinkingConfig
  { ThinkingConfig -> Maybe Int
thinkingConfigThinkingBudget :: !(Maybe Int)
  -- ^ "thinkingBudget" - The number of thoughts tokens that the model should generate.
  , ThinkingConfig -> Maybe Bool
thinkingConfigIncludeThoughts :: !(Maybe Bool)
  -- ^ "includeThoughts" - Indicates whether to include thoughts in the response. If true, thoughts are returned only when available.
  }
  deriving (Int -> ThinkingConfig -> ShowS
[ThinkingConfig] -> ShowS
ThinkingConfig -> [Char]
(Int -> ThinkingConfig -> ShowS)
-> (ThinkingConfig -> [Char])
-> ([ThinkingConfig] -> ShowS)
-> Show ThinkingConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ThinkingConfig -> ShowS
showsPrec :: Int -> ThinkingConfig -> ShowS
$cshow :: ThinkingConfig -> [Char]
show :: ThinkingConfig -> [Char]
$cshowList :: [ThinkingConfig] -> ShowS
showList :: [ThinkingConfig] -> ShowS
P.Show, ThinkingConfig -> ThinkingConfig -> Bool
(ThinkingConfig -> ThinkingConfig -> Bool)
-> (ThinkingConfig -> ThinkingConfig -> Bool) -> Eq ThinkingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ThinkingConfig -> ThinkingConfig -> Bool
== :: ThinkingConfig -> ThinkingConfig -> Bool
$c/= :: ThinkingConfig -> ThinkingConfig -> Bool
/= :: ThinkingConfig -> ThinkingConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON ThinkingConfig
instance A.FromJSON ThinkingConfig where
  parseJSON :: Value -> Parser ThinkingConfig
parseJSON = [Char]
-> (Object -> Parser ThinkingConfig)
-> Value
-> Parser ThinkingConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ThinkingConfig" ((Object -> Parser ThinkingConfig)
 -> Value -> Parser ThinkingConfig)
-> (Object -> Parser ThinkingConfig)
-> Value
-> Parser ThinkingConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Int -> Maybe Bool -> ThinkingConfig
ThinkingConfig
      (Maybe Int -> Maybe Bool -> ThinkingConfig)
-> Parser (Maybe Int) -> Parser (Maybe Bool -> ThinkingConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"thinkingBudget")
      Parser (Maybe Bool -> ThinkingConfig)
-> Parser (Maybe Bool) -> Parser ThinkingConfig
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"includeThoughts")

-- | ToJSON ThinkingConfig
instance A.ToJSON ThinkingConfig where
  toJSON :: ThinkingConfig -> Value
toJSON ThinkingConfig {Maybe Bool
Maybe Int
thinkingConfigThinkingBudget :: ThinkingConfig -> Maybe Int
thinkingConfigIncludeThoughts :: ThinkingConfig -> Maybe Bool
thinkingConfigThinkingBudget :: Maybe Int
thinkingConfigIncludeThoughts :: Maybe Bool
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"thinkingBudget" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
thinkingConfigThinkingBudget
      , Key
"includeThoughts" Key -> Maybe Bool -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Bool
thinkingConfigIncludeThoughts
      ]

-- | Construct a value of type 'ThinkingConfig' (by applying it's required fields, if any)
mkThinkingConfig ::
  ThinkingConfig
mkThinkingConfig :: ThinkingConfig
mkThinkingConfig =
  ThinkingConfig
    { thinkingConfigThinkingBudget :: Maybe Int
thinkingConfigThinkingBudget = Maybe Int
forall a. Maybe a
Nothing
    , thinkingConfigIncludeThoughts :: Maybe Bool
thinkingConfigIncludeThoughts = Maybe Bool
forall a. Maybe a
Nothing
    }

-- ** Tool

{- | Tool
Tool details that the model may use to generate response.  A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model.
-}
data Tool = Tool
  { Tool -> Maybe [FunctionDeclaration]
toolFunctionDeclarations :: !(Maybe [FunctionDeclaration])
  -- ^ "functionDeclarations" - Optional. A list of &#x60;FunctionDeclarations&#x60; available to the model that can be used for function calling.  The model or system does not execute the function. Instead the defined function may be returned as a FunctionCall with arguments to the client side for execution. The model may decide to call a subset of these functions by populating FunctionCall in the response. The next conversation turn may contain a FunctionResponse with the Content.role \&quot;function\&quot; generation context for the next model turn.
  , Tool -> Maybe GoogleSearchRetrieval
toolGoogleSearchRetrieval :: !(Maybe GoogleSearchRetrieval)
  -- ^ "googleSearchRetrieval" - Optional. Retrieval tool that is powered by Google search.
  , Tool -> Maybe GoogleSearch
toolGoogleSearch :: !(Maybe GoogleSearch)
  -- ^ "googleSearch" - Optional. GoogleSearch tool type. Tool to support Google Search in Model. Powered by Google.
  , Tool -> Maybe Value
toolCodeExecution :: !(Maybe A.Value)
  -- ^ "codeExecution" - Optional. Enables the model to execute code as part of generation.
  , Tool -> Maybe Value
toolUrlContext :: !(Maybe A.Value)
  -- ^ "urlContext" - Optional. Tool to support URL context retrieval.
  }
  deriving (Int -> Tool -> ShowS
[Tool] -> ShowS
Tool -> [Char]
(Int -> Tool -> ShowS)
-> (Tool -> [Char]) -> ([Tool] -> ShowS) -> Show Tool
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Tool -> ShowS
showsPrec :: Int -> Tool -> ShowS
$cshow :: Tool -> [Char]
show :: Tool -> [Char]
$cshowList :: [Tool] -> ShowS
showList :: [Tool] -> ShowS
P.Show, Tool -> Tool -> Bool
(Tool -> Tool -> Bool) -> (Tool -> Tool -> Bool) -> Eq Tool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Tool -> Tool -> Bool
== :: Tool -> Tool -> Bool
$c/= :: Tool -> Tool -> Bool
/= :: Tool -> Tool -> Bool
P.Eq, P.Typeable)

-- | FromJSON Tool
instance A.FromJSON Tool where
  parseJSON :: Value -> Parser Tool
parseJSON = [Char] -> (Object -> Parser Tool) -> Value -> Parser Tool
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Tool" ((Object -> Parser Tool) -> Value -> Parser Tool)
-> (Object -> Parser Tool) -> Value -> Parser Tool
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [FunctionDeclaration]
-> Maybe GoogleSearchRetrieval
-> Maybe GoogleSearch
-> Maybe Value
-> Maybe Value
-> Tool
Tool
      (Maybe [FunctionDeclaration]
 -> Maybe GoogleSearchRetrieval
 -> Maybe GoogleSearch
 -> Maybe Value
 -> Maybe Value
 -> Tool)
-> Parser (Maybe [FunctionDeclaration])
-> Parser
     (Maybe GoogleSearchRetrieval
      -> Maybe GoogleSearch -> Maybe Value -> Maybe Value -> Tool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [FunctionDeclaration])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"functionDeclarations")
      Parser
  (Maybe GoogleSearchRetrieval
   -> Maybe GoogleSearch -> Maybe Value -> Maybe Value -> Tool)
-> Parser (Maybe GoogleSearchRetrieval)
-> Parser
     (Maybe GoogleSearch -> Maybe Value -> Maybe Value -> Tool)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe GoogleSearchRetrieval)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"googleSearchRetrieval")
      Parser (Maybe GoogleSearch -> Maybe Value -> Maybe Value -> Tool)
-> Parser (Maybe GoogleSearch)
-> Parser (Maybe Value -> Maybe Value -> Tool)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe GoogleSearch)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"googleSearch")
      Parser (Maybe Value -> Maybe Value -> Tool)
-> Parser (Maybe Value) -> Parser (Maybe Value -> Tool)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"codeExecution")
      Parser (Maybe Value -> Tool) -> Parser (Maybe Value) -> Parser Tool
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Value)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"urlContext")

-- | ToJSON Tool
instance A.ToJSON Tool where
  toJSON :: Tool -> Value
toJSON Tool {Maybe [FunctionDeclaration]
Maybe Value
Maybe GoogleSearch
Maybe GoogleSearchRetrieval
toolFunctionDeclarations :: Tool -> Maybe [FunctionDeclaration]
toolGoogleSearchRetrieval :: Tool -> Maybe GoogleSearchRetrieval
toolGoogleSearch :: Tool -> Maybe GoogleSearch
toolCodeExecution :: Tool -> Maybe Value
toolUrlContext :: Tool -> Maybe Value
toolFunctionDeclarations :: Maybe [FunctionDeclaration]
toolGoogleSearchRetrieval :: Maybe GoogleSearchRetrieval
toolGoogleSearch :: Maybe GoogleSearch
toolCodeExecution :: Maybe Value
toolUrlContext :: Maybe Value
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"functionDeclarations" Key -> Maybe [FunctionDeclaration] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [FunctionDeclaration]
toolFunctionDeclarations
      , Key
"googleSearchRetrieval" Key -> Maybe GoogleSearchRetrieval -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GoogleSearchRetrieval
toolGoogleSearchRetrieval
      , Key
"googleSearch" Key -> Maybe GoogleSearch -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe GoogleSearch
toolGoogleSearch
      , Key
"codeExecution" Key -> Maybe Value -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Value
toolCodeExecution
      , Key
"urlContext" Key -> Maybe Value -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Value
toolUrlContext
      ]

-- | Construct a value of type 'Tool' (by applying it's required fields, if any)
mkTool ::
  Tool
mkTool :: Tool
mkTool =
  Tool
    { toolFunctionDeclarations :: Maybe [FunctionDeclaration]
toolFunctionDeclarations = Maybe [FunctionDeclaration]
forall a. Maybe a
Nothing
    , toolGoogleSearchRetrieval :: Maybe GoogleSearchRetrieval
toolGoogleSearchRetrieval = Maybe GoogleSearchRetrieval
forall a. Maybe a
Nothing
    , toolGoogleSearch :: Maybe GoogleSearch
toolGoogleSearch = Maybe GoogleSearch
forall a. Maybe a
Nothing
    , toolCodeExecution :: Maybe Value
toolCodeExecution = Maybe Value
forall a. Maybe a
Nothing
    , toolUrlContext :: Maybe Value
toolUrlContext = Maybe Value
forall a. Maybe a
Nothing
    }

-- ** ToolConfig

{- | ToolConfig
The Tool configuration containing parameters for specifying `Tool` use in the request.
-}
data ToolConfig = ToolConfig
  { ToolConfig -> Maybe FunctionCallingConfig
toolConfigFunctionCallingConfig :: !(Maybe FunctionCallingConfig)
  -- ^ "functionCallingConfig" - Optional. Function calling config.
  }
  deriving (Int -> ToolConfig -> ShowS
[ToolConfig] -> ShowS
ToolConfig -> [Char]
(Int -> ToolConfig -> ShowS)
-> (ToolConfig -> [Char])
-> ([ToolConfig] -> ShowS)
-> Show ToolConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ToolConfig -> ShowS
showsPrec :: Int -> ToolConfig -> ShowS
$cshow :: ToolConfig -> [Char]
show :: ToolConfig -> [Char]
$cshowList :: [ToolConfig] -> ShowS
showList :: [ToolConfig] -> ShowS
P.Show, ToolConfig -> ToolConfig -> Bool
(ToolConfig -> ToolConfig -> Bool)
-> (ToolConfig -> ToolConfig -> Bool) -> Eq ToolConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ToolConfig -> ToolConfig -> Bool
== :: ToolConfig -> ToolConfig -> Bool
$c/= :: ToolConfig -> ToolConfig -> Bool
/= :: ToolConfig -> ToolConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON ToolConfig
instance A.FromJSON ToolConfig where
  parseJSON :: Value -> Parser ToolConfig
parseJSON = [Char]
-> (Object -> Parser ToolConfig) -> Value -> Parser ToolConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"ToolConfig" ((Object -> Parser ToolConfig) -> Value -> Parser ToolConfig)
-> (Object -> Parser ToolConfig) -> Value -> Parser ToolConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe FunctionCallingConfig -> ToolConfig
ToolConfig
      (Maybe FunctionCallingConfig -> ToolConfig)
-> Parser (Maybe FunctionCallingConfig) -> Parser ToolConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe FunctionCallingConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"functionCallingConfig")

-- | ToJSON ToolConfig
instance A.ToJSON ToolConfig where
  toJSON :: ToolConfig -> Value
toJSON ToolConfig {Maybe FunctionCallingConfig
toolConfigFunctionCallingConfig :: ToolConfig -> Maybe FunctionCallingConfig
toolConfigFunctionCallingConfig :: Maybe FunctionCallingConfig
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"functionCallingConfig" Key -> Maybe FunctionCallingConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe FunctionCallingConfig
toolConfigFunctionCallingConfig
      ]

-- | Construct a value of type 'ToolConfig' (by applying it's required fields, if any)
mkToolConfig ::
  ToolConfig
mkToolConfig :: ToolConfig
mkToolConfig =
  ToolConfig
    { toolConfigFunctionCallingConfig :: Maybe FunctionCallingConfig
toolConfigFunctionCallingConfig = Maybe FunctionCallingConfig
forall a. Maybe a
Nothing
    }

-- ** TopCandidates

{- | TopCandidates
Candidates with top log probabilities at each decoding step.
-}
data TopCandidates = TopCandidates
  { TopCandidates -> Maybe [LogprobsResultCandidate]
topCandidatesCandidates :: !(Maybe [LogprobsResultCandidate])
  -- ^ "candidates" - Sorted by log probability in descending order.
  }
  deriving (Int -> TopCandidates -> ShowS
[TopCandidates] -> ShowS
TopCandidates -> [Char]
(Int -> TopCandidates -> ShowS)
-> (TopCandidates -> [Char])
-> ([TopCandidates] -> ShowS)
-> Show TopCandidates
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TopCandidates -> ShowS
showsPrec :: Int -> TopCandidates -> ShowS
$cshow :: TopCandidates -> [Char]
show :: TopCandidates -> [Char]
$cshowList :: [TopCandidates] -> ShowS
showList :: [TopCandidates] -> ShowS
P.Show, TopCandidates -> TopCandidates -> Bool
(TopCandidates -> TopCandidates -> Bool)
-> (TopCandidates -> TopCandidates -> Bool) -> Eq TopCandidates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TopCandidates -> TopCandidates -> Bool
== :: TopCandidates -> TopCandidates -> Bool
$c/= :: TopCandidates -> TopCandidates -> Bool
/= :: TopCandidates -> TopCandidates -> Bool
P.Eq, P.Typeable)

-- | FromJSON TopCandidates
instance A.FromJSON TopCandidates where
  parseJSON :: Value -> Parser TopCandidates
parseJSON = [Char]
-> (Object -> Parser TopCandidates)
-> Value
-> Parser TopCandidates
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TopCandidates" ((Object -> Parser TopCandidates) -> Value -> Parser TopCandidates)
-> (Object -> Parser TopCandidates)
-> Value
-> Parser TopCandidates
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [LogprobsResultCandidate] -> TopCandidates
TopCandidates
      (Maybe [LogprobsResultCandidate] -> TopCandidates)
-> Parser (Maybe [LogprobsResultCandidate]) -> Parser TopCandidates
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [LogprobsResultCandidate])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidates")

-- | ToJSON TopCandidates
instance A.ToJSON TopCandidates where
  toJSON :: TopCandidates -> Value
toJSON TopCandidates {Maybe [LogprobsResultCandidate]
topCandidatesCandidates :: TopCandidates -> Maybe [LogprobsResultCandidate]
topCandidatesCandidates :: Maybe [LogprobsResultCandidate]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"candidates" Key -> Maybe [LogprobsResultCandidate] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [LogprobsResultCandidate]
topCandidatesCandidates
      ]

-- | Construct a value of type 'TopCandidates' (by applying it's required fields, if any)
mkTopCandidates ::
  TopCandidates
mkTopCandidates :: TopCandidates
mkTopCandidates =
  TopCandidates
    { topCandidatesCandidates :: Maybe [LogprobsResultCandidate]
topCandidatesCandidates = Maybe [LogprobsResultCandidate]
forall a. Maybe a
Nothing
    }

-- ** TransferOwnershipRequest

{- | TransferOwnershipRequest
Request to transfer the ownership of the tuned model.
-}
data TransferOwnershipRequest = TransferOwnershipRequest
  { TransferOwnershipRequest -> Text
transferOwnershipRequestEmailAddress :: !(Text)
  -- ^ /Required/ "emailAddress" - Required. The email address of the user to whom the tuned model is being transferred to.
  }
  deriving (Int -> TransferOwnershipRequest -> ShowS
[TransferOwnershipRequest] -> ShowS
TransferOwnershipRequest -> [Char]
(Int -> TransferOwnershipRequest -> ShowS)
-> (TransferOwnershipRequest -> [Char])
-> ([TransferOwnershipRequest] -> ShowS)
-> Show TransferOwnershipRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransferOwnershipRequest -> ShowS
showsPrec :: Int -> TransferOwnershipRequest -> ShowS
$cshow :: TransferOwnershipRequest -> [Char]
show :: TransferOwnershipRequest -> [Char]
$cshowList :: [TransferOwnershipRequest] -> ShowS
showList :: [TransferOwnershipRequest] -> ShowS
P.Show, TransferOwnershipRequest -> TransferOwnershipRequest -> Bool
(TransferOwnershipRequest -> TransferOwnershipRequest -> Bool)
-> (TransferOwnershipRequest -> TransferOwnershipRequest -> Bool)
-> Eq TransferOwnershipRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TransferOwnershipRequest -> TransferOwnershipRequest -> Bool
== :: TransferOwnershipRequest -> TransferOwnershipRequest -> Bool
$c/= :: TransferOwnershipRequest -> TransferOwnershipRequest -> Bool
/= :: TransferOwnershipRequest -> TransferOwnershipRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON TransferOwnershipRequest
instance A.FromJSON TransferOwnershipRequest where
  parseJSON :: Value -> Parser TransferOwnershipRequest
parseJSON = [Char]
-> (Object -> Parser TransferOwnershipRequest)
-> Value
-> Parser TransferOwnershipRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TransferOwnershipRequest" ((Object -> Parser TransferOwnershipRequest)
 -> Value -> Parser TransferOwnershipRequest)
-> (Object -> Parser TransferOwnershipRequest)
-> Value
-> Parser TransferOwnershipRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Text -> TransferOwnershipRequest
TransferOwnershipRequest
      (Text -> TransferOwnershipRequest)
-> Parser Text -> Parser TransferOwnershipRequest
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"emailAddress")

-- | ToJSON TransferOwnershipRequest
instance A.ToJSON TransferOwnershipRequest where
  toJSON :: TransferOwnershipRequest -> Value
toJSON TransferOwnershipRequest {Text
transferOwnershipRequestEmailAddress :: TransferOwnershipRequest -> Text
transferOwnershipRequestEmailAddress :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"emailAddress" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
transferOwnershipRequestEmailAddress
      ]

-- | Construct a value of type 'TransferOwnershipRequest' (by applying it's required fields, if any)
mkTransferOwnershipRequest ::
  -- | 'transferOwnershipRequestEmailAddress': Required. The email address of the user to whom the tuned model is being transferred to.
  Text ->
  TransferOwnershipRequest
mkTransferOwnershipRequest :: Text -> TransferOwnershipRequest
mkTransferOwnershipRequest Text
transferOwnershipRequestEmailAddress =
  TransferOwnershipRequest
    { Text
transferOwnershipRequestEmailAddress :: Text
transferOwnershipRequestEmailAddress :: Text
transferOwnershipRequestEmailAddress
    }

-- ** TunedModel

{- | TunedModel
A fine-tuned model created using ModelService.CreateTunedModel.
-}
data TunedModel = TunedModel
  { TunedModel -> Maybe DateTime
tunedModelUpdateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "updateTime" - Output only. The timestamp when this model was updated.
  , TunedModel -> Maybe Text
tunedModelName :: !(Maybe Text)
  -- ^ /ReadOnly/ "name" - Output only. The tuned model name. A unique name will be generated on create. Example: &#x60;tunedModels/az2mb0bpw6i&#x60; If display_name is set on create, the id portion of the name will be set by concatenating the words of the display_name with hyphens and adding a random portion for uniqueness.  Example:   * display_name &#x3D; &#x60;Sentence Translator&#x60;  * name &#x3D; &#x60;tunedModels/sentence-translator-u3b7m&#x60;
  , TunedModel -> Maybe DateTime
tunedModelCreateTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "createTime" - Output only. The timestamp when this model was created.
  , TunedModel -> TuningTask
tunedModelTuningTask :: !(TuningTask)
  -- ^ /Required/ "tuningTask" - Required. The tuning task that creates the tuned model.
  , TunedModel -> Maybe TunedModelSource
tunedModelTunedModelSource :: !(Maybe TunedModelSource)
  -- ^ "tunedModelSource" - Optional. TunedModel to use as the starting point for training the new model.
  , TunedModel -> Maybe Text
tunedModelBaseModel :: !(Maybe Text)
  -- ^ "baseModel" - Immutable. The name of the &#x60;Model&#x60; to tune. Example: &#x60;models/gemini-1.5-flash-001&#x60;
  , TunedModel -> Maybe [Text]
tunedModelReaderProjectNumbers :: !(Maybe [Text])
  -- ^ "readerProjectNumbers" - Optional. List of project numbers that have read access to the tuned model.
  , TunedModel -> Maybe Text
tunedModelDisplayName :: !(Maybe Text)
  -- ^ "displayName" - Optional. The name to display for this model in user interfaces. The display name must be up to 40 characters including spaces.
  , TunedModel -> Maybe Float
tunedModelTemperature :: !(Maybe Float)
  -- ^ "temperature" - Optional. Controls the randomness of the output.  Values can range over &#x60;[0.0,1.0]&#x60;, inclusive. A value closer to &#x60;1.0&#x60; will produce responses that are more varied, while a value closer to &#x60;0.0&#x60; will typically result in less surprising responses from the model.  This value specifies default to be the one used by the base model while creating the model.
  , TunedModel -> Maybe Text
tunedModelDescription :: !(Maybe Text)
  -- ^ "description" - Optional. A short description of this model.
  , TunedModel -> Maybe Float
tunedModelTopP :: !(Maybe Float)
  -- ^ "topP" - Optional. For Nucleus sampling.  Nucleus sampling considers the smallest set of tokens whose probability sum is at least &#x60;top_p&#x60;.  This value specifies default to be the one used by the base model while creating the model.
  , TunedModel -> Maybe Int
tunedModelTopK :: !(Maybe Int)
  -- ^ "topK" - Optional. For Top-k sampling.  Top-k sampling considers the set of &#x60;top_k&#x60; most probable tokens. This value specifies default to be used by the backend while making the call to the model.  This value specifies default to be the one used by the base model while creating the model.
  , TunedModel -> Maybe E'State3
tunedModelState :: !(Maybe E'State3)
  -- ^ /ReadOnly/ "state" - Output only. The state of the tuned model.
  }
  deriving (Int -> TunedModel -> ShowS
[TunedModel] -> ShowS
TunedModel -> [Char]
(Int -> TunedModel -> ShowS)
-> (TunedModel -> [Char])
-> ([TunedModel] -> ShowS)
-> Show TunedModel
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TunedModel -> ShowS
showsPrec :: Int -> TunedModel -> ShowS
$cshow :: TunedModel -> [Char]
show :: TunedModel -> [Char]
$cshowList :: [TunedModel] -> ShowS
showList :: [TunedModel] -> ShowS
P.Show, TunedModel -> TunedModel -> Bool
(TunedModel -> TunedModel -> Bool)
-> (TunedModel -> TunedModel -> Bool) -> Eq TunedModel
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TunedModel -> TunedModel -> Bool
== :: TunedModel -> TunedModel -> Bool
$c/= :: TunedModel -> TunedModel -> Bool
/= :: TunedModel -> TunedModel -> Bool
P.Eq, P.Typeable)

-- | FromJSON TunedModel
instance A.FromJSON TunedModel where
  parseJSON :: Value -> Parser TunedModel
parseJSON = [Char]
-> (Object -> Parser TunedModel) -> Value -> Parser TunedModel
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TunedModel" ((Object -> Parser TunedModel) -> Value -> Parser TunedModel)
-> (Object -> Parser TunedModel) -> Value -> Parser TunedModel
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe DateTime
-> Maybe Text
-> Maybe DateTime
-> TuningTask
-> Maybe TunedModelSource
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe Float
-> Maybe Text
-> Maybe Float
-> Maybe Int
-> Maybe E'State3
-> TunedModel
TunedModel
      (Maybe DateTime
 -> Maybe Text
 -> Maybe DateTime
 -> TuningTask
 -> Maybe TunedModelSource
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Float
 -> Maybe Text
 -> Maybe Float
 -> Maybe Int
 -> Maybe E'State3
 -> TunedModel)
-> Parser (Maybe DateTime)
-> Parser
     (Maybe Text
      -> Maybe DateTime
      -> TuningTask
      -> Maybe TunedModelSource
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"updateTime")
      Parser
  (Maybe Text
   -> Maybe DateTime
   -> TuningTask
   -> Maybe TunedModelSource
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser (Maybe Text)
-> Parser
     (Maybe DateTime
      -> TuningTask
      -> Maybe TunedModelSource
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"name")
      Parser
  (Maybe DateTime
   -> TuningTask
   -> Maybe TunedModelSource
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser (Maybe DateTime)
-> Parser
     (TuningTask
      -> Maybe TunedModelSource
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"createTime")
      Parser
  (TuningTask
   -> Maybe TunedModelSource
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser TuningTask
-> Parser
     (Maybe TunedModelSource
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser TuningTask
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"tuningTask")
      Parser
  (Maybe TunedModelSource
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser (Maybe TunedModelSource)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe TunedModelSource)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tunedModelSource")
      Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"baseModel")
      Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"readerProjectNumbers")
      Parser
  (Maybe Text
   -> Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser (Maybe Text)
-> Parser
     (Maybe Float
      -> Maybe Text
      -> Maybe Float
      -> Maybe Int
      -> Maybe E'State3
      -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"displayName")
      Parser
  (Maybe Float
   -> Maybe Text
   -> Maybe Float
   -> Maybe Int
   -> Maybe E'State3
   -> TunedModel)
-> Parser (Maybe Float)
-> Parser
     (Maybe Text
      -> Maybe Float -> Maybe Int -> Maybe E'State3 -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"temperature")
      Parser
  (Maybe Text
   -> Maybe Float -> Maybe Int -> Maybe E'State3 -> TunedModel)
-> Parser (Maybe Text)
-> Parser
     (Maybe Float -> Maybe Int -> Maybe E'State3 -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"description")
      Parser (Maybe Float -> Maybe Int -> Maybe E'State3 -> TunedModel)
-> Parser (Maybe Float)
-> Parser (Maybe Int -> Maybe E'State3 -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topP")
      Parser (Maybe Int -> Maybe E'State3 -> TunedModel)
-> Parser (Maybe Int) -> Parser (Maybe E'State3 -> TunedModel)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"topK")
      Parser (Maybe E'State3 -> TunedModel)
-> Parser (Maybe E'State3) -> Parser TunedModel
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'State3)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"state")

-- | ToJSON TunedModel
instance A.ToJSON TunedModel where
  toJSON :: TunedModel -> Value
toJSON TunedModel {Maybe Float
Maybe Int
Maybe [Text]
Maybe Text
Maybe DateTime
Maybe E'State3
Maybe TunedModelSource
TuningTask
tunedModelUpdateTime :: TunedModel -> Maybe DateTime
tunedModelName :: TunedModel -> Maybe Text
tunedModelCreateTime :: TunedModel -> Maybe DateTime
tunedModelTuningTask :: TunedModel -> TuningTask
tunedModelTunedModelSource :: TunedModel -> Maybe TunedModelSource
tunedModelBaseModel :: TunedModel -> Maybe Text
tunedModelReaderProjectNumbers :: TunedModel -> Maybe [Text]
tunedModelDisplayName :: TunedModel -> Maybe Text
tunedModelTemperature :: TunedModel -> Maybe Float
tunedModelDescription :: TunedModel -> Maybe Text
tunedModelTopP :: TunedModel -> Maybe Float
tunedModelTopK :: TunedModel -> Maybe Int
tunedModelState :: TunedModel -> Maybe E'State3
tunedModelUpdateTime :: Maybe DateTime
tunedModelName :: Maybe Text
tunedModelCreateTime :: Maybe DateTime
tunedModelTuningTask :: TuningTask
tunedModelTunedModelSource :: Maybe TunedModelSource
tunedModelBaseModel :: Maybe Text
tunedModelReaderProjectNumbers :: Maybe [Text]
tunedModelDisplayName :: Maybe Text
tunedModelTemperature :: Maybe Float
tunedModelDescription :: Maybe Text
tunedModelTopP :: Maybe Float
tunedModelTopK :: Maybe Int
tunedModelState :: Maybe E'State3
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"updateTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
tunedModelUpdateTime
      , Key
"name" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
tunedModelName
      , Key
"createTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
tunedModelCreateTime
      , Key
"tuningTask" Key -> TuningTask -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= TuningTask
tunedModelTuningTask
      , Key
"tunedModelSource" Key -> Maybe TunedModelSource -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe TunedModelSource
tunedModelTunedModelSource
      , Key
"baseModel" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
tunedModelBaseModel
      , Key
"readerProjectNumbers" Key -> Maybe [Text] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [Text]
tunedModelReaderProjectNumbers
      , Key
"displayName" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
tunedModelDisplayName
      , Key
"temperature" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
tunedModelTemperature
      , Key
"description" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
tunedModelDescription
      , Key
"topP" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
tunedModelTopP
      , Key
"topK" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
tunedModelTopK
      , Key
"state" Key -> Maybe E'State3 -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'State3
tunedModelState
      ]

-- | Construct a value of type 'TunedModel' (by applying it's required fields, if any)
mkTunedModel ::
  -- | 'tunedModelTuningTask': Required. The tuning task that creates the tuned model.
  TuningTask ->
  TunedModel
mkTunedModel :: TuningTask -> TunedModel
mkTunedModel TuningTask
tunedModelTuningTask =
  TunedModel
    { tunedModelUpdateTime :: Maybe DateTime
tunedModelUpdateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , tunedModelName :: Maybe Text
tunedModelName = Maybe Text
forall a. Maybe a
Nothing
    , tunedModelCreateTime :: Maybe DateTime
tunedModelCreateTime = Maybe DateTime
forall a. Maybe a
Nothing
    , TuningTask
tunedModelTuningTask :: TuningTask
tunedModelTuningTask :: TuningTask
tunedModelTuningTask
    , tunedModelTunedModelSource :: Maybe TunedModelSource
tunedModelTunedModelSource = Maybe TunedModelSource
forall a. Maybe a
Nothing
    , tunedModelBaseModel :: Maybe Text
tunedModelBaseModel = Maybe Text
forall a. Maybe a
Nothing
    , tunedModelReaderProjectNumbers :: Maybe [Text]
tunedModelReaderProjectNumbers = Maybe [Text]
forall a. Maybe a
Nothing
    , tunedModelDisplayName :: Maybe Text
tunedModelDisplayName = Maybe Text
forall a. Maybe a
Nothing
    , tunedModelTemperature :: Maybe Float
tunedModelTemperature = Maybe Float
forall a. Maybe a
Nothing
    , tunedModelDescription :: Maybe Text
tunedModelDescription = Maybe Text
forall a. Maybe a
Nothing
    , tunedModelTopP :: Maybe Float
tunedModelTopP = Maybe Float
forall a. Maybe a
Nothing
    , tunedModelTopK :: Maybe Int
tunedModelTopK = Maybe Int
forall a. Maybe a
Nothing
    , tunedModelState :: Maybe E'State3
tunedModelState = Maybe E'State3
forall a. Maybe a
Nothing
    }

-- ** TunedModelSource

{- | TunedModelSource
Tuned model as a source for training a new model.
-}
data TunedModelSource = TunedModelSource
  { TunedModelSource -> Maybe Text
tunedModelSourceTunedModel :: !(Maybe Text)
  -- ^ "tunedModel" - Immutable. The name of the &#x60;TunedModel&#x60; to use as the starting point for training the new model. Example: &#x60;tunedModels/my-tuned-model&#x60;
  , TunedModelSource -> Maybe Text
tunedModelSourceBaseModel :: !(Maybe Text)
  -- ^ /ReadOnly/ "baseModel" - Output only. The name of the base &#x60;Model&#x60; this &#x60;TunedModel&#x60; was tuned from. Example: &#x60;models/gemini-1.5-flash-001&#x60;
  }
  deriving (Int -> TunedModelSource -> ShowS
[TunedModelSource] -> ShowS
TunedModelSource -> [Char]
(Int -> TunedModelSource -> ShowS)
-> (TunedModelSource -> [Char])
-> ([TunedModelSource] -> ShowS)
-> Show TunedModelSource
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TunedModelSource -> ShowS
showsPrec :: Int -> TunedModelSource -> ShowS
$cshow :: TunedModelSource -> [Char]
show :: TunedModelSource -> [Char]
$cshowList :: [TunedModelSource] -> ShowS
showList :: [TunedModelSource] -> ShowS
P.Show, TunedModelSource -> TunedModelSource -> Bool
(TunedModelSource -> TunedModelSource -> Bool)
-> (TunedModelSource -> TunedModelSource -> Bool)
-> Eq TunedModelSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TunedModelSource -> TunedModelSource -> Bool
== :: TunedModelSource -> TunedModelSource -> Bool
$c/= :: TunedModelSource -> TunedModelSource -> Bool
/= :: TunedModelSource -> TunedModelSource -> Bool
P.Eq, P.Typeable)

-- | FromJSON TunedModelSource
instance A.FromJSON TunedModelSource where
  parseJSON :: Value -> Parser TunedModelSource
parseJSON = [Char]
-> (Object -> Parser TunedModelSource)
-> Value
-> Parser TunedModelSource
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TunedModelSource" ((Object -> Parser TunedModelSource)
 -> Value -> Parser TunedModelSource)
-> (Object -> Parser TunedModelSource)
-> Value
-> Parser TunedModelSource
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe Text -> TunedModelSource
TunedModelSource
      (Maybe Text -> Maybe Text -> TunedModelSource)
-> Parser (Maybe Text) -> Parser (Maybe Text -> TunedModelSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"tunedModel")
      Parser (Maybe Text -> TunedModelSource)
-> Parser (Maybe Text) -> Parser TunedModelSource
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"baseModel")

-- | ToJSON TunedModelSource
instance A.ToJSON TunedModelSource where
  toJSON :: TunedModelSource -> Value
toJSON TunedModelSource {Maybe Text
tunedModelSourceTunedModel :: TunedModelSource -> Maybe Text
tunedModelSourceBaseModel :: TunedModelSource -> Maybe Text
tunedModelSourceTunedModel :: Maybe Text
tunedModelSourceBaseModel :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"tunedModel" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
tunedModelSourceTunedModel
      , Key
"baseModel" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
tunedModelSourceBaseModel
      ]

-- | Construct a value of type 'TunedModelSource' (by applying it's required fields, if any)
mkTunedModelSource ::
  TunedModelSource
mkTunedModelSource :: TunedModelSource
mkTunedModelSource =
  TunedModelSource
    { tunedModelSourceTunedModel :: Maybe Text
tunedModelSourceTunedModel = Maybe Text
forall a. Maybe a
Nothing
    , tunedModelSourceBaseModel :: Maybe Text
tunedModelSourceBaseModel = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** TuningExample

{- | TuningExample
A single example for tuning.
-}
data TuningExample = TuningExample
  { TuningExample -> Maybe Text
tuningExampleTextInput :: !(Maybe Text)
  -- ^ "textInput" - Optional. Text model input.
  , TuningExample -> Text
tuningExampleOutput :: !(Text)
  -- ^ /Required/ "output" - Required. The expected model output.
  }
  deriving (Int -> TuningExample -> ShowS
[TuningExample] -> ShowS
TuningExample -> [Char]
(Int -> TuningExample -> ShowS)
-> (TuningExample -> [Char])
-> ([TuningExample] -> ShowS)
-> Show TuningExample
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TuningExample -> ShowS
showsPrec :: Int -> TuningExample -> ShowS
$cshow :: TuningExample -> [Char]
show :: TuningExample -> [Char]
$cshowList :: [TuningExample] -> ShowS
showList :: [TuningExample] -> ShowS
P.Show, TuningExample -> TuningExample -> Bool
(TuningExample -> TuningExample -> Bool)
-> (TuningExample -> TuningExample -> Bool) -> Eq TuningExample
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TuningExample -> TuningExample -> Bool
== :: TuningExample -> TuningExample -> Bool
$c/= :: TuningExample -> TuningExample -> Bool
/= :: TuningExample -> TuningExample -> Bool
P.Eq, P.Typeable)

-- | FromJSON TuningExample
instance A.FromJSON TuningExample where
  parseJSON :: Value -> Parser TuningExample
parseJSON = [Char]
-> (Object -> Parser TuningExample)
-> Value
-> Parser TuningExample
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TuningExample" ((Object -> Parser TuningExample) -> Value -> Parser TuningExample)
-> (Object -> Parser TuningExample)
-> Value
-> Parser TuningExample
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Text -> TuningExample
TuningExample
      (Maybe Text -> Text -> TuningExample)
-> Parser (Maybe Text) -> Parser (Text -> TuningExample)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"textInput")
      Parser (Text -> TuningExample)
-> Parser Text -> Parser TuningExample
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"output")

-- | ToJSON TuningExample
instance A.ToJSON TuningExample where
  toJSON :: TuningExample -> Value
toJSON TuningExample {Maybe Text
Text
tuningExampleTextInput :: TuningExample -> Maybe Text
tuningExampleOutput :: TuningExample -> Text
tuningExampleTextInput :: Maybe Text
tuningExampleOutput :: Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"textInput" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
tuningExampleTextInput
      , Key
"output" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
tuningExampleOutput
      ]

-- | Construct a value of type 'TuningExample' (by applying it's required fields, if any)
mkTuningExample ::
  -- | 'tuningExampleOutput': Required. The expected model output.
  Text ->
  TuningExample
mkTuningExample :: Text -> TuningExample
mkTuningExample Text
tuningExampleOutput =
  TuningExample
    { tuningExampleTextInput :: Maybe Text
tuningExampleTextInput = Maybe Text
forall a. Maybe a
Nothing
    , Text
tuningExampleOutput :: Text
tuningExampleOutput :: Text
tuningExampleOutput
    }

-- ** TuningExamples

{- | TuningExamples
A set of tuning examples. Can be training or validation data.
-}
data TuningExamples = TuningExamples
  { TuningExamples -> Maybe [TuningExample]
tuningExamplesExamples :: !(Maybe [TuningExample])
  -- ^ "examples" - The examples. Example input can be for text or discuss, but all examples in a set must be of the same type.
  }
  deriving (Int -> TuningExamples -> ShowS
[TuningExamples] -> ShowS
TuningExamples -> [Char]
(Int -> TuningExamples -> ShowS)
-> (TuningExamples -> [Char])
-> ([TuningExamples] -> ShowS)
-> Show TuningExamples
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TuningExamples -> ShowS
showsPrec :: Int -> TuningExamples -> ShowS
$cshow :: TuningExamples -> [Char]
show :: TuningExamples -> [Char]
$cshowList :: [TuningExamples] -> ShowS
showList :: [TuningExamples] -> ShowS
P.Show, TuningExamples -> TuningExamples -> Bool
(TuningExamples -> TuningExamples -> Bool)
-> (TuningExamples -> TuningExamples -> Bool) -> Eq TuningExamples
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TuningExamples -> TuningExamples -> Bool
== :: TuningExamples -> TuningExamples -> Bool
$c/= :: TuningExamples -> TuningExamples -> Bool
/= :: TuningExamples -> TuningExamples -> Bool
P.Eq, P.Typeable)

-- | FromJSON TuningExamples
instance A.FromJSON TuningExamples where
  parseJSON :: Value -> Parser TuningExamples
parseJSON = [Char]
-> (Object -> Parser TuningExamples)
-> Value
-> Parser TuningExamples
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TuningExamples" ((Object -> Parser TuningExamples)
 -> Value -> Parser TuningExamples)
-> (Object -> Parser TuningExamples)
-> Value
-> Parser TuningExamples
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [TuningExample] -> TuningExamples
TuningExamples
      (Maybe [TuningExample] -> TuningExamples)
-> Parser (Maybe [TuningExample]) -> Parser TuningExamples
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [TuningExample])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"examples")

-- | ToJSON TuningExamples
instance A.ToJSON TuningExamples where
  toJSON :: TuningExamples -> Value
toJSON TuningExamples {Maybe [TuningExample]
tuningExamplesExamples :: TuningExamples -> Maybe [TuningExample]
tuningExamplesExamples :: Maybe [TuningExample]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"examples" Key -> Maybe [TuningExample] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [TuningExample]
tuningExamplesExamples
      ]

-- | Construct a value of type 'TuningExamples' (by applying it's required fields, if any)
mkTuningExamples ::
  TuningExamples
mkTuningExamples :: TuningExamples
mkTuningExamples =
  TuningExamples
    { tuningExamplesExamples :: Maybe [TuningExample]
tuningExamplesExamples = Maybe [TuningExample]
forall a. Maybe a
Nothing
    }

-- ** TuningSnapshot

{- | TuningSnapshot
Record for a single tuning step.
-}
data TuningSnapshot = TuningSnapshot
  { TuningSnapshot -> Maybe Float
tuningSnapshotMeanLoss :: !(Maybe Float)
  -- ^ /ReadOnly/ "meanLoss" - Output only. The mean loss of the training examples for this step.
  , TuningSnapshot -> Maybe DateTime
tuningSnapshotComputeTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "computeTime" - Output only. The timestamp when this metric was computed.
  , TuningSnapshot -> Maybe Int
tuningSnapshotStep :: !(Maybe Int)
  -- ^ /ReadOnly/ "step" - Output only. The tuning step.
  , TuningSnapshot -> Maybe Int
tuningSnapshotEpoch :: !(Maybe Int)
  -- ^ /ReadOnly/ "epoch" - Output only. The epoch this step was part of.
  }
  deriving (Int -> TuningSnapshot -> ShowS
[TuningSnapshot] -> ShowS
TuningSnapshot -> [Char]
(Int -> TuningSnapshot -> ShowS)
-> (TuningSnapshot -> [Char])
-> ([TuningSnapshot] -> ShowS)
-> Show TuningSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TuningSnapshot -> ShowS
showsPrec :: Int -> TuningSnapshot -> ShowS
$cshow :: TuningSnapshot -> [Char]
show :: TuningSnapshot -> [Char]
$cshowList :: [TuningSnapshot] -> ShowS
showList :: [TuningSnapshot] -> ShowS
P.Show, TuningSnapshot -> TuningSnapshot -> Bool
(TuningSnapshot -> TuningSnapshot -> Bool)
-> (TuningSnapshot -> TuningSnapshot -> Bool) -> Eq TuningSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TuningSnapshot -> TuningSnapshot -> Bool
== :: TuningSnapshot -> TuningSnapshot -> Bool
$c/= :: TuningSnapshot -> TuningSnapshot -> Bool
/= :: TuningSnapshot -> TuningSnapshot -> Bool
P.Eq, P.Typeable)

-- | FromJSON TuningSnapshot
instance A.FromJSON TuningSnapshot where
  parseJSON :: Value -> Parser TuningSnapshot
parseJSON = [Char]
-> (Object -> Parser TuningSnapshot)
-> Value
-> Parser TuningSnapshot
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TuningSnapshot" ((Object -> Parser TuningSnapshot)
 -> Value -> Parser TuningSnapshot)
-> (Object -> Parser TuningSnapshot)
-> Value
-> Parser TuningSnapshot
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Float
-> Maybe DateTime -> Maybe Int -> Maybe Int -> TuningSnapshot
TuningSnapshot
      (Maybe Float
 -> Maybe DateTime -> Maybe Int -> Maybe Int -> TuningSnapshot)
-> Parser (Maybe Float)
-> Parser
     (Maybe DateTime -> Maybe Int -> Maybe Int -> TuningSnapshot)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Float)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"meanLoss")
      Parser (Maybe DateTime -> Maybe Int -> Maybe Int -> TuningSnapshot)
-> Parser (Maybe DateTime)
-> Parser (Maybe Int -> Maybe Int -> TuningSnapshot)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"computeTime")
      Parser (Maybe Int -> Maybe Int -> TuningSnapshot)
-> Parser (Maybe Int) -> Parser (Maybe Int -> TuningSnapshot)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"step")
      Parser (Maybe Int -> TuningSnapshot)
-> Parser (Maybe Int) -> Parser TuningSnapshot
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"epoch")

-- | ToJSON TuningSnapshot
instance A.ToJSON TuningSnapshot where
  toJSON :: TuningSnapshot -> Value
toJSON TuningSnapshot {Maybe Float
Maybe Int
Maybe DateTime
tuningSnapshotMeanLoss :: TuningSnapshot -> Maybe Float
tuningSnapshotComputeTime :: TuningSnapshot -> Maybe DateTime
tuningSnapshotStep :: TuningSnapshot -> Maybe Int
tuningSnapshotEpoch :: TuningSnapshot -> Maybe Int
tuningSnapshotMeanLoss :: Maybe Float
tuningSnapshotComputeTime :: Maybe DateTime
tuningSnapshotStep :: Maybe Int
tuningSnapshotEpoch :: Maybe Int
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"meanLoss" Key -> Maybe Float -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Float
tuningSnapshotMeanLoss
      , Key
"computeTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
tuningSnapshotComputeTime
      , Key
"step" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
tuningSnapshotStep
      , Key
"epoch" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
tuningSnapshotEpoch
      ]

-- | Construct a value of type 'TuningSnapshot' (by applying it's required fields, if any)
mkTuningSnapshot ::
  TuningSnapshot
mkTuningSnapshot :: TuningSnapshot
mkTuningSnapshot =
  TuningSnapshot
    { tuningSnapshotMeanLoss :: Maybe Float
tuningSnapshotMeanLoss = Maybe Float
forall a. Maybe a
Nothing
    , tuningSnapshotComputeTime :: Maybe DateTime
tuningSnapshotComputeTime = Maybe DateTime
forall a. Maybe a
Nothing
    , tuningSnapshotStep :: Maybe Int
tuningSnapshotStep = Maybe Int
forall a. Maybe a
Nothing
    , tuningSnapshotEpoch :: Maybe Int
tuningSnapshotEpoch = Maybe Int
forall a. Maybe a
Nothing
    }

-- ** TuningTask

{- | TuningTask
Tuning tasks that create tuned models.
-}
data TuningTask = TuningTask
  { TuningTask -> Maybe DateTime
tuningTaskStartTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "startTime" - Output only. The timestamp when tuning this model started.
  , TuningTask -> Dataset
tuningTaskTrainingData :: !(Dataset)
  -- ^ /Required/ "trainingData" - Required. Input only. Immutable. The model training data.
  , TuningTask -> Maybe Hyperparameters
tuningTaskHyperparameters :: !(Maybe Hyperparameters)
  -- ^ "hyperparameters" - Immutable. Hyperparameters controlling the tuning process. If not provided, default values will be used.
  , TuningTask -> Maybe DateTime
tuningTaskCompleteTime :: !(Maybe DateTime)
  -- ^ /ReadOnly/ "completeTime" - Output only. The timestamp when tuning this model completed.
  , TuningTask -> Maybe [TuningSnapshot]
tuningTaskSnapshots :: !(Maybe [TuningSnapshot])
  -- ^ /ReadOnly/ "snapshots" - Output only. Metrics collected during tuning.
  }
  deriving (Int -> TuningTask -> ShowS
[TuningTask] -> ShowS
TuningTask -> [Char]
(Int -> TuningTask -> ShowS)
-> (TuningTask -> [Char])
-> ([TuningTask] -> ShowS)
-> Show TuningTask
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TuningTask -> ShowS
showsPrec :: Int -> TuningTask -> ShowS
$cshow :: TuningTask -> [Char]
show :: TuningTask -> [Char]
$cshowList :: [TuningTask] -> ShowS
showList :: [TuningTask] -> ShowS
P.Show, TuningTask -> TuningTask -> Bool
(TuningTask -> TuningTask -> Bool)
-> (TuningTask -> TuningTask -> Bool) -> Eq TuningTask
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TuningTask -> TuningTask -> Bool
== :: TuningTask -> TuningTask -> Bool
$c/= :: TuningTask -> TuningTask -> Bool
/= :: TuningTask -> TuningTask -> Bool
P.Eq, P.Typeable)

-- | FromJSON TuningTask
instance A.FromJSON TuningTask where
  parseJSON :: Value -> Parser TuningTask
parseJSON = [Char]
-> (Object -> Parser TuningTask) -> Value -> Parser TuningTask
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"TuningTask" ((Object -> Parser TuningTask) -> Value -> Parser TuningTask)
-> (Object -> Parser TuningTask) -> Value -> Parser TuningTask
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe DateTime
-> Dataset
-> Maybe Hyperparameters
-> Maybe DateTime
-> Maybe [TuningSnapshot]
-> TuningTask
TuningTask
      (Maybe DateTime
 -> Dataset
 -> Maybe Hyperparameters
 -> Maybe DateTime
 -> Maybe [TuningSnapshot]
 -> TuningTask)
-> Parser (Maybe DateTime)
-> Parser
     (Dataset
      -> Maybe Hyperparameters
      -> Maybe DateTime
      -> Maybe [TuningSnapshot]
      -> TuningTask)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"startTime")
      Parser
  (Dataset
   -> Maybe Hyperparameters
   -> Maybe DateTime
   -> Maybe [TuningSnapshot]
   -> TuningTask)
-> Parser Dataset
-> Parser
     (Maybe Hyperparameters
      -> Maybe DateTime -> Maybe [TuningSnapshot] -> TuningTask)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Dataset
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"trainingData")
      Parser
  (Maybe Hyperparameters
   -> Maybe DateTime -> Maybe [TuningSnapshot] -> TuningTask)
-> Parser (Maybe Hyperparameters)
-> Parser (Maybe DateTime -> Maybe [TuningSnapshot] -> TuningTask)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Hyperparameters)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"hyperparameters")
      Parser (Maybe DateTime -> Maybe [TuningSnapshot] -> TuningTask)
-> Parser (Maybe DateTime)
-> Parser (Maybe [TuningSnapshot] -> TuningTask)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe DateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"completeTime")
      Parser (Maybe [TuningSnapshot] -> TuningTask)
-> Parser (Maybe [TuningSnapshot]) -> Parser TuningTask
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [TuningSnapshot])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"snapshots")

-- | ToJSON TuningTask
instance A.ToJSON TuningTask where
  toJSON :: TuningTask -> Value
toJSON TuningTask {Maybe [TuningSnapshot]
Maybe DateTime
Maybe Hyperparameters
Dataset
tuningTaskStartTime :: TuningTask -> Maybe DateTime
tuningTaskTrainingData :: TuningTask -> Dataset
tuningTaskHyperparameters :: TuningTask -> Maybe Hyperparameters
tuningTaskCompleteTime :: TuningTask -> Maybe DateTime
tuningTaskSnapshots :: TuningTask -> Maybe [TuningSnapshot]
tuningTaskStartTime :: Maybe DateTime
tuningTaskTrainingData :: Dataset
tuningTaskHyperparameters :: Maybe Hyperparameters
tuningTaskCompleteTime :: Maybe DateTime
tuningTaskSnapshots :: Maybe [TuningSnapshot]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"startTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
tuningTaskStartTime
      , Key
"trainingData" Key -> Dataset -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Dataset
tuningTaskTrainingData
      , Key
"hyperparameters" Key -> Maybe Hyperparameters -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Hyperparameters
tuningTaskHyperparameters
      , Key
"completeTime" Key -> Maybe DateTime -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe DateTime
tuningTaskCompleteTime
      , Key
"snapshots" Key -> Maybe [TuningSnapshot] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [TuningSnapshot]
tuningTaskSnapshots
      ]

-- | Construct a value of type 'TuningTask' (by applying it's required fields, if any)
mkTuningTask ::
  -- | 'tuningTaskTrainingData': Required. Input only. Immutable. The model training data.
  Dataset ->
  TuningTask
mkTuningTask :: Dataset -> TuningTask
mkTuningTask Dataset
tuningTaskTrainingData =
  TuningTask
    { tuningTaskStartTime :: Maybe DateTime
tuningTaskStartTime = Maybe DateTime
forall a. Maybe a
Nothing
    , Dataset
tuningTaskTrainingData :: Dataset
tuningTaskTrainingData :: Dataset
tuningTaskTrainingData
    , tuningTaskHyperparameters :: Maybe Hyperparameters
tuningTaskHyperparameters = Maybe Hyperparameters
forall a. Maybe a
Nothing
    , tuningTaskCompleteTime :: Maybe DateTime
tuningTaskCompleteTime = Maybe DateTime
forall a. Maybe a
Nothing
    , tuningTaskSnapshots :: Maybe [TuningSnapshot]
tuningTaskSnapshots = Maybe [TuningSnapshot]
forall a. Maybe a
Nothing
    }

-- ** UpdateChunkRequest

{- | UpdateChunkRequest
Request to update a `Chunk`.
-}
data UpdateChunkRequest = UpdateChunkRequest
  { UpdateChunkRequest -> Text
updateChunkRequestUpdateMask :: !(Text)
  -- ^ /Required/ "updateMask" - Required. The list of fields to update. Currently, this only supports updating &#x60;custom_metadata&#x60; and &#x60;data&#x60;.
  , UpdateChunkRequest -> Chunk
updateChunkRequestChunk :: !(Chunk)
  -- ^ /Required/ "chunk" - Required. The &#x60;Chunk&#x60; to update.
  }
  deriving (Int -> UpdateChunkRequest -> ShowS
[UpdateChunkRequest] -> ShowS
UpdateChunkRequest -> [Char]
(Int -> UpdateChunkRequest -> ShowS)
-> (UpdateChunkRequest -> [Char])
-> ([UpdateChunkRequest] -> ShowS)
-> Show UpdateChunkRequest
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UpdateChunkRequest -> ShowS
showsPrec :: Int -> UpdateChunkRequest -> ShowS
$cshow :: UpdateChunkRequest -> [Char]
show :: UpdateChunkRequest -> [Char]
$cshowList :: [UpdateChunkRequest] -> ShowS
showList :: [UpdateChunkRequest] -> ShowS
P.Show, UpdateChunkRequest -> UpdateChunkRequest -> Bool
(UpdateChunkRequest -> UpdateChunkRequest -> Bool)
-> (UpdateChunkRequest -> UpdateChunkRequest -> Bool)
-> Eq UpdateChunkRequest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UpdateChunkRequest -> UpdateChunkRequest -> Bool
== :: UpdateChunkRequest -> UpdateChunkRequest -> Bool
$c/= :: UpdateChunkRequest -> UpdateChunkRequest -> Bool
/= :: UpdateChunkRequest -> UpdateChunkRequest -> Bool
P.Eq, P.Typeable)

-- | FromJSON UpdateChunkRequest
instance A.FromJSON UpdateChunkRequest where
  parseJSON :: Value -> Parser UpdateChunkRequest
parseJSON = [Char]
-> (Object -> Parser UpdateChunkRequest)
-> Value
-> Parser UpdateChunkRequest
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"UpdateChunkRequest" ((Object -> Parser UpdateChunkRequest)
 -> Value -> Parser UpdateChunkRequest)
-> (Object -> Parser UpdateChunkRequest)
-> Value
-> Parser UpdateChunkRequest
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Text -> Chunk -> UpdateChunkRequest
UpdateChunkRequest
      (Text -> Chunk -> UpdateChunkRequest)
-> Parser Text -> Parser (Chunk -> UpdateChunkRequest)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser Text
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"updateMask")
      Parser (Chunk -> UpdateChunkRequest)
-> Parser Chunk -> Parser UpdateChunkRequest
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser Chunk
forall a. FromJSON a => Object -> Key -> Parser a
.: Key
"chunk")

-- | ToJSON UpdateChunkRequest
instance A.ToJSON UpdateChunkRequest where
  toJSON :: UpdateChunkRequest -> Value
toJSON UpdateChunkRequest {Text
Chunk
updateChunkRequestUpdateMask :: UpdateChunkRequest -> Text
updateChunkRequestChunk :: UpdateChunkRequest -> Chunk
updateChunkRequestUpdateMask :: Text
updateChunkRequestChunk :: Chunk
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"updateMask" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
updateChunkRequestUpdateMask
      , Key
"chunk" Key -> Chunk -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Chunk
updateChunkRequestChunk
      ]

-- | Construct a value of type 'UpdateChunkRequest' (by applying it's required fields, if any)
mkUpdateChunkRequest ::
  -- | 'updateChunkRequestUpdateMask': Required. The list of fields to update. Currently, this only supports updating `custom_metadata` and `data`.
  Text ->
  -- | 'updateChunkRequestChunk': Required. The `Chunk` to update.
  Chunk ->
  UpdateChunkRequest
mkUpdateChunkRequest :: Text -> Chunk -> UpdateChunkRequest
mkUpdateChunkRequest Text
updateChunkRequestUpdateMask Chunk
updateChunkRequestChunk =
  UpdateChunkRequest
    { Text
updateChunkRequestUpdateMask :: Text
updateChunkRequestUpdateMask :: Text
updateChunkRequestUpdateMask
    , Chunk
updateChunkRequestChunk :: Chunk
updateChunkRequestChunk :: Chunk
updateChunkRequestChunk
    }

-- ** UrlContextMetadata

{- | UrlContextMetadata
Metadata related to url context retrieval tool.
-}
data UrlContextMetadata = UrlContextMetadata
  { UrlContextMetadata -> Maybe [UrlMetadata]
urlContextMetadataUrlMetadata :: !(Maybe [UrlMetadata])
  -- ^ "urlMetadata" - List of url context.
  }
  deriving (Int -> UrlContextMetadata -> ShowS
[UrlContextMetadata] -> ShowS
UrlContextMetadata -> [Char]
(Int -> UrlContextMetadata -> ShowS)
-> (UrlContextMetadata -> [Char])
-> ([UrlContextMetadata] -> ShowS)
-> Show UrlContextMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UrlContextMetadata -> ShowS
showsPrec :: Int -> UrlContextMetadata -> ShowS
$cshow :: UrlContextMetadata -> [Char]
show :: UrlContextMetadata -> [Char]
$cshowList :: [UrlContextMetadata] -> ShowS
showList :: [UrlContextMetadata] -> ShowS
P.Show, UrlContextMetadata -> UrlContextMetadata -> Bool
(UrlContextMetadata -> UrlContextMetadata -> Bool)
-> (UrlContextMetadata -> UrlContextMetadata -> Bool)
-> Eq UrlContextMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UrlContextMetadata -> UrlContextMetadata -> Bool
== :: UrlContextMetadata -> UrlContextMetadata -> Bool
$c/= :: UrlContextMetadata -> UrlContextMetadata -> Bool
/= :: UrlContextMetadata -> UrlContextMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON UrlContextMetadata
instance A.FromJSON UrlContextMetadata where
  parseJSON :: Value -> Parser UrlContextMetadata
parseJSON = [Char]
-> (Object -> Parser UrlContextMetadata)
-> Value
-> Parser UrlContextMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"UrlContextMetadata" ((Object -> Parser UrlContextMetadata)
 -> Value -> Parser UrlContextMetadata)
-> (Object -> Parser UrlContextMetadata)
-> Value
-> Parser UrlContextMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [UrlMetadata] -> UrlContextMetadata
UrlContextMetadata
      (Maybe [UrlMetadata] -> UrlContextMetadata)
-> Parser (Maybe [UrlMetadata]) -> Parser UrlContextMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [UrlMetadata])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"urlMetadata")

-- | ToJSON UrlContextMetadata
instance A.ToJSON UrlContextMetadata where
  toJSON :: UrlContextMetadata -> Value
toJSON UrlContextMetadata {Maybe [UrlMetadata]
urlContextMetadataUrlMetadata :: UrlContextMetadata -> Maybe [UrlMetadata]
urlContextMetadataUrlMetadata :: Maybe [UrlMetadata]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"urlMetadata" Key -> Maybe [UrlMetadata] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [UrlMetadata]
urlContextMetadataUrlMetadata
      ]

-- | Construct a value of type 'UrlContextMetadata' (by applying it's required fields, if any)
mkUrlContextMetadata ::
  UrlContextMetadata
mkUrlContextMetadata :: UrlContextMetadata
mkUrlContextMetadata =
  UrlContextMetadata
    { urlContextMetadataUrlMetadata :: Maybe [UrlMetadata]
urlContextMetadataUrlMetadata = Maybe [UrlMetadata]
forall a. Maybe a
Nothing
    }

-- ** UrlMetadata

{- | UrlMetadata
Context of the a single url retrieval.
-}
data UrlMetadata = UrlMetadata
  { UrlMetadata -> Maybe Text
urlMetadataRetrievedUrl :: !(Maybe Text)
  -- ^ "retrievedUrl" - Retrieved url by the tool.
  , UrlMetadata -> Maybe E'UrlRetrievalStatus
urlMetadataUrlRetrievalStatus :: !(Maybe E'UrlRetrievalStatus)
  -- ^ "urlRetrievalStatus" - Status of the url retrieval.
  }
  deriving (Int -> UrlMetadata -> ShowS
[UrlMetadata] -> ShowS
UrlMetadata -> [Char]
(Int -> UrlMetadata -> ShowS)
-> (UrlMetadata -> [Char])
-> ([UrlMetadata] -> ShowS)
-> Show UrlMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UrlMetadata -> ShowS
showsPrec :: Int -> UrlMetadata -> ShowS
$cshow :: UrlMetadata -> [Char]
show :: UrlMetadata -> [Char]
$cshowList :: [UrlMetadata] -> ShowS
showList :: [UrlMetadata] -> ShowS
P.Show, UrlMetadata -> UrlMetadata -> Bool
(UrlMetadata -> UrlMetadata -> Bool)
-> (UrlMetadata -> UrlMetadata -> Bool) -> Eq UrlMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UrlMetadata -> UrlMetadata -> Bool
== :: UrlMetadata -> UrlMetadata -> Bool
$c/= :: UrlMetadata -> UrlMetadata -> Bool
/= :: UrlMetadata -> UrlMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON UrlMetadata
instance A.FromJSON UrlMetadata where
  parseJSON :: Value -> Parser UrlMetadata
parseJSON = [Char]
-> (Object -> Parser UrlMetadata) -> Value -> Parser UrlMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"UrlMetadata" ((Object -> Parser UrlMetadata) -> Value -> Parser UrlMetadata)
-> (Object -> Parser UrlMetadata) -> Value -> Parser UrlMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe E'UrlRetrievalStatus -> UrlMetadata
UrlMetadata
      (Maybe Text -> Maybe E'UrlRetrievalStatus -> UrlMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe E'UrlRetrievalStatus -> UrlMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"retrievedUrl")
      Parser (Maybe E'UrlRetrievalStatus -> UrlMetadata)
-> Parser (Maybe E'UrlRetrievalStatus) -> Parser UrlMetadata
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe E'UrlRetrievalStatus)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"urlRetrievalStatus")

-- | ToJSON UrlMetadata
instance A.ToJSON UrlMetadata where
  toJSON :: UrlMetadata -> Value
toJSON UrlMetadata {Maybe Text
Maybe E'UrlRetrievalStatus
urlMetadataRetrievedUrl :: UrlMetadata -> Maybe Text
urlMetadataUrlRetrievalStatus :: UrlMetadata -> Maybe E'UrlRetrievalStatus
urlMetadataRetrievedUrl :: Maybe Text
urlMetadataUrlRetrievalStatus :: Maybe E'UrlRetrievalStatus
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"retrievedUrl" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
urlMetadataRetrievedUrl
      , Key
"urlRetrievalStatus" Key -> Maybe E'UrlRetrievalStatus -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe E'UrlRetrievalStatus
urlMetadataUrlRetrievalStatus
      ]

-- | Construct a value of type 'UrlMetadata' (by applying it's required fields, if any)
mkUrlMetadata ::
  UrlMetadata
mkUrlMetadata :: UrlMetadata
mkUrlMetadata =
  UrlMetadata
    { urlMetadataRetrievedUrl :: Maybe Text
urlMetadataRetrievedUrl = Maybe Text
forall a. Maybe a
Nothing
    , urlMetadataUrlRetrievalStatus :: Maybe E'UrlRetrievalStatus
urlMetadataUrlRetrievalStatus = Maybe E'UrlRetrievalStatus
forall a. Maybe a
Nothing
    }

-- ** UsageMetadata

{- | UsageMetadata
Metadata on the generation request's token usage.
-}
data UsageMetadata = UsageMetadata
  { UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataCandidatesTokensDetails :: !(Maybe [ModalityTokenCount])
  -- ^ /ReadOnly/ "candidatesTokensDetails" - Output only. List of modalities that were returned in the response.
  , UsageMetadata -> Maybe Int
usageMetadataThoughtsTokenCount :: !(Maybe Int)
  -- ^ /ReadOnly/ "thoughtsTokenCount" - Output only. Number of tokens of thoughts for thinking models.
  , UsageMetadata -> Maybe Int
usageMetadataToolUsePromptTokenCount :: !(Maybe Int)
  -- ^ /ReadOnly/ "toolUsePromptTokenCount" - Output only. Number of tokens present in tool-use prompt(s).
  , UsageMetadata -> Maybe Int
usageMetadataCachedContentTokenCount :: !(Maybe Int)
  -- ^ "cachedContentTokenCount" - Number of tokens in the cached part of the prompt (the cached content)
  , UsageMetadata -> Maybe Int
usageMetadataPromptTokenCount :: !(Maybe Int)
  -- ^ "promptTokenCount" - Number of tokens in the prompt. When &#x60;cached_content&#x60; is set, this is still the total effective prompt size meaning this includes the number of tokens in the cached content.
  , UsageMetadata -> Maybe Int
usageMetadataCandidatesTokenCount :: !(Maybe Int)
  -- ^ "candidatesTokenCount" - Total number of tokens across all the generated response candidates.
  , UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataPromptTokensDetails :: !(Maybe [ModalityTokenCount])
  -- ^ /ReadOnly/ "promptTokensDetails" - Output only. List of modalities that were processed in the request input.
  , UsageMetadata -> Maybe Int
usageMetadataTotalTokenCount :: !(Maybe Int)
  -- ^ "totalTokenCount" - Total token count for the generation request (prompt + response candidates).
  , UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataCacheTokensDetails :: !(Maybe [ModalityTokenCount])
  -- ^ /ReadOnly/ "cacheTokensDetails" - Output only. List of modalities of the cached content in the request input.
  , UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataToolUsePromptTokensDetails :: !(Maybe [ModalityTokenCount])
  -- ^ /ReadOnly/ "toolUsePromptTokensDetails" - Output only. List of modalities that were processed for tool-use request inputs.
  }
  deriving (Int -> UsageMetadata -> ShowS
[UsageMetadata] -> ShowS
UsageMetadata -> [Char]
(Int -> UsageMetadata -> ShowS)
-> (UsageMetadata -> [Char])
-> ([UsageMetadata] -> ShowS)
-> Show UsageMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> UsageMetadata -> ShowS
showsPrec :: Int -> UsageMetadata -> ShowS
$cshow :: UsageMetadata -> [Char]
show :: UsageMetadata -> [Char]
$cshowList :: [UsageMetadata] -> ShowS
showList :: [UsageMetadata] -> ShowS
P.Show, UsageMetadata -> UsageMetadata -> Bool
(UsageMetadata -> UsageMetadata -> Bool)
-> (UsageMetadata -> UsageMetadata -> Bool) -> Eq UsageMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: UsageMetadata -> UsageMetadata -> Bool
== :: UsageMetadata -> UsageMetadata -> Bool
$c/= :: UsageMetadata -> UsageMetadata -> Bool
/= :: UsageMetadata -> UsageMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON UsageMetadata
instance A.FromJSON UsageMetadata where
  parseJSON :: Value -> Parser UsageMetadata
parseJSON = [Char]
-> (Object -> Parser UsageMetadata)
-> Value
-> Parser UsageMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"UsageMetadata" ((Object -> Parser UsageMetadata) -> Value -> Parser UsageMetadata)
-> (Object -> Parser UsageMetadata)
-> Value
-> Parser UsageMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe [ModalityTokenCount]
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe Int
-> Maybe [ModalityTokenCount]
-> Maybe Int
-> Maybe [ModalityTokenCount]
-> Maybe [ModalityTokenCount]
-> UsageMetadata
UsageMetadata
      (Maybe [ModalityTokenCount]
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe Int
 -> Maybe [ModalityTokenCount]
 -> Maybe Int
 -> Maybe [ModalityTokenCount]
 -> Maybe [ModalityTokenCount]
 -> UsageMetadata)
-> Parser (Maybe [ModalityTokenCount])
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount]
      -> UsageMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe [ModalityTokenCount])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidatesTokensDetails")
      Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount]
   -> UsageMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount]
      -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"thoughtsTokenCount")
      Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount]
   -> UsageMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount]
      -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"toolUsePromptTokenCount")
      Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount]
   -> UsageMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount]
      -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"cachedContentTokenCount")
      Parser
  (Maybe Int
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount]
   -> UsageMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount]
      -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"promptTokenCount")
      Parser
  (Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount]
   -> UsageMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe [ModalityTokenCount]
      -> Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount]
      -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"candidatesTokenCount")
      Parser
  (Maybe [ModalityTokenCount]
   -> Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount]
   -> UsageMetadata)
-> Parser (Maybe [ModalityTokenCount])
-> Parser
     (Maybe Int
      -> Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount]
      -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [ModalityTokenCount])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"promptTokensDetails")
      Parser
  (Maybe Int
   -> Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount]
   -> UsageMetadata)
-> Parser (Maybe Int)
-> Parser
     (Maybe [ModalityTokenCount]
      -> Maybe [ModalityTokenCount] -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"totalTokenCount")
      Parser
  (Maybe [ModalityTokenCount]
   -> Maybe [ModalityTokenCount] -> UsageMetadata)
-> Parser (Maybe [ModalityTokenCount])
-> Parser (Maybe [ModalityTokenCount] -> UsageMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [ModalityTokenCount])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"cacheTokensDetails")
      Parser (Maybe [ModalityTokenCount] -> UsageMetadata)
-> Parser (Maybe [ModalityTokenCount]) -> Parser UsageMetadata
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe [ModalityTokenCount])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"toolUsePromptTokensDetails")

-- | ToJSON UsageMetadata
instance A.ToJSON UsageMetadata where
  toJSON :: UsageMetadata -> Value
toJSON UsageMetadata {Maybe Int
Maybe [ModalityTokenCount]
usageMetadataCandidatesTokensDetails :: UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataThoughtsTokenCount :: UsageMetadata -> Maybe Int
usageMetadataToolUsePromptTokenCount :: UsageMetadata -> Maybe Int
usageMetadataCachedContentTokenCount :: UsageMetadata -> Maybe Int
usageMetadataPromptTokenCount :: UsageMetadata -> Maybe Int
usageMetadataCandidatesTokenCount :: UsageMetadata -> Maybe Int
usageMetadataPromptTokensDetails :: UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataTotalTokenCount :: UsageMetadata -> Maybe Int
usageMetadataCacheTokensDetails :: UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataToolUsePromptTokensDetails :: UsageMetadata -> Maybe [ModalityTokenCount]
usageMetadataCandidatesTokensDetails :: Maybe [ModalityTokenCount]
usageMetadataThoughtsTokenCount :: Maybe Int
usageMetadataToolUsePromptTokenCount :: Maybe Int
usageMetadataCachedContentTokenCount :: Maybe Int
usageMetadataPromptTokenCount :: Maybe Int
usageMetadataCandidatesTokenCount :: Maybe Int
usageMetadataPromptTokensDetails :: Maybe [ModalityTokenCount]
usageMetadataTotalTokenCount :: Maybe Int
usageMetadataCacheTokensDetails :: Maybe [ModalityTokenCount]
usageMetadataToolUsePromptTokensDetails :: Maybe [ModalityTokenCount]
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"candidatesTokensDetails" Key -> Maybe [ModalityTokenCount] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ModalityTokenCount]
usageMetadataCandidatesTokensDetails
      , Key
"thoughtsTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
usageMetadataThoughtsTokenCount
      , Key
"toolUsePromptTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
usageMetadataToolUsePromptTokenCount
      , Key
"cachedContentTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
usageMetadataCachedContentTokenCount
      , Key
"promptTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
usageMetadataPromptTokenCount
      , Key
"candidatesTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
usageMetadataCandidatesTokenCount
      , Key
"promptTokensDetails" Key -> Maybe [ModalityTokenCount] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ModalityTokenCount]
usageMetadataPromptTokensDetails
      , Key
"totalTokenCount" Key -> Maybe Int -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Int
usageMetadataTotalTokenCount
      , Key
"cacheTokensDetails" Key -> Maybe [ModalityTokenCount] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ModalityTokenCount]
usageMetadataCacheTokensDetails
      , Key
"toolUsePromptTokensDetails" Key -> Maybe [ModalityTokenCount] -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe [ModalityTokenCount]
usageMetadataToolUsePromptTokensDetails
      ]

-- | Construct a value of type 'UsageMetadata' (by applying it's required fields, if any)
mkUsageMetadata ::
  UsageMetadata
mkUsageMetadata :: UsageMetadata
mkUsageMetadata =
  UsageMetadata
    { usageMetadataCandidatesTokensDetails :: Maybe [ModalityTokenCount]
usageMetadataCandidatesTokensDetails = Maybe [ModalityTokenCount]
forall a. Maybe a
Nothing
    , usageMetadataThoughtsTokenCount :: Maybe Int
usageMetadataThoughtsTokenCount = Maybe Int
forall a. Maybe a
Nothing
    , usageMetadataToolUsePromptTokenCount :: Maybe Int
usageMetadataToolUsePromptTokenCount = Maybe Int
forall a. Maybe a
Nothing
    , usageMetadataCachedContentTokenCount :: Maybe Int
usageMetadataCachedContentTokenCount = Maybe Int
forall a. Maybe a
Nothing
    , usageMetadataPromptTokenCount :: Maybe Int
usageMetadataPromptTokenCount = Maybe Int
forall a. Maybe a
Nothing
    , usageMetadataCandidatesTokenCount :: Maybe Int
usageMetadataCandidatesTokenCount = Maybe Int
forall a. Maybe a
Nothing
    , usageMetadataPromptTokensDetails :: Maybe [ModalityTokenCount]
usageMetadataPromptTokensDetails = Maybe [ModalityTokenCount]
forall a. Maybe a
Nothing
    , usageMetadataTotalTokenCount :: Maybe Int
usageMetadataTotalTokenCount = Maybe Int
forall a. Maybe a
Nothing
    , usageMetadataCacheTokensDetails :: Maybe [ModalityTokenCount]
usageMetadataCacheTokensDetails = Maybe [ModalityTokenCount]
forall a. Maybe a
Nothing
    , usageMetadataToolUsePromptTokensDetails :: Maybe [ModalityTokenCount]
usageMetadataToolUsePromptTokensDetails = Maybe [ModalityTokenCount]
forall a. Maybe a
Nothing
    }

-- ** Video

{- | Video
Representation of a video.
-}
data Video = Video
  { Video -> Maybe ByteArray
videoVideo :: !(Maybe ByteArray)
  -- ^ "video" - Raw bytes.
  , Video -> Maybe Text
videoUri :: !(Maybe Text)
  -- ^ "uri" - Path to another storage.
  }
  deriving (Int -> Video -> ShowS
[Video] -> ShowS
Video -> [Char]
(Int -> Video -> ShowS)
-> (Video -> [Char]) -> ([Video] -> ShowS) -> Show Video
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Video -> ShowS
showsPrec :: Int -> Video -> ShowS
$cshow :: Video -> [Char]
show :: Video -> [Char]
$cshowList :: [Video] -> ShowS
showList :: [Video] -> ShowS
P.Show, Video -> Video -> Bool
(Video -> Video -> Bool) -> (Video -> Video -> Bool) -> Eq Video
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Video -> Video -> Bool
== :: Video -> Video -> Bool
$c/= :: Video -> Video -> Bool
/= :: Video -> Video -> Bool
P.Eq, P.Typeable)

-- | FromJSON Video
instance A.FromJSON Video where
  parseJSON :: Value -> Parser Video
parseJSON = [Char] -> (Object -> Parser Video) -> Value -> Parser Video
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Video" ((Object -> Parser Video) -> Value -> Parser Video)
-> (Object -> Parser Video) -> Value -> Parser Video
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe ByteArray -> Maybe Text -> Video
Video
      (Maybe ByteArray -> Maybe Text -> Video)
-> Parser (Maybe ByteArray) -> Parser (Maybe Text -> Video)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe ByteArray)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"video")
      Parser (Maybe Text -> Video) -> Parser (Maybe Text) -> Parser Video
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"uri")

-- | ToJSON Video
instance A.ToJSON Video where
  toJSON :: Video -> Value
toJSON Video {Maybe Text
Maybe ByteArray
videoVideo :: Video -> Maybe ByteArray
videoUri :: Video -> Maybe Text
videoVideo :: Maybe ByteArray
videoUri :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"video" Key -> Maybe ByteArray -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe ByteArray
videoVideo
      , Key
"uri" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
videoUri
      ]

-- | Construct a value of type 'Video' (by applying it's required fields, if any)
mkVideo ::
  Video
mkVideo :: Video
mkVideo =
  Video
    { videoVideo :: Maybe ByteArray
videoVideo = Maybe ByteArray
forall a. Maybe a
Nothing
    , videoUri :: Maybe Text
videoUri = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** VideoFileMetadata

{- | VideoFileMetadata
Metadata for a video `File`.
-}
data VideoFileMetadata = VideoFileMetadata
  { VideoFileMetadata -> Maybe Text
videoFileMetadataVideoDuration :: !(Maybe Text)
  -- ^ "videoDuration" - Duration of the video.
  }
  deriving (Int -> VideoFileMetadata -> ShowS
[VideoFileMetadata] -> ShowS
VideoFileMetadata -> [Char]
(Int -> VideoFileMetadata -> ShowS)
-> (VideoFileMetadata -> [Char])
-> ([VideoFileMetadata] -> ShowS)
-> Show VideoFileMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VideoFileMetadata -> ShowS
showsPrec :: Int -> VideoFileMetadata -> ShowS
$cshow :: VideoFileMetadata -> [Char]
show :: VideoFileMetadata -> [Char]
$cshowList :: [VideoFileMetadata] -> ShowS
showList :: [VideoFileMetadata] -> ShowS
P.Show, VideoFileMetadata -> VideoFileMetadata -> Bool
(VideoFileMetadata -> VideoFileMetadata -> Bool)
-> (VideoFileMetadata -> VideoFileMetadata -> Bool)
-> Eq VideoFileMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VideoFileMetadata -> VideoFileMetadata -> Bool
== :: VideoFileMetadata -> VideoFileMetadata -> Bool
$c/= :: VideoFileMetadata -> VideoFileMetadata -> Bool
/= :: VideoFileMetadata -> VideoFileMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON VideoFileMetadata
instance A.FromJSON VideoFileMetadata where
  parseJSON :: Value -> Parser VideoFileMetadata
parseJSON = [Char]
-> (Object -> Parser VideoFileMetadata)
-> Value
-> Parser VideoFileMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"VideoFileMetadata" ((Object -> Parser VideoFileMetadata)
 -> Value -> Parser VideoFileMetadata)
-> (Object -> Parser VideoFileMetadata)
-> Value
-> Parser VideoFileMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> VideoFileMetadata
VideoFileMetadata
      (Maybe Text -> VideoFileMetadata)
-> Parser (Maybe Text) -> Parser VideoFileMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"videoDuration")

-- | ToJSON VideoFileMetadata
instance A.ToJSON VideoFileMetadata where
  toJSON :: VideoFileMetadata -> Value
toJSON VideoFileMetadata {Maybe Text
videoFileMetadataVideoDuration :: VideoFileMetadata -> Maybe Text
videoFileMetadataVideoDuration :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"videoDuration" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
videoFileMetadataVideoDuration
      ]

-- | Construct a value of type 'VideoFileMetadata' (by applying it's required fields, if any)
mkVideoFileMetadata ::
  VideoFileMetadata
mkVideoFileMetadata :: VideoFileMetadata
mkVideoFileMetadata =
  VideoFileMetadata
    { videoFileMetadataVideoDuration :: Maybe Text
videoFileMetadataVideoDuration = Maybe Text
forall a. Maybe a
Nothing
    }

-- ** VideoMetadata

{- | VideoMetadata
Metadata describes the input video content.
-}
data VideoMetadata = VideoMetadata
  { VideoMetadata -> Maybe Text
videoMetadataEndOffset :: !(Maybe Text)
  -- ^ "endOffset" - Optional. The end offset of the video.
  , VideoMetadata -> Maybe Text
videoMetadataStartOffset :: !(Maybe Text)
  -- ^ "startOffset" - Optional. The start offset of the video.
  , VideoMetadata -> Maybe Double
videoMetadataFps :: !(Maybe Double)
  -- ^ "fps" - Optional. The frame rate of the video sent to the model. If not specified, the default value will be 1.0. The fps range is (0.0, 24.0].
  }
  deriving (Int -> VideoMetadata -> ShowS
[VideoMetadata] -> ShowS
VideoMetadata -> [Char]
(Int -> VideoMetadata -> ShowS)
-> (VideoMetadata -> [Char])
-> ([VideoMetadata] -> ShowS)
-> Show VideoMetadata
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VideoMetadata -> ShowS
showsPrec :: Int -> VideoMetadata -> ShowS
$cshow :: VideoMetadata -> [Char]
show :: VideoMetadata -> [Char]
$cshowList :: [VideoMetadata] -> ShowS
showList :: [VideoMetadata] -> ShowS
P.Show, VideoMetadata -> VideoMetadata -> Bool
(VideoMetadata -> VideoMetadata -> Bool)
-> (VideoMetadata -> VideoMetadata -> Bool) -> Eq VideoMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VideoMetadata -> VideoMetadata -> Bool
== :: VideoMetadata -> VideoMetadata -> Bool
$c/= :: VideoMetadata -> VideoMetadata -> Bool
/= :: VideoMetadata -> VideoMetadata -> Bool
P.Eq, P.Typeable)

-- | FromJSON VideoMetadata
instance A.FromJSON VideoMetadata where
  parseJSON :: Value -> Parser VideoMetadata
parseJSON = [Char]
-> (Object -> Parser VideoMetadata)
-> Value
-> Parser VideoMetadata
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"VideoMetadata" ((Object -> Parser VideoMetadata) -> Value -> Parser VideoMetadata)
-> (Object -> Parser VideoMetadata)
-> Value
-> Parser VideoMetadata
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe Text -> Maybe Double -> VideoMetadata
VideoMetadata
      (Maybe Text -> Maybe Text -> Maybe Double -> VideoMetadata)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Double -> VideoMetadata)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"endOffset")
      Parser (Maybe Text -> Maybe Double -> VideoMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Double -> VideoMetadata)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"startOffset")
      Parser (Maybe Double -> VideoMetadata)
-> Parser (Maybe Double) -> Parser VideoMetadata
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"fps")

-- | ToJSON VideoMetadata
instance A.ToJSON VideoMetadata where
  toJSON :: VideoMetadata -> Value
toJSON VideoMetadata {Maybe Double
Maybe Text
videoMetadataEndOffset :: VideoMetadata -> Maybe Text
videoMetadataStartOffset :: VideoMetadata -> Maybe Text
videoMetadataFps :: VideoMetadata -> Maybe Double
videoMetadataEndOffset :: Maybe Text
videoMetadataStartOffset :: Maybe Text
videoMetadataFps :: Maybe Double
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"endOffset" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
videoMetadataEndOffset
      , Key
"startOffset" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
videoMetadataStartOffset
      , Key
"fps" Key -> Maybe Double -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Double
videoMetadataFps
      ]

-- | Construct a value of type 'VideoMetadata' (by applying it's required fields, if any)
mkVideoMetadata ::
  VideoMetadata
mkVideoMetadata :: VideoMetadata
mkVideoMetadata =
  VideoMetadata
    { videoMetadataEndOffset :: Maybe Text
videoMetadataEndOffset = Maybe Text
forall a. Maybe a
Nothing
    , videoMetadataStartOffset :: Maybe Text
videoMetadataStartOffset = Maybe Text
forall a. Maybe a
Nothing
    , videoMetadataFps :: Maybe Double
videoMetadataFps = Maybe Double
forall a. Maybe a
Nothing
    }

-- ** VoiceConfig

{- | VoiceConfig
The configuration for the voice to use.
-}
data VoiceConfig = VoiceConfig
  { VoiceConfig -> Maybe PrebuiltVoiceConfig
voiceConfigPrebuiltVoiceConfig :: !(Maybe PrebuiltVoiceConfig)
  -- ^ "prebuiltVoiceConfig" - The configuration for the prebuilt voice to use.
  }
  deriving (Int -> VoiceConfig -> ShowS
[VoiceConfig] -> ShowS
VoiceConfig -> [Char]
(Int -> VoiceConfig -> ShowS)
-> (VoiceConfig -> [Char])
-> ([VoiceConfig] -> ShowS)
-> Show VoiceConfig
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VoiceConfig -> ShowS
showsPrec :: Int -> VoiceConfig -> ShowS
$cshow :: VoiceConfig -> [Char]
show :: VoiceConfig -> [Char]
$cshowList :: [VoiceConfig] -> ShowS
showList :: [VoiceConfig] -> ShowS
P.Show, VoiceConfig -> VoiceConfig -> Bool
(VoiceConfig -> VoiceConfig -> Bool)
-> (VoiceConfig -> VoiceConfig -> Bool) -> Eq VoiceConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VoiceConfig -> VoiceConfig -> Bool
== :: VoiceConfig -> VoiceConfig -> Bool
$c/= :: VoiceConfig -> VoiceConfig -> Bool
/= :: VoiceConfig -> VoiceConfig -> Bool
P.Eq, P.Typeable)

-- | FromJSON VoiceConfig
instance A.FromJSON VoiceConfig where
  parseJSON :: Value -> Parser VoiceConfig
parseJSON = [Char]
-> (Object -> Parser VoiceConfig) -> Value -> Parser VoiceConfig
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"VoiceConfig" ((Object -> Parser VoiceConfig) -> Value -> Parser VoiceConfig)
-> (Object -> Parser VoiceConfig) -> Value -> Parser VoiceConfig
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe PrebuiltVoiceConfig -> VoiceConfig
VoiceConfig
      (Maybe PrebuiltVoiceConfig -> VoiceConfig)
-> Parser (Maybe PrebuiltVoiceConfig) -> Parser VoiceConfig
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe PrebuiltVoiceConfig)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"prebuiltVoiceConfig")

-- | ToJSON VoiceConfig
instance A.ToJSON VoiceConfig where
  toJSON :: VoiceConfig -> Value
toJSON VoiceConfig {Maybe PrebuiltVoiceConfig
voiceConfigPrebuiltVoiceConfig :: VoiceConfig -> Maybe PrebuiltVoiceConfig
voiceConfigPrebuiltVoiceConfig :: Maybe PrebuiltVoiceConfig
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"prebuiltVoiceConfig" Key -> Maybe PrebuiltVoiceConfig -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe PrebuiltVoiceConfig
voiceConfigPrebuiltVoiceConfig
      ]

-- | Construct a value of type 'VoiceConfig' (by applying it's required fields, if any)
mkVoiceConfig ::
  VoiceConfig
mkVoiceConfig :: VoiceConfig
mkVoiceConfig =
  VoiceConfig
    { voiceConfigPrebuiltVoiceConfig :: Maybe PrebuiltVoiceConfig
voiceConfigPrebuiltVoiceConfig = Maybe PrebuiltVoiceConfig
forall a. Maybe a
Nothing
    }

-- ** Web

{- | Web
Chunk from the web.
-}
data Web = Web
  { Web -> Maybe Text
webTitle :: !(Maybe Text)
  -- ^ "title" - Title of the chunk.
  , Web -> Maybe Text
webUri :: !(Maybe Text)
  -- ^ "uri" - URI reference of the chunk.
  }
  deriving (Int -> Web -> ShowS
[Web] -> ShowS
Web -> [Char]
(Int -> Web -> ShowS)
-> (Web -> [Char]) -> ([Web] -> ShowS) -> Show Web
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Web -> ShowS
showsPrec :: Int -> Web -> ShowS
$cshow :: Web -> [Char]
show :: Web -> [Char]
$cshowList :: [Web] -> ShowS
showList :: [Web] -> ShowS
P.Show, Web -> Web -> Bool
(Web -> Web -> Bool) -> (Web -> Web -> Bool) -> Eq Web
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Web -> Web -> Bool
== :: Web -> Web -> Bool
$c/= :: Web -> Web -> Bool
/= :: Web -> Web -> Bool
P.Eq, P.Typeable)

-- | FromJSON Web
instance A.FromJSON Web where
  parseJSON :: Value -> Parser Web
parseJSON = [Char] -> (Object -> Parser Web) -> Value -> Parser Web
forall a. [Char] -> (Object -> Parser a) -> Value -> Parser a
A.withObject [Char]
"Web" ((Object -> Parser Web) -> Value -> Parser Web)
-> (Object -> Parser Web) -> Value -> Parser Web
forall a b. (a -> b) -> a -> b
$ \Object
o ->
    Maybe Text -> Maybe Text -> Web
Web
      (Maybe Text -> Maybe Text -> Web)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Web)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"title")
      Parser (Maybe Text -> Web) -> Parser (Maybe Text) -> Parser Web
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> (Object
o Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
.:? Key
"uri")

-- | ToJSON Web
instance A.ToJSON Web where
  toJSON :: Web -> Value
toJSON Web {Maybe Text
webTitle :: Web -> Maybe Text
webUri :: Web -> Maybe Text
webTitle :: Maybe Text
webUri :: Maybe Text
..} =
    [(Key, Value)] -> Value
_omitNulls
      [ Key
"title" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
webTitle
      , Key
"uri" Key -> Maybe Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Maybe Text
webUri
      ]

-- | Construct a value of type 'Web' (by applying it's required fields, if any)
mkWeb ::
  Web
mkWeb :: Web
mkWeb =
  Web
    { webTitle :: Maybe Text
webTitle = Maybe Text
forall a. Maybe a
Nothing
    , webUri :: Maybe Text
webUri = Maybe Text
forall a. Maybe a
Nothing
    }

-- * Enums

-- ** E'Alt

-- | Enum of 'Text'
data E'Alt
  = -- | @"json"@
    E'Alt'Json
  | -- | @"media"@
    E'Alt'Media
  | -- | @"proto"@
    E'Alt'Proto
  deriving (Int -> E'Alt -> ShowS
[E'Alt] -> ShowS
E'Alt -> [Char]
(Int -> E'Alt -> ShowS)
-> (E'Alt -> [Char]) -> ([E'Alt] -> ShowS) -> Show E'Alt
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Alt -> ShowS
showsPrec :: Int -> E'Alt -> ShowS
$cshow :: E'Alt -> [Char]
show :: E'Alt -> [Char]
$cshowList :: [E'Alt] -> ShowS
showList :: [E'Alt] -> ShowS
P.Show, E'Alt -> E'Alt -> Bool
(E'Alt -> E'Alt -> Bool) -> (E'Alt -> E'Alt -> Bool) -> Eq E'Alt
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Alt -> E'Alt -> Bool
== :: E'Alt -> E'Alt -> Bool
$c/= :: E'Alt -> E'Alt -> Bool
/= :: E'Alt -> E'Alt -> Bool
P.Eq, P.Typeable, Eq E'Alt
Eq E'Alt =>
(E'Alt -> E'Alt -> Ordering)
-> (E'Alt -> E'Alt -> Bool)
-> (E'Alt -> E'Alt -> Bool)
-> (E'Alt -> E'Alt -> Bool)
-> (E'Alt -> E'Alt -> Bool)
-> (E'Alt -> E'Alt -> E'Alt)
-> (E'Alt -> E'Alt -> E'Alt)
-> Ord E'Alt
E'Alt -> E'Alt -> Bool
E'Alt -> E'Alt -> Ordering
E'Alt -> E'Alt -> E'Alt
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Alt -> E'Alt -> Ordering
compare :: E'Alt -> E'Alt -> Ordering
$c< :: E'Alt -> E'Alt -> Bool
< :: E'Alt -> E'Alt -> Bool
$c<= :: E'Alt -> E'Alt -> Bool
<= :: E'Alt -> E'Alt -> Bool
$c> :: E'Alt -> E'Alt -> Bool
> :: E'Alt -> E'Alt -> Bool
$c>= :: E'Alt -> E'Alt -> Bool
>= :: E'Alt -> E'Alt -> Bool
$cmax :: E'Alt -> E'Alt -> E'Alt
max :: E'Alt -> E'Alt -> E'Alt
$cmin :: E'Alt -> E'Alt -> E'Alt
min :: E'Alt -> E'Alt -> E'Alt
P.Ord, E'Alt
E'Alt -> E'Alt -> Bounded E'Alt
forall a. a -> a -> Bounded a
$cminBound :: E'Alt
minBound :: E'Alt
$cmaxBound :: E'Alt
maxBound :: E'Alt
P.Bounded, Int -> E'Alt
E'Alt -> Int
E'Alt -> [E'Alt]
E'Alt -> E'Alt
E'Alt -> E'Alt -> [E'Alt]
E'Alt -> E'Alt -> E'Alt -> [E'Alt]
(E'Alt -> E'Alt)
-> (E'Alt -> E'Alt)
-> (Int -> E'Alt)
-> (E'Alt -> Int)
-> (E'Alt -> [E'Alt])
-> (E'Alt -> E'Alt -> [E'Alt])
-> (E'Alt -> E'Alt -> [E'Alt])
-> (E'Alt -> E'Alt -> E'Alt -> [E'Alt])
-> Enum E'Alt
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Alt -> E'Alt
succ :: E'Alt -> E'Alt
$cpred :: E'Alt -> E'Alt
pred :: E'Alt -> E'Alt
$ctoEnum :: Int -> E'Alt
toEnum :: Int -> E'Alt
$cfromEnum :: E'Alt -> Int
fromEnum :: E'Alt -> Int
$cenumFrom :: E'Alt -> [E'Alt]
enumFrom :: E'Alt -> [E'Alt]
$cenumFromThen :: E'Alt -> E'Alt -> [E'Alt]
enumFromThen :: E'Alt -> E'Alt -> [E'Alt]
$cenumFromTo :: E'Alt -> E'Alt -> [E'Alt]
enumFromTo :: E'Alt -> E'Alt -> [E'Alt]
$cenumFromThenTo :: E'Alt -> E'Alt -> E'Alt -> [E'Alt]
enumFromThenTo :: E'Alt -> E'Alt -> E'Alt -> [E'Alt]
P.Enum)

instance A.ToJSON E'Alt where toJSON :: E'Alt -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Alt -> Text) -> E'Alt -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Alt -> Text
fromE'Alt
instance A.FromJSON E'Alt where parseJSON :: Value -> Parser E'Alt
parseJSON Value
o = ([Char] -> Parser E'Alt)
-> (E'Alt -> Parser E'Alt) -> Either [Char] E'Alt -> Parser E'Alt
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Alt
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Alt -> Parser E'Alt
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Alt -> Parser E'Alt)
-> (E'Alt -> E'Alt) -> E'Alt -> Parser E'Alt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Alt -> E'Alt
forall a. a -> a
P.id) (Either [Char] E'Alt -> Parser E'Alt)
-> (Text -> Either [Char] E'Alt) -> Text -> Parser E'Alt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Alt
toE'Alt (Text -> Parser E'Alt) -> Parser Text -> Parser E'Alt
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Alt where toQueryParam :: E'Alt -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Alt -> Text) -> E'Alt -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Alt -> Text
fromE'Alt
instance WH.FromHttpApiData E'Alt where parseQueryParam :: Text -> Either Text E'Alt
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Alt) -> Either Text E'Alt
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'Alt -> Either Text E'Alt
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Alt -> Either Text E'Alt)
-> (Text -> Either [Char] E'Alt) -> Text -> Either Text E'Alt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Alt
toE'Alt
instance MimeRender MimeMultipartFormData E'Alt where mimeRender :: Proxy MimeMultipartFormData -> E'Alt -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Alt -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Alt' enum
fromE'Alt :: E'Alt -> Text
fromE'Alt :: E'Alt -> Text
fromE'Alt = \case
  E'Alt
E'Alt'Json -> Text
"json"
  E'Alt
E'Alt'Media -> Text
"media"
  E'Alt
E'Alt'Proto -> Text
"proto"

-- | parse 'E'Alt' enum
toE'Alt :: Text -> P.Either String E'Alt
toE'Alt :: Text -> Either [Char] E'Alt
toE'Alt = \case
  Text
"json" -> E'Alt -> Either [Char] E'Alt
forall a b. b -> Either a b
P.Right E'Alt
E'Alt'Json
  Text
"media" -> E'Alt -> Either [Char] E'Alt
forall a b. b -> Either a b
P.Right E'Alt
E'Alt'Media
  Text
"proto" -> E'Alt -> Either [Char] E'Alt
forall a b. b -> Either a b
P.Right E'Alt
E'Alt'Proto
  Text
s -> [Char] -> Either [Char] E'Alt
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Alt) -> [Char] -> Either [Char] E'Alt
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Alt: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'AnswerStyle

{- | Enum of 'Text' .
Required. Style in which answers should be returned.
-}
data E'AnswerStyle
  = -- | @"ANSWER_STYLE_UNSPECIFIED"@
    E'AnswerStyle'ANSWER_STYLE_UNSPECIFIED
  | -- | @"ABSTRACTIVE"@
    E'AnswerStyle'ABSTRACTIVE
  | -- | @"EXTRACTIVE"@
    E'AnswerStyle'EXTRACTIVE
  | -- | @"VERBOSE"@
    E'AnswerStyle'VERBOSE
  deriving (Int -> E'AnswerStyle -> ShowS
[E'AnswerStyle] -> ShowS
E'AnswerStyle -> [Char]
(Int -> E'AnswerStyle -> ShowS)
-> (E'AnswerStyle -> [Char])
-> ([E'AnswerStyle] -> ShowS)
-> Show E'AnswerStyle
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'AnswerStyle -> ShowS
showsPrec :: Int -> E'AnswerStyle -> ShowS
$cshow :: E'AnswerStyle -> [Char]
show :: E'AnswerStyle -> [Char]
$cshowList :: [E'AnswerStyle] -> ShowS
showList :: [E'AnswerStyle] -> ShowS
P.Show, E'AnswerStyle -> E'AnswerStyle -> Bool
(E'AnswerStyle -> E'AnswerStyle -> Bool)
-> (E'AnswerStyle -> E'AnswerStyle -> Bool) -> Eq E'AnswerStyle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'AnswerStyle -> E'AnswerStyle -> Bool
== :: E'AnswerStyle -> E'AnswerStyle -> Bool
$c/= :: E'AnswerStyle -> E'AnswerStyle -> Bool
/= :: E'AnswerStyle -> E'AnswerStyle -> Bool
P.Eq, P.Typeable, Eq E'AnswerStyle
Eq E'AnswerStyle =>
(E'AnswerStyle -> E'AnswerStyle -> Ordering)
-> (E'AnswerStyle -> E'AnswerStyle -> Bool)
-> (E'AnswerStyle -> E'AnswerStyle -> Bool)
-> (E'AnswerStyle -> E'AnswerStyle -> Bool)
-> (E'AnswerStyle -> E'AnswerStyle -> Bool)
-> (E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle)
-> (E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle)
-> Ord E'AnswerStyle
E'AnswerStyle -> E'AnswerStyle -> Bool
E'AnswerStyle -> E'AnswerStyle -> Ordering
E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'AnswerStyle -> E'AnswerStyle -> Ordering
compare :: E'AnswerStyle -> E'AnswerStyle -> Ordering
$c< :: E'AnswerStyle -> E'AnswerStyle -> Bool
< :: E'AnswerStyle -> E'AnswerStyle -> Bool
$c<= :: E'AnswerStyle -> E'AnswerStyle -> Bool
<= :: E'AnswerStyle -> E'AnswerStyle -> Bool
$c> :: E'AnswerStyle -> E'AnswerStyle -> Bool
> :: E'AnswerStyle -> E'AnswerStyle -> Bool
$c>= :: E'AnswerStyle -> E'AnswerStyle -> Bool
>= :: E'AnswerStyle -> E'AnswerStyle -> Bool
$cmax :: E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle
max :: E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle
$cmin :: E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle
min :: E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle
P.Ord, E'AnswerStyle
E'AnswerStyle -> E'AnswerStyle -> Bounded E'AnswerStyle
forall a. a -> a -> Bounded a
$cminBound :: E'AnswerStyle
minBound :: E'AnswerStyle
$cmaxBound :: E'AnswerStyle
maxBound :: E'AnswerStyle
P.Bounded, Int -> E'AnswerStyle
E'AnswerStyle -> Int
E'AnswerStyle -> [E'AnswerStyle]
E'AnswerStyle -> E'AnswerStyle
E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
(E'AnswerStyle -> E'AnswerStyle)
-> (E'AnswerStyle -> E'AnswerStyle)
-> (Int -> E'AnswerStyle)
-> (E'AnswerStyle -> Int)
-> (E'AnswerStyle -> [E'AnswerStyle])
-> (E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle])
-> (E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle])
-> (E'AnswerStyle
    -> E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle])
-> Enum E'AnswerStyle
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'AnswerStyle -> E'AnswerStyle
succ :: E'AnswerStyle -> E'AnswerStyle
$cpred :: E'AnswerStyle -> E'AnswerStyle
pred :: E'AnswerStyle -> E'AnswerStyle
$ctoEnum :: Int -> E'AnswerStyle
toEnum :: Int -> E'AnswerStyle
$cfromEnum :: E'AnswerStyle -> Int
fromEnum :: E'AnswerStyle -> Int
$cenumFrom :: E'AnswerStyle -> [E'AnswerStyle]
enumFrom :: E'AnswerStyle -> [E'AnswerStyle]
$cenumFromThen :: E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
enumFromThen :: E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
$cenumFromTo :: E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
enumFromTo :: E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
$cenumFromThenTo :: E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
enumFromThenTo :: E'AnswerStyle -> E'AnswerStyle -> E'AnswerStyle -> [E'AnswerStyle]
P.Enum)

instance A.ToJSON E'AnswerStyle where toJSON :: E'AnswerStyle -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'AnswerStyle -> Text) -> E'AnswerStyle -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'AnswerStyle -> Text
fromE'AnswerStyle
instance A.FromJSON E'AnswerStyle where parseJSON :: Value -> Parser E'AnswerStyle
parseJSON Value
o = ([Char] -> Parser E'AnswerStyle)
-> (E'AnswerStyle -> Parser E'AnswerStyle)
-> Either [Char] E'AnswerStyle
-> Parser E'AnswerStyle
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'AnswerStyle
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'AnswerStyle -> Parser E'AnswerStyle
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'AnswerStyle -> Parser E'AnswerStyle)
-> (E'AnswerStyle -> E'AnswerStyle)
-> E'AnswerStyle
-> Parser E'AnswerStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'AnswerStyle -> E'AnswerStyle
forall a. a -> a
P.id) (Either [Char] E'AnswerStyle -> Parser E'AnswerStyle)
-> (Text -> Either [Char] E'AnswerStyle)
-> Text
-> Parser E'AnswerStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'AnswerStyle
toE'AnswerStyle (Text -> Parser E'AnswerStyle)
-> Parser Text -> Parser E'AnswerStyle
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'AnswerStyle where toQueryParam :: E'AnswerStyle -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'AnswerStyle -> Text) -> E'AnswerStyle -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'AnswerStyle -> Text
fromE'AnswerStyle
instance WH.FromHttpApiData E'AnswerStyle where parseQueryParam :: Text -> Either Text E'AnswerStyle
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'AnswerStyle) -> Either Text E'AnswerStyle
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'AnswerStyle -> Either Text E'AnswerStyle
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'AnswerStyle -> Either Text E'AnswerStyle)
-> (Text -> Either [Char] E'AnswerStyle)
-> Text
-> Either Text E'AnswerStyle
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'AnswerStyle
toE'AnswerStyle
instance MimeRender MimeMultipartFormData E'AnswerStyle where mimeRender :: Proxy MimeMultipartFormData -> E'AnswerStyle -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'AnswerStyle -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'AnswerStyle' enum
fromE'AnswerStyle :: E'AnswerStyle -> Text
fromE'AnswerStyle :: E'AnswerStyle -> Text
fromE'AnswerStyle = \case
  E'AnswerStyle
E'AnswerStyle'ANSWER_STYLE_UNSPECIFIED -> Text
"ANSWER_STYLE_UNSPECIFIED"
  E'AnswerStyle
E'AnswerStyle'ABSTRACTIVE -> Text
"ABSTRACTIVE"
  E'AnswerStyle
E'AnswerStyle'EXTRACTIVE -> Text
"EXTRACTIVE"
  E'AnswerStyle
E'AnswerStyle'VERBOSE -> Text
"VERBOSE"

-- | parse 'E'AnswerStyle' enum
toE'AnswerStyle :: Text -> P.Either String E'AnswerStyle
toE'AnswerStyle :: Text -> Either [Char] E'AnswerStyle
toE'AnswerStyle = \case
  Text
"ANSWER_STYLE_UNSPECIFIED" -> E'AnswerStyle -> Either [Char] E'AnswerStyle
forall a b. b -> Either a b
P.Right E'AnswerStyle
E'AnswerStyle'ANSWER_STYLE_UNSPECIFIED
  Text
"ABSTRACTIVE" -> E'AnswerStyle -> Either [Char] E'AnswerStyle
forall a b. b -> Either a b
P.Right E'AnswerStyle
E'AnswerStyle'ABSTRACTIVE
  Text
"EXTRACTIVE" -> E'AnswerStyle -> Either [Char] E'AnswerStyle
forall a b. b -> Either a b
P.Right E'AnswerStyle
E'AnswerStyle'EXTRACTIVE
  Text
"VERBOSE" -> E'AnswerStyle -> Either [Char] E'AnswerStyle
forall a b. b -> Either a b
P.Right E'AnswerStyle
E'AnswerStyle'VERBOSE
  Text
s -> [Char] -> Either [Char] E'AnswerStyle
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'AnswerStyle)
-> [Char] -> Either [Char] E'AnswerStyle
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'AnswerStyle: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Behavior

{- | Enum of 'Text' .
Optional. Specifies the function Behavior. Currently only supported by the BidiGenerateContent method.
-}
data E'Behavior
  = -- | @"UNSPECIFIED"@
    E'Behavior'UNSPECIFIED
  | -- | @"BLOCKING"@
    E'Behavior'BLOCKING
  | -- | @"NON_BLOCKING"@
    E'Behavior'NON_BLOCKING
  deriving (Int -> E'Behavior -> ShowS
[E'Behavior] -> ShowS
E'Behavior -> [Char]
(Int -> E'Behavior -> ShowS)
-> (E'Behavior -> [Char])
-> ([E'Behavior] -> ShowS)
-> Show E'Behavior
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Behavior -> ShowS
showsPrec :: Int -> E'Behavior -> ShowS
$cshow :: E'Behavior -> [Char]
show :: E'Behavior -> [Char]
$cshowList :: [E'Behavior] -> ShowS
showList :: [E'Behavior] -> ShowS
P.Show, E'Behavior -> E'Behavior -> Bool
(E'Behavior -> E'Behavior -> Bool)
-> (E'Behavior -> E'Behavior -> Bool) -> Eq E'Behavior
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Behavior -> E'Behavior -> Bool
== :: E'Behavior -> E'Behavior -> Bool
$c/= :: E'Behavior -> E'Behavior -> Bool
/= :: E'Behavior -> E'Behavior -> Bool
P.Eq, P.Typeable, Eq E'Behavior
Eq E'Behavior =>
(E'Behavior -> E'Behavior -> Ordering)
-> (E'Behavior -> E'Behavior -> Bool)
-> (E'Behavior -> E'Behavior -> Bool)
-> (E'Behavior -> E'Behavior -> Bool)
-> (E'Behavior -> E'Behavior -> Bool)
-> (E'Behavior -> E'Behavior -> E'Behavior)
-> (E'Behavior -> E'Behavior -> E'Behavior)
-> Ord E'Behavior
E'Behavior -> E'Behavior -> Bool
E'Behavior -> E'Behavior -> Ordering
E'Behavior -> E'Behavior -> E'Behavior
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Behavior -> E'Behavior -> Ordering
compare :: E'Behavior -> E'Behavior -> Ordering
$c< :: E'Behavior -> E'Behavior -> Bool
< :: E'Behavior -> E'Behavior -> Bool
$c<= :: E'Behavior -> E'Behavior -> Bool
<= :: E'Behavior -> E'Behavior -> Bool
$c> :: E'Behavior -> E'Behavior -> Bool
> :: E'Behavior -> E'Behavior -> Bool
$c>= :: E'Behavior -> E'Behavior -> Bool
>= :: E'Behavior -> E'Behavior -> Bool
$cmax :: E'Behavior -> E'Behavior -> E'Behavior
max :: E'Behavior -> E'Behavior -> E'Behavior
$cmin :: E'Behavior -> E'Behavior -> E'Behavior
min :: E'Behavior -> E'Behavior -> E'Behavior
P.Ord, E'Behavior
E'Behavior -> E'Behavior -> Bounded E'Behavior
forall a. a -> a -> Bounded a
$cminBound :: E'Behavior
minBound :: E'Behavior
$cmaxBound :: E'Behavior
maxBound :: E'Behavior
P.Bounded, Int -> E'Behavior
E'Behavior -> Int
E'Behavior -> [E'Behavior]
E'Behavior -> E'Behavior
E'Behavior -> E'Behavior -> [E'Behavior]
E'Behavior -> E'Behavior -> E'Behavior -> [E'Behavior]
(E'Behavior -> E'Behavior)
-> (E'Behavior -> E'Behavior)
-> (Int -> E'Behavior)
-> (E'Behavior -> Int)
-> (E'Behavior -> [E'Behavior])
-> (E'Behavior -> E'Behavior -> [E'Behavior])
-> (E'Behavior -> E'Behavior -> [E'Behavior])
-> (E'Behavior -> E'Behavior -> E'Behavior -> [E'Behavior])
-> Enum E'Behavior
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Behavior -> E'Behavior
succ :: E'Behavior -> E'Behavior
$cpred :: E'Behavior -> E'Behavior
pred :: E'Behavior -> E'Behavior
$ctoEnum :: Int -> E'Behavior
toEnum :: Int -> E'Behavior
$cfromEnum :: E'Behavior -> Int
fromEnum :: E'Behavior -> Int
$cenumFrom :: E'Behavior -> [E'Behavior]
enumFrom :: E'Behavior -> [E'Behavior]
$cenumFromThen :: E'Behavior -> E'Behavior -> [E'Behavior]
enumFromThen :: E'Behavior -> E'Behavior -> [E'Behavior]
$cenumFromTo :: E'Behavior -> E'Behavior -> [E'Behavior]
enumFromTo :: E'Behavior -> E'Behavior -> [E'Behavior]
$cenumFromThenTo :: E'Behavior -> E'Behavior -> E'Behavior -> [E'Behavior]
enumFromThenTo :: E'Behavior -> E'Behavior -> E'Behavior -> [E'Behavior]
P.Enum)

instance A.ToJSON E'Behavior where toJSON :: E'Behavior -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Behavior -> Text) -> E'Behavior -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Behavior -> Text
fromE'Behavior
instance A.FromJSON E'Behavior where parseJSON :: Value -> Parser E'Behavior
parseJSON Value
o = ([Char] -> Parser E'Behavior)
-> (E'Behavior -> Parser E'Behavior)
-> Either [Char] E'Behavior
-> Parser E'Behavior
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Behavior
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Behavior -> Parser E'Behavior
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Behavior -> Parser E'Behavior)
-> (E'Behavior -> E'Behavior) -> E'Behavior -> Parser E'Behavior
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Behavior -> E'Behavior
forall a. a -> a
P.id) (Either [Char] E'Behavior -> Parser E'Behavior)
-> (Text -> Either [Char] E'Behavior) -> Text -> Parser E'Behavior
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Behavior
toE'Behavior (Text -> Parser E'Behavior) -> Parser Text -> Parser E'Behavior
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Behavior where toQueryParam :: E'Behavior -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Behavior -> Text) -> E'Behavior -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Behavior -> Text
fromE'Behavior
instance WH.FromHttpApiData E'Behavior where parseQueryParam :: Text -> Either Text E'Behavior
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Behavior) -> Either Text E'Behavior
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'Behavior -> Either Text E'Behavior
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Behavior -> Either Text E'Behavior)
-> (Text -> Either [Char] E'Behavior)
-> Text
-> Either Text E'Behavior
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Behavior
toE'Behavior
instance MimeRender MimeMultipartFormData E'Behavior where mimeRender :: Proxy MimeMultipartFormData -> E'Behavior -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Behavior -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Behavior' enum
fromE'Behavior :: E'Behavior -> Text
fromE'Behavior :: E'Behavior -> Text
fromE'Behavior = \case
  E'Behavior
E'Behavior'UNSPECIFIED -> Text
"UNSPECIFIED"
  E'Behavior
E'Behavior'BLOCKING -> Text
"BLOCKING"
  E'Behavior
E'Behavior'NON_BLOCKING -> Text
"NON_BLOCKING"

-- | parse 'E'Behavior' enum
toE'Behavior :: Text -> P.Either String E'Behavior
toE'Behavior :: Text -> Either [Char] E'Behavior
toE'Behavior = \case
  Text
"UNSPECIFIED" -> E'Behavior -> Either [Char] E'Behavior
forall a b. b -> Either a b
P.Right E'Behavior
E'Behavior'UNSPECIFIED
  Text
"BLOCKING" -> E'Behavior -> Either [Char] E'Behavior
forall a b. b -> Either a b
P.Right E'Behavior
E'Behavior'BLOCKING
  Text
"NON_BLOCKING" -> E'Behavior -> Either [Char] E'Behavior
forall a b. b -> Either a b
P.Right E'Behavior
E'Behavior'NON_BLOCKING
  Text
s -> [Char] -> Either [Char] E'Behavior
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Behavior)
-> [Char] -> Either [Char] E'Behavior
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Behavior: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'BlockReason

{- | Enum of 'Text' .
Optional. If set, the prompt was blocked and no candidates are returned. Rephrase the prompt.
-}
data E'BlockReason
  = -- | @"BLOCK_REASON_UNSPECIFIED"@
    E'BlockReason'BLOCK_REASON_UNSPECIFIED
  | -- | @"SAFETY"@
    E'BlockReason'SAFETY
  | -- | @"OTHER"@
    E'BlockReason'OTHER
  | -- | @"BLOCKLIST"@
    E'BlockReason'BLOCKLIST
  | -- | @"PROHIBITED_CONTENT"@
    E'BlockReason'PROHIBITED_CONTENT
  | -- | @"IMAGE_SAFETY"@
    E'BlockReason'IMAGE_SAFETY
  deriving (Int -> E'BlockReason -> ShowS
[E'BlockReason] -> ShowS
E'BlockReason -> [Char]
(Int -> E'BlockReason -> ShowS)
-> (E'BlockReason -> [Char])
-> ([E'BlockReason] -> ShowS)
-> Show E'BlockReason
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'BlockReason -> ShowS
showsPrec :: Int -> E'BlockReason -> ShowS
$cshow :: E'BlockReason -> [Char]
show :: E'BlockReason -> [Char]
$cshowList :: [E'BlockReason] -> ShowS
showList :: [E'BlockReason] -> ShowS
P.Show, E'BlockReason -> E'BlockReason -> Bool
(E'BlockReason -> E'BlockReason -> Bool)
-> (E'BlockReason -> E'BlockReason -> Bool) -> Eq E'BlockReason
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'BlockReason -> E'BlockReason -> Bool
== :: E'BlockReason -> E'BlockReason -> Bool
$c/= :: E'BlockReason -> E'BlockReason -> Bool
/= :: E'BlockReason -> E'BlockReason -> Bool
P.Eq, P.Typeable, Eq E'BlockReason
Eq E'BlockReason =>
(E'BlockReason -> E'BlockReason -> Ordering)
-> (E'BlockReason -> E'BlockReason -> Bool)
-> (E'BlockReason -> E'BlockReason -> Bool)
-> (E'BlockReason -> E'BlockReason -> Bool)
-> (E'BlockReason -> E'BlockReason -> Bool)
-> (E'BlockReason -> E'BlockReason -> E'BlockReason)
-> (E'BlockReason -> E'BlockReason -> E'BlockReason)
-> Ord E'BlockReason
E'BlockReason -> E'BlockReason -> Bool
E'BlockReason -> E'BlockReason -> Ordering
E'BlockReason -> E'BlockReason -> E'BlockReason
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'BlockReason -> E'BlockReason -> Ordering
compare :: E'BlockReason -> E'BlockReason -> Ordering
$c< :: E'BlockReason -> E'BlockReason -> Bool
< :: E'BlockReason -> E'BlockReason -> Bool
$c<= :: E'BlockReason -> E'BlockReason -> Bool
<= :: E'BlockReason -> E'BlockReason -> Bool
$c> :: E'BlockReason -> E'BlockReason -> Bool
> :: E'BlockReason -> E'BlockReason -> Bool
$c>= :: E'BlockReason -> E'BlockReason -> Bool
>= :: E'BlockReason -> E'BlockReason -> Bool
$cmax :: E'BlockReason -> E'BlockReason -> E'BlockReason
max :: E'BlockReason -> E'BlockReason -> E'BlockReason
$cmin :: E'BlockReason -> E'BlockReason -> E'BlockReason
min :: E'BlockReason -> E'BlockReason -> E'BlockReason
P.Ord, E'BlockReason
E'BlockReason -> E'BlockReason -> Bounded E'BlockReason
forall a. a -> a -> Bounded a
$cminBound :: E'BlockReason
minBound :: E'BlockReason
$cmaxBound :: E'BlockReason
maxBound :: E'BlockReason
P.Bounded, Int -> E'BlockReason
E'BlockReason -> Int
E'BlockReason -> [E'BlockReason]
E'BlockReason -> E'BlockReason
E'BlockReason -> E'BlockReason -> [E'BlockReason]
E'BlockReason -> E'BlockReason -> E'BlockReason -> [E'BlockReason]
(E'BlockReason -> E'BlockReason)
-> (E'BlockReason -> E'BlockReason)
-> (Int -> E'BlockReason)
-> (E'BlockReason -> Int)
-> (E'BlockReason -> [E'BlockReason])
-> (E'BlockReason -> E'BlockReason -> [E'BlockReason])
-> (E'BlockReason -> E'BlockReason -> [E'BlockReason])
-> (E'BlockReason
    -> E'BlockReason -> E'BlockReason -> [E'BlockReason])
-> Enum E'BlockReason
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'BlockReason -> E'BlockReason
succ :: E'BlockReason -> E'BlockReason
$cpred :: E'BlockReason -> E'BlockReason
pred :: E'BlockReason -> E'BlockReason
$ctoEnum :: Int -> E'BlockReason
toEnum :: Int -> E'BlockReason
$cfromEnum :: E'BlockReason -> Int
fromEnum :: E'BlockReason -> Int
$cenumFrom :: E'BlockReason -> [E'BlockReason]
enumFrom :: E'BlockReason -> [E'BlockReason]
$cenumFromThen :: E'BlockReason -> E'BlockReason -> [E'BlockReason]
enumFromThen :: E'BlockReason -> E'BlockReason -> [E'BlockReason]
$cenumFromTo :: E'BlockReason -> E'BlockReason -> [E'BlockReason]
enumFromTo :: E'BlockReason -> E'BlockReason -> [E'BlockReason]
$cenumFromThenTo :: E'BlockReason -> E'BlockReason -> E'BlockReason -> [E'BlockReason]
enumFromThenTo :: E'BlockReason -> E'BlockReason -> E'BlockReason -> [E'BlockReason]
P.Enum)

instance A.ToJSON E'BlockReason where toJSON :: E'BlockReason -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'BlockReason -> Text) -> E'BlockReason -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'BlockReason -> Text
fromE'BlockReason
instance A.FromJSON E'BlockReason where parseJSON :: Value -> Parser E'BlockReason
parseJSON Value
o = ([Char] -> Parser E'BlockReason)
-> (E'BlockReason -> Parser E'BlockReason)
-> Either [Char] E'BlockReason
-> Parser E'BlockReason
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'BlockReason
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'BlockReason -> Parser E'BlockReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'BlockReason -> Parser E'BlockReason)
-> (E'BlockReason -> E'BlockReason)
-> E'BlockReason
-> Parser E'BlockReason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'BlockReason -> E'BlockReason
forall a. a -> a
P.id) (Either [Char] E'BlockReason -> Parser E'BlockReason)
-> (Text -> Either [Char] E'BlockReason)
-> Text
-> Parser E'BlockReason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'BlockReason
toE'BlockReason (Text -> Parser E'BlockReason)
-> Parser Text -> Parser E'BlockReason
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'BlockReason where toQueryParam :: E'BlockReason -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'BlockReason -> Text) -> E'BlockReason -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'BlockReason -> Text
fromE'BlockReason
instance WH.FromHttpApiData E'BlockReason where parseQueryParam :: Text -> Either Text E'BlockReason
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'BlockReason) -> Either Text E'BlockReason
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'BlockReason -> Either Text E'BlockReason
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'BlockReason -> Either Text E'BlockReason)
-> (Text -> Either [Char] E'BlockReason)
-> Text
-> Either Text E'BlockReason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'BlockReason
toE'BlockReason
instance MimeRender MimeMultipartFormData E'BlockReason where mimeRender :: Proxy MimeMultipartFormData -> E'BlockReason -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'BlockReason -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'BlockReason' enum
fromE'BlockReason :: E'BlockReason -> Text
fromE'BlockReason :: E'BlockReason -> Text
fromE'BlockReason = \case
  E'BlockReason
E'BlockReason'BLOCK_REASON_UNSPECIFIED -> Text
"BLOCK_REASON_UNSPECIFIED"
  E'BlockReason
E'BlockReason'SAFETY -> Text
"SAFETY"
  E'BlockReason
E'BlockReason'OTHER -> Text
"OTHER"
  E'BlockReason
E'BlockReason'BLOCKLIST -> Text
"BLOCKLIST"
  E'BlockReason
E'BlockReason'PROHIBITED_CONTENT -> Text
"PROHIBITED_CONTENT"
  E'BlockReason
E'BlockReason'IMAGE_SAFETY -> Text
"IMAGE_SAFETY"

-- | parse 'E'BlockReason' enum
toE'BlockReason :: Text -> P.Either String E'BlockReason
toE'BlockReason :: Text -> Either [Char] E'BlockReason
toE'BlockReason = \case
  Text
"BLOCK_REASON_UNSPECIFIED" -> E'BlockReason -> Either [Char] E'BlockReason
forall a b. b -> Either a b
P.Right E'BlockReason
E'BlockReason'BLOCK_REASON_UNSPECIFIED
  Text
"SAFETY" -> E'BlockReason -> Either [Char] E'BlockReason
forall a b. b -> Either a b
P.Right E'BlockReason
E'BlockReason'SAFETY
  Text
"OTHER" -> E'BlockReason -> Either [Char] E'BlockReason
forall a b. b -> Either a b
P.Right E'BlockReason
E'BlockReason'OTHER
  Text
"BLOCKLIST" -> E'BlockReason -> Either [Char] E'BlockReason
forall a b. b -> Either a b
P.Right E'BlockReason
E'BlockReason'BLOCKLIST
  Text
"PROHIBITED_CONTENT" -> E'BlockReason -> Either [Char] E'BlockReason
forall a b. b -> Either a b
P.Right E'BlockReason
E'BlockReason'PROHIBITED_CONTENT
  Text
"IMAGE_SAFETY" -> E'BlockReason -> Either [Char] E'BlockReason
forall a b. b -> Either a b
P.Right E'BlockReason
E'BlockReason'IMAGE_SAFETY
  Text
s -> [Char] -> Either [Char] E'BlockReason
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'BlockReason)
-> [Char] -> Either [Char] E'BlockReason
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'BlockReason: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'BlockReason2

{- | Enum of 'Text' .
Optional. If set, the input was blocked and no candidates are returned. Rephrase the input.
-}
data E'BlockReason2
  = -- | @"BLOCK_REASON_UNSPECIFIED"@
    E'BlockReason2'BLOCK_REASON_UNSPECIFIED
  | -- | @"SAFETY"@
    E'BlockReason2'SAFETY
  | -- | @"OTHER"@
    E'BlockReason2'OTHER
  deriving (Int -> E'BlockReason2 -> ShowS
[E'BlockReason2] -> ShowS
E'BlockReason2 -> [Char]
(Int -> E'BlockReason2 -> ShowS)
-> (E'BlockReason2 -> [Char])
-> ([E'BlockReason2] -> ShowS)
-> Show E'BlockReason2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'BlockReason2 -> ShowS
showsPrec :: Int -> E'BlockReason2 -> ShowS
$cshow :: E'BlockReason2 -> [Char]
show :: E'BlockReason2 -> [Char]
$cshowList :: [E'BlockReason2] -> ShowS
showList :: [E'BlockReason2] -> ShowS
P.Show, E'BlockReason2 -> E'BlockReason2 -> Bool
(E'BlockReason2 -> E'BlockReason2 -> Bool)
-> (E'BlockReason2 -> E'BlockReason2 -> Bool) -> Eq E'BlockReason2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'BlockReason2 -> E'BlockReason2 -> Bool
== :: E'BlockReason2 -> E'BlockReason2 -> Bool
$c/= :: E'BlockReason2 -> E'BlockReason2 -> Bool
/= :: E'BlockReason2 -> E'BlockReason2 -> Bool
P.Eq, P.Typeable, Eq E'BlockReason2
Eq E'BlockReason2 =>
(E'BlockReason2 -> E'BlockReason2 -> Ordering)
-> (E'BlockReason2 -> E'BlockReason2 -> Bool)
-> (E'BlockReason2 -> E'BlockReason2 -> Bool)
-> (E'BlockReason2 -> E'BlockReason2 -> Bool)
-> (E'BlockReason2 -> E'BlockReason2 -> Bool)
-> (E'BlockReason2 -> E'BlockReason2 -> E'BlockReason2)
-> (E'BlockReason2 -> E'BlockReason2 -> E'BlockReason2)
-> Ord E'BlockReason2
E'BlockReason2 -> E'BlockReason2 -> Bool
E'BlockReason2 -> E'BlockReason2 -> Ordering
E'BlockReason2 -> E'BlockReason2 -> E'BlockReason2
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'BlockReason2 -> E'BlockReason2 -> Ordering
compare :: E'BlockReason2 -> E'BlockReason2 -> Ordering
$c< :: E'BlockReason2 -> E'BlockReason2 -> Bool
< :: E'BlockReason2 -> E'BlockReason2 -> Bool
$c<= :: E'BlockReason2 -> E'BlockReason2 -> Bool
<= :: E'BlockReason2 -> E'BlockReason2 -> Bool
$c> :: E'BlockReason2 -> E'BlockReason2 -> Bool
> :: E'BlockReason2 -> E'BlockReason2 -> Bool
$c>= :: E'BlockReason2 -> E'BlockReason2 -> Bool
>= :: E'BlockReason2 -> E'BlockReason2 -> Bool
$cmax :: E'BlockReason2 -> E'BlockReason2 -> E'BlockReason2
max :: E'BlockReason2 -> E'BlockReason2 -> E'BlockReason2
$cmin :: E'BlockReason2 -> E'BlockReason2 -> E'BlockReason2
min :: E'BlockReason2 -> E'BlockReason2 -> E'BlockReason2
P.Ord, E'BlockReason2
E'BlockReason2 -> E'BlockReason2 -> Bounded E'BlockReason2
forall a. a -> a -> Bounded a
$cminBound :: E'BlockReason2
minBound :: E'BlockReason2
$cmaxBound :: E'BlockReason2
maxBound :: E'BlockReason2
P.Bounded, Int -> E'BlockReason2
E'BlockReason2 -> Int
E'BlockReason2 -> [E'BlockReason2]
E'BlockReason2 -> E'BlockReason2
E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
E'BlockReason2
-> E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
(E'BlockReason2 -> E'BlockReason2)
-> (E'BlockReason2 -> E'BlockReason2)
-> (Int -> E'BlockReason2)
-> (E'BlockReason2 -> Int)
-> (E'BlockReason2 -> [E'BlockReason2])
-> (E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2])
-> (E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2])
-> (E'BlockReason2
    -> E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2])
-> Enum E'BlockReason2
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'BlockReason2 -> E'BlockReason2
succ :: E'BlockReason2 -> E'BlockReason2
$cpred :: E'BlockReason2 -> E'BlockReason2
pred :: E'BlockReason2 -> E'BlockReason2
$ctoEnum :: Int -> E'BlockReason2
toEnum :: Int -> E'BlockReason2
$cfromEnum :: E'BlockReason2 -> Int
fromEnum :: E'BlockReason2 -> Int
$cenumFrom :: E'BlockReason2 -> [E'BlockReason2]
enumFrom :: E'BlockReason2 -> [E'BlockReason2]
$cenumFromThen :: E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
enumFromThen :: E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
$cenumFromTo :: E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
enumFromTo :: E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
$cenumFromThenTo :: E'BlockReason2
-> E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
enumFromThenTo :: E'BlockReason2
-> E'BlockReason2 -> E'BlockReason2 -> [E'BlockReason2]
P.Enum)

instance A.ToJSON E'BlockReason2 where toJSON :: E'BlockReason2 -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'BlockReason2 -> Text) -> E'BlockReason2 -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'BlockReason2 -> Text
fromE'BlockReason2
instance A.FromJSON E'BlockReason2 where parseJSON :: Value -> Parser E'BlockReason2
parseJSON Value
o = ([Char] -> Parser E'BlockReason2)
-> (E'BlockReason2 -> Parser E'BlockReason2)
-> Either [Char] E'BlockReason2
-> Parser E'BlockReason2
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'BlockReason2
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'BlockReason2 -> Parser E'BlockReason2
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'BlockReason2 -> Parser E'BlockReason2)
-> (E'BlockReason2 -> E'BlockReason2)
-> E'BlockReason2
-> Parser E'BlockReason2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'BlockReason2 -> E'BlockReason2
forall a. a -> a
P.id) (Either [Char] E'BlockReason2 -> Parser E'BlockReason2)
-> (Text -> Either [Char] E'BlockReason2)
-> Text
-> Parser E'BlockReason2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'BlockReason2
toE'BlockReason2 (Text -> Parser E'BlockReason2)
-> Parser Text -> Parser E'BlockReason2
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'BlockReason2 where toQueryParam :: E'BlockReason2 -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text)
-> (E'BlockReason2 -> Text) -> E'BlockReason2 -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'BlockReason2 -> Text
fromE'BlockReason2
instance WH.FromHttpApiData E'BlockReason2 where parseQueryParam :: Text -> Either Text E'BlockReason2
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'BlockReason2)
-> Either Text E'BlockReason2
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'BlockReason2 -> Either Text E'BlockReason2
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'BlockReason2 -> Either Text E'BlockReason2)
-> (Text -> Either [Char] E'BlockReason2)
-> Text
-> Either Text E'BlockReason2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'BlockReason2
toE'BlockReason2
instance MimeRender MimeMultipartFormData E'BlockReason2 where mimeRender :: Proxy MimeMultipartFormData -> E'BlockReason2 -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'BlockReason2 -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'BlockReason2' enum
fromE'BlockReason2 :: E'BlockReason2 -> Text
fromE'BlockReason2 :: E'BlockReason2 -> Text
fromE'BlockReason2 = \case
  E'BlockReason2
E'BlockReason2'BLOCK_REASON_UNSPECIFIED -> Text
"BLOCK_REASON_UNSPECIFIED"
  E'BlockReason2
E'BlockReason2'SAFETY -> Text
"SAFETY"
  E'BlockReason2
E'BlockReason2'OTHER -> Text
"OTHER"

-- | parse 'E'BlockReason2' enum
toE'BlockReason2 :: Text -> P.Either String E'BlockReason2
toE'BlockReason2 :: Text -> Either [Char] E'BlockReason2
toE'BlockReason2 = \case
  Text
"BLOCK_REASON_UNSPECIFIED" -> E'BlockReason2 -> Either [Char] E'BlockReason2
forall a b. b -> Either a b
P.Right E'BlockReason2
E'BlockReason2'BLOCK_REASON_UNSPECIFIED
  Text
"SAFETY" -> E'BlockReason2 -> Either [Char] E'BlockReason2
forall a b. b -> Either a b
P.Right E'BlockReason2
E'BlockReason2'SAFETY
  Text
"OTHER" -> E'BlockReason2 -> Either [Char] E'BlockReason2
forall a b. b -> Either a b
P.Right E'BlockReason2
E'BlockReason2'OTHER
  Text
s -> [Char] -> Either [Char] E'BlockReason2
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'BlockReason2)
-> [Char] -> Either [Char] E'BlockReason2
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'BlockReason2: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'FinishReason

{- | Enum of 'Text' .
Optional. Output only. The reason why the model stopped generating tokens.  If empty, the model has not stopped generating tokens.
-}
data E'FinishReason
  = -- | @"FINISH_REASON_UNSPECIFIED"@
    E'FinishReason'FINISH_REASON_UNSPECIFIED
  | -- | @"STOP"@
    E'FinishReason'STOP
  | -- | @"MAX_TOKENS"@
    E'FinishReason'MAX_TOKENS
  | -- | @"SAFETY"@
    E'FinishReason'SAFETY
  | -- | @"RECITATION"@
    E'FinishReason'RECITATION
  | -- | @"LANGUAGE"@
    E'FinishReason'LANGUAGE
  | -- | @"OTHER"@
    E'FinishReason'OTHER
  | -- | @"BLOCKLIST"@
    E'FinishReason'BLOCKLIST
  | -- | @"PROHIBITED_CONTENT"@
    E'FinishReason'PROHIBITED_CONTENT
  | -- | @"SPII"@
    E'FinishReason'SPII
  | -- | @"MALFORMED_FUNCTION_CALL"@
    E'FinishReason'MALFORMED_FUNCTION_CALL
  | -- | @"IMAGE_SAFETY"@
    E'FinishReason'IMAGE_SAFETY
  deriving (Int -> E'FinishReason -> ShowS
[E'FinishReason] -> ShowS
E'FinishReason -> [Char]
(Int -> E'FinishReason -> ShowS)
-> (E'FinishReason -> [Char])
-> ([E'FinishReason] -> ShowS)
-> Show E'FinishReason
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'FinishReason -> ShowS
showsPrec :: Int -> E'FinishReason -> ShowS
$cshow :: E'FinishReason -> [Char]
show :: E'FinishReason -> [Char]
$cshowList :: [E'FinishReason] -> ShowS
showList :: [E'FinishReason] -> ShowS
P.Show, E'FinishReason -> E'FinishReason -> Bool
(E'FinishReason -> E'FinishReason -> Bool)
-> (E'FinishReason -> E'FinishReason -> Bool) -> Eq E'FinishReason
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'FinishReason -> E'FinishReason -> Bool
== :: E'FinishReason -> E'FinishReason -> Bool
$c/= :: E'FinishReason -> E'FinishReason -> Bool
/= :: E'FinishReason -> E'FinishReason -> Bool
P.Eq, P.Typeable, Eq E'FinishReason
Eq E'FinishReason =>
(E'FinishReason -> E'FinishReason -> Ordering)
-> (E'FinishReason -> E'FinishReason -> Bool)
-> (E'FinishReason -> E'FinishReason -> Bool)
-> (E'FinishReason -> E'FinishReason -> Bool)
-> (E'FinishReason -> E'FinishReason -> Bool)
-> (E'FinishReason -> E'FinishReason -> E'FinishReason)
-> (E'FinishReason -> E'FinishReason -> E'FinishReason)
-> Ord E'FinishReason
E'FinishReason -> E'FinishReason -> Bool
E'FinishReason -> E'FinishReason -> Ordering
E'FinishReason -> E'FinishReason -> E'FinishReason
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'FinishReason -> E'FinishReason -> Ordering
compare :: E'FinishReason -> E'FinishReason -> Ordering
$c< :: E'FinishReason -> E'FinishReason -> Bool
< :: E'FinishReason -> E'FinishReason -> Bool
$c<= :: E'FinishReason -> E'FinishReason -> Bool
<= :: E'FinishReason -> E'FinishReason -> Bool
$c> :: E'FinishReason -> E'FinishReason -> Bool
> :: E'FinishReason -> E'FinishReason -> Bool
$c>= :: E'FinishReason -> E'FinishReason -> Bool
>= :: E'FinishReason -> E'FinishReason -> Bool
$cmax :: E'FinishReason -> E'FinishReason -> E'FinishReason
max :: E'FinishReason -> E'FinishReason -> E'FinishReason
$cmin :: E'FinishReason -> E'FinishReason -> E'FinishReason
min :: E'FinishReason -> E'FinishReason -> E'FinishReason
P.Ord, E'FinishReason
E'FinishReason -> E'FinishReason -> Bounded E'FinishReason
forall a. a -> a -> Bounded a
$cminBound :: E'FinishReason
minBound :: E'FinishReason
$cmaxBound :: E'FinishReason
maxBound :: E'FinishReason
P.Bounded, Int -> E'FinishReason
E'FinishReason -> Int
E'FinishReason -> [E'FinishReason]
E'FinishReason -> E'FinishReason
E'FinishReason -> E'FinishReason -> [E'FinishReason]
E'FinishReason
-> E'FinishReason -> E'FinishReason -> [E'FinishReason]
(E'FinishReason -> E'FinishReason)
-> (E'FinishReason -> E'FinishReason)
-> (Int -> E'FinishReason)
-> (E'FinishReason -> Int)
-> (E'FinishReason -> [E'FinishReason])
-> (E'FinishReason -> E'FinishReason -> [E'FinishReason])
-> (E'FinishReason -> E'FinishReason -> [E'FinishReason])
-> (E'FinishReason
    -> E'FinishReason -> E'FinishReason -> [E'FinishReason])
-> Enum E'FinishReason
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'FinishReason -> E'FinishReason
succ :: E'FinishReason -> E'FinishReason
$cpred :: E'FinishReason -> E'FinishReason
pred :: E'FinishReason -> E'FinishReason
$ctoEnum :: Int -> E'FinishReason
toEnum :: Int -> E'FinishReason
$cfromEnum :: E'FinishReason -> Int
fromEnum :: E'FinishReason -> Int
$cenumFrom :: E'FinishReason -> [E'FinishReason]
enumFrom :: E'FinishReason -> [E'FinishReason]
$cenumFromThen :: E'FinishReason -> E'FinishReason -> [E'FinishReason]
enumFromThen :: E'FinishReason -> E'FinishReason -> [E'FinishReason]
$cenumFromTo :: E'FinishReason -> E'FinishReason -> [E'FinishReason]
enumFromTo :: E'FinishReason -> E'FinishReason -> [E'FinishReason]
$cenumFromThenTo :: E'FinishReason
-> E'FinishReason -> E'FinishReason -> [E'FinishReason]
enumFromThenTo :: E'FinishReason
-> E'FinishReason -> E'FinishReason -> [E'FinishReason]
P.Enum)

instance A.ToJSON E'FinishReason where toJSON :: E'FinishReason -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'FinishReason -> Text) -> E'FinishReason -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'FinishReason -> Text
fromE'FinishReason
instance A.FromJSON E'FinishReason where parseJSON :: Value -> Parser E'FinishReason
parseJSON Value
o = ([Char] -> Parser E'FinishReason)
-> (E'FinishReason -> Parser E'FinishReason)
-> Either [Char] E'FinishReason
-> Parser E'FinishReason
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'FinishReason
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'FinishReason -> Parser E'FinishReason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'FinishReason -> Parser E'FinishReason)
-> (E'FinishReason -> E'FinishReason)
-> E'FinishReason
-> Parser E'FinishReason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'FinishReason -> E'FinishReason
forall a. a -> a
P.id) (Either [Char] E'FinishReason -> Parser E'FinishReason)
-> (Text -> Either [Char] E'FinishReason)
-> Text
-> Parser E'FinishReason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'FinishReason
toE'FinishReason (Text -> Parser E'FinishReason)
-> Parser Text -> Parser E'FinishReason
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'FinishReason where toQueryParam :: E'FinishReason -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text)
-> (E'FinishReason -> Text) -> E'FinishReason -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'FinishReason -> Text
fromE'FinishReason
instance WH.FromHttpApiData E'FinishReason where parseQueryParam :: Text -> Either Text E'FinishReason
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'FinishReason)
-> Either Text E'FinishReason
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'FinishReason -> Either Text E'FinishReason
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'FinishReason -> Either Text E'FinishReason)
-> (Text -> Either [Char] E'FinishReason)
-> Text
-> Either Text E'FinishReason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'FinishReason
toE'FinishReason
instance MimeRender MimeMultipartFormData E'FinishReason where mimeRender :: Proxy MimeMultipartFormData -> E'FinishReason -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'FinishReason -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'FinishReason' enum
fromE'FinishReason :: E'FinishReason -> Text
fromE'FinishReason :: E'FinishReason -> Text
fromE'FinishReason = \case
  E'FinishReason
E'FinishReason'FINISH_REASON_UNSPECIFIED -> Text
"FINISH_REASON_UNSPECIFIED"
  E'FinishReason
E'FinishReason'STOP -> Text
"STOP"
  E'FinishReason
E'FinishReason'MAX_TOKENS -> Text
"MAX_TOKENS"
  E'FinishReason
E'FinishReason'SAFETY -> Text
"SAFETY"
  E'FinishReason
E'FinishReason'RECITATION -> Text
"RECITATION"
  E'FinishReason
E'FinishReason'LANGUAGE -> Text
"LANGUAGE"
  E'FinishReason
E'FinishReason'OTHER -> Text
"OTHER"
  E'FinishReason
E'FinishReason'BLOCKLIST -> Text
"BLOCKLIST"
  E'FinishReason
E'FinishReason'PROHIBITED_CONTENT -> Text
"PROHIBITED_CONTENT"
  E'FinishReason
E'FinishReason'SPII -> Text
"SPII"
  E'FinishReason
E'FinishReason'MALFORMED_FUNCTION_CALL -> Text
"MALFORMED_FUNCTION_CALL"
  E'FinishReason
E'FinishReason'IMAGE_SAFETY -> Text
"IMAGE_SAFETY"

-- | parse 'E'FinishReason' enum
toE'FinishReason :: Text -> P.Either String E'FinishReason
toE'FinishReason :: Text -> Either [Char] E'FinishReason
toE'FinishReason = \case
  Text
"FINISH_REASON_UNSPECIFIED" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'FINISH_REASON_UNSPECIFIED
  Text
"STOP" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'STOP
  Text
"MAX_TOKENS" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'MAX_TOKENS
  Text
"SAFETY" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'SAFETY
  Text
"RECITATION" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'RECITATION
  Text
"LANGUAGE" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'LANGUAGE
  Text
"OTHER" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'OTHER
  Text
"BLOCKLIST" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'BLOCKLIST
  Text
"PROHIBITED_CONTENT" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'PROHIBITED_CONTENT
  Text
"SPII" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'SPII
  Text
"MALFORMED_FUNCTION_CALL" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'MALFORMED_FUNCTION_CALL
  Text
"IMAGE_SAFETY" -> E'FinishReason -> Either [Char] E'FinishReason
forall a b. b -> Either a b
P.Right E'FinishReason
E'FinishReason'IMAGE_SAFETY
  Text
s -> [Char] -> Either [Char] E'FinishReason
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'FinishReason)
-> [Char] -> Either [Char] E'FinishReason
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'FinishReason: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'GranteeType

{- | Enum of 'Text' .
Optional. Immutable. The type of the grantee.
-}
data E'GranteeType
  = -- | @"GRANTEE_TYPE_UNSPECIFIED"@
    E'GranteeType'GRANTEE_TYPE_UNSPECIFIED
  | -- | @"USER"@
    E'GranteeType'USER
  | -- | @"GROUP"@
    E'GranteeType'GROUP
  | -- | @"EVERYONE"@
    E'GranteeType'EVERYONE
  deriving (Int -> E'GranteeType -> ShowS
[E'GranteeType] -> ShowS
E'GranteeType -> [Char]
(Int -> E'GranteeType -> ShowS)
-> (E'GranteeType -> [Char])
-> ([E'GranteeType] -> ShowS)
-> Show E'GranteeType
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'GranteeType -> ShowS
showsPrec :: Int -> E'GranteeType -> ShowS
$cshow :: E'GranteeType -> [Char]
show :: E'GranteeType -> [Char]
$cshowList :: [E'GranteeType] -> ShowS
showList :: [E'GranteeType] -> ShowS
P.Show, E'GranteeType -> E'GranteeType -> Bool
(E'GranteeType -> E'GranteeType -> Bool)
-> (E'GranteeType -> E'GranteeType -> Bool) -> Eq E'GranteeType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'GranteeType -> E'GranteeType -> Bool
== :: E'GranteeType -> E'GranteeType -> Bool
$c/= :: E'GranteeType -> E'GranteeType -> Bool
/= :: E'GranteeType -> E'GranteeType -> Bool
P.Eq, P.Typeable, Eq E'GranteeType
Eq E'GranteeType =>
(E'GranteeType -> E'GranteeType -> Ordering)
-> (E'GranteeType -> E'GranteeType -> Bool)
-> (E'GranteeType -> E'GranteeType -> Bool)
-> (E'GranteeType -> E'GranteeType -> Bool)
-> (E'GranteeType -> E'GranteeType -> Bool)
-> (E'GranteeType -> E'GranteeType -> E'GranteeType)
-> (E'GranteeType -> E'GranteeType -> E'GranteeType)
-> Ord E'GranteeType
E'GranteeType -> E'GranteeType -> Bool
E'GranteeType -> E'GranteeType -> Ordering
E'GranteeType -> E'GranteeType -> E'GranteeType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'GranteeType -> E'GranteeType -> Ordering
compare :: E'GranteeType -> E'GranteeType -> Ordering
$c< :: E'GranteeType -> E'GranteeType -> Bool
< :: E'GranteeType -> E'GranteeType -> Bool
$c<= :: E'GranteeType -> E'GranteeType -> Bool
<= :: E'GranteeType -> E'GranteeType -> Bool
$c> :: E'GranteeType -> E'GranteeType -> Bool
> :: E'GranteeType -> E'GranteeType -> Bool
$c>= :: E'GranteeType -> E'GranteeType -> Bool
>= :: E'GranteeType -> E'GranteeType -> Bool
$cmax :: E'GranteeType -> E'GranteeType -> E'GranteeType
max :: E'GranteeType -> E'GranteeType -> E'GranteeType
$cmin :: E'GranteeType -> E'GranteeType -> E'GranteeType
min :: E'GranteeType -> E'GranteeType -> E'GranteeType
P.Ord, E'GranteeType
E'GranteeType -> E'GranteeType -> Bounded E'GranteeType
forall a. a -> a -> Bounded a
$cminBound :: E'GranteeType
minBound :: E'GranteeType
$cmaxBound :: E'GranteeType
maxBound :: E'GranteeType
P.Bounded, Int -> E'GranteeType
E'GranteeType -> Int
E'GranteeType -> [E'GranteeType]
E'GranteeType -> E'GranteeType
E'GranteeType -> E'GranteeType -> [E'GranteeType]
E'GranteeType -> E'GranteeType -> E'GranteeType -> [E'GranteeType]
(E'GranteeType -> E'GranteeType)
-> (E'GranteeType -> E'GranteeType)
-> (Int -> E'GranteeType)
-> (E'GranteeType -> Int)
-> (E'GranteeType -> [E'GranteeType])
-> (E'GranteeType -> E'GranteeType -> [E'GranteeType])
-> (E'GranteeType -> E'GranteeType -> [E'GranteeType])
-> (E'GranteeType
    -> E'GranteeType -> E'GranteeType -> [E'GranteeType])
-> Enum E'GranteeType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'GranteeType -> E'GranteeType
succ :: E'GranteeType -> E'GranteeType
$cpred :: E'GranteeType -> E'GranteeType
pred :: E'GranteeType -> E'GranteeType
$ctoEnum :: Int -> E'GranteeType
toEnum :: Int -> E'GranteeType
$cfromEnum :: E'GranteeType -> Int
fromEnum :: E'GranteeType -> Int
$cenumFrom :: E'GranteeType -> [E'GranteeType]
enumFrom :: E'GranteeType -> [E'GranteeType]
$cenumFromThen :: E'GranteeType -> E'GranteeType -> [E'GranteeType]
enumFromThen :: E'GranteeType -> E'GranteeType -> [E'GranteeType]
$cenumFromTo :: E'GranteeType -> E'GranteeType -> [E'GranteeType]
enumFromTo :: E'GranteeType -> E'GranteeType -> [E'GranteeType]
$cenumFromThenTo :: E'GranteeType -> E'GranteeType -> E'GranteeType -> [E'GranteeType]
enumFromThenTo :: E'GranteeType -> E'GranteeType -> E'GranteeType -> [E'GranteeType]
P.Enum)

instance A.ToJSON E'GranteeType where toJSON :: E'GranteeType -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'GranteeType -> Text) -> E'GranteeType -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'GranteeType -> Text
fromE'GranteeType
instance A.FromJSON E'GranteeType where parseJSON :: Value -> Parser E'GranteeType
parseJSON Value
o = ([Char] -> Parser E'GranteeType)
-> (E'GranteeType -> Parser E'GranteeType)
-> Either [Char] E'GranteeType
-> Parser E'GranteeType
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'GranteeType
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'GranteeType -> Parser E'GranteeType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'GranteeType -> Parser E'GranteeType)
-> (E'GranteeType -> E'GranteeType)
-> E'GranteeType
-> Parser E'GranteeType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'GranteeType -> E'GranteeType
forall a. a -> a
P.id) (Either [Char] E'GranteeType -> Parser E'GranteeType)
-> (Text -> Either [Char] E'GranteeType)
-> Text
-> Parser E'GranteeType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'GranteeType
toE'GranteeType (Text -> Parser E'GranteeType)
-> Parser Text -> Parser E'GranteeType
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'GranteeType where toQueryParam :: E'GranteeType -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'GranteeType -> Text) -> E'GranteeType -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'GranteeType -> Text
fromE'GranteeType
instance WH.FromHttpApiData E'GranteeType where parseQueryParam :: Text -> Either Text E'GranteeType
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'GranteeType) -> Either Text E'GranteeType
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'GranteeType -> Either Text E'GranteeType
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'GranteeType -> Either Text E'GranteeType)
-> (Text -> Either [Char] E'GranteeType)
-> Text
-> Either Text E'GranteeType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'GranteeType
toE'GranteeType
instance MimeRender MimeMultipartFormData E'GranteeType where mimeRender :: Proxy MimeMultipartFormData -> E'GranteeType -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'GranteeType -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'GranteeType' enum
fromE'GranteeType :: E'GranteeType -> Text
fromE'GranteeType :: E'GranteeType -> Text
fromE'GranteeType = \case
  E'GranteeType
E'GranteeType'GRANTEE_TYPE_UNSPECIFIED -> Text
"GRANTEE_TYPE_UNSPECIFIED"
  E'GranteeType
E'GranteeType'USER -> Text
"USER"
  E'GranteeType
E'GranteeType'GROUP -> Text
"GROUP"
  E'GranteeType
E'GranteeType'EVERYONE -> Text
"EVERYONE"

-- | parse 'E'GranteeType' enum
toE'GranteeType :: Text -> P.Either String E'GranteeType
toE'GranteeType :: Text -> Either [Char] E'GranteeType
toE'GranteeType = \case
  Text
"GRANTEE_TYPE_UNSPECIFIED" -> E'GranteeType -> Either [Char] E'GranteeType
forall a b. b -> Either a b
P.Right E'GranteeType
E'GranteeType'GRANTEE_TYPE_UNSPECIFIED
  Text
"USER" -> E'GranteeType -> Either [Char] E'GranteeType
forall a b. b -> Either a b
P.Right E'GranteeType
E'GranteeType'USER
  Text
"GROUP" -> E'GranteeType -> Either [Char] E'GranteeType
forall a b. b -> Either a b
P.Right E'GranteeType
E'GranteeType'GROUP
  Text
"EVERYONE" -> E'GranteeType -> Either [Char] E'GranteeType
forall a b. b -> Either a b
P.Right E'GranteeType
E'GranteeType'EVERYONE
  Text
s -> [Char] -> Either [Char] E'GranteeType
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'GranteeType)
-> [Char] -> Either [Char] E'GranteeType
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'GranteeType: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Language

{- | Enum of 'Text' .
Required. Programming language of the `code`.
-}
data E'Language
  = -- | @"LANGUAGE_UNSPECIFIED"@
    E'Language'LANGUAGE_UNSPECIFIED
  | -- | @"PYTHON"@
    E'Language'PYTHON
  deriving (Int -> E'Language -> ShowS
[E'Language] -> ShowS
E'Language -> [Char]
(Int -> E'Language -> ShowS)
-> (E'Language -> [Char])
-> ([E'Language] -> ShowS)
-> Show E'Language
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Language -> ShowS
showsPrec :: Int -> E'Language -> ShowS
$cshow :: E'Language -> [Char]
show :: E'Language -> [Char]
$cshowList :: [E'Language] -> ShowS
showList :: [E'Language] -> ShowS
P.Show, E'Language -> E'Language -> Bool
(E'Language -> E'Language -> Bool)
-> (E'Language -> E'Language -> Bool) -> Eq E'Language
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Language -> E'Language -> Bool
== :: E'Language -> E'Language -> Bool
$c/= :: E'Language -> E'Language -> Bool
/= :: E'Language -> E'Language -> Bool
P.Eq, P.Typeable, Eq E'Language
Eq E'Language =>
(E'Language -> E'Language -> Ordering)
-> (E'Language -> E'Language -> Bool)
-> (E'Language -> E'Language -> Bool)
-> (E'Language -> E'Language -> Bool)
-> (E'Language -> E'Language -> Bool)
-> (E'Language -> E'Language -> E'Language)
-> (E'Language -> E'Language -> E'Language)
-> Ord E'Language
E'Language -> E'Language -> Bool
E'Language -> E'Language -> Ordering
E'Language -> E'Language -> E'Language
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Language -> E'Language -> Ordering
compare :: E'Language -> E'Language -> Ordering
$c< :: E'Language -> E'Language -> Bool
< :: E'Language -> E'Language -> Bool
$c<= :: E'Language -> E'Language -> Bool
<= :: E'Language -> E'Language -> Bool
$c> :: E'Language -> E'Language -> Bool
> :: E'Language -> E'Language -> Bool
$c>= :: E'Language -> E'Language -> Bool
>= :: E'Language -> E'Language -> Bool
$cmax :: E'Language -> E'Language -> E'Language
max :: E'Language -> E'Language -> E'Language
$cmin :: E'Language -> E'Language -> E'Language
min :: E'Language -> E'Language -> E'Language
P.Ord, E'Language
E'Language -> E'Language -> Bounded E'Language
forall a. a -> a -> Bounded a
$cminBound :: E'Language
minBound :: E'Language
$cmaxBound :: E'Language
maxBound :: E'Language
P.Bounded, Int -> E'Language
E'Language -> Int
E'Language -> [E'Language]
E'Language -> E'Language
E'Language -> E'Language -> [E'Language]
E'Language -> E'Language -> E'Language -> [E'Language]
(E'Language -> E'Language)
-> (E'Language -> E'Language)
-> (Int -> E'Language)
-> (E'Language -> Int)
-> (E'Language -> [E'Language])
-> (E'Language -> E'Language -> [E'Language])
-> (E'Language -> E'Language -> [E'Language])
-> (E'Language -> E'Language -> E'Language -> [E'Language])
-> Enum E'Language
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Language -> E'Language
succ :: E'Language -> E'Language
$cpred :: E'Language -> E'Language
pred :: E'Language -> E'Language
$ctoEnum :: Int -> E'Language
toEnum :: Int -> E'Language
$cfromEnum :: E'Language -> Int
fromEnum :: E'Language -> Int
$cenumFrom :: E'Language -> [E'Language]
enumFrom :: E'Language -> [E'Language]
$cenumFromThen :: E'Language -> E'Language -> [E'Language]
enumFromThen :: E'Language -> E'Language -> [E'Language]
$cenumFromTo :: E'Language -> E'Language -> [E'Language]
enumFromTo :: E'Language -> E'Language -> [E'Language]
$cenumFromThenTo :: E'Language -> E'Language -> E'Language -> [E'Language]
enumFromThenTo :: E'Language -> E'Language -> E'Language -> [E'Language]
P.Enum)

instance A.ToJSON E'Language where toJSON :: E'Language -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Language -> Text) -> E'Language -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Language -> Text
fromE'Language
instance A.FromJSON E'Language where parseJSON :: Value -> Parser E'Language
parseJSON Value
o = ([Char] -> Parser E'Language)
-> (E'Language -> Parser E'Language)
-> Either [Char] E'Language
-> Parser E'Language
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Language
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Language -> Parser E'Language
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Language -> Parser E'Language)
-> (E'Language -> E'Language) -> E'Language -> Parser E'Language
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Language -> E'Language
forall a. a -> a
P.id) (Either [Char] E'Language -> Parser E'Language)
-> (Text -> Either [Char] E'Language) -> Text -> Parser E'Language
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Language
toE'Language (Text -> Parser E'Language) -> Parser Text -> Parser E'Language
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Language where toQueryParam :: E'Language -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Language -> Text) -> E'Language -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Language -> Text
fromE'Language
instance WH.FromHttpApiData E'Language where parseQueryParam :: Text -> Either Text E'Language
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Language) -> Either Text E'Language
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'Language -> Either Text E'Language
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Language -> Either Text E'Language)
-> (Text -> Either [Char] E'Language)
-> Text
-> Either Text E'Language
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Language
toE'Language
instance MimeRender MimeMultipartFormData E'Language where mimeRender :: Proxy MimeMultipartFormData -> E'Language -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Language -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Language' enum
fromE'Language :: E'Language -> Text
fromE'Language :: E'Language -> Text
fromE'Language = \case
  E'Language
E'Language'LANGUAGE_UNSPECIFIED -> Text
"LANGUAGE_UNSPECIFIED"
  E'Language
E'Language'PYTHON -> Text
"PYTHON"

-- | parse 'E'Language' enum
toE'Language :: Text -> P.Either String E'Language
toE'Language :: Text -> Either [Char] E'Language
toE'Language = \case
  Text
"LANGUAGE_UNSPECIFIED" -> E'Language -> Either [Char] E'Language
forall a b. b -> Either a b
P.Right E'Language
E'Language'LANGUAGE_UNSPECIFIED
  Text
"PYTHON" -> E'Language -> Either [Char] E'Language
forall a b. b -> Either a b
P.Right E'Language
E'Language'PYTHON
  Text
s -> [Char] -> Either [Char] E'Language
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Language)
-> [Char] -> Either [Char] E'Language
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Language: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'MediaResolution

{- | Enum of 'Text' .
Optional. If specified, the media resolution specified will be used.
-}
data E'MediaResolution
  = -- | @"MEDIA_RESOLUTION_UNSPECIFIED"@
    E'MediaResolution'UNSPECIFIED
  | -- | @"MEDIA_RESOLUTION_LOW"@
    E'MediaResolution'LOW
  | -- | @"MEDIA_RESOLUTION_MEDIUM"@
    E'MediaResolution'MEDIUM
  | -- | @"MEDIA_RESOLUTION_HIGH"@
    E'MediaResolution'HIGH
  deriving (Int -> E'MediaResolution -> ShowS
[E'MediaResolution] -> ShowS
E'MediaResolution -> [Char]
(Int -> E'MediaResolution -> ShowS)
-> (E'MediaResolution -> [Char])
-> ([E'MediaResolution] -> ShowS)
-> Show E'MediaResolution
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'MediaResolution -> ShowS
showsPrec :: Int -> E'MediaResolution -> ShowS
$cshow :: E'MediaResolution -> [Char]
show :: E'MediaResolution -> [Char]
$cshowList :: [E'MediaResolution] -> ShowS
showList :: [E'MediaResolution] -> ShowS
P.Show, E'MediaResolution -> E'MediaResolution -> Bool
(E'MediaResolution -> E'MediaResolution -> Bool)
-> (E'MediaResolution -> E'MediaResolution -> Bool)
-> Eq E'MediaResolution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'MediaResolution -> E'MediaResolution -> Bool
== :: E'MediaResolution -> E'MediaResolution -> Bool
$c/= :: E'MediaResolution -> E'MediaResolution -> Bool
/= :: E'MediaResolution -> E'MediaResolution -> Bool
P.Eq, P.Typeable, Eq E'MediaResolution
Eq E'MediaResolution =>
(E'MediaResolution -> E'MediaResolution -> Ordering)
-> (E'MediaResolution -> E'MediaResolution -> Bool)
-> (E'MediaResolution -> E'MediaResolution -> Bool)
-> (E'MediaResolution -> E'MediaResolution -> Bool)
-> (E'MediaResolution -> E'MediaResolution -> Bool)
-> (E'MediaResolution -> E'MediaResolution -> E'MediaResolution)
-> (E'MediaResolution -> E'MediaResolution -> E'MediaResolution)
-> Ord E'MediaResolution
E'MediaResolution -> E'MediaResolution -> Bool
E'MediaResolution -> E'MediaResolution -> Ordering
E'MediaResolution -> E'MediaResolution -> E'MediaResolution
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'MediaResolution -> E'MediaResolution -> Ordering
compare :: E'MediaResolution -> E'MediaResolution -> Ordering
$c< :: E'MediaResolution -> E'MediaResolution -> Bool
< :: E'MediaResolution -> E'MediaResolution -> Bool
$c<= :: E'MediaResolution -> E'MediaResolution -> Bool
<= :: E'MediaResolution -> E'MediaResolution -> Bool
$c> :: E'MediaResolution -> E'MediaResolution -> Bool
> :: E'MediaResolution -> E'MediaResolution -> Bool
$c>= :: E'MediaResolution -> E'MediaResolution -> Bool
>= :: E'MediaResolution -> E'MediaResolution -> Bool
$cmax :: E'MediaResolution -> E'MediaResolution -> E'MediaResolution
max :: E'MediaResolution -> E'MediaResolution -> E'MediaResolution
$cmin :: E'MediaResolution -> E'MediaResolution -> E'MediaResolution
min :: E'MediaResolution -> E'MediaResolution -> E'MediaResolution
P.Ord, E'MediaResolution
E'MediaResolution -> E'MediaResolution -> Bounded E'MediaResolution
forall a. a -> a -> Bounded a
$cminBound :: E'MediaResolution
minBound :: E'MediaResolution
$cmaxBound :: E'MediaResolution
maxBound :: E'MediaResolution
P.Bounded, Int -> E'MediaResolution
E'MediaResolution -> Int
E'MediaResolution -> [E'MediaResolution]
E'MediaResolution -> E'MediaResolution
E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
E'MediaResolution
-> E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
(E'MediaResolution -> E'MediaResolution)
-> (E'MediaResolution -> E'MediaResolution)
-> (Int -> E'MediaResolution)
-> (E'MediaResolution -> Int)
-> (E'MediaResolution -> [E'MediaResolution])
-> (E'MediaResolution -> E'MediaResolution -> [E'MediaResolution])
-> (E'MediaResolution -> E'MediaResolution -> [E'MediaResolution])
-> (E'MediaResolution
    -> E'MediaResolution -> E'MediaResolution -> [E'MediaResolution])
-> Enum E'MediaResolution
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'MediaResolution -> E'MediaResolution
succ :: E'MediaResolution -> E'MediaResolution
$cpred :: E'MediaResolution -> E'MediaResolution
pred :: E'MediaResolution -> E'MediaResolution
$ctoEnum :: Int -> E'MediaResolution
toEnum :: Int -> E'MediaResolution
$cfromEnum :: E'MediaResolution -> Int
fromEnum :: E'MediaResolution -> Int
$cenumFrom :: E'MediaResolution -> [E'MediaResolution]
enumFrom :: E'MediaResolution -> [E'MediaResolution]
$cenumFromThen :: E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
enumFromThen :: E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
$cenumFromTo :: E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
enumFromTo :: E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
$cenumFromThenTo :: E'MediaResolution
-> E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
enumFromThenTo :: E'MediaResolution
-> E'MediaResolution -> E'MediaResolution -> [E'MediaResolution]
P.Enum)

instance A.ToJSON E'MediaResolution where toJSON :: E'MediaResolution -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'MediaResolution -> Text) -> E'MediaResolution -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'MediaResolution -> Text
fromE'MediaResolution
instance A.FromJSON E'MediaResolution where parseJSON :: Value -> Parser E'MediaResolution
parseJSON Value
o = ([Char] -> Parser E'MediaResolution)
-> (E'MediaResolution -> Parser E'MediaResolution)
-> Either [Char] E'MediaResolution
-> Parser E'MediaResolution
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'MediaResolution
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'MediaResolution -> Parser E'MediaResolution
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'MediaResolution -> Parser E'MediaResolution)
-> (E'MediaResolution -> E'MediaResolution)
-> E'MediaResolution
-> Parser E'MediaResolution
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'MediaResolution -> E'MediaResolution
forall a. a -> a
P.id) (Either [Char] E'MediaResolution -> Parser E'MediaResolution)
-> (Text -> Either [Char] E'MediaResolution)
-> Text
-> Parser E'MediaResolution
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'MediaResolution
toE'MediaResolution (Text -> Parser E'MediaResolution)
-> Parser Text -> Parser E'MediaResolution
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'MediaResolution where toQueryParam :: E'MediaResolution -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text)
-> (E'MediaResolution -> Text) -> E'MediaResolution -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'MediaResolution -> Text
fromE'MediaResolution
instance WH.FromHttpApiData E'MediaResolution where parseQueryParam :: Text -> Either Text E'MediaResolution
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'MediaResolution)
-> Either Text E'MediaResolution
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'MediaResolution -> Either Text E'MediaResolution
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'MediaResolution -> Either Text E'MediaResolution)
-> (Text -> Either [Char] E'MediaResolution)
-> Text
-> Either Text E'MediaResolution
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'MediaResolution
toE'MediaResolution
instance MimeRender MimeMultipartFormData E'MediaResolution where mimeRender :: Proxy MimeMultipartFormData -> E'MediaResolution -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'MediaResolution -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'MediaResolution' enum
fromE'MediaResolution :: E'MediaResolution -> Text
fromE'MediaResolution :: E'MediaResolution -> Text
fromE'MediaResolution = \case
  E'MediaResolution
E'MediaResolution'UNSPECIFIED -> Text
"MEDIA_RESOLUTION_UNSPECIFIED"
  E'MediaResolution
E'MediaResolution'LOW -> Text
"MEDIA_RESOLUTION_LOW"
  E'MediaResolution
E'MediaResolution'MEDIUM -> Text
"MEDIA_RESOLUTION_MEDIUM"
  E'MediaResolution
E'MediaResolution'HIGH -> Text
"MEDIA_RESOLUTION_HIGH"

-- | parse 'E'MediaResolution' enum
toE'MediaResolution :: Text -> P.Either String E'MediaResolution
toE'MediaResolution :: Text -> Either [Char] E'MediaResolution
toE'MediaResolution = \case
  Text
"MEDIA_RESOLUTION_UNSPECIFIED" -> E'MediaResolution -> Either [Char] E'MediaResolution
forall a b. b -> Either a b
P.Right E'MediaResolution
E'MediaResolution'UNSPECIFIED
  Text
"MEDIA_RESOLUTION_LOW" -> E'MediaResolution -> Either [Char] E'MediaResolution
forall a b. b -> Either a b
P.Right E'MediaResolution
E'MediaResolution'LOW
  Text
"MEDIA_RESOLUTION_MEDIUM" -> E'MediaResolution -> Either [Char] E'MediaResolution
forall a b. b -> Either a b
P.Right E'MediaResolution
E'MediaResolution'MEDIUM
  Text
"MEDIA_RESOLUTION_HIGH" -> E'MediaResolution -> Either [Char] E'MediaResolution
forall a b. b -> Either a b
P.Right E'MediaResolution
E'MediaResolution'HIGH
  Text
s -> [Char] -> Either [Char] E'MediaResolution
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'MediaResolution)
-> [Char] -> Either [Char] E'MediaResolution
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'MediaResolution: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Mode

{- | Enum of 'Text' .
The mode of the predictor to be used in dynamic retrieval.
-}
data E'Mode
  = -- | @"MODE_UNSPECIFIED"@
    E'Mode'UNSPECIFIED
  | -- | @"MODE_DYNAMIC"@
    E'Mode'DYNAMIC
  deriving (Int -> E'Mode -> ShowS
[E'Mode] -> ShowS
E'Mode -> [Char]
(Int -> E'Mode -> ShowS)
-> (E'Mode -> [Char]) -> ([E'Mode] -> ShowS) -> Show E'Mode
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Mode -> ShowS
showsPrec :: Int -> E'Mode -> ShowS
$cshow :: E'Mode -> [Char]
show :: E'Mode -> [Char]
$cshowList :: [E'Mode] -> ShowS
showList :: [E'Mode] -> ShowS
P.Show, E'Mode -> E'Mode -> Bool
(E'Mode -> E'Mode -> Bool)
-> (E'Mode -> E'Mode -> Bool) -> Eq E'Mode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Mode -> E'Mode -> Bool
== :: E'Mode -> E'Mode -> Bool
$c/= :: E'Mode -> E'Mode -> Bool
/= :: E'Mode -> E'Mode -> Bool
P.Eq, P.Typeable, Eq E'Mode
Eq E'Mode =>
(E'Mode -> E'Mode -> Ordering)
-> (E'Mode -> E'Mode -> Bool)
-> (E'Mode -> E'Mode -> Bool)
-> (E'Mode -> E'Mode -> Bool)
-> (E'Mode -> E'Mode -> Bool)
-> (E'Mode -> E'Mode -> E'Mode)
-> (E'Mode -> E'Mode -> E'Mode)
-> Ord E'Mode
E'Mode -> E'Mode -> Bool
E'Mode -> E'Mode -> Ordering
E'Mode -> E'Mode -> E'Mode
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Mode -> E'Mode -> Ordering
compare :: E'Mode -> E'Mode -> Ordering
$c< :: E'Mode -> E'Mode -> Bool
< :: E'Mode -> E'Mode -> Bool
$c<= :: E'Mode -> E'Mode -> Bool
<= :: E'Mode -> E'Mode -> Bool
$c> :: E'Mode -> E'Mode -> Bool
> :: E'Mode -> E'Mode -> Bool
$c>= :: E'Mode -> E'Mode -> Bool
>= :: E'Mode -> E'Mode -> Bool
$cmax :: E'Mode -> E'Mode -> E'Mode
max :: E'Mode -> E'Mode -> E'Mode
$cmin :: E'Mode -> E'Mode -> E'Mode
min :: E'Mode -> E'Mode -> E'Mode
P.Ord, E'Mode
E'Mode -> E'Mode -> Bounded E'Mode
forall a. a -> a -> Bounded a
$cminBound :: E'Mode
minBound :: E'Mode
$cmaxBound :: E'Mode
maxBound :: E'Mode
P.Bounded, Int -> E'Mode
E'Mode -> Int
E'Mode -> [E'Mode]
E'Mode -> E'Mode
E'Mode -> E'Mode -> [E'Mode]
E'Mode -> E'Mode -> E'Mode -> [E'Mode]
(E'Mode -> E'Mode)
-> (E'Mode -> E'Mode)
-> (Int -> E'Mode)
-> (E'Mode -> Int)
-> (E'Mode -> [E'Mode])
-> (E'Mode -> E'Mode -> [E'Mode])
-> (E'Mode -> E'Mode -> [E'Mode])
-> (E'Mode -> E'Mode -> E'Mode -> [E'Mode])
-> Enum E'Mode
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Mode -> E'Mode
succ :: E'Mode -> E'Mode
$cpred :: E'Mode -> E'Mode
pred :: E'Mode -> E'Mode
$ctoEnum :: Int -> E'Mode
toEnum :: Int -> E'Mode
$cfromEnum :: E'Mode -> Int
fromEnum :: E'Mode -> Int
$cenumFrom :: E'Mode -> [E'Mode]
enumFrom :: E'Mode -> [E'Mode]
$cenumFromThen :: E'Mode -> E'Mode -> [E'Mode]
enumFromThen :: E'Mode -> E'Mode -> [E'Mode]
$cenumFromTo :: E'Mode -> E'Mode -> [E'Mode]
enumFromTo :: E'Mode -> E'Mode -> [E'Mode]
$cenumFromThenTo :: E'Mode -> E'Mode -> E'Mode -> [E'Mode]
enumFromThenTo :: E'Mode -> E'Mode -> E'Mode -> [E'Mode]
P.Enum)

instance A.ToJSON E'Mode where toJSON :: E'Mode -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Mode -> Text) -> E'Mode -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Mode -> Text
fromE'Mode
instance A.FromJSON E'Mode where parseJSON :: Value -> Parser E'Mode
parseJSON Value
o = ([Char] -> Parser E'Mode)
-> (E'Mode -> Parser E'Mode)
-> Either [Char] E'Mode
-> Parser E'Mode
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Mode
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Mode -> Parser E'Mode
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Mode -> Parser E'Mode)
-> (E'Mode -> E'Mode) -> E'Mode -> Parser E'Mode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Mode -> E'Mode
forall a. a -> a
P.id) (Either [Char] E'Mode -> Parser E'Mode)
-> (Text -> Either [Char] E'Mode) -> Text -> Parser E'Mode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Mode
toE'Mode (Text -> Parser E'Mode) -> Parser Text -> Parser E'Mode
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Mode where toQueryParam :: E'Mode -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Mode -> Text) -> E'Mode -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Mode -> Text
fromE'Mode
instance WH.FromHttpApiData E'Mode where parseQueryParam :: Text -> Either Text E'Mode
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Mode) -> Either Text E'Mode
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'Mode -> Either Text E'Mode
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Mode -> Either Text E'Mode)
-> (Text -> Either [Char] E'Mode) -> Text -> Either Text E'Mode
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Mode
toE'Mode
instance MimeRender MimeMultipartFormData E'Mode where mimeRender :: Proxy MimeMultipartFormData -> E'Mode -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Mode -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Mode' enum
fromE'Mode :: E'Mode -> Text
fromE'Mode :: E'Mode -> Text
fromE'Mode = \case
  E'Mode
E'Mode'UNSPECIFIED -> Text
"MODE_UNSPECIFIED"
  E'Mode
E'Mode'DYNAMIC -> Text
"MODE_DYNAMIC"

-- | parse 'E'Mode' enum
toE'Mode :: Text -> P.Either String E'Mode
toE'Mode :: Text -> Either [Char] E'Mode
toE'Mode = \case
  Text
"MODE_UNSPECIFIED" -> E'Mode -> Either [Char] E'Mode
forall a b. b -> Either a b
P.Right E'Mode
E'Mode'UNSPECIFIED
  Text
"MODE_DYNAMIC" -> E'Mode -> Either [Char] E'Mode
forall a b. b -> Either a b
P.Right E'Mode
E'Mode'DYNAMIC
  Text
s -> [Char] -> Either [Char] E'Mode
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Mode) -> [Char] -> Either [Char] E'Mode
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Mode: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Mode2

{- | Enum of 'Text' .
Optional. Specifies the mode in which function calling should execute. If unspecified, the default value will be set to AUTO.
-}
data E'Mode2
  = -- | @"MODE_UNSPECIFIED"@
    E'Mode2'MODE_UNSPECIFIED
  | -- | @"AUTO"@
    E'Mode2'AUTO
  | -- | @"ANY"@
    E'Mode2'ANY
  | -- | @"NONE"@
    E'Mode2'NONE
  | -- | @"VALIDATED"@
    E'Mode2'VALIDATED
  deriving (Int -> E'Mode2 -> ShowS
[E'Mode2] -> ShowS
E'Mode2 -> [Char]
(Int -> E'Mode2 -> ShowS)
-> (E'Mode2 -> [Char]) -> ([E'Mode2] -> ShowS) -> Show E'Mode2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Mode2 -> ShowS
showsPrec :: Int -> E'Mode2 -> ShowS
$cshow :: E'Mode2 -> [Char]
show :: E'Mode2 -> [Char]
$cshowList :: [E'Mode2] -> ShowS
showList :: [E'Mode2] -> ShowS
P.Show, E'Mode2 -> E'Mode2 -> Bool
(E'Mode2 -> E'Mode2 -> Bool)
-> (E'Mode2 -> E'Mode2 -> Bool) -> Eq E'Mode2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Mode2 -> E'Mode2 -> Bool
== :: E'Mode2 -> E'Mode2 -> Bool
$c/= :: E'Mode2 -> E'Mode2 -> Bool
/= :: E'Mode2 -> E'Mode2 -> Bool
P.Eq, P.Typeable, Eq E'Mode2
Eq E'Mode2 =>
(E'Mode2 -> E'Mode2 -> Ordering)
-> (E'Mode2 -> E'Mode2 -> Bool)
-> (E'Mode2 -> E'Mode2 -> Bool)
-> (E'Mode2 -> E'Mode2 -> Bool)
-> (E'Mode2 -> E'Mode2 -> Bool)
-> (E'Mode2 -> E'Mode2 -> E'Mode2)
-> (E'Mode2 -> E'Mode2 -> E'Mode2)
-> Ord E'Mode2
E'Mode2 -> E'Mode2 -> Bool
E'Mode2 -> E'Mode2 -> Ordering
E'Mode2 -> E'Mode2 -> E'Mode2
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Mode2 -> E'Mode2 -> Ordering
compare :: E'Mode2 -> E'Mode2 -> Ordering
$c< :: E'Mode2 -> E'Mode2 -> Bool
< :: E'Mode2 -> E'Mode2 -> Bool
$c<= :: E'Mode2 -> E'Mode2 -> Bool
<= :: E'Mode2 -> E'Mode2 -> Bool
$c> :: E'Mode2 -> E'Mode2 -> Bool
> :: E'Mode2 -> E'Mode2 -> Bool
$c>= :: E'Mode2 -> E'Mode2 -> Bool
>= :: E'Mode2 -> E'Mode2 -> Bool
$cmax :: E'Mode2 -> E'Mode2 -> E'Mode2
max :: E'Mode2 -> E'Mode2 -> E'Mode2
$cmin :: E'Mode2 -> E'Mode2 -> E'Mode2
min :: E'Mode2 -> E'Mode2 -> E'Mode2
P.Ord, E'Mode2
E'Mode2 -> E'Mode2 -> Bounded E'Mode2
forall a. a -> a -> Bounded a
$cminBound :: E'Mode2
minBound :: E'Mode2
$cmaxBound :: E'Mode2
maxBound :: E'Mode2
P.Bounded, Int -> E'Mode2
E'Mode2 -> Int
E'Mode2 -> [E'Mode2]
E'Mode2 -> E'Mode2
E'Mode2 -> E'Mode2 -> [E'Mode2]
E'Mode2 -> E'Mode2 -> E'Mode2 -> [E'Mode2]
(E'Mode2 -> E'Mode2)
-> (E'Mode2 -> E'Mode2)
-> (Int -> E'Mode2)
-> (E'Mode2 -> Int)
-> (E'Mode2 -> [E'Mode2])
-> (E'Mode2 -> E'Mode2 -> [E'Mode2])
-> (E'Mode2 -> E'Mode2 -> [E'Mode2])
-> (E'Mode2 -> E'Mode2 -> E'Mode2 -> [E'Mode2])
-> Enum E'Mode2
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Mode2 -> E'Mode2
succ :: E'Mode2 -> E'Mode2
$cpred :: E'Mode2 -> E'Mode2
pred :: E'Mode2 -> E'Mode2
$ctoEnum :: Int -> E'Mode2
toEnum :: Int -> E'Mode2
$cfromEnum :: E'Mode2 -> Int
fromEnum :: E'Mode2 -> Int
$cenumFrom :: E'Mode2 -> [E'Mode2]
enumFrom :: E'Mode2 -> [E'Mode2]
$cenumFromThen :: E'Mode2 -> E'Mode2 -> [E'Mode2]
enumFromThen :: E'Mode2 -> E'Mode2 -> [E'Mode2]
$cenumFromTo :: E'Mode2 -> E'Mode2 -> [E'Mode2]
enumFromTo :: E'Mode2 -> E'Mode2 -> [E'Mode2]
$cenumFromThenTo :: E'Mode2 -> E'Mode2 -> E'Mode2 -> [E'Mode2]
enumFromThenTo :: E'Mode2 -> E'Mode2 -> E'Mode2 -> [E'Mode2]
P.Enum)

instance A.ToJSON E'Mode2 where toJSON :: E'Mode2 -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Mode2 -> Text) -> E'Mode2 -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Mode2 -> Text
fromE'Mode2
instance A.FromJSON E'Mode2 where parseJSON :: Value -> Parser E'Mode2
parseJSON Value
o = ([Char] -> Parser E'Mode2)
-> (E'Mode2 -> Parser E'Mode2)
-> Either [Char] E'Mode2
-> Parser E'Mode2
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Mode2
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Mode2 -> Parser E'Mode2
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Mode2 -> Parser E'Mode2)
-> (E'Mode2 -> E'Mode2) -> E'Mode2 -> Parser E'Mode2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Mode2 -> E'Mode2
forall a. a -> a
P.id) (Either [Char] E'Mode2 -> Parser E'Mode2)
-> (Text -> Either [Char] E'Mode2) -> Text -> Parser E'Mode2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Mode2
toE'Mode2 (Text -> Parser E'Mode2) -> Parser Text -> Parser E'Mode2
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Mode2 where toQueryParam :: E'Mode2 -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Mode2 -> Text) -> E'Mode2 -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Mode2 -> Text
fromE'Mode2
instance WH.FromHttpApiData E'Mode2 where parseQueryParam :: Text -> Either Text E'Mode2
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Mode2) -> Either Text E'Mode2
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'Mode2 -> Either Text E'Mode2
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Mode2 -> Either Text E'Mode2)
-> (Text -> Either [Char] E'Mode2) -> Text -> Either Text E'Mode2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Mode2
toE'Mode2
instance MimeRender MimeMultipartFormData E'Mode2 where mimeRender :: Proxy MimeMultipartFormData -> E'Mode2 -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Mode2 -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Mode2' enum
fromE'Mode2 :: E'Mode2 -> Text
fromE'Mode2 :: E'Mode2 -> Text
fromE'Mode2 = \case
  E'Mode2
E'Mode2'MODE_UNSPECIFIED -> Text
"MODE_UNSPECIFIED"
  E'Mode2
E'Mode2'AUTO -> Text
"AUTO"
  E'Mode2
E'Mode2'ANY -> Text
"ANY"
  E'Mode2
E'Mode2'NONE -> Text
"NONE"
  E'Mode2
E'Mode2'VALIDATED -> Text
"VALIDATED"

-- | parse 'E'Mode2' enum
toE'Mode2 :: Text -> P.Either String E'Mode2
toE'Mode2 :: Text -> Either [Char] E'Mode2
toE'Mode2 = \case
  Text
"MODE_UNSPECIFIED" -> E'Mode2 -> Either [Char] E'Mode2
forall a b. b -> Either a b
P.Right E'Mode2
E'Mode2'MODE_UNSPECIFIED
  Text
"AUTO" -> E'Mode2 -> Either [Char] E'Mode2
forall a b. b -> Either a b
P.Right E'Mode2
E'Mode2'AUTO
  Text
"ANY" -> E'Mode2 -> Either [Char] E'Mode2
forall a b. b -> Either a b
P.Right E'Mode2
E'Mode2'ANY
  Text
"NONE" -> E'Mode2 -> Either [Char] E'Mode2
forall a b. b -> Either a b
P.Right E'Mode2
E'Mode2'NONE
  Text
"VALIDATED" -> E'Mode2 -> Either [Char] E'Mode2
forall a b. b -> Either a b
P.Right E'Mode2
E'Mode2'VALIDATED
  Text
s -> [Char] -> Either [Char] E'Mode2
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Mode2)
-> [Char] -> Either [Char] E'Mode2
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Mode2: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Operation

{- | Enum of 'Text' .
Required. Operator applied to the given key-value pair to trigger the condition.
-}
data E'Operation
  = -- | @"OPERATOR_UNSPECIFIED"@
    E'Operation'OPERATOR_UNSPECIFIED
  | -- | @"LESS"@
    E'Operation'LESS
  | -- | @"LESS_EQUAL"@
    E'Operation'LESS_EQUAL
  | -- | @"EQUAL"@
    E'Operation'EQUAL
  | -- | @"GREATER_EQUAL"@
    E'Operation'GREATER_EQUAL
  | -- | @"GREATER"@
    E'Operation'GREATER
  | -- | @"NOT_EQUAL"@
    E'Operation'NOT_EQUAL
  | -- | @"INCLUDES"@
    E'Operation'INCLUDES
  | -- | @"EXCLUDES"@
    E'Operation'EXCLUDES
  deriving (Int -> E'Operation -> ShowS
[E'Operation] -> ShowS
E'Operation -> [Char]
(Int -> E'Operation -> ShowS)
-> (E'Operation -> [Char])
-> ([E'Operation] -> ShowS)
-> Show E'Operation
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Operation -> ShowS
showsPrec :: Int -> E'Operation -> ShowS
$cshow :: E'Operation -> [Char]
show :: E'Operation -> [Char]
$cshowList :: [E'Operation] -> ShowS
showList :: [E'Operation] -> ShowS
P.Show, E'Operation -> E'Operation -> Bool
(E'Operation -> E'Operation -> Bool)
-> (E'Operation -> E'Operation -> Bool) -> Eq E'Operation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Operation -> E'Operation -> Bool
== :: E'Operation -> E'Operation -> Bool
$c/= :: E'Operation -> E'Operation -> Bool
/= :: E'Operation -> E'Operation -> Bool
P.Eq, P.Typeable, Eq E'Operation
Eq E'Operation =>
(E'Operation -> E'Operation -> Ordering)
-> (E'Operation -> E'Operation -> Bool)
-> (E'Operation -> E'Operation -> Bool)
-> (E'Operation -> E'Operation -> Bool)
-> (E'Operation -> E'Operation -> Bool)
-> (E'Operation -> E'Operation -> E'Operation)
-> (E'Operation -> E'Operation -> E'Operation)
-> Ord E'Operation
E'Operation -> E'Operation -> Bool
E'Operation -> E'Operation -> Ordering
E'Operation -> E'Operation -> E'Operation
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Operation -> E'Operation -> Ordering
compare :: E'Operation -> E'Operation -> Ordering
$c< :: E'Operation -> E'Operation -> Bool
< :: E'Operation -> E'Operation -> Bool
$c<= :: E'Operation -> E'Operation -> Bool
<= :: E'Operation -> E'Operation -> Bool
$c> :: E'Operation -> E'Operation -> Bool
> :: E'Operation -> E'Operation -> Bool
$c>= :: E'Operation -> E'Operation -> Bool
>= :: E'Operation -> E'Operation -> Bool
$cmax :: E'Operation -> E'Operation -> E'Operation
max :: E'Operation -> E'Operation -> E'Operation
$cmin :: E'Operation -> E'Operation -> E'Operation
min :: E'Operation -> E'Operation -> E'Operation
P.Ord, E'Operation
E'Operation -> E'Operation -> Bounded E'Operation
forall a. a -> a -> Bounded a
$cminBound :: E'Operation
minBound :: E'Operation
$cmaxBound :: E'Operation
maxBound :: E'Operation
P.Bounded, Int -> E'Operation
E'Operation -> Int
E'Operation -> [E'Operation]
E'Operation -> E'Operation
E'Operation -> E'Operation -> [E'Operation]
E'Operation -> E'Operation -> E'Operation -> [E'Operation]
(E'Operation -> E'Operation)
-> (E'Operation -> E'Operation)
-> (Int -> E'Operation)
-> (E'Operation -> Int)
-> (E'Operation -> [E'Operation])
-> (E'Operation -> E'Operation -> [E'Operation])
-> (E'Operation -> E'Operation -> [E'Operation])
-> (E'Operation -> E'Operation -> E'Operation -> [E'Operation])
-> Enum E'Operation
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Operation -> E'Operation
succ :: E'Operation -> E'Operation
$cpred :: E'Operation -> E'Operation
pred :: E'Operation -> E'Operation
$ctoEnum :: Int -> E'Operation
toEnum :: Int -> E'Operation
$cfromEnum :: E'Operation -> Int
fromEnum :: E'Operation -> Int
$cenumFrom :: E'Operation -> [E'Operation]
enumFrom :: E'Operation -> [E'Operation]
$cenumFromThen :: E'Operation -> E'Operation -> [E'Operation]
enumFromThen :: E'Operation -> E'Operation -> [E'Operation]
$cenumFromTo :: E'Operation -> E'Operation -> [E'Operation]
enumFromTo :: E'Operation -> E'Operation -> [E'Operation]
$cenumFromThenTo :: E'Operation -> E'Operation -> E'Operation -> [E'Operation]
enumFromThenTo :: E'Operation -> E'Operation -> E'Operation -> [E'Operation]
P.Enum)

instance A.ToJSON E'Operation where toJSON :: E'Operation -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Operation -> Text) -> E'Operation -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Operation -> Text
fromE'Operation
instance A.FromJSON E'Operation where parseJSON :: Value -> Parser E'Operation
parseJSON Value
o = ([Char] -> Parser E'Operation)
-> (E'Operation -> Parser E'Operation)
-> Either [Char] E'Operation
-> Parser E'Operation
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Operation
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Operation -> Parser E'Operation
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Operation -> Parser E'Operation)
-> (E'Operation -> E'Operation)
-> E'Operation
-> Parser E'Operation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Operation -> E'Operation
forall a. a -> a
P.id) (Either [Char] E'Operation -> Parser E'Operation)
-> (Text -> Either [Char] E'Operation)
-> Text
-> Parser E'Operation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Operation
toE'Operation (Text -> Parser E'Operation) -> Parser Text -> Parser E'Operation
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Operation where toQueryParam :: E'Operation -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Operation -> Text) -> E'Operation -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Operation -> Text
fromE'Operation
instance WH.FromHttpApiData E'Operation where parseQueryParam :: Text -> Either Text E'Operation
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Operation) -> Either Text E'Operation
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'Operation -> Either Text E'Operation
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Operation -> Either Text E'Operation)
-> (Text -> Either [Char] E'Operation)
-> Text
-> Either Text E'Operation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Operation
toE'Operation
instance MimeRender MimeMultipartFormData E'Operation where mimeRender :: Proxy MimeMultipartFormData -> E'Operation -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Operation -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Operation' enum
fromE'Operation :: E'Operation -> Text
fromE'Operation :: E'Operation -> Text
fromE'Operation = \case
  E'Operation
E'Operation'OPERATOR_UNSPECIFIED -> Text
"OPERATOR_UNSPECIFIED"
  E'Operation
E'Operation'LESS -> Text
"LESS"
  E'Operation
E'Operation'LESS_EQUAL -> Text
"LESS_EQUAL"
  E'Operation
E'Operation'EQUAL -> Text
"EQUAL"
  E'Operation
E'Operation'GREATER_EQUAL -> Text
"GREATER_EQUAL"
  E'Operation
E'Operation'GREATER -> Text
"GREATER"
  E'Operation
E'Operation'NOT_EQUAL -> Text
"NOT_EQUAL"
  E'Operation
E'Operation'INCLUDES -> Text
"INCLUDES"
  E'Operation
E'Operation'EXCLUDES -> Text
"EXCLUDES"

-- | parse 'E'Operation' enum
toE'Operation :: Text -> P.Either String E'Operation
toE'Operation :: Text -> Either [Char] E'Operation
toE'Operation = \case
  Text
"OPERATOR_UNSPECIFIED" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'OPERATOR_UNSPECIFIED
  Text
"LESS" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'LESS
  Text
"LESS_EQUAL" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'LESS_EQUAL
  Text
"EQUAL" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'EQUAL
  Text
"GREATER_EQUAL" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'GREATER_EQUAL
  Text
"GREATER" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'GREATER
  Text
"NOT_EQUAL" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'NOT_EQUAL
  Text
"INCLUDES" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'INCLUDES
  Text
"EXCLUDES" -> E'Operation -> Either [Char] E'Operation
forall a b. b -> Either a b
P.Right E'Operation
E'Operation'EXCLUDES
  Text
s -> [Char] -> Either [Char] E'Operation
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Operation)
-> [Char] -> Either [Char] E'Operation
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Operation: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Outcome

{- | Enum of 'Text' .
Required. Outcome of the code execution.
-}
data E'Outcome
  = -- | @"OUTCOME_UNSPECIFIED"@
    E'Outcome'UNSPECIFIED
  | -- | @"OUTCOME_OK"@
    E'Outcome'OK
  | -- | @"OUTCOME_FAILED"@
    E'Outcome'FAILED
  | -- | @"OUTCOME_DEADLINE_EXCEEDED"@
    E'Outcome'DEADLINE_EXCEEDED
  deriving (Int -> E'Outcome -> ShowS
[E'Outcome] -> ShowS
E'Outcome -> [Char]
(Int -> E'Outcome -> ShowS)
-> (E'Outcome -> [Char])
-> ([E'Outcome] -> ShowS)
-> Show E'Outcome
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Outcome -> ShowS
showsPrec :: Int -> E'Outcome -> ShowS
$cshow :: E'Outcome -> [Char]
show :: E'Outcome -> [Char]
$cshowList :: [E'Outcome] -> ShowS
showList :: [E'Outcome] -> ShowS
P.Show, E'Outcome -> E'Outcome -> Bool
(E'Outcome -> E'Outcome -> Bool)
-> (E'Outcome -> E'Outcome -> Bool) -> Eq E'Outcome
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Outcome -> E'Outcome -> Bool
== :: E'Outcome -> E'Outcome -> Bool
$c/= :: E'Outcome -> E'Outcome -> Bool
/= :: E'Outcome -> E'Outcome -> Bool
P.Eq, P.Typeable, Eq E'Outcome
Eq E'Outcome =>
(E'Outcome -> E'Outcome -> Ordering)
-> (E'Outcome -> E'Outcome -> Bool)
-> (E'Outcome -> E'Outcome -> Bool)
-> (E'Outcome -> E'Outcome -> Bool)
-> (E'Outcome -> E'Outcome -> Bool)
-> (E'Outcome -> E'Outcome -> E'Outcome)
-> (E'Outcome -> E'Outcome -> E'Outcome)
-> Ord E'Outcome
E'Outcome -> E'Outcome -> Bool
E'Outcome -> E'Outcome -> Ordering
E'Outcome -> E'Outcome -> E'Outcome
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Outcome -> E'Outcome -> Ordering
compare :: E'Outcome -> E'Outcome -> Ordering
$c< :: E'Outcome -> E'Outcome -> Bool
< :: E'Outcome -> E'Outcome -> Bool
$c<= :: E'Outcome -> E'Outcome -> Bool
<= :: E'Outcome -> E'Outcome -> Bool
$c> :: E'Outcome -> E'Outcome -> Bool
> :: E'Outcome -> E'Outcome -> Bool
$c>= :: E'Outcome -> E'Outcome -> Bool
>= :: E'Outcome -> E'Outcome -> Bool
$cmax :: E'Outcome -> E'Outcome -> E'Outcome
max :: E'Outcome -> E'Outcome -> E'Outcome
$cmin :: E'Outcome -> E'Outcome -> E'Outcome
min :: E'Outcome -> E'Outcome -> E'Outcome
P.Ord, E'Outcome
E'Outcome -> E'Outcome -> Bounded E'Outcome
forall a. a -> a -> Bounded a
$cminBound :: E'Outcome
minBound :: E'Outcome
$cmaxBound :: E'Outcome
maxBound :: E'Outcome
P.Bounded, Int -> E'Outcome
E'Outcome -> Int
E'Outcome -> [E'Outcome]
E'Outcome -> E'Outcome
E'Outcome -> E'Outcome -> [E'Outcome]
E'Outcome -> E'Outcome -> E'Outcome -> [E'Outcome]
(E'Outcome -> E'Outcome)
-> (E'Outcome -> E'Outcome)
-> (Int -> E'Outcome)
-> (E'Outcome -> Int)
-> (E'Outcome -> [E'Outcome])
-> (E'Outcome -> E'Outcome -> [E'Outcome])
-> (E'Outcome -> E'Outcome -> [E'Outcome])
-> (E'Outcome -> E'Outcome -> E'Outcome -> [E'Outcome])
-> Enum E'Outcome
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Outcome -> E'Outcome
succ :: E'Outcome -> E'Outcome
$cpred :: E'Outcome -> E'Outcome
pred :: E'Outcome -> E'Outcome
$ctoEnum :: Int -> E'Outcome
toEnum :: Int -> E'Outcome
$cfromEnum :: E'Outcome -> Int
fromEnum :: E'Outcome -> Int
$cenumFrom :: E'Outcome -> [E'Outcome]
enumFrom :: E'Outcome -> [E'Outcome]
$cenumFromThen :: E'Outcome -> E'Outcome -> [E'Outcome]
enumFromThen :: E'Outcome -> E'Outcome -> [E'Outcome]
$cenumFromTo :: E'Outcome -> E'Outcome -> [E'Outcome]
enumFromTo :: E'Outcome -> E'Outcome -> [E'Outcome]
$cenumFromThenTo :: E'Outcome -> E'Outcome -> E'Outcome -> [E'Outcome]
enumFromThenTo :: E'Outcome -> E'Outcome -> E'Outcome -> [E'Outcome]
P.Enum)

instance A.ToJSON E'Outcome where toJSON :: E'Outcome -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Outcome -> Text) -> E'Outcome -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Outcome -> Text
fromE'Outcome
instance A.FromJSON E'Outcome where parseJSON :: Value -> Parser E'Outcome
parseJSON Value
o = ([Char] -> Parser E'Outcome)
-> (E'Outcome -> Parser E'Outcome)
-> Either [Char] E'Outcome
-> Parser E'Outcome
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Outcome
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Outcome -> Parser E'Outcome
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Outcome -> Parser E'Outcome)
-> (E'Outcome -> E'Outcome) -> E'Outcome -> Parser E'Outcome
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Outcome -> E'Outcome
forall a. a -> a
P.id) (Either [Char] E'Outcome -> Parser E'Outcome)
-> (Text -> Either [Char] E'Outcome) -> Text -> Parser E'Outcome
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Outcome
toE'Outcome (Text -> Parser E'Outcome) -> Parser Text -> Parser E'Outcome
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Outcome where toQueryParam :: E'Outcome -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Outcome -> Text) -> E'Outcome -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Outcome -> Text
fromE'Outcome
instance WH.FromHttpApiData E'Outcome where parseQueryParam :: Text -> Either Text E'Outcome
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Outcome) -> Either Text E'Outcome
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'Outcome -> Either Text E'Outcome
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Outcome -> Either Text E'Outcome)
-> (Text -> Either [Char] E'Outcome)
-> Text
-> Either Text E'Outcome
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Outcome
toE'Outcome
instance MimeRender MimeMultipartFormData E'Outcome where mimeRender :: Proxy MimeMultipartFormData -> E'Outcome -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Outcome -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Outcome' enum
fromE'Outcome :: E'Outcome -> Text
fromE'Outcome :: E'Outcome -> Text
fromE'Outcome = \case
  E'Outcome
E'Outcome'UNSPECIFIED -> Text
"OUTCOME_UNSPECIFIED"
  E'Outcome
E'Outcome'OK -> Text
"OUTCOME_OK"
  E'Outcome
E'Outcome'FAILED -> Text
"OUTCOME_FAILED"
  E'Outcome
E'Outcome'DEADLINE_EXCEEDED -> Text
"OUTCOME_DEADLINE_EXCEEDED"

-- | parse 'E'Outcome' enum
toE'Outcome :: Text -> P.Either String E'Outcome
toE'Outcome :: Text -> Either [Char] E'Outcome
toE'Outcome = \case
  Text
"OUTCOME_UNSPECIFIED" -> E'Outcome -> Either [Char] E'Outcome
forall a b. b -> Either a b
P.Right E'Outcome
E'Outcome'UNSPECIFIED
  Text
"OUTCOME_OK" -> E'Outcome -> Either [Char] E'Outcome
forall a b. b -> Either a b
P.Right E'Outcome
E'Outcome'OK
  Text
"OUTCOME_FAILED" -> E'Outcome -> Either [Char] E'Outcome
forall a b. b -> Either a b
P.Right E'Outcome
E'Outcome'FAILED
  Text
"OUTCOME_DEADLINE_EXCEEDED" -> E'Outcome -> Either [Char] E'Outcome
forall a b. b -> Either a b
P.Right E'Outcome
E'Outcome'DEADLINE_EXCEEDED
  Text
s -> [Char] -> Either [Char] E'Outcome
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Outcome)
-> [Char] -> Either [Char] E'Outcome
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Outcome: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Probability

{- | Enum of 'Text' .
Required. The probability of harm for this content.
-}
data E'Probability
  = -- | @"HARM_PROBABILITY_UNSPECIFIED"@
    E'Probability'HARM_PROBABILITY_UNSPECIFIED
  | -- | @"NEGLIGIBLE"@
    E'Probability'NEGLIGIBLE
  | -- | @"LOW"@
    E'Probability'LOW
  | -- | @"MEDIUM"@
    E'Probability'MEDIUM
  | -- | @"HIGH"@
    E'Probability'HIGH
  deriving (Int -> E'Probability -> ShowS
[E'Probability] -> ShowS
E'Probability -> [Char]
(Int -> E'Probability -> ShowS)
-> (E'Probability -> [Char])
-> ([E'Probability] -> ShowS)
-> Show E'Probability
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Probability -> ShowS
showsPrec :: Int -> E'Probability -> ShowS
$cshow :: E'Probability -> [Char]
show :: E'Probability -> [Char]
$cshowList :: [E'Probability] -> ShowS
showList :: [E'Probability] -> ShowS
P.Show, E'Probability -> E'Probability -> Bool
(E'Probability -> E'Probability -> Bool)
-> (E'Probability -> E'Probability -> Bool) -> Eq E'Probability
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Probability -> E'Probability -> Bool
== :: E'Probability -> E'Probability -> Bool
$c/= :: E'Probability -> E'Probability -> Bool
/= :: E'Probability -> E'Probability -> Bool
P.Eq, P.Typeable, Eq E'Probability
Eq E'Probability =>
(E'Probability -> E'Probability -> Ordering)
-> (E'Probability -> E'Probability -> Bool)
-> (E'Probability -> E'Probability -> Bool)
-> (E'Probability -> E'Probability -> Bool)
-> (E'Probability -> E'Probability -> Bool)
-> (E'Probability -> E'Probability -> E'Probability)
-> (E'Probability -> E'Probability -> E'Probability)
-> Ord E'Probability
E'Probability -> E'Probability -> Bool
E'Probability -> E'Probability -> Ordering
E'Probability -> E'Probability -> E'Probability
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Probability -> E'Probability -> Ordering
compare :: E'Probability -> E'Probability -> Ordering
$c< :: E'Probability -> E'Probability -> Bool
< :: E'Probability -> E'Probability -> Bool
$c<= :: E'Probability -> E'Probability -> Bool
<= :: E'Probability -> E'Probability -> Bool
$c> :: E'Probability -> E'Probability -> Bool
> :: E'Probability -> E'Probability -> Bool
$c>= :: E'Probability -> E'Probability -> Bool
>= :: E'Probability -> E'Probability -> Bool
$cmax :: E'Probability -> E'Probability -> E'Probability
max :: E'Probability -> E'Probability -> E'Probability
$cmin :: E'Probability -> E'Probability -> E'Probability
min :: E'Probability -> E'Probability -> E'Probability
P.Ord, E'Probability
E'Probability -> E'Probability -> Bounded E'Probability
forall a. a -> a -> Bounded a
$cminBound :: E'Probability
minBound :: E'Probability
$cmaxBound :: E'Probability
maxBound :: E'Probability
P.Bounded, Int -> E'Probability
E'Probability -> Int
E'Probability -> [E'Probability]
E'Probability -> E'Probability
E'Probability -> E'Probability -> [E'Probability]
E'Probability -> E'Probability -> E'Probability -> [E'Probability]
(E'Probability -> E'Probability)
-> (E'Probability -> E'Probability)
-> (Int -> E'Probability)
-> (E'Probability -> Int)
-> (E'Probability -> [E'Probability])
-> (E'Probability -> E'Probability -> [E'Probability])
-> (E'Probability -> E'Probability -> [E'Probability])
-> (E'Probability
    -> E'Probability -> E'Probability -> [E'Probability])
-> Enum E'Probability
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Probability -> E'Probability
succ :: E'Probability -> E'Probability
$cpred :: E'Probability -> E'Probability
pred :: E'Probability -> E'Probability
$ctoEnum :: Int -> E'Probability
toEnum :: Int -> E'Probability
$cfromEnum :: E'Probability -> Int
fromEnum :: E'Probability -> Int
$cenumFrom :: E'Probability -> [E'Probability]
enumFrom :: E'Probability -> [E'Probability]
$cenumFromThen :: E'Probability -> E'Probability -> [E'Probability]
enumFromThen :: E'Probability -> E'Probability -> [E'Probability]
$cenumFromTo :: E'Probability -> E'Probability -> [E'Probability]
enumFromTo :: E'Probability -> E'Probability -> [E'Probability]
$cenumFromThenTo :: E'Probability -> E'Probability -> E'Probability -> [E'Probability]
enumFromThenTo :: E'Probability -> E'Probability -> E'Probability -> [E'Probability]
P.Enum)

instance A.ToJSON E'Probability where toJSON :: E'Probability -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'Probability -> Text) -> E'Probability -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Probability -> Text
fromE'Probability
instance A.FromJSON E'Probability where parseJSON :: Value -> Parser E'Probability
parseJSON Value
o = ([Char] -> Parser E'Probability)
-> (E'Probability -> Parser E'Probability)
-> Either [Char] E'Probability
-> Parser E'Probability
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Probability
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Probability -> Parser E'Probability
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Probability -> Parser E'Probability)
-> (E'Probability -> E'Probability)
-> E'Probability
-> Parser E'Probability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Probability -> E'Probability
forall a. a -> a
P.id) (Either [Char] E'Probability -> Parser E'Probability)
-> (Text -> Either [Char] E'Probability)
-> Text
-> Parser E'Probability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Probability
toE'Probability (Text -> Parser E'Probability)
-> Parser Text -> Parser E'Probability
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Probability where toQueryParam :: E'Probability -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Probability -> Text) -> E'Probability -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Probability -> Text
fromE'Probability
instance WH.FromHttpApiData E'Probability where parseQueryParam :: Text -> Either Text E'Probability
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Probability) -> Either Text E'Probability
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'Probability -> Either Text E'Probability
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Probability -> Either Text E'Probability)
-> (Text -> Either [Char] E'Probability)
-> Text
-> Either Text E'Probability
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Probability
toE'Probability
instance MimeRender MimeMultipartFormData E'Probability where mimeRender :: Proxy MimeMultipartFormData -> E'Probability -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Probability -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Probability' enum
fromE'Probability :: E'Probability -> Text
fromE'Probability :: E'Probability -> Text
fromE'Probability = \case
  E'Probability
E'Probability'HARM_PROBABILITY_UNSPECIFIED -> Text
"HARM_PROBABILITY_UNSPECIFIED"
  E'Probability
E'Probability'NEGLIGIBLE -> Text
"NEGLIGIBLE"
  E'Probability
E'Probability'LOW -> Text
"LOW"
  E'Probability
E'Probability'MEDIUM -> Text
"MEDIUM"
  E'Probability
E'Probability'HIGH -> Text
"HIGH"

-- | parse 'E'Probability' enum
toE'Probability :: Text -> P.Either String E'Probability
toE'Probability :: Text -> Either [Char] E'Probability
toE'Probability = \case
  Text
"HARM_PROBABILITY_UNSPECIFIED" -> E'Probability -> Either [Char] E'Probability
forall a b. b -> Either a b
P.Right E'Probability
E'Probability'HARM_PROBABILITY_UNSPECIFIED
  Text
"NEGLIGIBLE" -> E'Probability -> Either [Char] E'Probability
forall a b. b -> Either a b
P.Right E'Probability
E'Probability'NEGLIGIBLE
  Text
"LOW" -> E'Probability -> Either [Char] E'Probability
forall a b. b -> Either a b
P.Right E'Probability
E'Probability'LOW
  Text
"MEDIUM" -> E'Probability -> Either [Char] E'Probability
forall a b. b -> Either a b
P.Right E'Probability
E'Probability'MEDIUM
  Text
"HIGH" -> E'Probability -> Either [Char] E'Probability
forall a b. b -> Either a b
P.Right E'Probability
E'Probability'HIGH
  Text
s -> [Char] -> Either [Char] E'Probability
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Probability)
-> [Char] -> Either [Char] E'Probability
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Probability: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Reason

{- | Enum of 'Text' .
The reason content was blocked during request processing.
-}
data E'Reason
  = -- | @"BLOCKED_REASON_UNSPECIFIED"@
    E'Reason'BLOCKED_REASON_UNSPECIFIED
  | -- | @"SAFETY"@
    E'Reason'SAFETY
  | -- | @"OTHER"@
    E'Reason'OTHER
  deriving (Int -> E'Reason -> ShowS
[E'Reason] -> ShowS
E'Reason -> [Char]
(Int -> E'Reason -> ShowS)
-> (E'Reason -> [Char]) -> ([E'Reason] -> ShowS) -> Show E'Reason
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Reason -> ShowS
showsPrec :: Int -> E'Reason -> ShowS
$cshow :: E'Reason -> [Char]
show :: E'Reason -> [Char]
$cshowList :: [E'Reason] -> ShowS
showList :: [E'Reason] -> ShowS
P.Show, E'Reason -> E'Reason -> Bool
(E'Reason -> E'Reason -> Bool)
-> (E'Reason -> E'Reason -> Bool) -> Eq E'Reason
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Reason -> E'Reason -> Bool
== :: E'Reason -> E'Reason -> Bool
$c/= :: E'Reason -> E'Reason -> Bool
/= :: E'Reason -> E'Reason -> Bool
P.Eq, P.Typeable, Eq E'Reason
Eq E'Reason =>
(E'Reason -> E'Reason -> Ordering)
-> (E'Reason -> E'Reason -> Bool)
-> (E'Reason -> E'Reason -> Bool)
-> (E'Reason -> E'Reason -> Bool)
-> (E'Reason -> E'Reason -> Bool)
-> (E'Reason -> E'Reason -> E'Reason)
-> (E'Reason -> E'Reason -> E'Reason)
-> Ord E'Reason
E'Reason -> E'Reason -> Bool
E'Reason -> E'Reason -> Ordering
E'Reason -> E'Reason -> E'Reason
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Reason -> E'Reason -> Ordering
compare :: E'Reason -> E'Reason -> Ordering
$c< :: E'Reason -> E'Reason -> Bool
< :: E'Reason -> E'Reason -> Bool
$c<= :: E'Reason -> E'Reason -> Bool
<= :: E'Reason -> E'Reason -> Bool
$c> :: E'Reason -> E'Reason -> Bool
> :: E'Reason -> E'Reason -> Bool
$c>= :: E'Reason -> E'Reason -> Bool
>= :: E'Reason -> E'Reason -> Bool
$cmax :: E'Reason -> E'Reason -> E'Reason
max :: E'Reason -> E'Reason -> E'Reason
$cmin :: E'Reason -> E'Reason -> E'Reason
min :: E'Reason -> E'Reason -> E'Reason
P.Ord, E'Reason
E'Reason -> E'Reason -> Bounded E'Reason
forall a. a -> a -> Bounded a
$cminBound :: E'Reason
minBound :: E'Reason
$cmaxBound :: E'Reason
maxBound :: E'Reason
P.Bounded, Int -> E'Reason
E'Reason -> Int
E'Reason -> [E'Reason]
E'Reason -> E'Reason
E'Reason -> E'Reason -> [E'Reason]
E'Reason -> E'Reason -> E'Reason -> [E'Reason]
(E'Reason -> E'Reason)
-> (E'Reason -> E'Reason)
-> (Int -> E'Reason)
-> (E'Reason -> Int)
-> (E'Reason -> [E'Reason])
-> (E'Reason -> E'Reason -> [E'Reason])
-> (E'Reason -> E'Reason -> [E'Reason])
-> (E'Reason -> E'Reason -> E'Reason -> [E'Reason])
-> Enum E'Reason
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Reason -> E'Reason
succ :: E'Reason -> E'Reason
$cpred :: E'Reason -> E'Reason
pred :: E'Reason -> E'Reason
$ctoEnum :: Int -> E'Reason
toEnum :: Int -> E'Reason
$cfromEnum :: E'Reason -> Int
fromEnum :: E'Reason -> Int
$cenumFrom :: E'Reason -> [E'Reason]
enumFrom :: E'Reason -> [E'Reason]
$cenumFromThen :: E'Reason -> E'Reason -> [E'Reason]
enumFromThen :: E'Reason -> E'Reason -> [E'Reason]
$cenumFromTo :: E'Reason -> E'Reason -> [E'Reason]
enumFromTo :: E'Reason -> E'Reason -> [E'Reason]
$cenumFromThenTo :: E'Reason -> E'Reason -> E'Reason -> [E'Reason]
enumFromThenTo :: E'Reason -> E'Reason -> E'Reason -> [E'Reason]
P.Enum)

instance A.ToJSON E'Reason where toJSON :: E'Reason -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Reason -> Text) -> E'Reason -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Reason -> Text
fromE'Reason
instance A.FromJSON E'Reason where parseJSON :: Value -> Parser E'Reason
parseJSON Value
o = ([Char] -> Parser E'Reason)
-> (E'Reason -> Parser E'Reason)
-> Either [Char] E'Reason
-> Parser E'Reason
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Reason
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Reason -> Parser E'Reason
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Reason -> Parser E'Reason)
-> (E'Reason -> E'Reason) -> E'Reason -> Parser E'Reason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Reason -> E'Reason
forall a. a -> a
P.id) (Either [Char] E'Reason -> Parser E'Reason)
-> (Text -> Either [Char] E'Reason) -> Text -> Parser E'Reason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Reason
toE'Reason (Text -> Parser E'Reason) -> Parser Text -> Parser E'Reason
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Reason where toQueryParam :: E'Reason -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Reason -> Text) -> E'Reason -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Reason -> Text
fromE'Reason
instance WH.FromHttpApiData E'Reason where parseQueryParam :: Text -> Either Text E'Reason
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Reason) -> Either Text E'Reason
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'Reason -> Either Text E'Reason
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Reason -> Either Text E'Reason)
-> (Text -> Either [Char] E'Reason) -> Text -> Either Text E'Reason
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Reason
toE'Reason
instance MimeRender MimeMultipartFormData E'Reason where mimeRender :: Proxy MimeMultipartFormData -> E'Reason -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Reason -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Reason' enum
fromE'Reason :: E'Reason -> Text
fromE'Reason :: E'Reason -> Text
fromE'Reason = \case
  E'Reason
E'Reason'BLOCKED_REASON_UNSPECIFIED -> Text
"BLOCKED_REASON_UNSPECIFIED"
  E'Reason
E'Reason'SAFETY -> Text
"SAFETY"
  E'Reason
E'Reason'OTHER -> Text
"OTHER"

-- | parse 'E'Reason' enum
toE'Reason :: Text -> P.Either String E'Reason
toE'Reason :: Text -> Either [Char] E'Reason
toE'Reason = \case
  Text
"BLOCKED_REASON_UNSPECIFIED" -> E'Reason -> Either [Char] E'Reason
forall a b. b -> Either a b
P.Right E'Reason
E'Reason'BLOCKED_REASON_UNSPECIFIED
  Text
"SAFETY" -> E'Reason -> Either [Char] E'Reason
forall a b. b -> Either a b
P.Right E'Reason
E'Reason'SAFETY
  Text
"OTHER" -> E'Reason -> Either [Char] E'Reason
forall a b. b -> Either a b
P.Right E'Reason
E'Reason'OTHER
  Text
s -> [Char] -> Either [Char] E'Reason
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Reason)
-> [Char] -> Either [Char] E'Reason
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Reason: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'ResponseModalities

-- | Enum of 'Text'
data E'ResponseModalities
  = -- | @"MODALITY_UNSPECIFIED"@
    E'ResponseModalities'MODALITY_UNSPECIFIED
  | -- | @"TEXT"@
    E'ResponseModalities'TEXT
  | -- | @"IMAGE"@
    E'ResponseModalities'IMAGE
  | -- | @"AUDIO"@
    E'ResponseModalities'AUDIO
  deriving (Int -> E'ResponseModalities -> ShowS
[E'ResponseModalities] -> ShowS
E'ResponseModalities -> [Char]
(Int -> E'ResponseModalities -> ShowS)
-> (E'ResponseModalities -> [Char])
-> ([E'ResponseModalities] -> ShowS)
-> Show E'ResponseModalities
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'ResponseModalities -> ShowS
showsPrec :: Int -> E'ResponseModalities -> ShowS
$cshow :: E'ResponseModalities -> [Char]
show :: E'ResponseModalities -> [Char]
$cshowList :: [E'ResponseModalities] -> ShowS
showList :: [E'ResponseModalities] -> ShowS
P.Show, E'ResponseModalities -> E'ResponseModalities -> Bool
(E'ResponseModalities -> E'ResponseModalities -> Bool)
-> (E'ResponseModalities -> E'ResponseModalities -> Bool)
-> Eq E'ResponseModalities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'ResponseModalities -> E'ResponseModalities -> Bool
== :: E'ResponseModalities -> E'ResponseModalities -> Bool
$c/= :: E'ResponseModalities -> E'ResponseModalities -> Bool
/= :: E'ResponseModalities -> E'ResponseModalities -> Bool
P.Eq, P.Typeable, Eq E'ResponseModalities
Eq E'ResponseModalities =>
(E'ResponseModalities -> E'ResponseModalities -> Ordering)
-> (E'ResponseModalities -> E'ResponseModalities -> Bool)
-> (E'ResponseModalities -> E'ResponseModalities -> Bool)
-> (E'ResponseModalities -> E'ResponseModalities -> Bool)
-> (E'ResponseModalities -> E'ResponseModalities -> Bool)
-> (E'ResponseModalities
    -> E'ResponseModalities -> E'ResponseModalities)
-> (E'ResponseModalities
    -> E'ResponseModalities -> E'ResponseModalities)
-> Ord E'ResponseModalities
E'ResponseModalities -> E'ResponseModalities -> Bool
E'ResponseModalities -> E'ResponseModalities -> Ordering
E'ResponseModalities
-> E'ResponseModalities -> E'ResponseModalities
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'ResponseModalities -> E'ResponseModalities -> Ordering
compare :: E'ResponseModalities -> E'ResponseModalities -> Ordering
$c< :: E'ResponseModalities -> E'ResponseModalities -> Bool
< :: E'ResponseModalities -> E'ResponseModalities -> Bool
$c<= :: E'ResponseModalities -> E'ResponseModalities -> Bool
<= :: E'ResponseModalities -> E'ResponseModalities -> Bool
$c> :: E'ResponseModalities -> E'ResponseModalities -> Bool
> :: E'ResponseModalities -> E'ResponseModalities -> Bool
$c>= :: E'ResponseModalities -> E'ResponseModalities -> Bool
>= :: E'ResponseModalities -> E'ResponseModalities -> Bool
$cmax :: E'ResponseModalities
-> E'ResponseModalities -> E'ResponseModalities
max :: E'ResponseModalities
-> E'ResponseModalities -> E'ResponseModalities
$cmin :: E'ResponseModalities
-> E'ResponseModalities -> E'ResponseModalities
min :: E'ResponseModalities
-> E'ResponseModalities -> E'ResponseModalities
P.Ord, E'ResponseModalities
E'ResponseModalities
-> E'ResponseModalities -> Bounded E'ResponseModalities
forall a. a -> a -> Bounded a
$cminBound :: E'ResponseModalities
minBound :: E'ResponseModalities
$cmaxBound :: E'ResponseModalities
maxBound :: E'ResponseModalities
P.Bounded, Int -> E'ResponseModalities
E'ResponseModalities -> Int
E'ResponseModalities -> [E'ResponseModalities]
E'ResponseModalities -> E'ResponseModalities
E'ResponseModalities
-> E'ResponseModalities -> [E'ResponseModalities]
E'ResponseModalities
-> E'ResponseModalities
-> E'ResponseModalities
-> [E'ResponseModalities]
(E'ResponseModalities -> E'ResponseModalities)
-> (E'ResponseModalities -> E'ResponseModalities)
-> (Int -> E'ResponseModalities)
-> (E'ResponseModalities -> Int)
-> (E'ResponseModalities -> [E'ResponseModalities])
-> (E'ResponseModalities
    -> E'ResponseModalities -> [E'ResponseModalities])
-> (E'ResponseModalities
    -> E'ResponseModalities -> [E'ResponseModalities])
-> (E'ResponseModalities
    -> E'ResponseModalities
    -> E'ResponseModalities
    -> [E'ResponseModalities])
-> Enum E'ResponseModalities
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'ResponseModalities -> E'ResponseModalities
succ :: E'ResponseModalities -> E'ResponseModalities
$cpred :: E'ResponseModalities -> E'ResponseModalities
pred :: E'ResponseModalities -> E'ResponseModalities
$ctoEnum :: Int -> E'ResponseModalities
toEnum :: Int -> E'ResponseModalities
$cfromEnum :: E'ResponseModalities -> Int
fromEnum :: E'ResponseModalities -> Int
$cenumFrom :: E'ResponseModalities -> [E'ResponseModalities]
enumFrom :: E'ResponseModalities -> [E'ResponseModalities]
$cenumFromThen :: E'ResponseModalities
-> E'ResponseModalities -> [E'ResponseModalities]
enumFromThen :: E'ResponseModalities
-> E'ResponseModalities -> [E'ResponseModalities]
$cenumFromTo :: E'ResponseModalities
-> E'ResponseModalities -> [E'ResponseModalities]
enumFromTo :: E'ResponseModalities
-> E'ResponseModalities -> [E'ResponseModalities]
$cenumFromThenTo :: E'ResponseModalities
-> E'ResponseModalities
-> E'ResponseModalities
-> [E'ResponseModalities]
enumFromThenTo :: E'ResponseModalities
-> E'ResponseModalities
-> E'ResponseModalities
-> [E'ResponseModalities]
P.Enum)

instance A.ToJSON E'ResponseModalities where toJSON :: E'ResponseModalities -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'ResponseModalities -> Text) -> E'ResponseModalities -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'ResponseModalities -> Text
fromE'ResponseModalities
instance A.FromJSON E'ResponseModalities where parseJSON :: Value -> Parser E'ResponseModalities
parseJSON Value
o = ([Char] -> Parser E'ResponseModalities)
-> (E'ResponseModalities -> Parser E'ResponseModalities)
-> Either [Char] E'ResponseModalities
-> Parser E'ResponseModalities
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'ResponseModalities
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'ResponseModalities -> Parser E'ResponseModalities
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'ResponseModalities -> Parser E'ResponseModalities)
-> (E'ResponseModalities -> E'ResponseModalities)
-> E'ResponseModalities
-> Parser E'ResponseModalities
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'ResponseModalities -> E'ResponseModalities
forall a. a -> a
P.id) (Either [Char] E'ResponseModalities -> Parser E'ResponseModalities)
-> (Text -> Either [Char] E'ResponseModalities)
-> Text
-> Parser E'ResponseModalities
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'ResponseModalities
toE'ResponseModalities (Text -> Parser E'ResponseModalities)
-> Parser Text -> Parser E'ResponseModalities
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'ResponseModalities where toQueryParam :: E'ResponseModalities -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text)
-> (E'ResponseModalities -> Text) -> E'ResponseModalities -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'ResponseModalities -> Text
fromE'ResponseModalities
instance WH.FromHttpApiData E'ResponseModalities where parseQueryParam :: Text -> Either Text E'ResponseModalities
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'ResponseModalities)
-> Either Text E'ResponseModalities
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'ResponseModalities
-> Either Text E'ResponseModalities
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'ResponseModalities
 -> Either Text E'ResponseModalities)
-> (Text -> Either [Char] E'ResponseModalities)
-> Text
-> Either Text E'ResponseModalities
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'ResponseModalities
toE'ResponseModalities
instance MimeRender MimeMultipartFormData E'ResponseModalities where mimeRender :: Proxy MimeMultipartFormData -> E'ResponseModalities -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'ResponseModalities -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'ResponseModalities' enum
fromE'ResponseModalities :: E'ResponseModalities -> Text
fromE'ResponseModalities :: E'ResponseModalities -> Text
fromE'ResponseModalities = \case
  E'ResponseModalities
E'ResponseModalities'MODALITY_UNSPECIFIED -> Text
"MODALITY_UNSPECIFIED"
  E'ResponseModalities
E'ResponseModalities'TEXT -> Text
"TEXT"
  E'ResponseModalities
E'ResponseModalities'IMAGE -> Text
"IMAGE"
  E'ResponseModalities
E'ResponseModalities'AUDIO -> Text
"AUDIO"

-- | parse 'E'ResponseModalities' enum
toE'ResponseModalities :: Text -> P.Either String E'ResponseModalities
toE'ResponseModalities :: Text -> Either [Char] E'ResponseModalities
toE'ResponseModalities = \case
  Text
"MODALITY_UNSPECIFIED" -> E'ResponseModalities -> Either [Char] E'ResponseModalities
forall a b. b -> Either a b
P.Right E'ResponseModalities
E'ResponseModalities'MODALITY_UNSPECIFIED
  Text
"TEXT" -> E'ResponseModalities -> Either [Char] E'ResponseModalities
forall a b. b -> Either a b
P.Right E'ResponseModalities
E'ResponseModalities'TEXT
  Text
"IMAGE" -> E'ResponseModalities -> Either [Char] E'ResponseModalities
forall a b. b -> Either a b
P.Right E'ResponseModalities
E'ResponseModalities'IMAGE
  Text
"AUDIO" -> E'ResponseModalities -> Either [Char] E'ResponseModalities
forall a b. b -> Either a b
P.Right E'ResponseModalities
E'ResponseModalities'AUDIO
  Text
s -> [Char] -> Either [Char] E'ResponseModalities
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'ResponseModalities)
-> [Char] -> Either [Char] E'ResponseModalities
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'ResponseModalities: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Role

{- | Enum of 'Text' .
Required. The role granted by this permission.
-}
data E'Role
  = -- | @"ROLE_UNSPECIFIED"@
    E'Role'ROLE_UNSPECIFIED
  | -- | @"OWNER"@
    E'Role'OWNER
  | -- | @"WRITER"@
    E'Role'WRITER
  | -- | @"READER"@
    E'Role'READER
  deriving (Int -> E'Role -> ShowS
[E'Role] -> ShowS
E'Role -> [Char]
(Int -> E'Role -> ShowS)
-> (E'Role -> [Char]) -> ([E'Role] -> ShowS) -> Show E'Role
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Role -> ShowS
showsPrec :: Int -> E'Role -> ShowS
$cshow :: E'Role -> [Char]
show :: E'Role -> [Char]
$cshowList :: [E'Role] -> ShowS
showList :: [E'Role] -> ShowS
P.Show, E'Role -> E'Role -> Bool
(E'Role -> E'Role -> Bool)
-> (E'Role -> E'Role -> Bool) -> Eq E'Role
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Role -> E'Role -> Bool
== :: E'Role -> E'Role -> Bool
$c/= :: E'Role -> E'Role -> Bool
/= :: E'Role -> E'Role -> Bool
P.Eq, P.Typeable, Eq E'Role
Eq E'Role =>
(E'Role -> E'Role -> Ordering)
-> (E'Role -> E'Role -> Bool)
-> (E'Role -> E'Role -> Bool)
-> (E'Role -> E'Role -> Bool)
-> (E'Role -> E'Role -> Bool)
-> (E'Role -> E'Role -> E'Role)
-> (E'Role -> E'Role -> E'Role)
-> Ord E'Role
E'Role -> E'Role -> Bool
E'Role -> E'Role -> Ordering
E'Role -> E'Role -> E'Role
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Role -> E'Role -> Ordering
compare :: E'Role -> E'Role -> Ordering
$c< :: E'Role -> E'Role -> Bool
< :: E'Role -> E'Role -> Bool
$c<= :: E'Role -> E'Role -> Bool
<= :: E'Role -> E'Role -> Bool
$c> :: E'Role -> E'Role -> Bool
> :: E'Role -> E'Role -> Bool
$c>= :: E'Role -> E'Role -> Bool
>= :: E'Role -> E'Role -> Bool
$cmax :: E'Role -> E'Role -> E'Role
max :: E'Role -> E'Role -> E'Role
$cmin :: E'Role -> E'Role -> E'Role
min :: E'Role -> E'Role -> E'Role
P.Ord, E'Role
E'Role -> E'Role -> Bounded E'Role
forall a. a -> a -> Bounded a
$cminBound :: E'Role
minBound :: E'Role
$cmaxBound :: E'Role
maxBound :: E'Role
P.Bounded, Int -> E'Role
E'Role -> Int
E'Role -> [E'Role]
E'Role -> E'Role
E'Role -> E'Role -> [E'Role]
E'Role -> E'Role -> E'Role -> [E'Role]
(E'Role -> E'Role)
-> (E'Role -> E'Role)
-> (Int -> E'Role)
-> (E'Role -> Int)
-> (E'Role -> [E'Role])
-> (E'Role -> E'Role -> [E'Role])
-> (E'Role -> E'Role -> [E'Role])
-> (E'Role -> E'Role -> E'Role -> [E'Role])
-> Enum E'Role
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Role -> E'Role
succ :: E'Role -> E'Role
$cpred :: E'Role -> E'Role
pred :: E'Role -> E'Role
$ctoEnum :: Int -> E'Role
toEnum :: Int -> E'Role
$cfromEnum :: E'Role -> Int
fromEnum :: E'Role -> Int
$cenumFrom :: E'Role -> [E'Role]
enumFrom :: E'Role -> [E'Role]
$cenumFromThen :: E'Role -> E'Role -> [E'Role]
enumFromThen :: E'Role -> E'Role -> [E'Role]
$cenumFromTo :: E'Role -> E'Role -> [E'Role]
enumFromTo :: E'Role -> E'Role -> [E'Role]
$cenumFromThenTo :: E'Role -> E'Role -> E'Role -> [E'Role]
enumFromThenTo :: E'Role -> E'Role -> E'Role -> [E'Role]
P.Enum)

instance A.ToJSON E'Role where toJSON :: E'Role -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Role -> Text) -> E'Role -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Role -> Text
fromE'Role
instance A.FromJSON E'Role where parseJSON :: Value -> Parser E'Role
parseJSON Value
o = ([Char] -> Parser E'Role)
-> (E'Role -> Parser E'Role)
-> Either [Char] E'Role
-> Parser E'Role
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Role
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Role -> Parser E'Role
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Role -> Parser E'Role)
-> (E'Role -> E'Role) -> E'Role -> Parser E'Role
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Role -> E'Role
forall a. a -> a
P.id) (Either [Char] E'Role -> Parser E'Role)
-> (Text -> Either [Char] E'Role) -> Text -> Parser E'Role
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Role
toE'Role (Text -> Parser E'Role) -> Parser Text -> Parser E'Role
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Role where toQueryParam :: E'Role -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Role -> Text) -> E'Role -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Role -> Text
fromE'Role
instance WH.FromHttpApiData E'Role where parseQueryParam :: Text -> Either Text E'Role
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Role) -> Either Text E'Role
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'Role -> Either Text E'Role
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Role -> Either Text E'Role)
-> (Text -> Either [Char] E'Role) -> Text -> Either Text E'Role
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Role
toE'Role
instance MimeRender MimeMultipartFormData E'Role where mimeRender :: Proxy MimeMultipartFormData -> E'Role -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Role -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Role' enum
fromE'Role :: E'Role -> Text
fromE'Role :: E'Role -> Text
fromE'Role = \case
  E'Role
E'Role'ROLE_UNSPECIFIED -> Text
"ROLE_UNSPECIFIED"
  E'Role
E'Role'OWNER -> Text
"OWNER"
  E'Role
E'Role'WRITER -> Text
"WRITER"
  E'Role
E'Role'READER -> Text
"READER"

-- | parse 'E'Role' enum
toE'Role :: Text -> P.Either String E'Role
toE'Role :: Text -> Either [Char] E'Role
toE'Role = \case
  Text
"ROLE_UNSPECIFIED" -> E'Role -> Either [Char] E'Role
forall a b. b -> Either a b
P.Right E'Role
E'Role'ROLE_UNSPECIFIED
  Text
"OWNER" -> E'Role -> Either [Char] E'Role
forall a b. b -> Either a b
P.Right E'Role
E'Role'OWNER
  Text
"WRITER" -> E'Role -> Either [Char] E'Role
forall a b. b -> Either a b
P.Right E'Role
E'Role'WRITER
  Text
"READER" -> E'Role -> Either [Char] E'Role
forall a b. b -> Either a b
P.Right E'Role
E'Role'READER
  Text
s -> [Char] -> Either [Char] E'Role
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Role) -> [Char] -> Either [Char] E'Role
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Role: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Scheduling

{- | Enum of 'Text' .
Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE.
-}
data E'Scheduling
  = -- | @"SCHEDULING_UNSPECIFIED"@
    E'Scheduling'SCHEDULING_UNSPECIFIED
  | -- | @"SILENT"@
    E'Scheduling'SILENT
  | -- | @"WHEN_IDLE"@
    E'Scheduling'WHEN_IDLE
  | -- | @"INTERRUPT"@
    E'Scheduling'INTERRUPT
  deriving (Int -> E'Scheduling -> ShowS
[E'Scheduling] -> ShowS
E'Scheduling -> [Char]
(Int -> E'Scheduling -> ShowS)
-> (E'Scheduling -> [Char])
-> ([E'Scheduling] -> ShowS)
-> Show E'Scheduling
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Scheduling -> ShowS
showsPrec :: Int -> E'Scheduling -> ShowS
$cshow :: E'Scheduling -> [Char]
show :: E'Scheduling -> [Char]
$cshowList :: [E'Scheduling] -> ShowS
showList :: [E'Scheduling] -> ShowS
P.Show, E'Scheduling -> E'Scheduling -> Bool
(E'Scheduling -> E'Scheduling -> Bool)
-> (E'Scheduling -> E'Scheduling -> Bool) -> Eq E'Scheduling
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Scheduling -> E'Scheduling -> Bool
== :: E'Scheduling -> E'Scheduling -> Bool
$c/= :: E'Scheduling -> E'Scheduling -> Bool
/= :: E'Scheduling -> E'Scheduling -> Bool
P.Eq, P.Typeable, Eq E'Scheduling
Eq E'Scheduling =>
(E'Scheduling -> E'Scheduling -> Ordering)
-> (E'Scheduling -> E'Scheduling -> Bool)
-> (E'Scheduling -> E'Scheduling -> Bool)
-> (E'Scheduling -> E'Scheduling -> Bool)
-> (E'Scheduling -> E'Scheduling -> Bool)
-> (E'Scheduling -> E'Scheduling -> E'Scheduling)
-> (E'Scheduling -> E'Scheduling -> E'Scheduling)
-> Ord E'Scheduling
E'Scheduling -> E'Scheduling -> Bool
E'Scheduling -> E'Scheduling -> Ordering
E'Scheduling -> E'Scheduling -> E'Scheduling
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Scheduling -> E'Scheduling -> Ordering
compare :: E'Scheduling -> E'Scheduling -> Ordering
$c< :: E'Scheduling -> E'Scheduling -> Bool
< :: E'Scheduling -> E'Scheduling -> Bool
$c<= :: E'Scheduling -> E'Scheduling -> Bool
<= :: E'Scheduling -> E'Scheduling -> Bool
$c> :: E'Scheduling -> E'Scheduling -> Bool
> :: E'Scheduling -> E'Scheduling -> Bool
$c>= :: E'Scheduling -> E'Scheduling -> Bool
>= :: E'Scheduling -> E'Scheduling -> Bool
$cmax :: E'Scheduling -> E'Scheduling -> E'Scheduling
max :: E'Scheduling -> E'Scheduling -> E'Scheduling
$cmin :: E'Scheduling -> E'Scheduling -> E'Scheduling
min :: E'Scheduling -> E'Scheduling -> E'Scheduling
P.Ord, E'Scheduling
E'Scheduling -> E'Scheduling -> Bounded E'Scheduling
forall a. a -> a -> Bounded a
$cminBound :: E'Scheduling
minBound :: E'Scheduling
$cmaxBound :: E'Scheduling
maxBound :: E'Scheduling
P.Bounded, Int -> E'Scheduling
E'Scheduling -> Int
E'Scheduling -> [E'Scheduling]
E'Scheduling -> E'Scheduling
E'Scheduling -> E'Scheduling -> [E'Scheduling]
E'Scheduling -> E'Scheduling -> E'Scheduling -> [E'Scheduling]
(E'Scheduling -> E'Scheduling)
-> (E'Scheduling -> E'Scheduling)
-> (Int -> E'Scheduling)
-> (E'Scheduling -> Int)
-> (E'Scheduling -> [E'Scheduling])
-> (E'Scheduling -> E'Scheduling -> [E'Scheduling])
-> (E'Scheduling -> E'Scheduling -> [E'Scheduling])
-> (E'Scheduling -> E'Scheduling -> E'Scheduling -> [E'Scheduling])
-> Enum E'Scheduling
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Scheduling -> E'Scheduling
succ :: E'Scheduling -> E'Scheduling
$cpred :: E'Scheduling -> E'Scheduling
pred :: E'Scheduling -> E'Scheduling
$ctoEnum :: Int -> E'Scheduling
toEnum :: Int -> E'Scheduling
$cfromEnum :: E'Scheduling -> Int
fromEnum :: E'Scheduling -> Int
$cenumFrom :: E'Scheduling -> [E'Scheduling]
enumFrom :: E'Scheduling -> [E'Scheduling]
$cenumFromThen :: E'Scheduling -> E'Scheduling -> [E'Scheduling]
enumFromThen :: E'Scheduling -> E'Scheduling -> [E'Scheduling]
$cenumFromTo :: E'Scheduling -> E'Scheduling -> [E'Scheduling]
enumFromTo :: E'Scheduling -> E'Scheduling -> [E'Scheduling]
$cenumFromThenTo :: E'Scheduling -> E'Scheduling -> E'Scheduling -> [E'Scheduling]
enumFromThenTo :: E'Scheduling -> E'Scheduling -> E'Scheduling -> [E'Scheduling]
P.Enum)

instance A.ToJSON E'Scheduling where toJSON :: E'Scheduling -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Scheduling -> Text) -> E'Scheduling -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Scheduling -> Text
fromE'Scheduling
instance A.FromJSON E'Scheduling where parseJSON :: Value -> Parser E'Scheduling
parseJSON Value
o = ([Char] -> Parser E'Scheduling)
-> (E'Scheduling -> Parser E'Scheduling)
-> Either [Char] E'Scheduling
-> Parser E'Scheduling
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Scheduling
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Scheduling -> Parser E'Scheduling
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Scheduling -> Parser E'Scheduling)
-> (E'Scheduling -> E'Scheduling)
-> E'Scheduling
-> Parser E'Scheduling
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Scheduling -> E'Scheduling
forall a. a -> a
P.id) (Either [Char] E'Scheduling -> Parser E'Scheduling)
-> (Text -> Either [Char] E'Scheduling)
-> Text
-> Parser E'Scheduling
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Scheduling
toE'Scheduling (Text -> Parser E'Scheduling) -> Parser Text -> Parser E'Scheduling
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Scheduling where toQueryParam :: E'Scheduling -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Scheduling -> Text) -> E'Scheduling -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Scheduling -> Text
fromE'Scheduling
instance WH.FromHttpApiData E'Scheduling where parseQueryParam :: Text -> Either Text E'Scheduling
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Scheduling) -> Either Text E'Scheduling
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'Scheduling -> Either Text E'Scheduling
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Scheduling -> Either Text E'Scheduling)
-> (Text -> Either [Char] E'Scheduling)
-> Text
-> Either Text E'Scheduling
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Scheduling
toE'Scheduling
instance MimeRender MimeMultipartFormData E'Scheduling where mimeRender :: Proxy MimeMultipartFormData -> E'Scheduling -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Scheduling -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Scheduling' enum
fromE'Scheduling :: E'Scheduling -> Text
fromE'Scheduling :: E'Scheduling -> Text
fromE'Scheduling = \case
  E'Scheduling
E'Scheduling'SCHEDULING_UNSPECIFIED -> Text
"SCHEDULING_UNSPECIFIED"
  E'Scheduling
E'Scheduling'SILENT -> Text
"SILENT"
  E'Scheduling
E'Scheduling'WHEN_IDLE -> Text
"WHEN_IDLE"
  E'Scheduling
E'Scheduling'INTERRUPT -> Text
"INTERRUPT"

-- | parse 'E'Scheduling' enum
toE'Scheduling :: Text -> P.Either String E'Scheduling
toE'Scheduling :: Text -> Either [Char] E'Scheduling
toE'Scheduling = \case
  Text
"SCHEDULING_UNSPECIFIED" -> E'Scheduling -> Either [Char] E'Scheduling
forall a b. b -> Either a b
P.Right E'Scheduling
E'Scheduling'SCHEDULING_UNSPECIFIED
  Text
"SILENT" -> E'Scheduling -> Either [Char] E'Scheduling
forall a b. b -> Either a b
P.Right E'Scheduling
E'Scheduling'SILENT
  Text
"WHEN_IDLE" -> E'Scheduling -> Either [Char] E'Scheduling
forall a b. b -> Either a b
P.Right E'Scheduling
E'Scheduling'WHEN_IDLE
  Text
"INTERRUPT" -> E'Scheduling -> Either [Char] E'Scheduling
forall a b. b -> Either a b
P.Right E'Scheduling
E'Scheduling'INTERRUPT
  Text
s -> [Char] -> Either [Char] E'Scheduling
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Scheduling)
-> [Char] -> Either [Char] E'Scheduling
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Scheduling: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Source

{- | Enum of 'Text' .
Source of the File.
-}
data E'Source
  = -- | @"SOURCE_UNSPECIFIED"@
    E'Source'SOURCE_UNSPECIFIED
  | -- | @"UPLOADED"@
    E'Source'UPLOADED
  | -- | @"GENERATED"@
    E'Source'GENERATED
  deriving (Int -> E'Source -> ShowS
[E'Source] -> ShowS
E'Source -> [Char]
(Int -> E'Source -> ShowS)
-> (E'Source -> [Char]) -> ([E'Source] -> ShowS) -> Show E'Source
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Source -> ShowS
showsPrec :: Int -> E'Source -> ShowS
$cshow :: E'Source -> [Char]
show :: E'Source -> [Char]
$cshowList :: [E'Source] -> ShowS
showList :: [E'Source] -> ShowS
P.Show, E'Source -> E'Source -> Bool
(E'Source -> E'Source -> Bool)
-> (E'Source -> E'Source -> Bool) -> Eq E'Source
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Source -> E'Source -> Bool
== :: E'Source -> E'Source -> Bool
$c/= :: E'Source -> E'Source -> Bool
/= :: E'Source -> E'Source -> Bool
P.Eq, P.Typeable, Eq E'Source
Eq E'Source =>
(E'Source -> E'Source -> Ordering)
-> (E'Source -> E'Source -> Bool)
-> (E'Source -> E'Source -> Bool)
-> (E'Source -> E'Source -> Bool)
-> (E'Source -> E'Source -> Bool)
-> (E'Source -> E'Source -> E'Source)
-> (E'Source -> E'Source -> E'Source)
-> Ord E'Source
E'Source -> E'Source -> Bool
E'Source -> E'Source -> Ordering
E'Source -> E'Source -> E'Source
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Source -> E'Source -> Ordering
compare :: E'Source -> E'Source -> Ordering
$c< :: E'Source -> E'Source -> Bool
< :: E'Source -> E'Source -> Bool
$c<= :: E'Source -> E'Source -> Bool
<= :: E'Source -> E'Source -> Bool
$c> :: E'Source -> E'Source -> Bool
> :: E'Source -> E'Source -> Bool
$c>= :: E'Source -> E'Source -> Bool
>= :: E'Source -> E'Source -> Bool
$cmax :: E'Source -> E'Source -> E'Source
max :: E'Source -> E'Source -> E'Source
$cmin :: E'Source -> E'Source -> E'Source
min :: E'Source -> E'Source -> E'Source
P.Ord, E'Source
E'Source -> E'Source -> Bounded E'Source
forall a. a -> a -> Bounded a
$cminBound :: E'Source
minBound :: E'Source
$cmaxBound :: E'Source
maxBound :: E'Source
P.Bounded, Int -> E'Source
E'Source -> Int
E'Source -> [E'Source]
E'Source -> E'Source
E'Source -> E'Source -> [E'Source]
E'Source -> E'Source -> E'Source -> [E'Source]
(E'Source -> E'Source)
-> (E'Source -> E'Source)
-> (Int -> E'Source)
-> (E'Source -> Int)
-> (E'Source -> [E'Source])
-> (E'Source -> E'Source -> [E'Source])
-> (E'Source -> E'Source -> [E'Source])
-> (E'Source -> E'Source -> E'Source -> [E'Source])
-> Enum E'Source
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Source -> E'Source
succ :: E'Source -> E'Source
$cpred :: E'Source -> E'Source
pred :: E'Source -> E'Source
$ctoEnum :: Int -> E'Source
toEnum :: Int -> E'Source
$cfromEnum :: E'Source -> Int
fromEnum :: E'Source -> Int
$cenumFrom :: E'Source -> [E'Source]
enumFrom :: E'Source -> [E'Source]
$cenumFromThen :: E'Source -> E'Source -> [E'Source]
enumFromThen :: E'Source -> E'Source -> [E'Source]
$cenumFromTo :: E'Source -> E'Source -> [E'Source]
enumFromTo :: E'Source -> E'Source -> [E'Source]
$cenumFromThenTo :: E'Source -> E'Source -> E'Source -> [E'Source]
enumFromThenTo :: E'Source -> E'Source -> E'Source -> [E'Source]
P.Enum)

instance A.ToJSON E'Source where toJSON :: E'Source -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Source -> Text) -> E'Source -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Source -> Text
fromE'Source
instance A.FromJSON E'Source where parseJSON :: Value -> Parser E'Source
parseJSON Value
o = ([Char] -> Parser E'Source)
-> (E'Source -> Parser E'Source)
-> Either [Char] E'Source
-> Parser E'Source
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Source
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Source -> Parser E'Source
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Source -> Parser E'Source)
-> (E'Source -> E'Source) -> E'Source -> Parser E'Source
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Source -> E'Source
forall a. a -> a
P.id) (Either [Char] E'Source -> Parser E'Source)
-> (Text -> Either [Char] E'Source) -> Text -> Parser E'Source
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Source
toE'Source (Text -> Parser E'Source) -> Parser Text -> Parser E'Source
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Source where toQueryParam :: E'Source -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Source -> Text) -> E'Source -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Source -> Text
fromE'Source
instance WH.FromHttpApiData E'Source where parseQueryParam :: Text -> Either Text E'Source
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Source) -> Either Text E'Source
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'Source -> Either Text E'Source
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Source -> Either Text E'Source)
-> (Text -> Either [Char] E'Source) -> Text -> Either Text E'Source
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Source
toE'Source
instance MimeRender MimeMultipartFormData E'Source where mimeRender :: Proxy MimeMultipartFormData -> E'Source -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Source -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Source' enum
fromE'Source :: E'Source -> Text
fromE'Source :: E'Source -> Text
fromE'Source = \case
  E'Source
E'Source'SOURCE_UNSPECIFIED -> Text
"SOURCE_UNSPECIFIED"
  E'Source
E'Source'UPLOADED -> Text
"UPLOADED"
  E'Source
E'Source'GENERATED -> Text
"GENERATED"

-- | parse 'E'Source' enum
toE'Source :: Text -> P.Either String E'Source
toE'Source :: Text -> Either [Char] E'Source
toE'Source = \case
  Text
"SOURCE_UNSPECIFIED" -> E'Source -> Either [Char] E'Source
forall a b. b -> Either a b
P.Right E'Source
E'Source'SOURCE_UNSPECIFIED
  Text
"UPLOADED" -> E'Source -> Either [Char] E'Source
forall a b. b -> Either a b
P.Right E'Source
E'Source'UPLOADED
  Text
"GENERATED" -> E'Source -> Either [Char] E'Source
forall a b. b -> Either a b
P.Right E'Source
E'Source'GENERATED
  Text
s -> [Char] -> Either [Char] E'Source
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Source)
-> [Char] -> Either [Char] E'Source
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Source: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'State

{- | Enum of 'Text' .
Output only. Processing state of the File.
-}
data E'State
  = -- | @"STATE_UNSPECIFIED"@
    E'State'STATE_UNSPECIFIED
  | -- | @"PROCESSING"@
    E'State'PROCESSING
  | -- | @"ACTIVE"@
    E'State'ACTIVE
  | -- | @"FAILED"@
    E'State'FAILED
  deriving (Int -> E'State -> ShowS
[E'State] -> ShowS
E'State -> [Char]
(Int -> E'State -> ShowS)
-> (E'State -> [Char]) -> ([E'State] -> ShowS) -> Show E'State
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'State -> ShowS
showsPrec :: Int -> E'State -> ShowS
$cshow :: E'State -> [Char]
show :: E'State -> [Char]
$cshowList :: [E'State] -> ShowS
showList :: [E'State] -> ShowS
P.Show, E'State -> E'State -> Bool
(E'State -> E'State -> Bool)
-> (E'State -> E'State -> Bool) -> Eq E'State
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'State -> E'State -> Bool
== :: E'State -> E'State -> Bool
$c/= :: E'State -> E'State -> Bool
/= :: E'State -> E'State -> Bool
P.Eq, P.Typeable, Eq E'State
Eq E'State =>
(E'State -> E'State -> Ordering)
-> (E'State -> E'State -> Bool)
-> (E'State -> E'State -> Bool)
-> (E'State -> E'State -> Bool)
-> (E'State -> E'State -> Bool)
-> (E'State -> E'State -> E'State)
-> (E'State -> E'State -> E'State)
-> Ord E'State
E'State -> E'State -> Bool
E'State -> E'State -> Ordering
E'State -> E'State -> E'State
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'State -> E'State -> Ordering
compare :: E'State -> E'State -> Ordering
$c< :: E'State -> E'State -> Bool
< :: E'State -> E'State -> Bool
$c<= :: E'State -> E'State -> Bool
<= :: E'State -> E'State -> Bool
$c> :: E'State -> E'State -> Bool
> :: E'State -> E'State -> Bool
$c>= :: E'State -> E'State -> Bool
>= :: E'State -> E'State -> Bool
$cmax :: E'State -> E'State -> E'State
max :: E'State -> E'State -> E'State
$cmin :: E'State -> E'State -> E'State
min :: E'State -> E'State -> E'State
P.Ord, E'State
E'State -> E'State -> Bounded E'State
forall a. a -> a -> Bounded a
$cminBound :: E'State
minBound :: E'State
$cmaxBound :: E'State
maxBound :: E'State
P.Bounded, Int -> E'State
E'State -> Int
E'State -> [E'State]
E'State -> E'State
E'State -> E'State -> [E'State]
E'State -> E'State -> E'State -> [E'State]
(E'State -> E'State)
-> (E'State -> E'State)
-> (Int -> E'State)
-> (E'State -> Int)
-> (E'State -> [E'State])
-> (E'State -> E'State -> [E'State])
-> (E'State -> E'State -> [E'State])
-> (E'State -> E'State -> E'State -> [E'State])
-> Enum E'State
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'State -> E'State
succ :: E'State -> E'State
$cpred :: E'State -> E'State
pred :: E'State -> E'State
$ctoEnum :: Int -> E'State
toEnum :: Int -> E'State
$cfromEnum :: E'State -> Int
fromEnum :: E'State -> Int
$cenumFrom :: E'State -> [E'State]
enumFrom :: E'State -> [E'State]
$cenumFromThen :: E'State -> E'State -> [E'State]
enumFromThen :: E'State -> E'State -> [E'State]
$cenumFromTo :: E'State -> E'State -> [E'State]
enumFromTo :: E'State -> E'State -> [E'State]
$cenumFromThenTo :: E'State -> E'State -> E'State -> [E'State]
enumFromThenTo :: E'State -> E'State -> E'State -> [E'State]
P.Enum)

instance A.ToJSON E'State where toJSON :: E'State -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'State -> Text) -> E'State -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State -> Text
fromE'State
instance A.FromJSON E'State where parseJSON :: Value -> Parser E'State
parseJSON Value
o = ([Char] -> Parser E'State)
-> (E'State -> Parser E'State)
-> Either [Char] E'State
-> Parser E'State
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'State
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'State -> Parser E'State
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'State -> Parser E'State)
-> (E'State -> E'State) -> E'State -> Parser E'State
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State -> E'State
forall a. a -> a
P.id) (Either [Char] E'State -> Parser E'State)
-> (Text -> Either [Char] E'State) -> Text -> Parser E'State
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State
toE'State (Text -> Parser E'State) -> Parser Text -> Parser E'State
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'State where toQueryParam :: E'State -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'State -> Text) -> E'State -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State -> Text
fromE'State
instance WH.FromHttpApiData E'State where parseQueryParam :: Text -> Either Text E'State
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'State) -> Either Text E'State
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'State -> Either Text E'State
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'State -> Either Text E'State)
-> (Text -> Either [Char] E'State) -> Text -> Either Text E'State
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State
toE'State
instance MimeRender MimeMultipartFormData E'State where mimeRender :: Proxy MimeMultipartFormData -> E'State -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'State -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'State' enum
fromE'State :: E'State -> Text
fromE'State :: E'State -> Text
fromE'State = \case
  E'State
E'State'STATE_UNSPECIFIED -> Text
"STATE_UNSPECIFIED"
  E'State
E'State'PROCESSING -> Text
"PROCESSING"
  E'State
E'State'ACTIVE -> Text
"ACTIVE"
  E'State
E'State'FAILED -> Text
"FAILED"

-- | parse 'E'State' enum
toE'State :: Text -> P.Either String E'State
toE'State :: Text -> Either [Char] E'State
toE'State = \case
  Text
"STATE_UNSPECIFIED" -> E'State -> Either [Char] E'State
forall a b. b -> Either a b
P.Right E'State
E'State'STATE_UNSPECIFIED
  Text
"PROCESSING" -> E'State -> Either [Char] E'State
forall a b. b -> Either a b
P.Right E'State
E'State'PROCESSING
  Text
"ACTIVE" -> E'State -> Either [Char] E'State
forall a b. b -> Either a b
P.Right E'State
E'State'ACTIVE
  Text
"FAILED" -> E'State -> Either [Char] E'State
forall a b. b -> Either a b
P.Right E'State
E'State'FAILED
  Text
s -> [Char] -> Either [Char] E'State
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'State)
-> [Char] -> Either [Char] E'State
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'State: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'State2

{- | Enum of 'Text' .
Output only. The state of the GeneratedFile.
-}
data E'State2
  = -- | @"STATE_UNSPECIFIED"@
    E'State2'STATE_UNSPECIFIED
  | -- | @"GENERATING"@
    E'State2'GENERATING
  | -- | @"GENERATED"@
    E'State2'GENERATED
  | -- | @"FAILED"@
    E'State2'FAILED
  deriving (Int -> E'State2 -> ShowS
[E'State2] -> ShowS
E'State2 -> [Char]
(Int -> E'State2 -> ShowS)
-> (E'State2 -> [Char]) -> ([E'State2] -> ShowS) -> Show E'State2
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'State2 -> ShowS
showsPrec :: Int -> E'State2 -> ShowS
$cshow :: E'State2 -> [Char]
show :: E'State2 -> [Char]
$cshowList :: [E'State2] -> ShowS
showList :: [E'State2] -> ShowS
P.Show, E'State2 -> E'State2 -> Bool
(E'State2 -> E'State2 -> Bool)
-> (E'State2 -> E'State2 -> Bool) -> Eq E'State2
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'State2 -> E'State2 -> Bool
== :: E'State2 -> E'State2 -> Bool
$c/= :: E'State2 -> E'State2 -> Bool
/= :: E'State2 -> E'State2 -> Bool
P.Eq, P.Typeable, Eq E'State2
Eq E'State2 =>
(E'State2 -> E'State2 -> Ordering)
-> (E'State2 -> E'State2 -> Bool)
-> (E'State2 -> E'State2 -> Bool)
-> (E'State2 -> E'State2 -> Bool)
-> (E'State2 -> E'State2 -> Bool)
-> (E'State2 -> E'State2 -> E'State2)
-> (E'State2 -> E'State2 -> E'State2)
-> Ord E'State2
E'State2 -> E'State2 -> Bool
E'State2 -> E'State2 -> Ordering
E'State2 -> E'State2 -> E'State2
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'State2 -> E'State2 -> Ordering
compare :: E'State2 -> E'State2 -> Ordering
$c< :: E'State2 -> E'State2 -> Bool
< :: E'State2 -> E'State2 -> Bool
$c<= :: E'State2 -> E'State2 -> Bool
<= :: E'State2 -> E'State2 -> Bool
$c> :: E'State2 -> E'State2 -> Bool
> :: E'State2 -> E'State2 -> Bool
$c>= :: E'State2 -> E'State2 -> Bool
>= :: E'State2 -> E'State2 -> Bool
$cmax :: E'State2 -> E'State2 -> E'State2
max :: E'State2 -> E'State2 -> E'State2
$cmin :: E'State2 -> E'State2 -> E'State2
min :: E'State2 -> E'State2 -> E'State2
P.Ord, E'State2
E'State2 -> E'State2 -> Bounded E'State2
forall a. a -> a -> Bounded a
$cminBound :: E'State2
minBound :: E'State2
$cmaxBound :: E'State2
maxBound :: E'State2
P.Bounded, Int -> E'State2
E'State2 -> Int
E'State2 -> [E'State2]
E'State2 -> E'State2
E'State2 -> E'State2 -> [E'State2]
E'State2 -> E'State2 -> E'State2 -> [E'State2]
(E'State2 -> E'State2)
-> (E'State2 -> E'State2)
-> (Int -> E'State2)
-> (E'State2 -> Int)
-> (E'State2 -> [E'State2])
-> (E'State2 -> E'State2 -> [E'State2])
-> (E'State2 -> E'State2 -> [E'State2])
-> (E'State2 -> E'State2 -> E'State2 -> [E'State2])
-> Enum E'State2
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'State2 -> E'State2
succ :: E'State2 -> E'State2
$cpred :: E'State2 -> E'State2
pred :: E'State2 -> E'State2
$ctoEnum :: Int -> E'State2
toEnum :: Int -> E'State2
$cfromEnum :: E'State2 -> Int
fromEnum :: E'State2 -> Int
$cenumFrom :: E'State2 -> [E'State2]
enumFrom :: E'State2 -> [E'State2]
$cenumFromThen :: E'State2 -> E'State2 -> [E'State2]
enumFromThen :: E'State2 -> E'State2 -> [E'State2]
$cenumFromTo :: E'State2 -> E'State2 -> [E'State2]
enumFromTo :: E'State2 -> E'State2 -> [E'State2]
$cenumFromThenTo :: E'State2 -> E'State2 -> E'State2 -> [E'State2]
enumFromThenTo :: E'State2 -> E'State2 -> E'State2 -> [E'State2]
P.Enum)

instance A.ToJSON E'State2 where toJSON :: E'State2 -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'State2 -> Text) -> E'State2 -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State2 -> Text
fromE'State2
instance A.FromJSON E'State2 where parseJSON :: Value -> Parser E'State2
parseJSON Value
o = ([Char] -> Parser E'State2)
-> (E'State2 -> Parser E'State2)
-> Either [Char] E'State2
-> Parser E'State2
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'State2
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'State2 -> Parser E'State2
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'State2 -> Parser E'State2)
-> (E'State2 -> E'State2) -> E'State2 -> Parser E'State2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State2 -> E'State2
forall a. a -> a
P.id) (Either [Char] E'State2 -> Parser E'State2)
-> (Text -> Either [Char] E'State2) -> Text -> Parser E'State2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State2
toE'State2 (Text -> Parser E'State2) -> Parser Text -> Parser E'State2
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'State2 where toQueryParam :: E'State2 -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'State2 -> Text) -> E'State2 -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State2 -> Text
fromE'State2
instance WH.FromHttpApiData E'State2 where parseQueryParam :: Text -> Either Text E'State2
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'State2) -> Either Text E'State2
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'State2 -> Either Text E'State2
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'State2 -> Either Text E'State2)
-> (Text -> Either [Char] E'State2) -> Text -> Either Text E'State2
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State2
toE'State2
instance MimeRender MimeMultipartFormData E'State2 where mimeRender :: Proxy MimeMultipartFormData -> E'State2 -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'State2 -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'State2' enum
fromE'State2 :: E'State2 -> Text
fromE'State2 :: E'State2 -> Text
fromE'State2 = \case
  E'State2
E'State2'STATE_UNSPECIFIED -> Text
"STATE_UNSPECIFIED"
  E'State2
E'State2'GENERATING -> Text
"GENERATING"
  E'State2
E'State2'GENERATED -> Text
"GENERATED"
  E'State2
E'State2'FAILED -> Text
"FAILED"

-- | parse 'E'State2' enum
toE'State2 :: Text -> P.Either String E'State2
toE'State2 :: Text -> Either [Char] E'State2
toE'State2 = \case
  Text
"STATE_UNSPECIFIED" -> E'State2 -> Either [Char] E'State2
forall a b. b -> Either a b
P.Right E'State2
E'State2'STATE_UNSPECIFIED
  Text
"GENERATING" -> E'State2 -> Either [Char] E'State2
forall a b. b -> Either a b
P.Right E'State2
E'State2'GENERATING
  Text
"GENERATED" -> E'State2 -> Either [Char] E'State2
forall a b. b -> Either a b
P.Right E'State2
E'State2'GENERATED
  Text
"FAILED" -> E'State2 -> Either [Char] E'State2
forall a b. b -> Either a b
P.Right E'State2
E'State2'FAILED
  Text
s -> [Char] -> Either [Char] E'State2
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'State2)
-> [Char] -> Either [Char] E'State2
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'State2: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'State3

{- | Enum of 'Text' .
Output only. The state of the tuned model.
-}
data E'State3
  = -- | @"STATE_UNSPECIFIED"@
    E'State3'STATE_UNSPECIFIED
  | -- | @"CREATING"@
    E'State3'CREATING
  | -- | @"ACTIVE"@
    E'State3'ACTIVE
  | -- | @"FAILED"@
    E'State3'FAILED
  deriving (Int -> E'State3 -> ShowS
[E'State3] -> ShowS
E'State3 -> [Char]
(Int -> E'State3 -> ShowS)
-> (E'State3 -> [Char]) -> ([E'State3] -> ShowS) -> Show E'State3
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'State3 -> ShowS
showsPrec :: Int -> E'State3 -> ShowS
$cshow :: E'State3 -> [Char]
show :: E'State3 -> [Char]
$cshowList :: [E'State3] -> ShowS
showList :: [E'State3] -> ShowS
P.Show, E'State3 -> E'State3 -> Bool
(E'State3 -> E'State3 -> Bool)
-> (E'State3 -> E'State3 -> Bool) -> Eq E'State3
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'State3 -> E'State3 -> Bool
== :: E'State3 -> E'State3 -> Bool
$c/= :: E'State3 -> E'State3 -> Bool
/= :: E'State3 -> E'State3 -> Bool
P.Eq, P.Typeable, Eq E'State3
Eq E'State3 =>
(E'State3 -> E'State3 -> Ordering)
-> (E'State3 -> E'State3 -> Bool)
-> (E'State3 -> E'State3 -> Bool)
-> (E'State3 -> E'State3 -> Bool)
-> (E'State3 -> E'State3 -> Bool)
-> (E'State3 -> E'State3 -> E'State3)
-> (E'State3 -> E'State3 -> E'State3)
-> Ord E'State3
E'State3 -> E'State3 -> Bool
E'State3 -> E'State3 -> Ordering
E'State3 -> E'State3 -> E'State3
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'State3 -> E'State3 -> Ordering
compare :: E'State3 -> E'State3 -> Ordering
$c< :: E'State3 -> E'State3 -> Bool
< :: E'State3 -> E'State3 -> Bool
$c<= :: E'State3 -> E'State3 -> Bool
<= :: E'State3 -> E'State3 -> Bool
$c> :: E'State3 -> E'State3 -> Bool
> :: E'State3 -> E'State3 -> Bool
$c>= :: E'State3 -> E'State3 -> Bool
>= :: E'State3 -> E'State3 -> Bool
$cmax :: E'State3 -> E'State3 -> E'State3
max :: E'State3 -> E'State3 -> E'State3
$cmin :: E'State3 -> E'State3 -> E'State3
min :: E'State3 -> E'State3 -> E'State3
P.Ord, E'State3
E'State3 -> E'State3 -> Bounded E'State3
forall a. a -> a -> Bounded a
$cminBound :: E'State3
minBound :: E'State3
$cmaxBound :: E'State3
maxBound :: E'State3
P.Bounded, Int -> E'State3
E'State3 -> Int
E'State3 -> [E'State3]
E'State3 -> E'State3
E'State3 -> E'State3 -> [E'State3]
E'State3 -> E'State3 -> E'State3 -> [E'State3]
(E'State3 -> E'State3)
-> (E'State3 -> E'State3)
-> (Int -> E'State3)
-> (E'State3 -> Int)
-> (E'State3 -> [E'State3])
-> (E'State3 -> E'State3 -> [E'State3])
-> (E'State3 -> E'State3 -> [E'State3])
-> (E'State3 -> E'State3 -> E'State3 -> [E'State3])
-> Enum E'State3
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'State3 -> E'State3
succ :: E'State3 -> E'State3
$cpred :: E'State3 -> E'State3
pred :: E'State3 -> E'State3
$ctoEnum :: Int -> E'State3
toEnum :: Int -> E'State3
$cfromEnum :: E'State3 -> Int
fromEnum :: E'State3 -> Int
$cenumFrom :: E'State3 -> [E'State3]
enumFrom :: E'State3 -> [E'State3]
$cenumFromThen :: E'State3 -> E'State3 -> [E'State3]
enumFromThen :: E'State3 -> E'State3 -> [E'State3]
$cenumFromTo :: E'State3 -> E'State3 -> [E'State3]
enumFromTo :: E'State3 -> E'State3 -> [E'State3]
$cenumFromThenTo :: E'State3 -> E'State3 -> E'State3 -> [E'State3]
enumFromThenTo :: E'State3 -> E'State3 -> E'State3 -> [E'State3]
P.Enum)

instance A.ToJSON E'State3 where toJSON :: E'State3 -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'State3 -> Text) -> E'State3 -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State3 -> Text
fromE'State3
instance A.FromJSON E'State3 where parseJSON :: Value -> Parser E'State3
parseJSON Value
o = ([Char] -> Parser E'State3)
-> (E'State3 -> Parser E'State3)
-> Either [Char] E'State3
-> Parser E'State3
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'State3
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'State3 -> Parser E'State3
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'State3 -> Parser E'State3)
-> (E'State3 -> E'State3) -> E'State3 -> Parser E'State3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State3 -> E'State3
forall a. a -> a
P.id) (Either [Char] E'State3 -> Parser E'State3)
-> (Text -> Either [Char] E'State3) -> Text -> Parser E'State3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State3
toE'State3 (Text -> Parser E'State3) -> Parser Text -> Parser E'State3
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'State3 where toQueryParam :: E'State3 -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'State3 -> Text) -> E'State3 -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State3 -> Text
fromE'State3
instance WH.FromHttpApiData E'State3 where parseQueryParam :: Text -> Either Text E'State3
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'State3) -> Either Text E'State3
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'State3 -> Either Text E'State3
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'State3 -> Either Text E'State3)
-> (Text -> Either [Char] E'State3) -> Text -> Either Text E'State3
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State3
toE'State3
instance MimeRender MimeMultipartFormData E'State3 where mimeRender :: Proxy MimeMultipartFormData -> E'State3 -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'State3 -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'State3' enum
fromE'State3 :: E'State3 -> Text
fromE'State3 :: E'State3 -> Text
fromE'State3 = \case
  E'State3
E'State3'STATE_UNSPECIFIED -> Text
"STATE_UNSPECIFIED"
  E'State3
E'State3'CREATING -> Text
"CREATING"
  E'State3
E'State3'ACTIVE -> Text
"ACTIVE"
  E'State3
E'State3'FAILED -> Text
"FAILED"

-- | parse 'E'State3' enum
toE'State3 :: Text -> P.Either String E'State3
toE'State3 :: Text -> Either [Char] E'State3
toE'State3 = \case
  Text
"STATE_UNSPECIFIED" -> E'State3 -> Either [Char] E'State3
forall a b. b -> Either a b
P.Right E'State3
E'State3'STATE_UNSPECIFIED
  Text
"CREATING" -> E'State3 -> Either [Char] E'State3
forall a b. b -> Either a b
P.Right E'State3
E'State3'CREATING
  Text
"ACTIVE" -> E'State3 -> Either [Char] E'State3
forall a b. b -> Either a b
P.Right E'State3
E'State3'ACTIVE
  Text
"FAILED" -> E'State3 -> Either [Char] E'State3
forall a b. b -> Either a b
P.Right E'State3
E'State3'FAILED
  Text
s -> [Char] -> Either [Char] E'State3
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'State3)
-> [Char] -> Either [Char] E'State3
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'State3: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'State4

{- | Enum of 'Text' .
Output only. Current state of the `Chunk`.
-}
data E'State4
  = -- | @"STATE_UNSPECIFIED"@
    E'State4'UNSPECIFIED
  | -- | @"STATE_PENDING_PROCESSING"@
    E'State4'PENDING_PROCESSING
  | -- | @"STATE_ACTIVE"@
    E'State4'ACTIVE
  | -- | @"STATE_FAILED"@
    E'State4'FAILED
  deriving (Int -> E'State4 -> ShowS
[E'State4] -> ShowS
E'State4 -> [Char]
(Int -> E'State4 -> ShowS)
-> (E'State4 -> [Char]) -> ([E'State4] -> ShowS) -> Show E'State4
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'State4 -> ShowS
showsPrec :: Int -> E'State4 -> ShowS
$cshow :: E'State4 -> [Char]
show :: E'State4 -> [Char]
$cshowList :: [E'State4] -> ShowS
showList :: [E'State4] -> ShowS
P.Show, E'State4 -> E'State4 -> Bool
(E'State4 -> E'State4 -> Bool)
-> (E'State4 -> E'State4 -> Bool) -> Eq E'State4
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'State4 -> E'State4 -> Bool
== :: E'State4 -> E'State4 -> Bool
$c/= :: E'State4 -> E'State4 -> Bool
/= :: E'State4 -> E'State4 -> Bool
P.Eq, P.Typeable, Eq E'State4
Eq E'State4 =>
(E'State4 -> E'State4 -> Ordering)
-> (E'State4 -> E'State4 -> Bool)
-> (E'State4 -> E'State4 -> Bool)
-> (E'State4 -> E'State4 -> Bool)
-> (E'State4 -> E'State4 -> Bool)
-> (E'State4 -> E'State4 -> E'State4)
-> (E'State4 -> E'State4 -> E'State4)
-> Ord E'State4
E'State4 -> E'State4 -> Bool
E'State4 -> E'State4 -> Ordering
E'State4 -> E'State4 -> E'State4
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'State4 -> E'State4 -> Ordering
compare :: E'State4 -> E'State4 -> Ordering
$c< :: E'State4 -> E'State4 -> Bool
< :: E'State4 -> E'State4 -> Bool
$c<= :: E'State4 -> E'State4 -> Bool
<= :: E'State4 -> E'State4 -> Bool
$c> :: E'State4 -> E'State4 -> Bool
> :: E'State4 -> E'State4 -> Bool
$c>= :: E'State4 -> E'State4 -> Bool
>= :: E'State4 -> E'State4 -> Bool
$cmax :: E'State4 -> E'State4 -> E'State4
max :: E'State4 -> E'State4 -> E'State4
$cmin :: E'State4 -> E'State4 -> E'State4
min :: E'State4 -> E'State4 -> E'State4
P.Ord, E'State4
E'State4 -> E'State4 -> Bounded E'State4
forall a. a -> a -> Bounded a
$cminBound :: E'State4
minBound :: E'State4
$cmaxBound :: E'State4
maxBound :: E'State4
P.Bounded, Int -> E'State4
E'State4 -> Int
E'State4 -> [E'State4]
E'State4 -> E'State4
E'State4 -> E'State4 -> [E'State4]
E'State4 -> E'State4 -> E'State4 -> [E'State4]
(E'State4 -> E'State4)
-> (E'State4 -> E'State4)
-> (Int -> E'State4)
-> (E'State4 -> Int)
-> (E'State4 -> [E'State4])
-> (E'State4 -> E'State4 -> [E'State4])
-> (E'State4 -> E'State4 -> [E'State4])
-> (E'State4 -> E'State4 -> E'State4 -> [E'State4])
-> Enum E'State4
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'State4 -> E'State4
succ :: E'State4 -> E'State4
$cpred :: E'State4 -> E'State4
pred :: E'State4 -> E'State4
$ctoEnum :: Int -> E'State4
toEnum :: Int -> E'State4
$cfromEnum :: E'State4 -> Int
fromEnum :: E'State4 -> Int
$cenumFrom :: E'State4 -> [E'State4]
enumFrom :: E'State4 -> [E'State4]
$cenumFromThen :: E'State4 -> E'State4 -> [E'State4]
enumFromThen :: E'State4 -> E'State4 -> [E'State4]
$cenumFromTo :: E'State4 -> E'State4 -> [E'State4]
enumFromTo :: E'State4 -> E'State4 -> [E'State4]
$cenumFromThenTo :: E'State4 -> E'State4 -> E'State4 -> [E'State4]
enumFromThenTo :: E'State4 -> E'State4 -> E'State4 -> [E'State4]
P.Enum)

instance A.ToJSON E'State4 where toJSON :: E'State4 -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'State4 -> Text) -> E'State4 -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State4 -> Text
fromE'State4
instance A.FromJSON E'State4 where parseJSON :: Value -> Parser E'State4
parseJSON Value
o = ([Char] -> Parser E'State4)
-> (E'State4 -> Parser E'State4)
-> Either [Char] E'State4
-> Parser E'State4
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'State4
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'State4 -> Parser E'State4
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'State4 -> Parser E'State4)
-> (E'State4 -> E'State4) -> E'State4 -> Parser E'State4
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State4 -> E'State4
forall a. a -> a
P.id) (Either [Char] E'State4 -> Parser E'State4)
-> (Text -> Either [Char] E'State4) -> Text -> Parser E'State4
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State4
toE'State4 (Text -> Parser E'State4) -> Parser Text -> Parser E'State4
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'State4 where toQueryParam :: E'State4 -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'State4 -> Text) -> E'State4 -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'State4 -> Text
fromE'State4
instance WH.FromHttpApiData E'State4 where parseQueryParam :: Text -> Either Text E'State4
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'State4) -> Either Text E'State4
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'State4 -> Either Text E'State4
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'State4 -> Either Text E'State4)
-> (Text -> Either [Char] E'State4) -> Text -> Either Text E'State4
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'State4
toE'State4
instance MimeRender MimeMultipartFormData E'State4 where mimeRender :: Proxy MimeMultipartFormData -> E'State4 -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'State4 -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'State4' enum
fromE'State4 :: E'State4 -> Text
fromE'State4 :: E'State4 -> Text
fromE'State4 = \case
  E'State4
E'State4'UNSPECIFIED -> Text
"STATE_UNSPECIFIED"
  E'State4
E'State4'PENDING_PROCESSING -> Text
"STATE_PENDING_PROCESSING"
  E'State4
E'State4'ACTIVE -> Text
"STATE_ACTIVE"
  E'State4
E'State4'FAILED -> Text
"STATE_FAILED"

-- | parse 'E'State4' enum
toE'State4 :: Text -> P.Either String E'State4
toE'State4 :: Text -> Either [Char] E'State4
toE'State4 = \case
  Text
"STATE_UNSPECIFIED" -> E'State4 -> Either [Char] E'State4
forall a b. b -> Either a b
P.Right E'State4
E'State4'UNSPECIFIED
  Text
"STATE_PENDING_PROCESSING" -> E'State4 -> Either [Char] E'State4
forall a b. b -> Either a b
P.Right E'State4
E'State4'PENDING_PROCESSING
  Text
"STATE_ACTIVE" -> E'State4 -> Either [Char] E'State4
forall a b. b -> Either a b
P.Right E'State4
E'State4'ACTIVE
  Text
"STATE_FAILED" -> E'State4 -> Either [Char] E'State4
forall a b. b -> Either a b
P.Right E'State4
E'State4'FAILED
  Text
s -> [Char] -> Either [Char] E'State4
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'State4)
-> [Char] -> Either [Char] E'State4
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'State4: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Threshold

{- | Enum of 'Text' .
Required. Controls the probability threshold at which harm is blocked.
-}
data E'Threshold
  = -- | @"HARM_BLOCK_THRESHOLD_UNSPECIFIED"@
    E'Threshold'HARM_BLOCK_THRESHOLD_UNSPECIFIED
  | -- | @"BLOCK_LOW_AND_ABOVE"@
    E'Threshold'BLOCK_LOW_AND_ABOVE
  | -- | @"BLOCK_MEDIUM_AND_ABOVE"@
    E'Threshold'BLOCK_MEDIUM_AND_ABOVE
  | -- | @"BLOCK_ONLY_HIGH"@
    E'Threshold'BLOCK_ONLY_HIGH
  | -- | @"BLOCK_NONE"@
    E'Threshold'BLOCK_NONE
  | -- | @"OFF"@
    E'Threshold'OFF
  deriving (Int -> E'Threshold -> ShowS
[E'Threshold] -> ShowS
E'Threshold -> [Char]
(Int -> E'Threshold -> ShowS)
-> (E'Threshold -> [Char])
-> ([E'Threshold] -> ShowS)
-> Show E'Threshold
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Threshold -> ShowS
showsPrec :: Int -> E'Threshold -> ShowS
$cshow :: E'Threshold -> [Char]
show :: E'Threshold -> [Char]
$cshowList :: [E'Threshold] -> ShowS
showList :: [E'Threshold] -> ShowS
P.Show, E'Threshold -> E'Threshold -> Bool
(E'Threshold -> E'Threshold -> Bool)
-> (E'Threshold -> E'Threshold -> Bool) -> Eq E'Threshold
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Threshold -> E'Threshold -> Bool
== :: E'Threshold -> E'Threshold -> Bool
$c/= :: E'Threshold -> E'Threshold -> Bool
/= :: E'Threshold -> E'Threshold -> Bool
P.Eq, P.Typeable, Eq E'Threshold
Eq E'Threshold =>
(E'Threshold -> E'Threshold -> Ordering)
-> (E'Threshold -> E'Threshold -> Bool)
-> (E'Threshold -> E'Threshold -> Bool)
-> (E'Threshold -> E'Threshold -> Bool)
-> (E'Threshold -> E'Threshold -> Bool)
-> (E'Threshold -> E'Threshold -> E'Threshold)
-> (E'Threshold -> E'Threshold -> E'Threshold)
-> Ord E'Threshold
E'Threshold -> E'Threshold -> Bool
E'Threshold -> E'Threshold -> Ordering
E'Threshold -> E'Threshold -> E'Threshold
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Threshold -> E'Threshold -> Ordering
compare :: E'Threshold -> E'Threshold -> Ordering
$c< :: E'Threshold -> E'Threshold -> Bool
< :: E'Threshold -> E'Threshold -> Bool
$c<= :: E'Threshold -> E'Threshold -> Bool
<= :: E'Threshold -> E'Threshold -> Bool
$c> :: E'Threshold -> E'Threshold -> Bool
> :: E'Threshold -> E'Threshold -> Bool
$c>= :: E'Threshold -> E'Threshold -> Bool
>= :: E'Threshold -> E'Threshold -> Bool
$cmax :: E'Threshold -> E'Threshold -> E'Threshold
max :: E'Threshold -> E'Threshold -> E'Threshold
$cmin :: E'Threshold -> E'Threshold -> E'Threshold
min :: E'Threshold -> E'Threshold -> E'Threshold
P.Ord, E'Threshold
E'Threshold -> E'Threshold -> Bounded E'Threshold
forall a. a -> a -> Bounded a
$cminBound :: E'Threshold
minBound :: E'Threshold
$cmaxBound :: E'Threshold
maxBound :: E'Threshold
P.Bounded, Int -> E'Threshold
E'Threshold -> Int
E'Threshold -> [E'Threshold]
E'Threshold -> E'Threshold
E'Threshold -> E'Threshold -> [E'Threshold]
E'Threshold -> E'Threshold -> E'Threshold -> [E'Threshold]
(E'Threshold -> E'Threshold)
-> (E'Threshold -> E'Threshold)
-> (Int -> E'Threshold)
-> (E'Threshold -> Int)
-> (E'Threshold -> [E'Threshold])
-> (E'Threshold -> E'Threshold -> [E'Threshold])
-> (E'Threshold -> E'Threshold -> [E'Threshold])
-> (E'Threshold -> E'Threshold -> E'Threshold -> [E'Threshold])
-> Enum E'Threshold
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Threshold -> E'Threshold
succ :: E'Threshold -> E'Threshold
$cpred :: E'Threshold -> E'Threshold
pred :: E'Threshold -> E'Threshold
$ctoEnum :: Int -> E'Threshold
toEnum :: Int -> E'Threshold
$cfromEnum :: E'Threshold -> Int
fromEnum :: E'Threshold -> Int
$cenumFrom :: E'Threshold -> [E'Threshold]
enumFrom :: E'Threshold -> [E'Threshold]
$cenumFromThen :: E'Threshold -> E'Threshold -> [E'Threshold]
enumFromThen :: E'Threshold -> E'Threshold -> [E'Threshold]
$cenumFromTo :: E'Threshold -> E'Threshold -> [E'Threshold]
enumFromTo :: E'Threshold -> E'Threshold -> [E'Threshold]
$cenumFromThenTo :: E'Threshold -> E'Threshold -> E'Threshold -> [E'Threshold]
enumFromThenTo :: E'Threshold -> E'Threshold -> E'Threshold -> [E'Threshold]
P.Enum)

instance A.ToJSON E'Threshold where toJSON :: E'Threshold -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Threshold -> Text) -> E'Threshold -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Threshold -> Text
fromE'Threshold
instance A.FromJSON E'Threshold where parseJSON :: Value -> Parser E'Threshold
parseJSON Value
o = ([Char] -> Parser E'Threshold)
-> (E'Threshold -> Parser E'Threshold)
-> Either [Char] E'Threshold
-> Parser E'Threshold
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Threshold
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Threshold -> Parser E'Threshold
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Threshold -> Parser E'Threshold)
-> (E'Threshold -> E'Threshold)
-> E'Threshold
-> Parser E'Threshold
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Threshold -> E'Threshold
forall a. a -> a
P.id) (Either [Char] E'Threshold -> Parser E'Threshold)
-> (Text -> Either [Char] E'Threshold)
-> Text
-> Parser E'Threshold
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Threshold
toE'Threshold (Text -> Parser E'Threshold) -> Parser Text -> Parser E'Threshold
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Threshold where toQueryParam :: E'Threshold -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Threshold -> Text) -> E'Threshold -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Threshold -> Text
fromE'Threshold
instance WH.FromHttpApiData E'Threshold where parseQueryParam :: Text -> Either Text E'Threshold
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Threshold) -> Either Text E'Threshold
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'Threshold -> Either Text E'Threshold
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Threshold -> Either Text E'Threshold)
-> (Text -> Either [Char] E'Threshold)
-> Text
-> Either Text E'Threshold
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Threshold
toE'Threshold
instance MimeRender MimeMultipartFormData E'Threshold where mimeRender :: Proxy MimeMultipartFormData -> E'Threshold -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Threshold -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Threshold' enum
fromE'Threshold :: E'Threshold -> Text
fromE'Threshold :: E'Threshold -> Text
fromE'Threshold = \case
  E'Threshold
E'Threshold'HARM_BLOCK_THRESHOLD_UNSPECIFIED -> Text
"HARM_BLOCK_THRESHOLD_UNSPECIFIED"
  E'Threshold
E'Threshold'BLOCK_LOW_AND_ABOVE -> Text
"BLOCK_LOW_AND_ABOVE"
  E'Threshold
E'Threshold'BLOCK_MEDIUM_AND_ABOVE -> Text
"BLOCK_MEDIUM_AND_ABOVE"
  E'Threshold
E'Threshold'BLOCK_ONLY_HIGH -> Text
"BLOCK_ONLY_HIGH"
  E'Threshold
E'Threshold'BLOCK_NONE -> Text
"BLOCK_NONE"
  E'Threshold
E'Threshold'OFF -> Text
"OFF"

-- | parse 'E'Threshold' enum
toE'Threshold :: Text -> P.Either String E'Threshold
toE'Threshold :: Text -> Either [Char] E'Threshold
toE'Threshold = \case
  Text
"HARM_BLOCK_THRESHOLD_UNSPECIFIED" -> E'Threshold -> Either [Char] E'Threshold
forall a b. b -> Either a b
P.Right E'Threshold
E'Threshold'HARM_BLOCK_THRESHOLD_UNSPECIFIED
  Text
"BLOCK_LOW_AND_ABOVE" -> E'Threshold -> Either [Char] E'Threshold
forall a b. b -> Either a b
P.Right E'Threshold
E'Threshold'BLOCK_LOW_AND_ABOVE
  Text
"BLOCK_MEDIUM_AND_ABOVE" -> E'Threshold -> Either [Char] E'Threshold
forall a b. b -> Either a b
P.Right E'Threshold
E'Threshold'BLOCK_MEDIUM_AND_ABOVE
  Text
"BLOCK_ONLY_HIGH" -> E'Threshold -> Either [Char] E'Threshold
forall a b. b -> Either a b
P.Right E'Threshold
E'Threshold'BLOCK_ONLY_HIGH
  Text
"BLOCK_NONE" -> E'Threshold -> Either [Char] E'Threshold
forall a b. b -> Either a b
P.Right E'Threshold
E'Threshold'BLOCK_NONE
  Text
"OFF" -> E'Threshold -> Either [Char] E'Threshold
forall a b. b -> Either a b
P.Right E'Threshold
E'Threshold'OFF
  Text
s -> [Char] -> Either [Char] E'Threshold
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Threshold)
-> [Char] -> Either [Char] E'Threshold
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Threshold: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'UrlRetrievalStatus

{- | Enum of 'Text' .
Status of the url retrieval.
-}
data E'UrlRetrievalStatus
  = -- | @"URL_RETRIEVAL_STATUS_UNSPECIFIED"@
    E'UrlRetrievalStatus'UNSPECIFIED
  | -- | @"URL_RETRIEVAL_STATUS_SUCCESS"@
    E'UrlRetrievalStatus'SUCCESS
  | -- | @"URL_RETRIEVAL_STATUS_ERROR"@
    E'UrlRetrievalStatus'ERROR
  deriving (Int -> E'UrlRetrievalStatus -> ShowS
[E'UrlRetrievalStatus] -> ShowS
E'UrlRetrievalStatus -> [Char]
(Int -> E'UrlRetrievalStatus -> ShowS)
-> (E'UrlRetrievalStatus -> [Char])
-> ([E'UrlRetrievalStatus] -> ShowS)
-> Show E'UrlRetrievalStatus
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'UrlRetrievalStatus -> ShowS
showsPrec :: Int -> E'UrlRetrievalStatus -> ShowS
$cshow :: E'UrlRetrievalStatus -> [Char]
show :: E'UrlRetrievalStatus -> [Char]
$cshowList :: [E'UrlRetrievalStatus] -> ShowS
showList :: [E'UrlRetrievalStatus] -> ShowS
P.Show, E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
(E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool)
-> (E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool)
-> Eq E'UrlRetrievalStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
== :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
$c/= :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
/= :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
P.Eq, P.Typeable, Eq E'UrlRetrievalStatus
Eq E'UrlRetrievalStatus =>
(E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Ordering)
-> (E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool)
-> (E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool)
-> (E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool)
-> (E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool)
-> (E'UrlRetrievalStatus
    -> E'UrlRetrievalStatus -> E'UrlRetrievalStatus)
-> (E'UrlRetrievalStatus
    -> E'UrlRetrievalStatus -> E'UrlRetrievalStatus)
-> Ord E'UrlRetrievalStatus
E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Ordering
E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> E'UrlRetrievalStatus
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Ordering
compare :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Ordering
$c< :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
< :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
$c<= :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
<= :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
$c> :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
> :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
$c>= :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
>= :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus -> Bool
$cmax :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> E'UrlRetrievalStatus
max :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> E'UrlRetrievalStatus
$cmin :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> E'UrlRetrievalStatus
min :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> E'UrlRetrievalStatus
P.Ord, E'UrlRetrievalStatus
E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> Bounded E'UrlRetrievalStatus
forall a. a -> a -> Bounded a
$cminBound :: E'UrlRetrievalStatus
minBound :: E'UrlRetrievalStatus
$cmaxBound :: E'UrlRetrievalStatus
maxBound :: E'UrlRetrievalStatus
P.Bounded, Int -> E'UrlRetrievalStatus
E'UrlRetrievalStatus -> Int
E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
E'UrlRetrievalStatus -> E'UrlRetrievalStatus
E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
E'UrlRetrievalStatus
-> E'UrlRetrievalStatus
-> E'UrlRetrievalStatus
-> [E'UrlRetrievalStatus]
(E'UrlRetrievalStatus -> E'UrlRetrievalStatus)
-> (E'UrlRetrievalStatus -> E'UrlRetrievalStatus)
-> (Int -> E'UrlRetrievalStatus)
-> (E'UrlRetrievalStatus -> Int)
-> (E'UrlRetrievalStatus -> [E'UrlRetrievalStatus])
-> (E'UrlRetrievalStatus
    -> E'UrlRetrievalStatus -> [E'UrlRetrievalStatus])
-> (E'UrlRetrievalStatus
    -> E'UrlRetrievalStatus -> [E'UrlRetrievalStatus])
-> (E'UrlRetrievalStatus
    -> E'UrlRetrievalStatus
    -> E'UrlRetrievalStatus
    -> [E'UrlRetrievalStatus])
-> Enum E'UrlRetrievalStatus
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus
succ :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus
$cpred :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus
pred :: E'UrlRetrievalStatus -> E'UrlRetrievalStatus
$ctoEnum :: Int -> E'UrlRetrievalStatus
toEnum :: Int -> E'UrlRetrievalStatus
$cfromEnum :: E'UrlRetrievalStatus -> Int
fromEnum :: E'UrlRetrievalStatus -> Int
$cenumFrom :: E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
enumFrom :: E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
$cenumFromThen :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
enumFromThen :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
$cenumFromTo :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
enumFromTo :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus -> [E'UrlRetrievalStatus]
$cenumFromThenTo :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus
-> E'UrlRetrievalStatus
-> [E'UrlRetrievalStatus]
enumFromThenTo :: E'UrlRetrievalStatus
-> E'UrlRetrievalStatus
-> E'UrlRetrievalStatus
-> [E'UrlRetrievalStatus]
P.Enum)

instance A.ToJSON E'UrlRetrievalStatus where toJSON :: E'UrlRetrievalStatus -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value)
-> (E'UrlRetrievalStatus -> Text) -> E'UrlRetrievalStatus -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'UrlRetrievalStatus -> Text
fromE'UrlRetrievalStatus
instance A.FromJSON E'UrlRetrievalStatus where parseJSON :: Value -> Parser E'UrlRetrievalStatus
parseJSON Value
o = ([Char] -> Parser E'UrlRetrievalStatus)
-> (E'UrlRetrievalStatus -> Parser E'UrlRetrievalStatus)
-> Either [Char] E'UrlRetrievalStatus
-> Parser E'UrlRetrievalStatus
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'UrlRetrievalStatus
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'UrlRetrievalStatus -> Parser E'UrlRetrievalStatus
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'UrlRetrievalStatus -> Parser E'UrlRetrievalStatus)
-> (E'UrlRetrievalStatus -> E'UrlRetrievalStatus)
-> E'UrlRetrievalStatus
-> Parser E'UrlRetrievalStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'UrlRetrievalStatus -> E'UrlRetrievalStatus
forall a. a -> a
P.id) (Either [Char] E'UrlRetrievalStatus -> Parser E'UrlRetrievalStatus)
-> (Text -> Either [Char] E'UrlRetrievalStatus)
-> Text
-> Parser E'UrlRetrievalStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'UrlRetrievalStatus
toE'UrlRetrievalStatus (Text -> Parser E'UrlRetrievalStatus)
-> Parser Text -> Parser E'UrlRetrievalStatus
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'UrlRetrievalStatus where toQueryParam :: E'UrlRetrievalStatus -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text)
-> (E'UrlRetrievalStatus -> Text) -> E'UrlRetrievalStatus -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'UrlRetrievalStatus -> Text
fromE'UrlRetrievalStatus
instance WH.FromHttpApiData E'UrlRetrievalStatus where parseQueryParam :: Text -> Either Text E'UrlRetrievalStatus
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'UrlRetrievalStatus)
-> Either Text E'UrlRetrievalStatus
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] E'UrlRetrievalStatus
-> Either Text E'UrlRetrievalStatus
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'UrlRetrievalStatus
 -> Either Text E'UrlRetrievalStatus)
-> (Text -> Either [Char] E'UrlRetrievalStatus)
-> Text
-> Either Text E'UrlRetrievalStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'UrlRetrievalStatus
toE'UrlRetrievalStatus
instance MimeRender MimeMultipartFormData E'UrlRetrievalStatus where mimeRender :: Proxy MimeMultipartFormData -> E'UrlRetrievalStatus -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'UrlRetrievalStatus -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'UrlRetrievalStatus' enum
fromE'UrlRetrievalStatus :: E'UrlRetrievalStatus -> Text
fromE'UrlRetrievalStatus :: E'UrlRetrievalStatus -> Text
fromE'UrlRetrievalStatus = \case
  E'UrlRetrievalStatus
E'UrlRetrievalStatus'UNSPECIFIED -> Text
"URL_RETRIEVAL_STATUS_UNSPECIFIED"
  E'UrlRetrievalStatus
E'UrlRetrievalStatus'SUCCESS -> Text
"URL_RETRIEVAL_STATUS_SUCCESS"
  E'UrlRetrievalStatus
E'UrlRetrievalStatus'ERROR -> Text
"URL_RETRIEVAL_STATUS_ERROR"

-- | parse 'E'UrlRetrievalStatus' enum
toE'UrlRetrievalStatus :: Text -> P.Either String E'UrlRetrievalStatus
toE'UrlRetrievalStatus :: Text -> Either [Char] E'UrlRetrievalStatus
toE'UrlRetrievalStatus = \case
  Text
"URL_RETRIEVAL_STATUS_UNSPECIFIED" -> E'UrlRetrievalStatus -> Either [Char] E'UrlRetrievalStatus
forall a b. b -> Either a b
P.Right E'UrlRetrievalStatus
E'UrlRetrievalStatus'UNSPECIFIED
  Text
"URL_RETRIEVAL_STATUS_SUCCESS" -> E'UrlRetrievalStatus -> Either [Char] E'UrlRetrievalStatus
forall a b. b -> Either a b
P.Right E'UrlRetrievalStatus
E'UrlRetrievalStatus'SUCCESS
  Text
"URL_RETRIEVAL_STATUS_ERROR" -> E'UrlRetrievalStatus -> Either [Char] E'UrlRetrievalStatus
forall a b. b -> Either a b
P.Right E'UrlRetrievalStatus
E'UrlRetrievalStatus'ERROR
  Text
s -> [Char] -> Either [Char] E'UrlRetrievalStatus
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'UrlRetrievalStatus)
-> [Char] -> Either [Char] E'UrlRetrievalStatus
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'UrlRetrievalStatus: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** E'Xgafv

-- | Enum of 'Text'
data E'Xgafv
  = -- | @"1"@
    E'Xgafv'1
  | -- | @"2"@
    E'Xgafv'2
  deriving (Int -> E'Xgafv -> ShowS
[E'Xgafv] -> ShowS
E'Xgafv -> [Char]
(Int -> E'Xgafv -> ShowS)
-> (E'Xgafv -> [Char]) -> ([E'Xgafv] -> ShowS) -> Show E'Xgafv
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> E'Xgafv -> ShowS
showsPrec :: Int -> E'Xgafv -> ShowS
$cshow :: E'Xgafv -> [Char]
show :: E'Xgafv -> [Char]
$cshowList :: [E'Xgafv] -> ShowS
showList :: [E'Xgafv] -> ShowS
P.Show, E'Xgafv -> E'Xgafv -> Bool
(E'Xgafv -> E'Xgafv -> Bool)
-> (E'Xgafv -> E'Xgafv -> Bool) -> Eq E'Xgafv
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: E'Xgafv -> E'Xgafv -> Bool
== :: E'Xgafv -> E'Xgafv -> Bool
$c/= :: E'Xgafv -> E'Xgafv -> Bool
/= :: E'Xgafv -> E'Xgafv -> Bool
P.Eq, P.Typeable, Eq E'Xgafv
Eq E'Xgafv =>
(E'Xgafv -> E'Xgafv -> Ordering)
-> (E'Xgafv -> E'Xgafv -> Bool)
-> (E'Xgafv -> E'Xgafv -> Bool)
-> (E'Xgafv -> E'Xgafv -> Bool)
-> (E'Xgafv -> E'Xgafv -> Bool)
-> (E'Xgafv -> E'Xgafv -> E'Xgafv)
-> (E'Xgafv -> E'Xgafv -> E'Xgafv)
-> Ord E'Xgafv
E'Xgafv -> E'Xgafv -> Bool
E'Xgafv -> E'Xgafv -> Ordering
E'Xgafv -> E'Xgafv -> E'Xgafv
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: E'Xgafv -> E'Xgafv -> Ordering
compare :: E'Xgafv -> E'Xgafv -> Ordering
$c< :: E'Xgafv -> E'Xgafv -> Bool
< :: E'Xgafv -> E'Xgafv -> Bool
$c<= :: E'Xgafv -> E'Xgafv -> Bool
<= :: E'Xgafv -> E'Xgafv -> Bool
$c> :: E'Xgafv -> E'Xgafv -> Bool
> :: E'Xgafv -> E'Xgafv -> Bool
$c>= :: E'Xgafv -> E'Xgafv -> Bool
>= :: E'Xgafv -> E'Xgafv -> Bool
$cmax :: E'Xgafv -> E'Xgafv -> E'Xgafv
max :: E'Xgafv -> E'Xgafv -> E'Xgafv
$cmin :: E'Xgafv -> E'Xgafv -> E'Xgafv
min :: E'Xgafv -> E'Xgafv -> E'Xgafv
P.Ord, E'Xgafv
E'Xgafv -> E'Xgafv -> Bounded E'Xgafv
forall a. a -> a -> Bounded a
$cminBound :: E'Xgafv
minBound :: E'Xgafv
$cmaxBound :: E'Xgafv
maxBound :: E'Xgafv
P.Bounded, Int -> E'Xgafv
E'Xgafv -> Int
E'Xgafv -> [E'Xgafv]
E'Xgafv -> E'Xgafv
E'Xgafv -> E'Xgafv -> [E'Xgafv]
E'Xgafv -> E'Xgafv -> E'Xgafv -> [E'Xgafv]
(E'Xgafv -> E'Xgafv)
-> (E'Xgafv -> E'Xgafv)
-> (Int -> E'Xgafv)
-> (E'Xgafv -> Int)
-> (E'Xgafv -> [E'Xgafv])
-> (E'Xgafv -> E'Xgafv -> [E'Xgafv])
-> (E'Xgafv -> E'Xgafv -> [E'Xgafv])
-> (E'Xgafv -> E'Xgafv -> E'Xgafv -> [E'Xgafv])
-> Enum E'Xgafv
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: E'Xgafv -> E'Xgafv
succ :: E'Xgafv -> E'Xgafv
$cpred :: E'Xgafv -> E'Xgafv
pred :: E'Xgafv -> E'Xgafv
$ctoEnum :: Int -> E'Xgafv
toEnum :: Int -> E'Xgafv
$cfromEnum :: E'Xgafv -> Int
fromEnum :: E'Xgafv -> Int
$cenumFrom :: E'Xgafv -> [E'Xgafv]
enumFrom :: E'Xgafv -> [E'Xgafv]
$cenumFromThen :: E'Xgafv -> E'Xgafv -> [E'Xgafv]
enumFromThen :: E'Xgafv -> E'Xgafv -> [E'Xgafv]
$cenumFromTo :: E'Xgafv -> E'Xgafv -> [E'Xgafv]
enumFromTo :: E'Xgafv -> E'Xgafv -> [E'Xgafv]
$cenumFromThenTo :: E'Xgafv -> E'Xgafv -> E'Xgafv -> [E'Xgafv]
enumFromThenTo :: E'Xgafv -> E'Xgafv -> E'Xgafv -> [E'Xgafv]
P.Enum)

instance A.ToJSON E'Xgafv where toJSON :: E'Xgafv -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (E'Xgafv -> Text) -> E'Xgafv -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Xgafv -> Text
fromE'Xgafv
instance A.FromJSON E'Xgafv where parseJSON :: Value -> Parser E'Xgafv
parseJSON Value
o = ([Char] -> Parser E'Xgafv)
-> (E'Xgafv -> Parser E'Xgafv)
-> Either [Char] E'Xgafv
-> Parser E'Xgafv
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser E'Xgafv
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (E'Xgafv -> Parser E'Xgafv
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (E'Xgafv -> Parser E'Xgafv)
-> (E'Xgafv -> E'Xgafv) -> E'Xgafv -> Parser E'Xgafv
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Xgafv -> E'Xgafv
forall a. a -> a
P.id) (Either [Char] E'Xgafv -> Parser E'Xgafv)
-> (Text -> Either [Char] E'Xgafv) -> Text -> Parser E'Xgafv
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Xgafv
toE'Xgafv (Text -> Parser E'Xgafv) -> Parser Text -> Parser E'Xgafv
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData E'Xgafv where toQueryParam :: E'Xgafv -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (E'Xgafv -> Text) -> E'Xgafv -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. E'Xgafv -> Text
fromE'Xgafv
instance WH.FromHttpApiData E'Xgafv where parseQueryParam :: Text -> Either Text E'Xgafv
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text E'Xgafv) -> Either Text E'Xgafv
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] E'Xgafv -> Either Text E'Xgafv
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] E'Xgafv -> Either Text E'Xgafv)
-> (Text -> Either [Char] E'Xgafv) -> Text -> Either Text E'Xgafv
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] E'Xgafv
toE'Xgafv
instance MimeRender MimeMultipartFormData E'Xgafv where mimeRender :: Proxy MimeMultipartFormData -> E'Xgafv -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = E'Xgafv -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'E'Xgafv' enum
fromE'Xgafv :: E'Xgafv -> Text
fromE'Xgafv :: E'Xgafv -> Text
fromE'Xgafv = \case
  E'Xgafv
E'Xgafv'1 -> Text
"1"
  E'Xgafv
E'Xgafv'2 -> Text
"2"

-- | parse 'E'Xgafv' enum
toE'Xgafv :: Text -> P.Either String E'Xgafv
toE'Xgafv :: Text -> Either [Char] E'Xgafv
toE'Xgafv = \case
  Text
"1" -> E'Xgafv -> Either [Char] E'Xgafv
forall a b. b -> Either a b
P.Right E'Xgafv
E'Xgafv'1
  Text
"2" -> E'Xgafv -> Either [Char] E'Xgafv
forall a b. b -> Either a b
P.Right E'Xgafv
E'Xgafv'2
  Text
s -> [Char] -> Either [Char] E'Xgafv
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] E'Xgafv)
-> [Char] -> Either [Char] E'Xgafv
forall a b. (a -> b) -> a -> b
$ [Char]
"toE'Xgafv: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** HarmCategory

-- | Enum of 'Text'
data HarmCategory
  = -- | @"HARM_CATEGORY_UNSPECIFIED"@
    HarmCategory'UNSPECIFIED
  | -- | @"HARM_CATEGORY_DEROGATORY"@
    HarmCategory'DEROGATORY
  | -- | @"HARM_CATEGORY_TOXICITY"@
    HarmCategory'TOXICITY
  | -- | @"HARM_CATEGORY_VIOLENCE"@
    HarmCategory'VIOLENCE
  | -- | @"HARM_CATEGORY_SEXUAL"@
    HarmCategory'SEXUAL
  | -- | @"HARM_CATEGORY_MEDICAL"@
    HarmCategory'MEDICAL
  | -- | @"HARM_CATEGORY_DANGEROUS"@
    HarmCategory'DANGEROUS
  | -- | @"HARM_CATEGORY_HARASSMENT"@
    HarmCategory'HARASSMENT
  | -- | @"HARM_CATEGORY_HATE_SPEECH"@
    HarmCategory'HATE_SPEECH
  | -- | @"HARM_CATEGORY_SEXUALLY_EXPLICIT"@
    HarmCategory'SEXUALLY_EXPLICIT
  | -- | @"HARM_CATEGORY_DANGEROUS_CONTENT"@
    HarmCategory'DANGEROUS_CONTENT
  | -- | @"HARM_CATEGORY_CIVIC_INTEGRITY"@
    HarmCategory'CIVIC_INTEGRITY
  deriving (Int -> HarmCategory -> ShowS
[HarmCategory] -> ShowS
HarmCategory -> [Char]
(Int -> HarmCategory -> ShowS)
-> (HarmCategory -> [Char])
-> ([HarmCategory] -> ShowS)
-> Show HarmCategory
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HarmCategory -> ShowS
showsPrec :: Int -> HarmCategory -> ShowS
$cshow :: HarmCategory -> [Char]
show :: HarmCategory -> [Char]
$cshowList :: [HarmCategory] -> ShowS
showList :: [HarmCategory] -> ShowS
P.Show, HarmCategory -> HarmCategory -> Bool
(HarmCategory -> HarmCategory -> Bool)
-> (HarmCategory -> HarmCategory -> Bool) -> Eq HarmCategory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HarmCategory -> HarmCategory -> Bool
== :: HarmCategory -> HarmCategory -> Bool
$c/= :: HarmCategory -> HarmCategory -> Bool
/= :: HarmCategory -> HarmCategory -> Bool
P.Eq, P.Typeable, Eq HarmCategory
Eq HarmCategory =>
(HarmCategory -> HarmCategory -> Ordering)
-> (HarmCategory -> HarmCategory -> Bool)
-> (HarmCategory -> HarmCategory -> Bool)
-> (HarmCategory -> HarmCategory -> Bool)
-> (HarmCategory -> HarmCategory -> Bool)
-> (HarmCategory -> HarmCategory -> HarmCategory)
-> (HarmCategory -> HarmCategory -> HarmCategory)
-> Ord HarmCategory
HarmCategory -> HarmCategory -> Bool
HarmCategory -> HarmCategory -> Ordering
HarmCategory -> HarmCategory -> HarmCategory
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: HarmCategory -> HarmCategory -> Ordering
compare :: HarmCategory -> HarmCategory -> Ordering
$c< :: HarmCategory -> HarmCategory -> Bool
< :: HarmCategory -> HarmCategory -> Bool
$c<= :: HarmCategory -> HarmCategory -> Bool
<= :: HarmCategory -> HarmCategory -> Bool
$c> :: HarmCategory -> HarmCategory -> Bool
> :: HarmCategory -> HarmCategory -> Bool
$c>= :: HarmCategory -> HarmCategory -> Bool
>= :: HarmCategory -> HarmCategory -> Bool
$cmax :: HarmCategory -> HarmCategory -> HarmCategory
max :: HarmCategory -> HarmCategory -> HarmCategory
$cmin :: HarmCategory -> HarmCategory -> HarmCategory
min :: HarmCategory -> HarmCategory -> HarmCategory
P.Ord, HarmCategory
HarmCategory -> HarmCategory -> Bounded HarmCategory
forall a. a -> a -> Bounded a
$cminBound :: HarmCategory
minBound :: HarmCategory
$cmaxBound :: HarmCategory
maxBound :: HarmCategory
P.Bounded, Int -> HarmCategory
HarmCategory -> Int
HarmCategory -> [HarmCategory]
HarmCategory -> HarmCategory
HarmCategory -> HarmCategory -> [HarmCategory]
HarmCategory -> HarmCategory -> HarmCategory -> [HarmCategory]
(HarmCategory -> HarmCategory)
-> (HarmCategory -> HarmCategory)
-> (Int -> HarmCategory)
-> (HarmCategory -> Int)
-> (HarmCategory -> [HarmCategory])
-> (HarmCategory -> HarmCategory -> [HarmCategory])
-> (HarmCategory -> HarmCategory -> [HarmCategory])
-> (HarmCategory -> HarmCategory -> HarmCategory -> [HarmCategory])
-> Enum HarmCategory
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: HarmCategory -> HarmCategory
succ :: HarmCategory -> HarmCategory
$cpred :: HarmCategory -> HarmCategory
pred :: HarmCategory -> HarmCategory
$ctoEnum :: Int -> HarmCategory
toEnum :: Int -> HarmCategory
$cfromEnum :: HarmCategory -> Int
fromEnum :: HarmCategory -> Int
$cenumFrom :: HarmCategory -> [HarmCategory]
enumFrom :: HarmCategory -> [HarmCategory]
$cenumFromThen :: HarmCategory -> HarmCategory -> [HarmCategory]
enumFromThen :: HarmCategory -> HarmCategory -> [HarmCategory]
$cenumFromTo :: HarmCategory -> HarmCategory -> [HarmCategory]
enumFromTo :: HarmCategory -> HarmCategory -> [HarmCategory]
$cenumFromThenTo :: HarmCategory -> HarmCategory -> HarmCategory -> [HarmCategory]
enumFromThenTo :: HarmCategory -> HarmCategory -> HarmCategory -> [HarmCategory]
P.Enum)

instance A.ToJSON HarmCategory where toJSON :: HarmCategory -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (HarmCategory -> Text) -> HarmCategory -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HarmCategory -> Text
fromHarmCategory
instance A.FromJSON HarmCategory where parseJSON :: Value -> Parser HarmCategory
parseJSON Value
o = ([Char] -> Parser HarmCategory)
-> (HarmCategory -> Parser HarmCategory)
-> Either [Char] HarmCategory
-> Parser HarmCategory
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser HarmCategory
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (HarmCategory -> Parser HarmCategory
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HarmCategory -> Parser HarmCategory)
-> (HarmCategory -> HarmCategory)
-> HarmCategory
-> Parser HarmCategory
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HarmCategory -> HarmCategory
forall a. a -> a
P.id) (Either [Char] HarmCategory -> Parser HarmCategory)
-> (Text -> Either [Char] HarmCategory)
-> Text
-> Parser HarmCategory
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] HarmCategory
toHarmCategory (Text -> Parser HarmCategory) -> Parser Text -> Parser HarmCategory
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData HarmCategory where toQueryParam :: HarmCategory -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (HarmCategory -> Text) -> HarmCategory -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. HarmCategory -> Text
fromHarmCategory
instance WH.FromHttpApiData HarmCategory where parseQueryParam :: Text -> Either Text HarmCategory
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text HarmCategory) -> Either Text HarmCategory
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] HarmCategory -> Either Text HarmCategory
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] HarmCategory -> Either Text HarmCategory)
-> (Text -> Either [Char] HarmCategory)
-> Text
-> Either Text HarmCategory
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] HarmCategory
toHarmCategory
instance MimeRender MimeMultipartFormData HarmCategory where mimeRender :: Proxy MimeMultipartFormData -> HarmCategory -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = HarmCategory -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'HarmCategory' enum
fromHarmCategory :: HarmCategory -> Text
fromHarmCategory :: HarmCategory -> Text
fromHarmCategory = \case
  HarmCategory
HarmCategory'UNSPECIFIED -> Text
"HARM_CATEGORY_UNSPECIFIED"
  HarmCategory
HarmCategory'DEROGATORY -> Text
"HARM_CATEGORY_DEROGATORY"
  HarmCategory
HarmCategory'TOXICITY -> Text
"HARM_CATEGORY_TOXICITY"
  HarmCategory
HarmCategory'VIOLENCE -> Text
"HARM_CATEGORY_VIOLENCE"
  HarmCategory
HarmCategory'SEXUAL -> Text
"HARM_CATEGORY_SEXUAL"
  HarmCategory
HarmCategory'MEDICAL -> Text
"HARM_CATEGORY_MEDICAL"
  HarmCategory
HarmCategory'DANGEROUS -> Text
"HARM_CATEGORY_DANGEROUS"
  HarmCategory
HarmCategory'HARASSMENT -> Text
"HARM_CATEGORY_HARASSMENT"
  HarmCategory
HarmCategory'HATE_SPEECH -> Text
"HARM_CATEGORY_HATE_SPEECH"
  HarmCategory
HarmCategory'SEXUALLY_EXPLICIT -> Text
"HARM_CATEGORY_SEXUALLY_EXPLICIT"
  HarmCategory
HarmCategory'DANGEROUS_CONTENT -> Text
"HARM_CATEGORY_DANGEROUS_CONTENT"
  HarmCategory
HarmCategory'CIVIC_INTEGRITY -> Text
"HARM_CATEGORY_CIVIC_INTEGRITY"

-- | parse 'HarmCategory' enum
toHarmCategory :: Text -> P.Either String HarmCategory
toHarmCategory :: Text -> Either [Char] HarmCategory
toHarmCategory = \case
  Text
"HARM_CATEGORY_UNSPECIFIED" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'UNSPECIFIED
  Text
"HARM_CATEGORY_DEROGATORY" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'DEROGATORY
  Text
"HARM_CATEGORY_TOXICITY" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'TOXICITY
  Text
"HARM_CATEGORY_VIOLENCE" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'VIOLENCE
  Text
"HARM_CATEGORY_SEXUAL" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'SEXUAL
  Text
"HARM_CATEGORY_MEDICAL" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'MEDICAL
  Text
"HARM_CATEGORY_DANGEROUS" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'DANGEROUS
  Text
"HARM_CATEGORY_HARASSMENT" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'HARASSMENT
  Text
"HARM_CATEGORY_HATE_SPEECH" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'HATE_SPEECH
  Text
"HARM_CATEGORY_SEXUALLY_EXPLICIT" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'SEXUALLY_EXPLICIT
  Text
"HARM_CATEGORY_DANGEROUS_CONTENT" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'DANGEROUS_CONTENT
  Text
"HARM_CATEGORY_CIVIC_INTEGRITY" -> HarmCategory -> Either [Char] HarmCategory
forall a b. b -> Either a b
P.Right HarmCategory
HarmCategory'CIVIC_INTEGRITY
  Text
s -> [Char] -> Either [Char] HarmCategory
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] HarmCategory)
-> [Char] -> Either [Char] HarmCategory
forall a b. (a -> b) -> a -> b
$ [Char]
"toHarmCategory: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** Modality

-- | Enum of 'Text'
data Modality
  = -- | @"MODALITY_UNSPECIFIED"@
    Modality'MODALITY_UNSPECIFIED
  | -- | @"TEXT"@
    Modality'TEXT
  | -- | @"IMAGE"@
    Modality'IMAGE
  | -- | @"VIDEO"@
    Modality'VIDEO
  | -- | @"AUDIO"@
    Modality'AUDIO
  | -- | @"DOCUMENT"@
    Modality'DOCUMENT
  deriving (Int -> Modality -> ShowS
[Modality] -> ShowS
Modality -> [Char]
(Int -> Modality -> ShowS)
-> (Modality -> [Char]) -> ([Modality] -> ShowS) -> Show Modality
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Modality -> ShowS
showsPrec :: Int -> Modality -> ShowS
$cshow :: Modality -> [Char]
show :: Modality -> [Char]
$cshowList :: [Modality] -> ShowS
showList :: [Modality] -> ShowS
P.Show, Modality -> Modality -> Bool
(Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool) -> Eq Modality
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Modality -> Modality -> Bool
== :: Modality -> Modality -> Bool
$c/= :: Modality -> Modality -> Bool
/= :: Modality -> Modality -> Bool
P.Eq, P.Typeable, Eq Modality
Eq Modality =>
(Modality -> Modality -> Ordering)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Bool)
-> (Modality -> Modality -> Modality)
-> (Modality -> Modality -> Modality)
-> Ord Modality
Modality -> Modality -> Bool
Modality -> Modality -> Ordering
Modality -> Modality -> Modality
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: Modality -> Modality -> Ordering
compare :: Modality -> Modality -> Ordering
$c< :: Modality -> Modality -> Bool
< :: Modality -> Modality -> Bool
$c<= :: Modality -> Modality -> Bool
<= :: Modality -> Modality -> Bool
$c> :: Modality -> Modality -> Bool
> :: Modality -> Modality -> Bool
$c>= :: Modality -> Modality -> Bool
>= :: Modality -> Modality -> Bool
$cmax :: Modality -> Modality -> Modality
max :: Modality -> Modality -> Modality
$cmin :: Modality -> Modality -> Modality
min :: Modality -> Modality -> Modality
P.Ord, Modality
Modality -> Modality -> Bounded Modality
forall a. a -> a -> Bounded a
$cminBound :: Modality
minBound :: Modality
$cmaxBound :: Modality
maxBound :: Modality
P.Bounded, Int -> Modality
Modality -> Int
Modality -> [Modality]
Modality -> Modality
Modality -> Modality -> [Modality]
Modality -> Modality -> Modality -> [Modality]
(Modality -> Modality)
-> (Modality -> Modality)
-> (Int -> Modality)
-> (Modality -> Int)
-> (Modality -> [Modality])
-> (Modality -> Modality -> [Modality])
-> (Modality -> Modality -> [Modality])
-> (Modality -> Modality -> Modality -> [Modality])
-> Enum Modality
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: Modality -> Modality
succ :: Modality -> Modality
$cpred :: Modality -> Modality
pred :: Modality -> Modality
$ctoEnum :: Int -> Modality
toEnum :: Int -> Modality
$cfromEnum :: Modality -> Int
fromEnum :: Modality -> Int
$cenumFrom :: Modality -> [Modality]
enumFrom :: Modality -> [Modality]
$cenumFromThen :: Modality -> Modality -> [Modality]
enumFromThen :: Modality -> Modality -> [Modality]
$cenumFromTo :: Modality -> Modality -> [Modality]
enumFromTo :: Modality -> Modality -> [Modality]
$cenumFromThenTo :: Modality -> Modality -> Modality -> [Modality]
enumFromThenTo :: Modality -> Modality -> Modality -> [Modality]
P.Enum)

instance A.ToJSON Modality where toJSON :: Modality -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (Modality -> Text) -> Modality -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Modality -> Text
fromModality
instance A.FromJSON Modality where parseJSON :: Value -> Parser Modality
parseJSON Value
o = ([Char] -> Parser Modality)
-> (Modality -> Parser Modality)
-> Either [Char] Modality
-> Parser Modality
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser Modality
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (Modality -> Parser Modality
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Modality -> Parser Modality)
-> (Modality -> Modality) -> Modality -> Parser Modality
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Modality -> Modality
forall a. a -> a
P.id) (Either [Char] Modality -> Parser Modality)
-> (Text -> Either [Char] Modality) -> Text -> Parser Modality
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] Modality
toModality (Text -> Parser Modality) -> Parser Text -> Parser Modality
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData Modality where toQueryParam :: Modality -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (Modality -> Text) -> Modality -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Modality -> Text
fromModality
instance WH.FromHttpApiData Modality where parseQueryParam :: Text -> Either Text Modality
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text Modality) -> Either Text Modality
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] Modality -> Either Text Modality
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] Modality -> Either Text Modality)
-> (Text -> Either [Char] Modality) -> Text -> Either Text Modality
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] Modality
toModality
instance MimeRender MimeMultipartFormData Modality where mimeRender :: Proxy MimeMultipartFormData -> Modality -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = Modality -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'Modality' enum
fromModality :: Modality -> Text
fromModality :: Modality -> Text
fromModality = \case
  Modality
Modality'MODALITY_UNSPECIFIED -> Text
"MODALITY_UNSPECIFIED"
  Modality
Modality'TEXT -> Text
"TEXT"
  Modality
Modality'IMAGE -> Text
"IMAGE"
  Modality
Modality'VIDEO -> Text
"VIDEO"
  Modality
Modality'AUDIO -> Text
"AUDIO"
  Modality
Modality'DOCUMENT -> Text
"DOCUMENT"

-- | parse 'Modality' enum
toModality :: Text -> P.Either String Modality
toModality :: Text -> Either [Char] Modality
toModality = \case
  Text
"MODALITY_UNSPECIFIED" -> Modality -> Either [Char] Modality
forall a b. b -> Either a b
P.Right Modality
Modality'MODALITY_UNSPECIFIED
  Text
"TEXT" -> Modality -> Either [Char] Modality
forall a b. b -> Either a b
P.Right Modality
Modality'TEXT
  Text
"IMAGE" -> Modality -> Either [Char] Modality
forall a b. b -> Either a b
P.Right Modality
Modality'IMAGE
  Text
"VIDEO" -> Modality -> Either [Char] Modality
forall a b. b -> Either a b
P.Right Modality
Modality'VIDEO
  Text
"AUDIO" -> Modality -> Either [Char] Modality
forall a b. b -> Either a b
P.Right Modality
Modality'AUDIO
  Text
"DOCUMENT" -> Modality -> Either [Char] Modality
forall a b. b -> Either a b
P.Right Modality
Modality'DOCUMENT
  Text
s -> [Char] -> Either [Char] Modality
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] Modality)
-> [Char] -> Either [Char] Modality
forall a b. (a -> b) -> a -> b
$ [Char]
"toModality: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** ModelType

-- | Enum of 'Text'
data ModelType
  = -- | @"TYPE_UNSPECIFIED"@
    ModelType'TYPE_UNSPECIFIED
  | -- | @"STRING"@
    ModelType'STRING
  | -- | @"NUMBER"@
    ModelType'NUMBER
  | -- | @"INTEGER"@
    ModelType'INTEGER
  | -- | @"BOOLEAN"@
    ModelType'BOOLEAN
  | -- | @"ARRAY"@
    ModelType'ARRAY
  | -- | @"OBJECT"@
    ModelType'OBJECT
  | -- | @"NULL"@
    ModelType'NULL
  deriving (Int -> ModelType -> ShowS
[ModelType] -> ShowS
ModelType -> [Char]
(Int -> ModelType -> ShowS)
-> (ModelType -> [Char])
-> ([ModelType] -> ShowS)
-> Show ModelType
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ModelType -> ShowS
showsPrec :: Int -> ModelType -> ShowS
$cshow :: ModelType -> [Char]
show :: ModelType -> [Char]
$cshowList :: [ModelType] -> ShowS
showList :: [ModelType] -> ShowS
P.Show, ModelType -> ModelType -> Bool
(ModelType -> ModelType -> Bool)
-> (ModelType -> ModelType -> Bool) -> Eq ModelType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ModelType -> ModelType -> Bool
== :: ModelType -> ModelType -> Bool
$c/= :: ModelType -> ModelType -> Bool
/= :: ModelType -> ModelType -> Bool
P.Eq, P.Typeable, Eq ModelType
Eq ModelType =>
(ModelType -> ModelType -> Ordering)
-> (ModelType -> ModelType -> Bool)
-> (ModelType -> ModelType -> Bool)
-> (ModelType -> ModelType -> Bool)
-> (ModelType -> ModelType -> Bool)
-> (ModelType -> ModelType -> ModelType)
-> (ModelType -> ModelType -> ModelType)
-> Ord ModelType
ModelType -> ModelType -> Bool
ModelType -> ModelType -> Ordering
ModelType -> ModelType -> ModelType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: ModelType -> ModelType -> Ordering
compare :: ModelType -> ModelType -> Ordering
$c< :: ModelType -> ModelType -> Bool
< :: ModelType -> ModelType -> Bool
$c<= :: ModelType -> ModelType -> Bool
<= :: ModelType -> ModelType -> Bool
$c> :: ModelType -> ModelType -> Bool
> :: ModelType -> ModelType -> Bool
$c>= :: ModelType -> ModelType -> Bool
>= :: ModelType -> ModelType -> Bool
$cmax :: ModelType -> ModelType -> ModelType
max :: ModelType -> ModelType -> ModelType
$cmin :: ModelType -> ModelType -> ModelType
min :: ModelType -> ModelType -> ModelType
P.Ord, ModelType
ModelType -> ModelType -> Bounded ModelType
forall a. a -> a -> Bounded a
$cminBound :: ModelType
minBound :: ModelType
$cmaxBound :: ModelType
maxBound :: ModelType
P.Bounded, Int -> ModelType
ModelType -> Int
ModelType -> [ModelType]
ModelType -> ModelType
ModelType -> ModelType -> [ModelType]
ModelType -> ModelType -> ModelType -> [ModelType]
(ModelType -> ModelType)
-> (ModelType -> ModelType)
-> (Int -> ModelType)
-> (ModelType -> Int)
-> (ModelType -> [ModelType])
-> (ModelType -> ModelType -> [ModelType])
-> (ModelType -> ModelType -> [ModelType])
-> (ModelType -> ModelType -> ModelType -> [ModelType])
-> Enum ModelType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: ModelType -> ModelType
succ :: ModelType -> ModelType
$cpred :: ModelType -> ModelType
pred :: ModelType -> ModelType
$ctoEnum :: Int -> ModelType
toEnum :: Int -> ModelType
$cfromEnum :: ModelType -> Int
fromEnum :: ModelType -> Int
$cenumFrom :: ModelType -> [ModelType]
enumFrom :: ModelType -> [ModelType]
$cenumFromThen :: ModelType -> ModelType -> [ModelType]
enumFromThen :: ModelType -> ModelType -> [ModelType]
$cenumFromTo :: ModelType -> ModelType -> [ModelType]
enumFromTo :: ModelType -> ModelType -> [ModelType]
$cenumFromThenTo :: ModelType -> ModelType -> ModelType -> [ModelType]
enumFromThenTo :: ModelType -> ModelType -> ModelType -> [ModelType]
P.Enum)

instance A.ToJSON ModelType where toJSON :: ModelType -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (ModelType -> Text) -> ModelType -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModelType -> Text
fromModelType
instance A.FromJSON ModelType where parseJSON :: Value -> Parser ModelType
parseJSON Value
o = ([Char] -> Parser ModelType)
-> (ModelType -> Parser ModelType)
-> Either [Char] ModelType
-> Parser ModelType
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser ModelType
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (ModelType -> Parser ModelType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (ModelType -> Parser ModelType)
-> (ModelType -> ModelType) -> ModelType -> Parser ModelType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModelType -> ModelType
forall a. a -> a
P.id) (Either [Char] ModelType -> Parser ModelType)
-> (Text -> Either [Char] ModelType) -> Text -> Parser ModelType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] ModelType
toModelType (Text -> Parser ModelType) -> Parser Text -> Parser ModelType
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData ModelType where toQueryParam :: ModelType -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (ModelType -> Text) -> ModelType -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModelType -> Text
fromModelType
instance WH.FromHttpApiData ModelType where parseQueryParam :: Text -> Either Text ModelType
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text ModelType) -> Either Text ModelType
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text)
-> Either [Char] ModelType -> Either Text ModelType
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] ModelType -> Either Text ModelType)
-> (Text -> Either [Char] ModelType)
-> Text
-> Either Text ModelType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] ModelType
toModelType
instance MimeRender MimeMultipartFormData ModelType where mimeRender :: Proxy MimeMultipartFormData -> ModelType -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = ModelType -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'ModelType' enum
fromModelType :: ModelType -> Text
fromModelType :: ModelType -> Text
fromModelType = \case
  ModelType
ModelType'TYPE_UNSPECIFIED -> Text
"TYPE_UNSPECIFIED"
  ModelType
ModelType'STRING -> Text
"STRING"
  ModelType
ModelType'NUMBER -> Text
"NUMBER"
  ModelType
ModelType'INTEGER -> Text
"INTEGER"
  ModelType
ModelType'BOOLEAN -> Text
"BOOLEAN"
  ModelType
ModelType'ARRAY -> Text
"ARRAY"
  ModelType
ModelType'OBJECT -> Text
"OBJECT"
  ModelType
ModelType'NULL -> Text
"NULL"

-- | parse 'ModelType' enum
toModelType :: Text -> P.Either String ModelType
toModelType :: Text -> Either [Char] ModelType
toModelType = \case
  Text
"TYPE_UNSPECIFIED" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'TYPE_UNSPECIFIED
  Text
"STRING" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'STRING
  Text
"NUMBER" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'NUMBER
  Text
"INTEGER" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'INTEGER
  Text
"BOOLEAN" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'BOOLEAN
  Text
"ARRAY" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'ARRAY
  Text
"OBJECT" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'OBJECT
  Text
"NULL" -> ModelType -> Either [Char] ModelType
forall a b. b -> Either a b
P.Right ModelType
ModelType'NULL
  Text
s -> [Char] -> Either [Char] ModelType
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] ModelType)
-> [Char] -> Either [Char] ModelType
forall a b. (a -> b) -> a -> b
$ [Char]
"toModelType: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s

-- ** TaskType

-- | Enum of 'Text'
data TaskType
  = -- | @"TASK_TYPE_UNSPECIFIED"@
    TaskType'TASK_TYPE_UNSPECIFIED
  | -- | @"RETRIEVAL_QUERY"@
    TaskType'RETRIEVAL_QUERY
  | -- | @"RETRIEVAL_DOCUMENT"@
    TaskType'RETRIEVAL_DOCUMENT
  | -- | @"SEMANTIC_SIMILARITY"@
    TaskType'SEMANTIC_SIMILARITY
  | -- | @"CLASSIFICATION"@
    TaskType'CLASSIFICATION
  | -- | @"CLUSTERING"@
    TaskType'CLUSTERING
  | -- | @"QUESTION_ANSWERING"@
    TaskType'QUESTION_ANSWERING
  | -- | @"FACT_VERIFICATION"@
    TaskType'FACT_VERIFICATION
  | -- | @"CODE_RETRIEVAL_QUERY"@
    TaskType'CODE_RETRIEVAL_QUERY
  deriving (Int -> TaskType -> ShowS
[TaskType] -> ShowS
TaskType -> [Char]
(Int -> TaskType -> ShowS)
-> (TaskType -> [Char]) -> ([TaskType] -> ShowS) -> Show TaskType
forall a.
(Int -> a -> ShowS) -> (a -> [Char]) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TaskType -> ShowS
showsPrec :: Int -> TaskType -> ShowS
$cshow :: TaskType -> [Char]
show :: TaskType -> [Char]
$cshowList :: [TaskType] -> ShowS
showList :: [TaskType] -> ShowS
P.Show, TaskType -> TaskType -> Bool
(TaskType -> TaskType -> Bool)
-> (TaskType -> TaskType -> Bool) -> Eq TaskType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TaskType -> TaskType -> Bool
== :: TaskType -> TaskType -> Bool
$c/= :: TaskType -> TaskType -> Bool
/= :: TaskType -> TaskType -> Bool
P.Eq, P.Typeable, Eq TaskType
Eq TaskType =>
(TaskType -> TaskType -> Ordering)
-> (TaskType -> TaskType -> Bool)
-> (TaskType -> TaskType -> Bool)
-> (TaskType -> TaskType -> Bool)
-> (TaskType -> TaskType -> Bool)
-> (TaskType -> TaskType -> TaskType)
-> (TaskType -> TaskType -> TaskType)
-> Ord TaskType
TaskType -> TaskType -> Bool
TaskType -> TaskType -> Ordering
TaskType -> TaskType -> TaskType
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: TaskType -> TaskType -> Ordering
compare :: TaskType -> TaskType -> Ordering
$c< :: TaskType -> TaskType -> Bool
< :: TaskType -> TaskType -> Bool
$c<= :: TaskType -> TaskType -> Bool
<= :: TaskType -> TaskType -> Bool
$c> :: TaskType -> TaskType -> Bool
> :: TaskType -> TaskType -> Bool
$c>= :: TaskType -> TaskType -> Bool
>= :: TaskType -> TaskType -> Bool
$cmax :: TaskType -> TaskType -> TaskType
max :: TaskType -> TaskType -> TaskType
$cmin :: TaskType -> TaskType -> TaskType
min :: TaskType -> TaskType -> TaskType
P.Ord, TaskType
TaskType -> TaskType -> Bounded TaskType
forall a. a -> a -> Bounded a
$cminBound :: TaskType
minBound :: TaskType
$cmaxBound :: TaskType
maxBound :: TaskType
P.Bounded, Int -> TaskType
TaskType -> Int
TaskType -> [TaskType]
TaskType -> TaskType
TaskType -> TaskType -> [TaskType]
TaskType -> TaskType -> TaskType -> [TaskType]
(TaskType -> TaskType)
-> (TaskType -> TaskType)
-> (Int -> TaskType)
-> (TaskType -> Int)
-> (TaskType -> [TaskType])
-> (TaskType -> TaskType -> [TaskType])
-> (TaskType -> TaskType -> [TaskType])
-> (TaskType -> TaskType -> TaskType -> [TaskType])
-> Enum TaskType
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
$csucc :: TaskType -> TaskType
succ :: TaskType -> TaskType
$cpred :: TaskType -> TaskType
pred :: TaskType -> TaskType
$ctoEnum :: Int -> TaskType
toEnum :: Int -> TaskType
$cfromEnum :: TaskType -> Int
fromEnum :: TaskType -> Int
$cenumFrom :: TaskType -> [TaskType]
enumFrom :: TaskType -> [TaskType]
$cenumFromThen :: TaskType -> TaskType -> [TaskType]
enumFromThen :: TaskType -> TaskType -> [TaskType]
$cenumFromTo :: TaskType -> TaskType -> [TaskType]
enumFromTo :: TaskType -> TaskType -> [TaskType]
$cenumFromThenTo :: TaskType -> TaskType -> TaskType -> [TaskType]
enumFromThenTo :: TaskType -> TaskType -> TaskType -> [TaskType]
P.Enum)

instance A.ToJSON TaskType where toJSON :: TaskType -> Value
toJSON = Text -> Value
forall a. ToJSON a => a -> Value
A.toJSON (Text -> Value) -> (TaskType -> Text) -> TaskType -> Value
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TaskType -> Text
fromTaskType
instance A.FromJSON TaskType where parseJSON :: Value -> Parser TaskType
parseJSON Value
o = ([Char] -> Parser TaskType)
-> (TaskType -> Parser TaskType)
-> Either [Char] TaskType
-> Parser TaskType
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
P.either [Char] -> Parser TaskType
forall a. [Char] -> Parser a
forall (m :: * -> *) a. MonadFail m => [Char] -> m a
P.fail (TaskType -> Parser TaskType
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (TaskType -> Parser TaskType)
-> (TaskType -> TaskType) -> TaskType -> Parser TaskType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TaskType -> TaskType
forall a. a -> a
P.id) (Either [Char] TaskType -> Parser TaskType)
-> (Text -> Either [Char] TaskType) -> Text -> Parser TaskType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] TaskType
toTaskType (Text -> Parser TaskType) -> Parser Text -> Parser TaskType
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Value -> Parser Text
forall a. FromJSON a => Value -> Parser a
A.parseJSON Value
o
instance WH.ToHttpApiData TaskType where toQueryParam :: TaskType -> Text
toQueryParam = Text -> Text
forall a. ToHttpApiData a => a -> Text
WH.toQueryParam (Text -> Text) -> (TaskType -> Text) -> TaskType -> Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TaskType -> Text
fromTaskType
instance WH.FromHttpApiData TaskType where parseQueryParam :: Text -> Either Text TaskType
parseQueryParam Text
o = Text -> Either Text Text
forall a. FromHttpApiData a => Text -> Either Text a
WH.parseQueryParam Text
o Either Text Text
-> (Text -> Either Text TaskType) -> Either Text TaskType
forall a b. Either Text a -> (a -> Either Text b) -> Either Text b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= ([Char] -> Text) -> Either [Char] TaskType -> Either Text TaskType
forall b c d. (b -> c) -> Either b d -> Either c d
forall (a :: * -> * -> *) b c d.
ArrowChoice a =>
a b c -> a (Either b d) (Either c d)
P.left [Char] -> Text
T.pack (Either [Char] TaskType -> Either Text TaskType)
-> (Text -> Either [Char] TaskType) -> Text -> Either Text TaskType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Either [Char] TaskType
toTaskType
instance MimeRender MimeMultipartFormData TaskType where mimeRender :: Proxy MimeMultipartFormData -> TaskType -> ByteString
mimeRender Proxy MimeMultipartFormData
_ = TaskType -> ByteString
forall a. ToHttpApiData a => a -> ByteString
mimeRenderDefaultMultipartFormData

-- | unwrap 'TaskType' enum
fromTaskType :: TaskType -> Text
fromTaskType :: TaskType -> Text
fromTaskType = \case
  TaskType
TaskType'TASK_TYPE_UNSPECIFIED -> Text
"TASK_TYPE_UNSPECIFIED"
  TaskType
TaskType'RETRIEVAL_QUERY -> Text
"RETRIEVAL_QUERY"
  TaskType
TaskType'RETRIEVAL_DOCUMENT -> Text
"RETRIEVAL_DOCUMENT"
  TaskType
TaskType'SEMANTIC_SIMILARITY -> Text
"SEMANTIC_SIMILARITY"
  TaskType
TaskType'CLASSIFICATION -> Text
"CLASSIFICATION"
  TaskType
TaskType'CLUSTERING -> Text
"CLUSTERING"
  TaskType
TaskType'QUESTION_ANSWERING -> Text
"QUESTION_ANSWERING"
  TaskType
TaskType'FACT_VERIFICATION -> Text
"FACT_VERIFICATION"
  TaskType
TaskType'CODE_RETRIEVAL_QUERY -> Text
"CODE_RETRIEVAL_QUERY"

-- | parse 'TaskType' enum
toTaskType :: Text -> P.Either String TaskType
toTaskType :: Text -> Either [Char] TaskType
toTaskType = \case
  Text
"TASK_TYPE_UNSPECIFIED" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'TASK_TYPE_UNSPECIFIED
  Text
"RETRIEVAL_QUERY" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'RETRIEVAL_QUERY
  Text
"RETRIEVAL_DOCUMENT" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'RETRIEVAL_DOCUMENT
  Text
"SEMANTIC_SIMILARITY" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'SEMANTIC_SIMILARITY
  Text
"CLASSIFICATION" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'CLASSIFICATION
  Text
"CLUSTERING" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'CLUSTERING
  Text
"QUESTION_ANSWERING" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'QUESTION_ANSWERING
  Text
"FACT_VERIFICATION" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'FACT_VERIFICATION
  Text
"CODE_RETRIEVAL_QUERY" -> TaskType -> Either [Char] TaskType
forall a b. b -> Either a b
P.Right TaskType
TaskType'CODE_RETRIEVAL_QUERY
  Text
s -> [Char] -> Either [Char] TaskType
forall a b. a -> Either a b
P.Left ([Char] -> Either [Char] TaskType)
-> [Char] -> Either [Char] TaskType
forall a b. (a -> b) -> a -> b
$ [Char]
"toTaskType: enum parse failure: " [Char] -> ShowS
forall a. [a] -> [a] -> [a]
P.++ Text -> [Char]
forall a. Show a => a -> [Char]
P.show Text
s