{-# 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.URLShortener.Url.List
-- 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)
--
-- Retrieves a list of URLs shortened by a user.
--
-- /See:/ <https://developers.google.com/url-shortener/v1/getting_started URL Shortener API Reference> for @urlshortener.url.list@.
module Gogol.URLShortener.Url.List
  ( -- * Resource
    URLShortenerUrlListResource,

    -- ** Constructing a Request
    URLShortenerUrlList (..),
    newURLShortenerUrlList,
  )
where

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

-- | A resource alias for @urlshortener.url.list@ method which the
-- 'URLShortenerUrlList' request conforms to.
type URLShortenerUrlListResource =
  "urlshortener"
    Core.:> "v1"
    Core.:> "url"
    Core.:> "history"
    Core.:> Core.QueryParam "projection" UrlListProjection
    Core.:> Core.QueryParam "start-token" Core.Text
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.Get '[Core.JSON] UrlHistory

-- | Retrieves a list of URLs shortened by a user.
--
-- /See:/ 'newURLShortenerUrlList' smart constructor.
data URLShortenerUrlList = URLShortenerUrlList
  { -- | Additional information to return.
    URLShortenerUrlList -> Maybe UrlListProjection
projection :: (Core.Maybe UrlListProjection),
    -- | Token for requesting successive pages of results.
    URLShortenerUrlList -> Maybe Text
startToken :: (Core.Maybe Core.Text)
  }
  deriving (URLShortenerUrlList -> URLShortenerUrlList -> Bool
(URLShortenerUrlList -> URLShortenerUrlList -> Bool)
-> (URLShortenerUrlList -> URLShortenerUrlList -> Bool)
-> Eq URLShortenerUrlList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: URLShortenerUrlList -> URLShortenerUrlList -> Bool
== :: URLShortenerUrlList -> URLShortenerUrlList -> Bool
$c/= :: URLShortenerUrlList -> URLShortenerUrlList -> Bool
/= :: URLShortenerUrlList -> URLShortenerUrlList -> Bool
Core.Eq, Int -> URLShortenerUrlList -> ShowS
[URLShortenerUrlList] -> ShowS
URLShortenerUrlList -> String
(Int -> URLShortenerUrlList -> ShowS)
-> (URLShortenerUrlList -> String)
-> ([URLShortenerUrlList] -> ShowS)
-> Show URLShortenerUrlList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> URLShortenerUrlList -> ShowS
showsPrec :: Int -> URLShortenerUrlList -> ShowS
$cshow :: URLShortenerUrlList -> String
show :: URLShortenerUrlList -> String
$cshowList :: [URLShortenerUrlList] -> ShowS
showList :: [URLShortenerUrlList] -> ShowS
Core.Show, (forall x. URLShortenerUrlList -> Rep URLShortenerUrlList x)
-> (forall x. Rep URLShortenerUrlList x -> URLShortenerUrlList)
-> Generic URLShortenerUrlList
forall x. Rep URLShortenerUrlList x -> URLShortenerUrlList
forall x. URLShortenerUrlList -> Rep URLShortenerUrlList x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. URLShortenerUrlList -> Rep URLShortenerUrlList x
from :: forall x. URLShortenerUrlList -> Rep URLShortenerUrlList x
$cto :: forall x. Rep URLShortenerUrlList x -> URLShortenerUrlList
to :: forall x. Rep URLShortenerUrlList x -> URLShortenerUrlList
Core.Generic)

-- | Creates a value of 'URLShortenerUrlList' with the minimum fields required to make a request.
newURLShortenerUrlList ::
  URLShortenerUrlList
newURLShortenerUrlList :: URLShortenerUrlList
newURLShortenerUrlList =
  URLShortenerUrlList
    { projection :: Maybe UrlListProjection
projection = Maybe UrlListProjection
forall a. Maybe a
Core.Nothing,
      startToken :: Maybe Text
startToken = Maybe Text
forall a. Maybe a
Core.Nothing
    }

instance Core.GoogleRequest URLShortenerUrlList where
  type Rs URLShortenerUrlList = UrlHistory
  type Scopes URLShortenerUrlList = '[Urlshortener'FullControl]
  requestClient :: URLShortenerUrlList -> GClient (Rs URLShortenerUrlList)
requestClient URLShortenerUrlList {Maybe Text
Maybe UrlListProjection
projection :: URLShortenerUrlList -> Maybe UrlListProjection
startToken :: URLShortenerUrlList -> Maybe Text
projection :: Maybe UrlListProjection
startToken :: Maybe Text
..} =
    Maybe UrlListProjection
-> Maybe Text
-> Maybe AltJSON
-> ServiceConfig
-> GClient UrlHistory
go
      Maybe UrlListProjection
projection
      Maybe Text
startToken
      (AltJSON -> Maybe AltJSON
forall a. a -> Maybe a
Core.Just AltJSON
Core.AltJSON)
      ServiceConfig
uRLShortenerService
    where
      go :: Fn URLShortenerUrlListResource
go =
        Proxy URLShortenerUrlListResource
-> Request -> Fn URLShortenerUrlListResource
forall {k} (fn :: k).
GoogleClient fn =>
Proxy fn -> Request -> Fn fn
Core.buildClient
          (Proxy URLShortenerUrlListResource
forall {k} (t :: k). Proxy t
Core.Proxy :: Core.Proxy URLShortenerUrlListResource)
          Request
forall a. Monoid a => a
Core.mempty