Skip to main content

NodeBackendApi

Trait NodeBackendApi 

Source
pub trait NodeBackendApi {
Show 46 methods // Required methods async fn get_user( &self, user_pk: UserPk, ) -> Result<MaybeUser, BackendApiError>; async fn get_sealed_seed( &self, data: &SealedSeedId, ) -> Result<MaybeSealedSeed, BackendApiError>; async fn create_sealed_seed( &self, data: &SealedSeed, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn delete_sealed_seeds( &self, measurement: Measurement, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn get_scids( &self, auth: BearerAuthToken, ) -> Result<Scids, BackendApiError>; async fn get_scid( &self, auth: BearerAuthToken, ) -> Result<MaybeScid, BackendApiError>; async fn get_file_v1( &self, file_id: &VfsFileId, auth: BearerAuthToken, ) -> Result<MaybeVfsFile, BackendApiError>; async fn get_file( &self, file_id: &VfsFileId, token: BearerAuthToken, ) -> Result<Bytes, BackendApiError>; async fn create_file_v1( &self, file: &VfsFile, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn create_file( &self, file_id: &VfsFileId, data: Bytes, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn upsert_file_v1( &self, file: &VfsFile, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn upsert_file( &self, file_id: &VfsFileId, data: Bytes, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn delete_file( &self, file_id: &VfsFileId, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn get_directory_v1( &self, dir: &VfsDirectory, auth: BearerAuthToken, ) -> Result<VecVfsFile, BackendApiError>; async fn list_directory( &self, dir: &VfsDirectory, auth: BearerAuthToken, ) -> Result<VfsDirectoryList, BackendApiError>; async fn get_payment_by_index_v1( &self, req: PaymentCreatedIndexStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV1, BackendApiError>; async fn create_payment( &self, payment: DbPaymentV1, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn upsert_payment_v1( &self, payment: DbPaymentV1, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn upsert_payment( &self, payment: DbPaymentV2, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn get_payment_by_id_v1( &self, req: PaymentIdStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV1, BackendApiError>; async fn get_payment_by_id( &self, req: PaymentIdStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV2, BackendApiError>; async fn get_payment_by_index( &self, req: PaymentCreatedIndexStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV1, BackendApiError>; async fn upsert_payment_batch_v1( &self, payments: VecDbPaymentV1, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn upsert_payment_batch( &self, payments: VecDbPaymentV2, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn get_payments_by_indexes( &self, req: PaymentCreatedIndexes, auth: BearerAuthToken, ) -> Result<VecDbPaymentV1, BackendApiError>; async fn get_payments_by_ids( &self, req: VecPaymentId, auth: BearerAuthToken, ) -> Result<VecDbPaymentV2, BackendApiError>; async fn get_new_payments( &self, req: GetNewPayments, auth: BearerAuthToken, ) -> Result<VecDbPaymentV1, BackendApiError>; async fn get_updated_payments( &self, req: GetUpdatedPayments, auth: BearerAuthToken, ) -> Result<VecDbPaymentV2, BackendApiError>; async fn get_pending_payments_v1( &self, auth: BearerAuthToken, ) -> Result<VecDbPaymentV1, BackendApiError>; async fn get_pending_payments( &self, auth: BearerAuthToken, ) -> Result<VecDbPaymentV2, BackendApiError>; async fn get_finalized_payment_ids( &self, auth: BearerAuthToken, ) -> Result<VecPaymentId, BackendApiError>; async fn upsert_payment_metadata( &self, metadata: DbPaymentMetadata, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn upsert_payment_metadata_batch( &self, payments: VecDbPaymentMetadata, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn get_payment_metadata_by_id( &self, req: PaymentIdStruct, token: BearerAuthToken, ) -> Result<MaybeDbPaymentMetadata, BackendApiError>; async fn get_payment_metadata_by_ids( &self, req: VecPaymentId, token: BearerAuthToken, ) -> Result<VecDbPaymentMetadata, BackendApiError>; async fn get_updated_payment_metadata( &self, req: GetUpdatedPaymentMetadata, auth: BearerAuthToken, ) -> Result<VecDbPaymentMetadata, BackendApiError>; async fn update_human_bitcoin_address( &self, req: UpdateHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError>; async fn get_human_bitcoin_address( &self, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError>; async fn claim_generated_human_bitcoin_address( &self, req: ClaimGeneratedHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; async fn get_generated_username( &self, auth: BearerAuthToken, ) -> Result<GetGeneratedUsernameResponse, BackendApiError>; async fn get_nwc_clients( &self, req: GetNwcClients, auth: BearerAuthToken, ) -> Result<VecDbNwcClient, BackendApiError>; async fn upsert_nwc_client( &self, req: DbNwcClientFields, auth: BearerAuthToken, ) -> Result<DbNwcClient, BackendApiError>; async fn delete_nwc_client( &self, req: NostrPkStruct, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>; // Provided methods async fn update_payment_address( &self, req: UpdateHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError> { ... } async fn get_payment_address( &self, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError> { ... } async fn claim_generated_payment_address( &self, req: ClaimGeneratedHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError> { ... }
}
Expand description

Defines the api that the backend exposes to the node.

Required MethodsΒ§

Source

async fn get_user(&self, user_pk: UserPk) -> Result<MaybeUser, BackendApiError>

GET /node/v1/user UserPkStruct -> MaybeUser

Source

async fn get_sealed_seed( &self, data: &SealedSeedId, ) -> Result<MaybeSealedSeed, BackendApiError>

GET /node/v1/sealed_seed SealedSeedId -> MaybeSealedSeed

Source

async fn create_sealed_seed( &self, data: &SealedSeed, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

PUT /node/v1/sealed_seed SealedSeed -> Empty

Idempotent: does nothing if the SealedSeedId already exists.

Source

async fn delete_sealed_seeds( &self, measurement: Measurement, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

Delete all sealed seeds which have the given measurement and the user_pk of the authenticated user.

DELETE /node/v1/sealed_seed MeasurementStruct -> Empty

Source

async fn get_scids( &self, auth: BearerAuthToken, ) -> Result<Scids, BackendApiError>

GET /node/v1/scids Empty -> Scids

Source

async fn get_scid( &self, auth: BearerAuthToken, ) -> Result<MaybeScid, BackendApiError>

πŸ‘ŽDeprecated:

since lsp-v0.7.3: Use multi scid version instead

GET /node/v1/scid Empty -> MaybeScid

Source

async fn get_file_v1( &self, file_id: &VfsFileId, auth: BearerAuthToken, ) -> Result<MaybeVfsFile, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.5: Use get_file instead

GET /node/v1/file VfsFileId -> MaybeVfsFile

Source

async fn get_file( &self, file_id: &VfsFileId, token: BearerAuthToken, ) -> Result<Bytes, BackendApiError>

GET /node/v2/file VfsFileId -> Bytes (VfsFile::data)

Source

async fn create_file_v1( &self, file: &VfsFile, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.5: Use create_file instead

POST /node/v1/file VfsFile -> Empty

Source

async fn create_file( &self, file_id: &VfsFileId, data: Bytes, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

POST /node/v2/file VfsFileId (query) + Bytes (body) -> Empty

Source

async fn upsert_file_v1( &self, file: &VfsFile, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.5: Use upsert_file instead

PUT /node/v1/file VfsFile -> Empty

Source

async fn upsert_file( &self, file_id: &VfsFileId, data: Bytes, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

PUT /node/v2/file VfsFileId (query) + Bytes (body) -> Empty

Source

async fn delete_file( &self, file_id: &VfsFileId, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

DELETE /node/v1/file VfsFileId -> Empty

Returns Ok only if exactly one row was deleted.

Source

async fn get_directory_v1( &self, dir: &VfsDirectory, auth: BearerAuthToken, ) -> Result<VecVfsFile, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.5: Use list_directory instead

GET /node/v1/directory VfsDirectory -> VecVfsFile

Source

async fn list_directory( &self, dir: &VfsDirectory, auth: BearerAuthToken, ) -> Result<VfsDirectoryList, BackendApiError>

GET /node/v2/directory VfsDirectory -> VecVfsFile

Source

async fn get_payment_by_index_v1( &self, req: PaymentCreatedIndexStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV1, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.8: Use get_payment_by_index instead

Source

async fn create_payment( &self, payment: DbPaymentV1, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.10: Use upsert_payment instead

POST /node/v1/payments DbPaymentV1 -> Empty

Source

async fn upsert_payment_v1( &self, payment: DbPaymentV1, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.8: Use upsert_payment instead

PUT /node/v1/payments DbPaymentV1 -> Empty

Source

async fn upsert_payment( &self, payment: DbPaymentV2, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

PUT /node/v2/payments DbPaymentV2 -> Empty

Source

async fn get_payment_by_id_v1( &self, req: PaymentIdStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV1, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.10: Use get_payment_by_id instead

GET /node/v1/payments/id PaymentIdStruct -> MaybeDbPaymentV1

Source

async fn get_payment_by_id( &self, req: PaymentIdStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV2, BackendApiError>

GET /node/v2/payments/id PaymentIdStruct -> MaybeDbPaymentV2

Source

async fn get_payment_by_index( &self, req: PaymentCreatedIndexStruct, auth: BearerAuthToken, ) -> Result<MaybeDbPaymentV1, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.10: Use get_payment_by_id instead

GET /node/v1/payments/index PaymentCreatedIndexStruct -> MaybeDbPaymentV1

Source

async fn upsert_payment_batch_v1( &self, payments: VecDbPaymentV1, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.8: Use upsert_payment_batch instead

PUT /node/v1/payments/batch VecDbPaymentV1 -> Empty

ACID endpoint for upserting a batch of payments.

Source

async fn upsert_payment_batch( &self, payments: VecDbPaymentV2, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

PUT /node/v2/payments/batch VecDbPaymentV2 -> Empty

ACID endpoint for upserting a batch of payments.

Source

async fn get_payments_by_indexes( &self, req: PaymentCreatedIndexes, auth: BearerAuthToken, ) -> Result<VecDbPaymentV1, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.10: Use get_payments_by_ids instead

POST /node/v1/payments/indexes PaymentCreatedIndexes -> VecDbPaymentV1

Fetch a batch of payments by their PaymentCreatedIndexs. This is typically used by a mobile client to poll for updates on payments which it currently has stored locally as β€œpending”; the intention is to check if any of these payments have been updated.

Source

async fn get_payments_by_ids( &self, req: VecPaymentId, auth: BearerAuthToken, ) -> Result<VecDbPaymentV2, BackendApiError>

POST /node/v1/payments/ids VecPaymentId -> VecDbPaymentV2

Fetch a batch of payments by their PaymentIds.

Source

async fn get_new_payments( &self, req: GetNewPayments, auth: BearerAuthToken, ) -> Result<VecDbPaymentV1, BackendApiError>

πŸ‘ŽDeprecated:

since app-v0.8.9+29 and sdk-sidecar-v0.3.1: Use get_updated_payments instead

GET /node/v1/payments/new GetNewPayments -> VecDbPaymentV1

Sync a batch of new payments to local storage, optionally starting from a known PaymentCreatedIndex (exclusive). Results are in ascending order, by (created_at, payment_id). See GetNewPayments for more info.

Source

async fn get_updated_payments( &self, req: GetUpdatedPayments, auth: BearerAuthToken, ) -> Result<VecDbPaymentV2, BackendApiError>

GET /node/v1/payments/updated GetUpdatedPayments -> VecDbPaymentV2

Source

async fn get_pending_payments_v1( &self, auth: BearerAuthToken, ) -> Result<VecDbPaymentV1, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.10: Use get_pending_payments instead

GET /node/v1/payments/pending -> VecDbPaymentV1

Fetches all pending payments.

Source

async fn get_pending_payments( &self, auth: BearerAuthToken, ) -> Result<VecDbPaymentV2, BackendApiError>

GET /node/v2/payments/pending -> VecDbPaymentV2

Fetches all pending payments.

Source

async fn get_finalized_payment_ids( &self, auth: BearerAuthToken, ) -> Result<VecPaymentId, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.8.8

GET /node/v1/payments/final -> VecPaymentId

Fetches the IDs of all finalized payments.

Source

async fn upsert_payment_metadata( &self, metadata: DbPaymentMetadata, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

PUT /node/v1/payments/metadata DbPaymentMetadata -> Empty

Source

async fn upsert_payment_metadata_batch( &self, payments: VecDbPaymentMetadata, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

PUT /node/v1/payments/metadata/batch VecDbPaymentMetadata -> Empty

ACID endpoint for upserting a batch of payments metadata.

Source

async fn get_payment_metadata_by_id( &self, req: PaymentIdStruct, token: BearerAuthToken, ) -> Result<MaybeDbPaymentMetadata, BackendApiError>

GET /node/v1/payments/metadata/id PaymentIdStruct -> MaybeDbPaymentMetadata

Fetch a payment metadata by its PaymentId.

Source

async fn get_payment_metadata_by_ids( &self, req: VecPaymentId, token: BearerAuthToken, ) -> Result<VecDbPaymentMetadata, BackendApiError>

POST /node/v1/payments/metadata/ids VecPaymentId -> VecDbPaymentMetadata

Fetch a batch of payment metadata by their PaymentIds.

Source

async fn get_updated_payment_metadata( &self, req: GetUpdatedPaymentMetadata, auth: BearerAuthToken, ) -> Result<VecDbPaymentMetadata, BackendApiError>

GET /node/v1/payments/metadata/updated GetUpdatedPaymentMetadata -> VecDbPaymentMetadata

Get a batch of payment metadata in asc (updated_at, payment_id) order.

Source

async fn update_human_bitcoin_address( &self, req: UpdateHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError>

PUT /node/v1/human_bitcoin_address UpdateHumanBitcoinAddress -> HumanBitcoinAddress

Updates the human Bitcoin address (username and offer) of the given node.

Source

async fn get_human_bitcoin_address( &self, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError>

GET /node/v1/human_bitcoin_address Empty -> HumanBitcoinAddress

Fetches the node’s primary human Bitcoin address (username and offer).

Source

async fn claim_generated_human_bitcoin_address( &self, req: ClaimGeneratedHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

POST /node/v1/claim_generated_human_bitcoin_address ClaimGeneratedHumanBitcoinAddress -> Empty

Claims a generated human Bitcoin address for the given node.

Source

async fn get_generated_username( &self, auth: BearerAuthToken, ) -> Result<GetGeneratedUsernameResponse, BackendApiError>

GET /node/v1/generated_username Empty -> GetGeneratedUsernameResponse

Generates an available username for the authenticated user without storing it. The username is derived deterministically from the user’s user_pk, with collision handling via numeric suffixes.

Source

async fn get_nwc_clients( &self, req: GetNwcClients, auth: BearerAuthToken, ) -> Result<VecDbNwcClient, BackendApiError>

GET /node/v1/nwc_clients Empty -> VecDbNwcClient

Fetches the node’s NWC clients and optionally filters by client_nostr_pk.

Source

async fn upsert_nwc_client( &self, req: DbNwcClientFields, auth: BearerAuthToken, ) -> Result<DbNwcClient, BackendApiError>

PUT /node/v1/nwc_clients DbNwcClientFields -> DbNwcClient

Upserts a NWC client in the database.

Source

async fn delete_nwc_client( &self, req: NostrPkStruct, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

DELETE /node/v1/nwc_clients NostrPkStruct -> Empty

Deletes a NWC client given its nostr client public key.

Provided MethodsΒ§

Source

async fn update_payment_address( &self, req: UpdateHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.9.3: Use update_human_bitcoin_address instead

PUT /node/v1/payment_address UpdateHumanBitcoinAddress -> HumanBitcoinAddress

Source

async fn get_payment_address( &self, auth: BearerAuthToken, ) -> Result<HumanBitcoinAddress, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.9.3: Use get_human_bitcoin_address instead

GET /node/v1/payment_address Empty -> HumanBitcoinAddress

Source

async fn claim_generated_payment_address( &self, req: ClaimGeneratedHumanBitcoinAddress, auth: BearerAuthToken, ) -> Result<Empty, BackendApiError>

πŸ‘ŽDeprecated:

since node-v0.9.3: Use claim_generated_human_bitcoin_address instead

POST /node/v1/claim_generated_payment_address ClaimGeneratedHumanBitcoinAddress -> Empty

Dyn CompatibilityΒ§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

ImplementorsΒ§