# LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DuplicateRecordFields #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE LambdaCase #
{-# LANGUAGE OverloadedStrings #-}
# LANGUAGE PatternSynonyms #
# LANGUAGE RecordWildCards #
{-# LANGUAGE StrictData #-}
# LANGUAGE TypeFamilies #
# LANGUAGE TypeOperators #
# 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       :  . People . SearchContacts
  Copyright    : ( c ) 2015 - 2022  
  License      : Mozilla Public License , v. 2.0 .
  Maintainer   :   < brendan.g.hay+ >
-- Stability   : auto-generated
  Portability : non - portable ( GHC extensions )
--
-- Provides a list of contacts in the authenticated user\'s grouped contacts that matches the search query. The query matches on a contact\'s @names@, @nickNames@, @emailAddresses@, @phoneNumbers@, and @organizations@ fields that are from the CONTACT source. __IMPORTANT__: Before searching, clients should send a warmup request with an empty query to update the cache. See https:\/\/developers.google.com\/people\/v1\/contacts#search/the/users_contacts
--
  /See:/ < / People API Reference > for @people.people.searchContacts@.
module Gogol.People.SearchContacts
  ( -- * Resource
    PeoplePeopleSearchContactsResource,

    -- ** Constructing a Request
    PeoplePeopleSearchContacts (..),
    newPeoplePeopleSearchContacts,
  )
where

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

  | A resource alias for @people.people.searchContacts@ method which the
-- 'PeoplePeopleSearchContacts' request conforms to.
type PeoplePeopleSearchContactsResource =
  "v1"
    Core.:> "people:searchContacts"
    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 "query" Core.Text
    Core.:> Core.QueryParam "readMask" Core.FieldMask
    Core.:> Core.QueryParams
              "sources"
              PeopleSearchContactsSources
    Core.:> Core.QueryParam "uploadType" Core.Text
    Core.:> Core.QueryParam "upload_protocol" Core.Text
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.Get '[Core.JSON] SearchResponse

-- | Provides a list of contacts in the authenticated user\'s grouped contacts that matches the search query. The query matches on a contact\'s @names@, @nickNames@, @emailAddresses@, @phoneNumbers@, and @organizations@ fields that are from the CONTACT source. __IMPORTANT__: Before searching, clients should send a warmup request with an empty query to update the cache. See https:\/\/developers.google.com\/people\/v1\/contacts#search/the/users_contacts
--
-- /See:/ 'newPeoplePeopleSearchContacts' smart constructor.
data PeoplePeopleSearchContacts = PeoplePeopleSearchContacts
  { -- | V1 error format.
    xgafv :: (Core.Maybe Xgafv),
    -- | OAuth access token.
    accessToken :: (Core.Maybe Core.Text),
  | JSONP
    callback :: (Core.Maybe Core.Text),
  | Optional . The number of results to return . Defaults to 10 if field is not set , or set to 0 . Values greater than 30 will be capped to 30 .
    pageSize :: (Core.Maybe Core.Int32),
  | Required . The plain - text query for the request . The query is used to match prefix phrases of the fields on a person . For example , a person with name \"foo name\ " matches queries such as \"f\ " , \"fo\ " , \"foo\ " , \"foo   , \"nam\ " , etc . , but not   " .
    query :: (Core.Maybe Core.Text),
  | Required . A field mask to restrict which fields on each person are returned . Multiple fields can be specified by separating them with commas . Valid values are : * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
    readMask :: (Core.Maybe Core.FieldMask),
    -- | Optional. A mask of what source types to return. Defaults to READ/SOURCE/TYPE_CONTACT if not set.
    sources :: (Core.Maybe [PeopleSearchContactsSources]),
  | 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 'PeoplePeopleSearchContacts' with the minimum fields required to make a request.
newPeoplePeopleSearchContacts ::
  PeoplePeopleSearchContacts
newPeoplePeopleSearchContacts =
  PeoplePeopleSearchContacts
    { xgafv = Core.Nothing,
      accessToken = Core.Nothing,
      callback = Core.Nothing,
      pageSize = Core.Nothing,
      query = Core.Nothing,
      readMask = Core.Nothing,
      sources = Core.Nothing,
      uploadType = Core.Nothing,
      uploadProtocol = Core.Nothing
    }

instance
  Core.GoogleRequest
    PeoplePeopleSearchContacts
  where
  type Rs PeoplePeopleSearchContacts = SearchResponse
  type
    Scopes PeoplePeopleSearchContacts =
      '[Contacts'FullControl, Contacts'Readonly]
  requestClient PeoplePeopleSearchContacts {..} =
    go
      xgafv
      accessToken
      callback
      pageSize
      query
      readMask
      (sources Core.^. Core._Default)
      uploadType
      uploadProtocol
      (Core.Just Core.AltJSON)
      peopleService
    where
      go =
        Core.buildClient
          ( Core.Proxy ::
              Core.Proxy PeoplePeopleSearchContactsResource
          )
          Core.mempty

# LANGUAGE OverloadedStrings #
# LANGUAGE StrictData #
 |
 Stability   : auto-generated

 Provides a list of contacts in the authenticated user\'s grouped contacts that matches the search query. The query matches on a contact\'s @names@, @nickNames@, @emailAddresses@, @phoneNumbers@, and @organizations@ fields that are from the CONTACT source. __IMPORTANT__: Before searching, clients should send a warmup request with an empty query to update the cache. See https:\/\/developers.google.com\/people\/v1\/contacts#search/the/users_contacts

 * Resource
 ** Constructing a Request
 'PeoplePeopleSearchContacts' request conforms to.
 | Provides a list of contacts in the authenticated user\'s grouped contacts that matches the search query. The query matches on a contact\'s @names@, @nickNames@, @emailAddresses@, @phoneNumbers@, and @organizations@ fields that are from the CONTACT source. __IMPORTANT__: Before searching, clients should send a warmup request with an empty query to update the cache. See https:\/\/developers.google.com\/people\/v1\/contacts#search/the/users_contacts

 /See:/ 'newPeoplePeopleSearchContacts' smart constructor.
 | V1 error format.
 | OAuth access token.
 | Optional. A mask of what source types to return. Defaults to READ/SOURCE/TYPE_CONTACT if not set.
 | Upload protocol for media (e.g. \"raw\", \"multipart\").
 | Creates a value of 'PeoplePeopleSearchContacts' with the minimum fields required to make a request.
# LANGUAGE DataKinds #
# LANGUAGE DeriveGeneric #
# LANGUAGE DerivingStrategies #
# LANGUAGE DuplicateRecordFields #
# LANGUAGE FlexibleInstances #
# LANGUAGE GeneralizedNewtypeDeriving #
# LANGUAGE LambdaCase #
# LANGUAGE PatternSynonyms #
# LANGUAGE RecordWildCards #
# LANGUAGE TypeFamilies #
# LANGUAGE TypeOperators #
# 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       :  . People . SearchContacts
  Copyright    : ( c ) 2015 - 2022  
  License      : Mozilla Public License , v. 2.0 .
  Maintainer   :   < brendan.g.hay+ >
  Portability : non - portable ( GHC extensions )
  /See:/ < / People API Reference > for @people.people.searchContacts@.
module Gogol.People.SearchContacts
    PeoplePeopleSearchContactsResource,

    PeoplePeopleSearchContacts (..),
    newPeoplePeopleSearchContacts,
  )
where

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

  | A resource alias for @people.people.searchContacts@ method which the
type PeoplePeopleSearchContactsResource =
  "v1"
    Core.:> "people:searchContacts"
    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 "query" Core.Text
    Core.:> Core.QueryParam "readMask" Core.FieldMask
    Core.:> Core.QueryParams
              "sources"
              PeopleSearchContactsSources
    Core.:> Core.QueryParam "uploadType" Core.Text
    Core.:> Core.QueryParam "upload_protocol" Core.Text
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.Get '[Core.JSON] SearchResponse

data PeoplePeopleSearchContacts = PeoplePeopleSearchContacts
    xgafv :: (Core.Maybe Xgafv),
    accessToken :: (Core.Maybe Core.Text),
  | JSONP
    callback :: (Core.Maybe Core.Text),
  | Optional . The number of results to return . Defaults to 10 if field is not set , or set to 0 . Values greater than 30 will be capped to 30 .
    pageSize :: (Core.Maybe Core.Int32),
  | Required . The plain - text query for the request . The query is used to match prefix phrases of the fields on a person . For example , a person with name \"foo name\ " matches queries such as \"f\ " , \"fo\ " , \"foo\ " , \"foo   , \"nam\ " , etc . , but not   " .
    query :: (Core.Maybe Core.Text),
  | Required . A field mask to restrict which fields on each person are returned . Multiple fields can be specified by separating them with commas . Valid values are : * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined
    readMask :: (Core.Maybe Core.FieldMask),
    sources :: (Core.Maybe [PeopleSearchContactsSources]),
  | Legacy upload protocol for media ( e.g. \"media\ " , \"multipart\ " ) .
    uploadType :: (Core.Maybe Core.Text),
    uploadProtocol :: (Core.Maybe Core.Text)
  }
  deriving (Core.Eq, Core.Show, Core.Generic)

newPeoplePeopleSearchContacts ::
  PeoplePeopleSearchContacts
newPeoplePeopleSearchContacts =
  PeoplePeopleSearchContacts
    { xgafv = Core.Nothing,
      accessToken = Core.Nothing,
      callback = Core.Nothing,
      pageSize = Core.Nothing,
      query = Core.Nothing,
      readMask = Core.Nothing,
      sources = Core.Nothing,
      uploadType = Core.Nothing,
      uploadProtocol = Core.Nothing
    }

instance
  Core.GoogleRequest
    PeoplePeopleSearchContacts
  where
  type Rs PeoplePeopleSearchContacts = SearchResponse
  type
    Scopes PeoplePeopleSearchContacts =
      '[Contacts'FullControl, Contacts'Readonly]
  requestClient PeoplePeopleSearchContacts {..} =
    go
      xgafv
      accessToken
      callback
      pageSize
      query
      readMask
      (sources Core.^. Core._Default)
      uploadType
      uploadProtocol
      (Core.Just Core.AltJSON)
      peopleService
    where
      go =
        Core.buildClient
          ( Core.Proxy ::
              Core.Proxy PeoplePeopleSearchContactsResource
          )
          Core.mempty
