get-management-instances.h (4427B)
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-management-instances.h 19 * @brief C interface for the GET /management/instances endpoint 20 * @author Christian Grothoff 21 */ 22 #ifndef _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H 23 #define _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H 24 25 #include <taler/merchant/common.h> 26 27 28 /** 29 * Handle for a GET /management/instances request. 30 */ 31 struct TALER_MERCHANT_GetManagementInstancesHandle; 32 33 34 /** 35 * Information about one merchant instance. 36 */ 37 struct TALER_MERCHANT_GetManagementInstancesInstanceInfo 38 { 39 40 /** 41 * Instance identifier string. 42 */ 43 const char *id; 44 45 /** 46 * Human-readable name of the instance. 47 */ 48 const char *name; 49 50 /** 51 * Public key of the instance. 52 */ 53 struct TALER_MerchantPublicKeyP merchant_pub; 54 55 /** 56 * JSON array of supported payment targets. 57 */ 58 const json_t *payment_targets; 59 60 /** 61 * Website URL of the instance, or NULL if not set. 62 */ 63 const char *website; 64 65 /** 66 * Logo (data URL) of the instance, or NULL if not set. 67 */ 68 const char *logo; 69 70 /** 71 * True if this instance has been deleted. 72 */ 73 bool deleted; 74 75 }; 76 77 78 /** 79 * Response details for a GET /management/instances request. 80 */ 81 struct TALER_MERCHANT_GetManagementInstancesResponse 82 { 83 84 /** 85 * HTTP response details. 86 */ 87 struct TALER_MERCHANT_HttpResponse hr; 88 89 /** 90 * Details depending on the HTTP status code. 91 */ 92 union 93 { 94 95 /** 96 * Details on #MHD_HTTP_OK. 97 */ 98 struct 99 { 100 101 /** 102 * Number of instances in @a iis. 103 */ 104 unsigned int iis_length; 105 106 /** 107 * Array of instance information. 108 */ 109 const struct TALER_MERCHANT_GetManagementInstancesInstanceInfo *iis; 110 111 } ok; 112 113 } details; 114 115 }; 116 117 118 /** 119 * Set up GET /management/instances operation. 120 * Note that you must explicitly start the operation after 121 * possibly setting options. 122 * 123 * @param ctx the context 124 * @param url base URL of the merchant backend 125 * @return handle to operation 126 */ 127 struct TALER_MERCHANT_GetManagementInstancesHandle * 128 TALER_MERCHANT_get_management_instances_create ( 129 struct GNUNET_CURL_Context *ctx, 130 const char *url); 131 132 133 #ifndef TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE 134 /** 135 * Type of the closure used by 136 * the #TALER_MERCHANT_GetManagementInstancesCallback. 137 */ 138 #define TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE void 139 #endif /* TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE */ 140 141 /** 142 * Callback for a GET /management/instances request. 143 * 144 * @param cls closure 145 * @param igr response details 146 */ 147 typedef void 148 (*TALER_MERCHANT_GetManagementInstancesCallback)( 149 TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cls, 150 const struct TALER_MERCHANT_GetManagementInstancesResponse *igr); 151 152 153 /** 154 * Start GET /management/instances operation. 155 * 156 * @param[in,out] gimh operation to start 157 * @param cb function to call with the merchant's result 158 * @param cb_cls closure for @a cb 159 * @return status code, #TALER_EC_NONE on success 160 */ 161 enum TALER_ErrorCode 162 TALER_MERCHANT_get_management_instances_start ( 163 struct TALER_MERCHANT_GetManagementInstancesHandle *gimh, 164 TALER_MERCHANT_GetManagementInstancesCallback cb, 165 TALER_MERCHANT_GET_MANAGEMENT_INSTANCES_RESULT_CLOSURE *cb_cls); 166 167 168 /** 169 * Cancel GET /management/instances operation. This function must not be 170 * called by clients after the TALER_MERCHANT_GetManagementInstancesCallback 171 * has been invoked (as in those cases it'll be called internally by the 172 * implementation already). 173 * 174 * @param[in] gimh operation to cancel 175 */ 176 void 177 TALER_MERCHANT_get_management_instances_cancel ( 178 struct TALER_MERCHANT_GetManagementInstancesHandle *gimh); 179 180 181 #endif /* _TALER_MERCHANT__GET_MANAGEMENT_INSTANCES_H */