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

-- |
-- Module      : Gogol.Vision.Images.AsyncBatchAnnotate
-- Copyright   : (c) 2015-2025 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+gogol@gmail.com>
--               Toni Cebrián <toni@tonicebrian.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Run asynchronous image detection and annotation for a list of images. Progress and results can be retrieved through the @google.longrunning.Operations@ interface. @Operation.metadata@ contains @OperationMetadata@ (metadata). @Operation.response@ contains @AsyncBatchAnnotateImagesResponse@ (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
--
-- /See:/ <https://cloud.google.com/vision/ Cloud Vision API Reference> for @vision.images.asyncBatchAnnotate@.
module Gogol.Vision.Images.AsyncBatchAnnotate
  ( -- * Resource
    VisionImagesAsyncBatchAnnotateResource,

    -- ** Constructing a Request
    VisionImagesAsyncBatchAnnotate (..),
    newVisionImagesAsyncBatchAnnotate,
  )
where

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

-- | A resource alias for @vision.images.asyncBatchAnnotate@ method which the
-- 'VisionImagesAsyncBatchAnnotate' request conforms to.
type VisionImagesAsyncBatchAnnotateResource =
  "v1p2beta1"
    Core.:> "images:asyncBatchAnnotate"
    Core.:> Core.QueryParam "$.xgafv" Xgafv
    Core.:> Core.QueryParam "access_token" Core.Text
    Core.:> Core.QueryParam "callback" Core.Text
    Core.:> Core.QueryParam "uploadType" Core.Text
    Core.:> Core.QueryParam "upload_protocol" Core.Text
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.ReqBody
              '[Core.JSON]
              GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
    Core.:> Core.Post '[Core.JSON] Operation

-- | Run asynchronous image detection and annotation for a list of images. Progress and results can be retrieved through the @google.longrunning.Operations@ interface. @Operation.metadata@ contains @OperationMetadata@ (metadata). @Operation.response@ contains @AsyncBatchAnnotateImagesResponse@ (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.
--
-- /See:/ 'newVisionImagesAsyncBatchAnnotate' smart constructor.
data VisionImagesAsyncBatchAnnotate = VisionImagesAsyncBatchAnnotate
  { -- | V1 error format.
    VisionImagesAsyncBatchAnnotate -> Maybe Xgafv
xgafv :: (Core.Maybe Xgafv),
    -- | OAuth access token.
    VisionImagesAsyncBatchAnnotate -> Maybe Text
accessToken :: (Core.Maybe Core.Text),
    -- | JSONP
    VisionImagesAsyncBatchAnnotate -> Maybe Text
callback :: (Core.Maybe Core.Text),
    -- | Multipart request metadata.
    VisionImagesAsyncBatchAnnotate
-> GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
payload :: GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest,
    -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
    VisionImagesAsyncBatchAnnotate -> Maybe Text
uploadType :: (Core.Maybe Core.Text),
    -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
    VisionImagesAsyncBatchAnnotate -> Maybe Text
uploadProtocol :: (Core.Maybe Core.Text)
  }
  deriving (VisionImagesAsyncBatchAnnotate
-> VisionImagesAsyncBatchAnnotate -> Bool
(VisionImagesAsyncBatchAnnotate
 -> VisionImagesAsyncBatchAnnotate -> Bool)
-> (VisionImagesAsyncBatchAnnotate
    -> VisionImagesAsyncBatchAnnotate -> Bool)
-> Eq VisionImagesAsyncBatchAnnotate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VisionImagesAsyncBatchAnnotate
-> VisionImagesAsyncBatchAnnotate -> Bool
== :: VisionImagesAsyncBatchAnnotate
-> VisionImagesAsyncBatchAnnotate -> Bool
$c/= :: VisionImagesAsyncBatchAnnotate
-> VisionImagesAsyncBatchAnnotate -> Bool
/= :: VisionImagesAsyncBatchAnnotate
-> VisionImagesAsyncBatchAnnotate -> Bool
Core.Eq, Int -> VisionImagesAsyncBatchAnnotate -> ShowS
[VisionImagesAsyncBatchAnnotate] -> ShowS
VisionImagesAsyncBatchAnnotate -> String
(Int -> VisionImagesAsyncBatchAnnotate -> ShowS)
-> (VisionImagesAsyncBatchAnnotate -> String)
-> ([VisionImagesAsyncBatchAnnotate] -> ShowS)
-> Show VisionImagesAsyncBatchAnnotate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VisionImagesAsyncBatchAnnotate -> ShowS
showsPrec :: Int -> VisionImagesAsyncBatchAnnotate -> ShowS
$cshow :: VisionImagesAsyncBatchAnnotate -> String
show :: VisionImagesAsyncBatchAnnotate -> String
$cshowList :: [VisionImagesAsyncBatchAnnotate] -> ShowS
showList :: [VisionImagesAsyncBatchAnnotate] -> ShowS
Core.Show, (forall x.
 VisionImagesAsyncBatchAnnotate
 -> Rep VisionImagesAsyncBatchAnnotate x)
-> (forall x.
    Rep VisionImagesAsyncBatchAnnotate x
    -> VisionImagesAsyncBatchAnnotate)
-> Generic VisionImagesAsyncBatchAnnotate
forall x.
Rep VisionImagesAsyncBatchAnnotate x
-> VisionImagesAsyncBatchAnnotate
forall x.
VisionImagesAsyncBatchAnnotate
-> Rep VisionImagesAsyncBatchAnnotate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
VisionImagesAsyncBatchAnnotate
-> Rep VisionImagesAsyncBatchAnnotate x
from :: forall x.
VisionImagesAsyncBatchAnnotate
-> Rep VisionImagesAsyncBatchAnnotate x
$cto :: forall x.
Rep VisionImagesAsyncBatchAnnotate x
-> VisionImagesAsyncBatchAnnotate
to :: forall x.
Rep VisionImagesAsyncBatchAnnotate x
-> VisionImagesAsyncBatchAnnotate
Core.Generic)

-- | Creates a value of 'VisionImagesAsyncBatchAnnotate' with the minimum fields required to make a request.
newVisionImagesAsyncBatchAnnotate ::
  -- |  Multipart request metadata. See 'payload'.
  GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest ->
  VisionImagesAsyncBatchAnnotate
newVisionImagesAsyncBatchAnnotate :: GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
-> VisionImagesAsyncBatchAnnotate
newVisionImagesAsyncBatchAnnotate GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
payload =
  VisionImagesAsyncBatchAnnotate
    { xgafv :: Maybe Xgafv
xgafv = Maybe Xgafv
forall a. Maybe a
Core.Nothing,
      accessToken :: Maybe Text
accessToken = Maybe Text
forall a. Maybe a
Core.Nothing,
      callback :: Maybe Text
callback = Maybe Text
forall a. Maybe a
Core.Nothing,
      payload :: GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
payload = GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
payload,
      uploadType :: Maybe Text
uploadType = Maybe Text
forall a. Maybe a
Core.Nothing,
      uploadProtocol :: Maybe Text
uploadProtocol = Maybe Text
forall a. Maybe a
Core.Nothing
    }

instance Core.GoogleRequest VisionImagesAsyncBatchAnnotate where
  type Rs VisionImagesAsyncBatchAnnotate = Operation
  type
    Scopes VisionImagesAsyncBatchAnnotate =
      '[CloudPlatform'FullControl, CloudVision'FullControl]
  requestClient :: VisionImagesAsyncBatchAnnotate
-> GClient (Rs VisionImagesAsyncBatchAnnotate)
requestClient VisionImagesAsyncBatchAnnotate {Maybe Text
Maybe Xgafv
GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
xgafv :: VisionImagesAsyncBatchAnnotate -> Maybe Xgafv
accessToken :: VisionImagesAsyncBatchAnnotate -> Maybe Text
callback :: VisionImagesAsyncBatchAnnotate -> Maybe Text
payload :: VisionImagesAsyncBatchAnnotate
-> GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
uploadType :: VisionImagesAsyncBatchAnnotate -> Maybe Text
uploadProtocol :: VisionImagesAsyncBatchAnnotate -> Maybe Text
xgafv :: Maybe Xgafv
accessToken :: Maybe Text
callback :: Maybe Text
payload :: GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
uploadType :: Maybe Text
uploadProtocol :: Maybe Text
..} =
    Maybe Xgafv
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe AltJSON
-> GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
-> ServiceConfig
-> GClient Operation
go
      Maybe Xgafv
xgafv
      Maybe Text
accessToken
      Maybe Text
callback
      Maybe Text
uploadType
      Maybe Text
uploadProtocol
      (AltJSON -> Maybe AltJSON
forall a. a -> Maybe a
Core.Just AltJSON
Core.AltJSON)
      GoogleCloudVisionV1p2beta1AsyncBatchAnnotateImagesRequest
payload
      ServiceConfig
visionService
    where
      go :: Fn VisionImagesAsyncBatchAnnotateResource
go =
        Proxy VisionImagesAsyncBatchAnnotateResource
-> Request -> Fn VisionImagesAsyncBatchAnnotateResource
forall {k} (fn :: k).
GoogleClient fn =>
Proxy fn -> Request -> Fn fn
Core.buildClient
          (Proxy VisionImagesAsyncBatchAnnotateResource
forall {k} (t :: k). Proxy t
Core.Proxy :: Core.Proxy VisionImagesAsyncBatchAnnotateResource)
          Request
forall a. Monoid a => a
Core.mempty