rename example

This commit is contained in:
2026-06-01 03:09:19 +02:00
parent 7f3d14a764
commit b5473bfafc
59 changed files with 261 additions and 182 deletions
@@ -0,0 +1,137 @@
package com.bitcointxoko.gudariwallet.api
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import retrofit2.http.Url
interface LNbitsApi {
/** GET /api/v1/wallet — returns balance and wallet info */
@GET("api/v1/wallet")
suspend fun getWallet(
@Header("X-Api-Key") apiKey: String
): WalletResponse
/** POST /api/v1/payments — creates a BOLT-11 invoice */
@POST("api/v1/payments")
suspend fun createInvoice(
@Header("X-Api-Key") apiKey: String,
@Body request: CreateInvoiceRequest
): CreateInvoiceResponse
/**
* GET /api/v1/payments/{checking_id}
* Returns paid status and details for a specific payment hash.
* Auth: invoice key is sufficient.
*/
@GET("api/v1/payments/{checking_id}")
suspend fun checkPayment(
@Header("X-Api-Key") apiKey: String,
@Path("checking_id") checkingId: String
): PaymentStatusResponse
/** POST /api/v1/payments/pay — pays a BOLT-11 invoice */
@POST("api/v1/payments")
suspend fun payInvoice(
@Header("X-Api-Key") adminKey: String,
@Body request: PayInvoiceRequest
): PayInvoiceResponse
/** GET /api/v1/payments — returns payment history */
@GET("api/v1/payments")
suspend fun getPayments(
@Header("X-Api-Key") apiKey: String
): List<WsPayment>
/** POST /api/v1/payments/decode — returns decoded payment request */
@POST("api/v1/payments/decode")
suspend fun decodeInvoice(
@Header("X-Api-Key") invoiceKey: String,
@Body request: DecodeInvoiceRequest
): DecodeInvoiceResponse
// Unified scanner — accepts LNURL, Lightning Address, OR bolt11
@GET("api/v1/lnurlscan/{code}")
suspend fun lnurlScan(
@Header("X-Api-Key") invoiceKey: String,
@Path("code") code: String
): LnurlScanResponse
// Pay an LNURL-pay (after scanning)
@POST("api/v1/payments/lnurl")
suspend fun payLnurl(
@Header("X-Api-Key") adminKey: String,
@Body body: PayLnurlRequest
): PayLnurlResponse
// LNURL-withdraw callback (dynamic URL, per LUD-03)
@GET
suspend fun withdrawCallback(
@Url url: String
): WithdrawCallbackResponse
// Direct fetch of a raw LNURL metadata URL (LUD-17: lnurlp://, lnurlw://)
@GET
suspend fun fetchLnurlMetadata(
@Url url: String
): LnurlScanResponse
/**
* GET {callback}?amount={msat}&comment={comment}
* Fetches a BOLT-11 invoice from an LNURL-pay callback URL directly.
* This is a raw @Url call — bypasses LNbits server-side proxy entirely.
*/
@GET
suspend fun fetchLnurlCallback(
@Url url: String
): LnurlCallbackResponse
/**
* GET /lnurlp/api/v1/links?all_wallets=false
* Returns all LNURLp pay links for the current wallet.
* Auth: invoice key is sufficient.
*/
@GET("lnurlp/api/v1/links")
suspend fun getLnurlpLinks(
@Header("X-Api-Key") invoiceKey: String,
@Query("all_wallets") allWallets: Boolean = false
): List<LnurlpLink>
// Get historical payments
@GET("api/v1/payments")
suspend fun getPayments(
@Header("X-Api-Key") invoiceKey: String,
@Query("limit") limit: Int,
@Query("offset") offset: Int
): List<PaymentRecord>
// Get payment detail
@GET("api/v1/payments/{checking_id}")
suspend fun getPaymentDetail(
@Header("X-Api-Key") invoiceKey: String,
@Path("checking_id") checkingId: String
): PaymentDetailResponse
/**
* Returns the current BTC price in [currency].
* Example: GET /api/v1/rate/USD → {"rate": 43250.50}
* No X-Api-Key header needed.
*/
@GET("api/v1/rate/{currency}")
suspend fun getFiatRate(
@Path("currency") currency: String
): FiatRateResponse
/**
* Returns the list of supported ISO 4217 currency codes.
* Example: GET /api/v1/currencies → ["USD","EUR","GBP",...]
* No X-Api-Key header needed.
*/
@GET("api/v1/currencies")
suspend fun getSupportedCurrencies(): List<String>
}