Skip to content

Commit

Permalink
feat: Query By Recipient (#1125)
Browse files Browse the repository at this point in the history
* feat: get deposits by recipient.

* chore: Fix linter error

* add generated sources changes

* Change internal Emily code to use u16s instead of i32s

* fix linter complaint

* Fix test
  • Loading branch information
AshtonStephens authored Jan 14, 2025
1 parent 1774855 commit 2d1249e
Show file tree
Hide file tree
Showing 34 changed files with 1,344 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .generated-sources/emily/client/rust/private/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Class | Method | HTTP request | Description
*CorsApi* | [**chainstate_height_options**](docs/CorsApi.md#chainstate_height_options) | **OPTIONS** /chainstate/{height} | CORS support
*CorsApi* | [**chainstate_options**](docs/CorsApi.md#chainstate_options) | **OPTIONS** /chainstate | CORS support
*CorsApi* | [**deposit_options**](docs/CorsApi.md#deposit_options) | **OPTIONS** /deposit | CORS support
*CorsApi* | [**deposit_recipient_recipient_options**](docs/CorsApi.md#deposit_recipient_recipient_options) | **OPTIONS** /deposit/recipient/{recipient} | CORS support
*CorsApi* | [**deposit_txid_index_options**](docs/CorsApi.md#deposit_txid_index_options) | **OPTIONS** /deposit/{txid}/{index} | CORS support
*CorsApi* | [**deposit_txid_options**](docs/CorsApi.md#deposit_txid_options) | **OPTIONS** /deposit/{txid} | CORS support
*CorsApi* | [**health_options**](docs/CorsApi.md#health_options) | **OPTIONS** /health | CORS support
Expand All @@ -43,6 +44,7 @@ Class | Method | HTTP request | Description
*DepositApi* | [**create_deposit**](docs/DepositApi.md#create_deposit) | **POST** /deposit | Create deposit handler.
*DepositApi* | [**get_deposit**](docs/DepositApi.md#get_deposit) | **GET** /deposit/{txid}/{index} | Get deposit handler.
*DepositApi* | [**get_deposits**](docs/DepositApi.md#get_deposits) | **GET** /deposit | Get deposits handler.
*DepositApi* | [**get_deposits_for_recipient**](docs/DepositApi.md#get_deposits_for_recipient) | **GET** /deposit/recipient/{recipient} | Get deposits by recipient handler.
*DepositApi* | [**get_deposits_for_transaction**](docs/DepositApi.md#get_deposits_for_transaction) | **GET** /deposit/{txid} | Get deposits for transaction handler.
*DepositApi* | [**update_deposits**](docs/DepositApi.md#update_deposits) | **PUT** /deposit | Update deposits handler.
*HealthApi* | [**check_health**](docs/HealthApi.md#check_health) | **GET** /health | Get health handler.
Expand Down
31 changes: 31 additions & 0 deletions .generated-sources/emily/client/rust/private/docs/CorsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**chainstate_height_options**](CorsApi.md#chainstate_height_options) | **OPTIONS** /chainstate/{height} | CORS support
[**chainstate_options**](CorsApi.md#chainstate_options) | **OPTIONS** /chainstate | CORS support
[**deposit_options**](CorsApi.md#deposit_options) | **OPTIONS** /deposit | CORS support
[**deposit_recipient_recipient_options**](CorsApi.md#deposit_recipient_recipient_options) | **OPTIONS** /deposit/recipient/{recipient} | CORS support
[**deposit_txid_index_options**](CorsApi.md#deposit_txid_index_options) | **OPTIONS** /deposit/{txid}/{index} | CORS support
[**deposit_txid_options**](CorsApi.md#deposit_txid_options) | **OPTIONS** /deposit/{txid} | CORS support
[**health_options**](CorsApi.md#health_options) | **OPTIONS** /health | CORS support
Expand Down Expand Up @@ -101,6 +102,36 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## deposit_recipient_recipient_options

> deposit_recipient_recipient_options(recipient)
CORS support

Handles CORS preflight requests

### Parameters


Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**recipient** | **String** | the status to search by when getting all deposits. | [required] |

### Return type

(empty response body)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## deposit_txid_index_options

> deposit_txid_index_options(txid, index)
Expand Down
31 changes: 31 additions & 0 deletions .generated-sources/emily/client/rust/private/docs/DepositApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**create_deposit**](DepositApi.md#create_deposit) | **POST** /deposit | Create deposit handler.
[**get_deposit**](DepositApi.md#get_deposit) | **GET** /deposit/{txid}/{index} | Get deposit handler.
[**get_deposits**](DepositApi.md#get_deposits) | **GET** /deposit | Get deposits handler.
[**get_deposits_for_recipient**](DepositApi.md#get_deposits_for_recipient) | **GET** /deposit/recipient/{recipient} | Get deposits by recipient handler.
[**get_deposits_for_transaction**](DepositApi.md#get_deposits_for_transaction) | **GET** /deposit/{txid} | Get deposits for transaction handler.
[**update_deposits**](DepositApi.md#update_deposits) | **PUT** /deposit | Update deposits handler.

Expand Down Expand Up @@ -99,6 +100,36 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## get_deposits_for_recipient

> models::GetDepositsResponse get_deposits_for_recipient(recipient, next_token, page_size)
Get deposits by recipient handler.

### Parameters


Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**recipient** | **String** | the status to search by when getting all deposits. | [required] |
**next_token** | Option<**String**> | the next token value from the previous return of this api call. | |
**page_size** | Option<**i32**> | the maximum number of items in the response list. | |

### Return type

[**models::GetDepositsResponse**](GetDepositsResponse.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## get_deposits_for_transaction

> models::GetDepositsForTransactionResponse get_deposits_for_transaction(txid, next_token, page_size)
Expand Down
49 changes: 49 additions & 0 deletions .generated-sources/emily/client/rust/private/src/apis/cors_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ pub enum DepositOptionsError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`deposit_recipient_recipient_options`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DepositRecipientRecipientOptionsError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`deposit_txid_index_options`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -199,6 +206,48 @@ pub async fn deposit_options(
}
}

/// Handles CORS preflight requests
pub async fn deposit_recipient_recipient_options(
configuration: &configuration::Configuration,
recipient: &str,
) -> Result<(), Error<DepositRecipientRecipientOptionsError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/deposit/recipient/{recipient}",
local_var_configuration.base_path,
recipient = crate::apis::urlencode(recipient)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::OPTIONS, local_var_uri_str.as_str());

if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
Ok(())
} else {
let local_var_entity: Option<DepositRecipientRecipientOptionsError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

/// Handles CORS preflight requests
pub async fn deposit_txid_index_options(
configuration: &configuration::Configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ pub enum GetDepositsError {
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_deposits_for_recipient`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetDepositsForRecipientError {
Status400(models::ErrorResponse),
Status404(models::ErrorResponse),
Status405(models::ErrorResponse),
Status500(models::ErrorResponse),
UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_deposits_for_transaction`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
Expand Down Expand Up @@ -198,6 +209,57 @@ pub async fn get_deposits(
}
}

pub async fn get_deposits_for_recipient(
configuration: &configuration::Configuration,
recipient: &str,
next_token: Option<&str>,
page_size: Option<i32>,
) -> Result<models::GetDepositsResponse, Error<GetDepositsForRecipientError>> {
let local_var_configuration = configuration;

let local_var_client = &local_var_configuration.client;

let local_var_uri_str = format!(
"{}/deposit/recipient/{recipient}",
local_var_configuration.base_path,
recipient = crate::apis::urlencode(recipient)
);
let mut local_var_req_builder =
local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());

if let Some(ref local_var_str) = next_token {
local_var_req_builder =
local_var_req_builder.query(&[("nextToken", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = page_size {
local_var_req_builder =
local_var_req_builder.query(&[("pageSize", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder =
local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}

let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;

let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;

if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
serde_json::from_str(&local_var_content).map_err(Error::from)
} else {
let local_var_entity: Option<GetDepositsForRecipientError> =
serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent {
status: local_var_status,
content: local_var_content,
entity: local_var_entity,
};
Err(Error::ResponseError(local_var_error))
}
}

pub async fn get_deposits_for_transaction(
configuration: &configuration::Configuration,
txid: &str,
Expand Down
2 changes: 2 additions & 0 deletions .generated-sources/emily/client/rust/public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Class | Method | HTTP request | Description
*CorsApi* | [**chainstate_height_options**](docs/CorsApi.md#chainstate_height_options) | **OPTIONS** /chainstate/{height} | CORS support
*CorsApi* | [**chainstate_options**](docs/CorsApi.md#chainstate_options) | **OPTIONS** /chainstate | CORS support
*CorsApi* | [**deposit_options**](docs/CorsApi.md#deposit_options) | **OPTIONS** /deposit | CORS support
*CorsApi* | [**deposit_recipient_recipient_options**](docs/CorsApi.md#deposit_recipient_recipient_options) | **OPTIONS** /deposit/recipient/{recipient} | CORS support
*CorsApi* | [**deposit_txid_index_options**](docs/CorsApi.md#deposit_txid_index_options) | **OPTIONS** /deposit/{txid}/{index} | CORS support
*CorsApi* | [**deposit_txid_options**](docs/CorsApi.md#deposit_txid_options) | **OPTIONS** /deposit/{txid} | CORS support
*CorsApi* | [**health_options**](docs/CorsApi.md#health_options) | **OPTIONS** /health | CORS support
Expand All @@ -43,6 +44,7 @@ Class | Method | HTTP request | Description
*DepositApi* | [**create_deposit**](docs/DepositApi.md#create_deposit) | **POST** /deposit | Create deposit handler.
*DepositApi* | [**get_deposit**](docs/DepositApi.md#get_deposit) | **GET** /deposit/{txid}/{index} | Get deposit handler.
*DepositApi* | [**get_deposits**](docs/DepositApi.md#get_deposits) | **GET** /deposit | Get deposits handler.
*DepositApi* | [**get_deposits_for_recipient**](docs/DepositApi.md#get_deposits_for_recipient) | **GET** /deposit/recipient/{recipient} | Get deposits by recipient handler.
*DepositApi* | [**get_deposits_for_transaction**](docs/DepositApi.md#get_deposits_for_transaction) | **GET** /deposit/{txid} | Get deposits for transaction handler.
*DepositApi* | [**update_deposits**](docs/DepositApi.md#update_deposits) | **PUT** /deposit | Update deposits handler.
*HealthApi* | [**check_health**](docs/HealthApi.md#check_health) | **GET** /health | Get health handler.
Expand Down
31 changes: 31 additions & 0 deletions .generated-sources/emily/client/rust/public/docs/CorsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**chainstate_height_options**](CorsApi.md#chainstate_height_options) | **OPTIONS** /chainstate/{height} | CORS support
[**chainstate_options**](CorsApi.md#chainstate_options) | **OPTIONS** /chainstate | CORS support
[**deposit_options**](CorsApi.md#deposit_options) | **OPTIONS** /deposit | CORS support
[**deposit_recipient_recipient_options**](CorsApi.md#deposit_recipient_recipient_options) | **OPTIONS** /deposit/recipient/{recipient} | CORS support
[**deposit_txid_index_options**](CorsApi.md#deposit_txid_index_options) | **OPTIONS** /deposit/{txid}/{index} | CORS support
[**deposit_txid_options**](CorsApi.md#deposit_txid_options) | **OPTIONS** /deposit/{txid} | CORS support
[**health_options**](CorsApi.md#health_options) | **OPTIONS** /health | CORS support
Expand Down Expand Up @@ -102,6 +103,36 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## deposit_recipient_recipient_options

> deposit_recipient_recipient_options(recipient)
CORS support

Handles CORS preflight requests

### Parameters


Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**recipient** | **String** | the status to search by when getting all deposits. | [required] |

### Return type

(empty response body)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: Not defined

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## deposit_txid_index_options

> deposit_txid_index_options(txid, index)
Expand Down
31 changes: 31 additions & 0 deletions .generated-sources/emily/client/rust/public/docs/DepositApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Method | HTTP request | Description
[**create_deposit**](DepositApi.md#create_deposit) | **POST** /deposit | Create deposit handler.
[**get_deposit**](DepositApi.md#get_deposit) | **GET** /deposit/{txid}/{index} | Get deposit handler.
[**get_deposits**](DepositApi.md#get_deposits) | **GET** /deposit | Get deposits handler.
[**get_deposits_for_recipient**](DepositApi.md#get_deposits_for_recipient) | **GET** /deposit/recipient/{recipient} | Get deposits by recipient handler.
[**get_deposits_for_transaction**](DepositApi.md#get_deposits_for_transaction) | **GET** /deposit/{txid} | Get deposits for transaction handler.
[**update_deposits**](DepositApi.md#update_deposits) | **PUT** /deposit | Update deposits handler.

Expand Down Expand Up @@ -99,6 +100,36 @@ No authorization required
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## get_deposits_for_recipient

> models::GetDepositsResponse get_deposits_for_recipient(recipient, next_token, page_size)
Get deposits by recipient handler.

### Parameters


Name | Type | Description | Required | Notes
------------- | ------------- | ------------- | ------------- | -------------
**recipient** | **String** | the status to search by when getting all deposits. | [required] |
**next_token** | Option<**String**> | the next token value from the previous return of this api call. | |
**page_size** | Option<**i32**> | the maximum number of items in the response list. | |

### Return type

[**models::GetDepositsResponse**](GetDepositsResponse.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)


## get_deposits_for_transaction

> models::GetDepositsForTransactionResponse get_deposits_for_transaction(txid, next_token, page_size)
Expand Down
Loading

0 comments on commit 2d1249e

Please sign in to comment.