Skip to content

Commit

Permalink
Merge pull request #27 from G8XSU/response-docs
Browse files Browse the repository at this point in the history
Add docs for API response objects.
  • Loading branch information
G8XSU authored Dec 3, 2024
2 parents 5ee3080 + 9236e26 commit eed8ba5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
28 changes: 28 additions & 0 deletions ldk-server-protos/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNodeInfoRequest {}
/// The response `content` for the `GetNodeInfo` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetNodeInfoResponse {
Expand Down Expand Up @@ -50,6 +52,8 @@ pub struct GetNodeInfoResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OnchainReceiveRequest {}
/// The response `content` for the `OnchainReceive` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`..
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OnchainReceiveResponse {
Expand Down Expand Up @@ -80,6 +84,8 @@ pub struct OnchainSendRequest {
#[prost(bool, optional, tag = "3")]
pub send_all: ::core::option::Option<bool>,
}
/// The response `content` for the `OnchainSend` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OnchainSendResponse {
Expand Down Expand Up @@ -107,6 +113,8 @@ pub struct Bolt11ReceiveRequest {
#[prost(uint32, tag = "3")]
pub expiry_secs: u32,
}
/// The response `content` for the `Bolt11Receive` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Bolt11ReceiveResponse {
Expand All @@ -130,6 +138,8 @@ pub struct Bolt11SendRequest {
#[prost(uint64, optional, tag = "2")]
pub amount_msat: ::core::option::Option<u64>,
}
/// The response `content` for the `Bolt11Send` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Bolt11SendResponse {
Expand Down Expand Up @@ -159,6 +169,8 @@ pub struct Bolt12ReceiveRequest {
#[prost(uint64, optional, tag = "4")]
pub quantity: ::core::option::Option<u64>,
}
/// The response `content` for the `Bolt12Receive` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Bolt12ReceiveResponse {
Expand Down Expand Up @@ -190,6 +202,8 @@ pub struct Bolt12SendRequest {
#[prost(string, optional, tag = "4")]
pub payer_note: ::core::option::Option<::prost::alloc::string::String>,
}
/// The response `content` for the `Bolt12Send` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Bolt12SendResponse {
Expand Down Expand Up @@ -222,6 +236,8 @@ pub struct OpenChannelRequest {
#[prost(bool, tag = "6")]
pub announce_channel: bool,
}
/// The response `content` for the `OpenChannel` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenChannelResponse {
Expand All @@ -244,6 +260,8 @@ pub struct UpdateChannelConfigRequest {
#[prost(message, optional, tag = "3")]
pub channel_config: ::core::option::Option<super::types::ChannelConfig>,
}
/// The response `content` for the `UpdateChannelConfig` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateChannelConfigResponse {}
Expand All @@ -267,6 +285,8 @@ pub struct CloseChannelRequest {
#[prost(string, optional, tag = "4")]
pub force_close_reason: ::core::option::Option<::prost::alloc::string::String>,
}
/// The response `content` for the `CloseChannel` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CloseChannelResponse {}
Expand All @@ -275,6 +295,8 @@ pub struct CloseChannelResponse {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListChannelsRequest {}
/// The response `content` for the `ListChannels` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListChannelsResponse {
Expand All @@ -291,6 +313,8 @@ pub struct GetPaymentDetailsRequest {
#[prost(string, tag = "1")]
pub payment_id: ::prost::alloc::string::String,
}
/// The response `content` for the `GetPaymentDetails` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetPaymentDetailsResponse {
Expand All @@ -304,6 +328,8 @@ pub struct GetPaymentDetailsResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPaymentsRequest {}
/// The response `content` for the `ListPayments` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListPaymentsResponse {
Expand All @@ -316,6 +342,8 @@ pub struct ListPaymentsResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBalancesRequest {}
/// The response `content` for the `GetBalances` API, when HttpStatusCode is OK (200).
/// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetBalancesResponse {
Expand Down
29 changes: 28 additions & 1 deletion ldk-server-protos/src/proto/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import 'types.proto';
message GetNodeInfoRequest {
}

// The response `content` for the `GetNodeInfo` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message GetNodeInfoResponse {

// The hex-encoded `node-id` or public key for our own lightning node.
Expand Down Expand Up @@ -54,6 +56,8 @@ message GetNodeInfoResponse {
message OnchainReceiveRequest {
}

// The response `content` for the `OnchainReceive` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`..
message OnchainReceiveResponse {

// A Bitcoin on-chain address.
Expand Down Expand Up @@ -82,6 +86,8 @@ message OnchainSendRequest {
optional bool send_all = 3;
}

// The response `content` for the `OnchainSend` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message OnchainSendResponse {

// The transaction ID of the broadcasted transaction.
Expand All @@ -107,7 +113,8 @@ message Bolt11ReceiveRequest {
uint32 expiry_secs = 3;
}


// The response `content` for the `Bolt11Receive` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message Bolt11ReceiveResponse {

// An invoice for a payment within the Lightning Network.
Expand All @@ -130,6 +137,8 @@ message Bolt11SendRequest {

}

// The response `content` for the `Bolt11Send` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message Bolt11SendResponse {

// An identifier used to uniquely identify a payment.
Expand Down Expand Up @@ -157,6 +166,8 @@ message Bolt12ReceiveRequest {
optional uint64 quantity = 4;
}

// The response `content` for the `Bolt12Receive` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message Bolt12ReceiveResponse {

// An offer for a payment within the Lightning Network.
Expand Down Expand Up @@ -186,6 +197,8 @@ message Bolt12SendRequest {
optional string payer_note = 4;
}

// The response `content` for the `Bolt12Send` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message Bolt12SendResponse {

// An identifier used to uniquely identify a payment.
Expand Down Expand Up @@ -216,6 +229,8 @@ message OpenChannelRequest {
bool announce_channel = 6;
}

// The response `content` for the `OpenChannel` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message OpenChannelResponse {

// The channel id of the created channel that user can use to refer to channel.
Expand All @@ -236,6 +251,8 @@ message UpdateChannelConfigRequest {
types.ChannelConfig channel_config = 3;
}

// The response `content` for the `UpdateChannelConfig` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message UpdateChannelConfigResponse {
}

Expand All @@ -258,6 +275,8 @@ message CloseChannelRequest {
optional string force_close_reason = 4;
}

// The response `content` for the `CloseChannel` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message CloseChannelResponse {

}
Expand All @@ -266,6 +285,8 @@ message CloseChannelResponse {
// See more: https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.list_channels
message ListChannelsRequest {}

// The response `content` for the `ListChannels` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message ListChannelsResponse {

// List of channels.
Expand All @@ -279,6 +300,8 @@ message GetPaymentDetailsRequest {
string payment_id = 1;
}

// The response `content` for the `GetPaymentDetails` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message GetPaymentDetailsResponse {
// Represents a payment.
// Will be `None` if payment doesn't exist.
Expand All @@ -289,6 +312,8 @@ message GetPaymentDetailsResponse {
// See more: https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.list_payments
message ListPaymentsRequest {}

// The response `content` for the `ListPayments` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message ListPaymentsResponse {
// List of payments.
repeated types.Payment payments = 1;
Expand All @@ -298,6 +323,8 @@ message ListPaymentsResponse {
// See more: https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.list_balances
message GetBalancesRequest {}

// The response `content` for the `GetBalances` API, when HttpStatusCode is OK (200).
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
message GetBalancesResponse {
// The total balance of our on-chain wallet.
uint64 total_onchain_balance_sats = 1;
Expand Down

0 comments on commit eed8ba5

Please sign in to comment.