content: {-# 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.Partners.Analytics.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)
  --
  -- Lists analytics data for a user\'s associated company. Should only be called within the context of an authorized logged in user.
  --
  -- /See:/ <https://developers.google.com/partners/ Google Partners API Reference> for @partners.analytics.list@.
  module Gogol.Partners.Analytics.List
    ( -- * Resource
      PartnersAnalyticsListResource,
  
      -- ** Constructing a Request
      PartnersAnalyticsList (..),
      newPartnersAnalyticsList,
    )
  where
  
  import Gogol.Partners.Types
  import Gogol.Prelude qualified as Core
  
  -- | A resource alias for @partners.analytics.list@ method which the
  -- 'PartnersAnalyticsList' request conforms to.
  type PartnersAnalyticsListResource =
    "v2"
      Core.:> "analytics"
      Core.:> Core.QueryParam "$.xgafv" Xgafv
      Core.:> Core.QueryParam "access_token" Core.Text
      Core.:> Core.QueryParam "callback" Core.Text
      Core.:> Core.QueryParam "pageSize" Core.Int32
      Core.:> Core.QueryParam "pageToken" Core.Text
      Core.:> Core.QueryParams "requestMetadata.experimentIds" Core.Text
      Core.:> Core.QueryParam "requestMetadata.locale" Core.Text
      Core.:> Core.QueryParam "requestMetadata.partnersSessionId" Core.Text
      Core.:> Core.QueryParam
                "requestMetadata.trafficSource.trafficSourceId"
                Core.Text
      Core.:> Core.QueryParam
                "requestMetadata.trafficSource.trafficSubId"
                Core.Text
      Core.:> Core.QueryParam "requestMetadata.userOverrides.ipAddress" Core.Text
      Core.:> Core.QueryParam "requestMetadata.userOverrides.userId" Core.Text
      Core.:> Core.QueryParam "uploadType" Core.Text
      Core.:> Core.QueryParam "upload_protocol" Core.Text
      Core.:> Core.QueryParam "alt" Core.AltJSON
      Core.:> Core.Get '[Core.JSON] ListAnalyticsResponse
  
  -- | Lists analytics data for a user\'s associated company. Should only be called within the context of an authorized logged in user.
  --
  -- /See:/ 'newPartnersAnalyticsList' smart constructor.
  data PartnersAnalyticsList = PartnersAnalyticsList
    { -- | V1 error format.
      xgafv :: (Core.Maybe Xgafv),
      -- | OAuth access token.
      accessToken :: (Core.Maybe Core.Text),
      -- | JSONP
      callback :: (Core.Maybe Core.Text),
      -- | Requested page size. Server may return fewer analytics than requested. If unspecified or set to 0, default value is 30. Specifies the number of days in the date range when querying analytics. The @page_token@ represents the end date of the date range and the start date is calculated using the @page_size@ as the number of days BEFORE the end date. Must be a non-negative integer.
      pageSize :: (Core.Maybe Core.Int32),
      -- | A token identifying a page of results that the server returns. Typically, this is the value of @ListAnalyticsResponse.next_page_token@ returned from the previous call to ListAnalytics. Will be a date string in @YYYY-MM-DD@ format representing the end date of the date range of results to return. If unspecified or set to \"\", default value is the current date.
      pageToken :: (Core.Maybe Core.Text),
      -- | Experiment IDs the current request belongs to.
      requestMetadataExperimentIds :: (Core.Maybe [Core.Text]),
      -- | Locale to use for the current request.
      requestMetadataLocale :: (Core.Maybe Core.Text),
      -- | Google Partners session ID.
      requestMetadataPartnersSessionId :: (Core.Maybe Core.Text),
      -- | Identifier to indicate where the traffic comes from. An identifier has multiple letters created by a team which redirected the traffic to us.
      requestMetadataTrafficSourceTrafficSourceId :: (Core.Maybe Core.Text),
      -- | Second level identifier to indicate where the traffic comes from. An identifier has multiple letters created by a team which redirected the traffic to us.
      requestMetadataTrafficSourceTrafficSubId :: (Core.Maybe Core.Text),
      -- | IP address to use instead of the user\'s geo-located IP address.
      requestMetadataUserOverridesIpAddress :: (Core.Maybe Core.Text),
      -- | Logged-in user ID to impersonate instead of the user\'s ID.
      requestMetadataUserOverridesUserId :: (Core.Maybe Core.Text),
      -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
      uploadType :: (Core.Maybe Core.Text),
      -- | Upload protocol for media (e.g. \"raw\", \"multipart\").
      uploadProtocol :: (Core.Maybe Core.Text)
    }
    deriving (Core.Eq, Core.Show, Core.Generic)
  
  -- | Creates a value of 'PartnersAnalyticsList' with the minimum fields required to make a request.
  newPartnersAnalyticsList ::
    PartnersAnalyticsList
  newPartnersAnalyticsList =
    PartnersAnalyticsList
      { xgafv = Core.Nothing,
        accessToken = Core.Nothing,
        callback = Core.Nothing,
        pageSize = Core.Nothing,
        pageToken = Core.Nothing,
        requestMetadataExperimentIds = Core.Nothing,
        requestMetadataLocale = Core.Nothing,
        requestMetadataPartnersSessionId = Core.Nothing,
        requestMetadataTrafficSourceTrafficSourceId = Core.Nothing,
        requestMetadataTrafficSourceTrafficSubId = Core.Nothing,
        requestMetadataUserOverridesIpAddress = Core.Nothing,
        requestMetadataUserOverridesUserId = Core.Nothing,
        uploadType = Core.Nothing,
        uploadProtocol = Core.Nothing
      }
  
  instance Core.GoogleRequest PartnersAnalyticsList where
    type Rs PartnersAnalyticsList = ListAnalyticsResponse
    type Scopes PartnersAnalyticsList = '[]
    requestClient PartnersAnalyticsList {..} =
      go
        xgafv
        accessToken
        callback
        pageSize
        pageToken
        (requestMetadataExperimentIds Core.^. Core._Default)
        requestMetadataLocale
        requestMetadataPartnersSessionId
        requestMetadataTrafficSourceTrafficSourceId
        requestMetadataTrafficSourceTrafficSubId
        requestMetadataUserOverridesIpAddress
        requestMetadataUserOverridesUserId
        uploadType
        uploadProtocol
        (Core.Just Core.AltJSON)
        partnersService
      where
        go =
          Core.buildClient
            (Core.Proxy :: Core.Proxy PartnersAnalyticsListResource)
            Core.mempty
  