get-private-webhooks.h (3868B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2014-2026 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify it under the 6 terms of the GNU Lesser General Public License as published by the Free Software 7 Foundation; either version 2.1, 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 Lesser General Public License for more details. 12 13 You should have received a copy of the GNU Lesser General Public License along with 14 TALER; see the file COPYING.LGPL. If not, see 15 <http://www.gnu.org/licenses/> 16 */ 17 /** 18 * @file src/include/taler/merchant/get-private-webhooks.h 19 * @brief C interface for the GET /private/webhooks endpoint 20 * @author Christian Grothoff 21 */ 22 #ifndef _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H 23 #define _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H 24 25 #include <taler/merchant/common.h> 26 27 28 /** 29 * Handle for a GET /private/webhooks request. 30 */ 31 struct TALER_MERCHANT_GetPrivateWebhooksHandle; 32 33 34 /** 35 * Entry for one webhook. 36 */ 37 struct TALER_MERCHANT_GetPrivateWebhooksWebhookEntry 38 { 39 40 /** 41 * Identifier of the webhook. 42 */ 43 const char *webhook_id; 44 45 /** 46 * Event type that triggers this webhook. 47 */ 48 const char *event_type; 49 50 }; 51 52 53 /** 54 * Response details for a GET /private/webhooks request. 55 */ 56 struct TALER_MERCHANT_GetPrivateWebhooksResponse 57 { 58 59 /** 60 * HTTP response details. 61 */ 62 struct TALER_MERCHANT_HttpResponse hr; 63 64 /** 65 * Details depending on the HTTP status code. 66 */ 67 union 68 { 69 70 /** 71 * Details on #MHD_HTTP_OK. 72 */ 73 struct 74 { 75 76 /** 77 * Number of webhooks in @a webhooks. 78 */ 79 unsigned int webhooks_length; 80 81 /** 82 * Array of webhook entries. 83 */ 84 const struct TALER_MERCHANT_GetPrivateWebhooksWebhookEntry *webhooks; 85 86 } ok; 87 88 } details; 89 90 }; 91 92 93 /** 94 * Set up GET /private/webhooks operation. 95 * Note that you must explicitly start the operation after 96 * possibly setting options. 97 * 98 * @param ctx the context 99 * @param url base URL of the merchant backend 100 * @return handle to operation 101 */ 102 struct TALER_MERCHANT_GetPrivateWebhooksHandle * 103 TALER_MERCHANT_get_private_webhooks_create ( 104 struct GNUNET_CURL_Context *ctx, 105 const char *url); 106 107 108 #ifndef TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE 109 /** 110 * Type of the closure used by 111 * the #TALER_MERCHANT_GetPrivateWebhooksCallback. 112 */ 113 #define TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE void 114 #endif /* TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE */ 115 116 /** 117 * Callback for a GET /private/webhooks request. 118 * 119 * @param cls closure 120 * @param wgr response details 121 */ 122 typedef void 123 (*TALER_MERCHANT_GetPrivateWebhooksCallback)( 124 TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cls, 125 const struct TALER_MERCHANT_GetPrivateWebhooksResponse *wgr); 126 127 128 /** 129 * Start GET /private/webhooks operation. 130 * 131 * @param[in,out] gpwh operation to start 132 * @param cb function to call with the merchant's result 133 * @param cb_cls closure for @a cb 134 * @return status code, #TALER_EC_NONE on success 135 */ 136 enum TALER_ErrorCode 137 TALER_MERCHANT_get_private_webhooks_start ( 138 struct TALER_MERCHANT_GetPrivateWebhooksHandle *gpwh, 139 TALER_MERCHANT_GetPrivateWebhooksCallback cb, 140 TALER_MERCHANT_GET_PRIVATE_WEBHOOKS_RESULT_CLOSURE *cb_cls); 141 142 143 /** 144 * Cancel GET /private/webhooks operation. This function must not be 145 * called by clients after the TALER_MERCHANT_GetPrivateWebhooksCallback 146 * has been invoked (as in those cases it'll be called internally by the 147 * implementation already). 148 * 149 * @param[in] gpwh operation to cancel 150 */ 151 void 152 TALER_MERCHANT_get_private_webhooks_cancel ( 153 struct TALER_MERCHANT_GetPrivateWebhooksHandle *gpwh); 154 155 156 #endif /* _TALER_MERCHANT__GET_PRIVATE_WEBHOOKS_H */