donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

donau-httpd_charity.h (2528B)


      1 /*
      2   This file is part of TALER
      3   Copyright (C) 2024 Taler Systems SA
      4 
      5   TALER is free software; you can redistribute it and/or modify it under the
      6   terms of the GNU Affero General Public License as published by the Free Software
      7   Foundation; either version 3, or (at your option) any later version.
      8 
      9   TALER is distributed in the hope that it will be useful, but WITHOUT ANY
     10   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     11   A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
     12 
     13   You should have received a copy of the GNU Affero General Public License along with
     14   TALER; see the file COPYING.  If not, see <http://www.gnu.org/licenses/>
     15 */
     16 /**
     17  * @file donau-httpd_charity.h
     18  * @brief Handle /charity requests
     19  * @author Johannes Casaburi
     20  */
     21 #ifndef DONAU_HTTPD_CHARITY_H
     22 #define DONAU_HTTPD_CHARITY_H
     23 
     24 #include <microhttpd.h>
     25 #include "donau-httpd.h"
     26 #include "donaudb_plugin.h"
     27 
     28 
     29 /**
     30  * Handle a POST "/charity" request.
     31  *
     32  * @param connection the MHD connection to handle
     33  * @param root uploaded JSON data
     34  * @return MHD result code
     35  */
     36 MHD_RESULT
     37 DH_handler_charity_post (
     38   struct DH_RequestContext *rc,
     39   const json_t *root,
     40   const char *const args[]);
     41 
     42 
     43 /**
     44  * Handle a PATCH "/charities/$CHARITY_ID" request.
     45  *
     46  * @param rc request context
     47  * @param root uploaded JSON data with updates
     48  * @param args array with the charity identifier in args[0]
     49  * @return MHD result code
     50  */
     51 MHD_RESULT
     52 DH_handler_charity_patch (
     53   struct DH_RequestContext *rc,
     54   const json_t *root,
     55   const char *const args[]);
     56 
     57 
     58 /**
     59  * Handle a GET "/charities/$CHARITY_ID" request.
     60  *
     61  * @param rc request context
     62  * @param charity_sig signature of the charity authorizing access
     63  *         (to be checked!)
     64  * @param charity_id_s the "$CHARITY_ID" argument
     65  * @return MHD result code
     66  */
     67 MHD_RESULT
     68 DH_handler_charity_get (
     69   struct DH_RequestContext *rc,
     70   const struct DONAU_CharitySignatureP *charity_sig,
     71   const char *charity_id_s);
     72 
     73 
     74 /**
     75  * Handle a GET "/charities" request.
     76  *
     77  * @param rc request context
     78  * @param args GET arguments (should be one)
     79  * @return MHD result code
     80  */
     81 MHD_RESULT
     82 DH_handler_charities_get (
     83   struct DH_RequestContext *rc);
     84 
     85 /**
     86  * Handle a DELETE "/charity/$CHARITY_ID" request.
     87  *
     88  * @param rc request details about the request to handle
     89  * @param args argument with the public key of the purse
     90  * @return MHD result code
     91  */
     92 MHD_RESULT
     93 DH_handler_charity_delete (
     94   struct DH_RequestContext *rc,
     95   const char *const args[1]);
     96 
     97 #endif