/*
   This file is part of Challenger
   Copyright (C) 2023 Taler Systems SA

   Challenger is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
   Foundation; either version 3, or (at your option) any later version.

   Challenger is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
   A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

   You should have received a copy of the GNU General Public License along with
   Challenger; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
 */
/**
 * @file src/include/challenger-database/get_client_by_uri.h
 * @brief implementation of the get_client_by_uri function for Postgres
 * @author Christian Grothoff
 */
#ifndef CHALLENGER_DATABASE_GET_CLIENT_BY_URI_H
#define CHALLENGER_DATABASE_GET_CLIENT_BY_URI_H

#include <taler/taler_util.h>
#include <taler/taler_json_lib.h>
#include "challenger_util.h"
#include "challenger_database_lib.h"


/**
 * Look up the client authorized under the given redirect URI
 * and secret.  Read-only.
 *
 * @param cls
 * @param client_url client redirect URL (if known)
 * @param client_secret secret of the client
 * @param[out] client_id set to the ID of the client if found
 * @return transaction status
 */
enum GNUNET_DB_QueryStatus
CHALLENGERDB_get_client_by_uri (
  struct CHALLENGERDB_PostgresContext *ctx,
  const char *client_url,
  const char *client_secret,
  uint64_t *client_id);

#endif
