# HistoryApi

All URIs are relative to *http://localhost*

| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**list**](HistoryApi.md#list) | **GET** /api/v1/history | Get wallet history |
| [**updateMetadata**](HistoryApi.md#updatemetadata) | **POST** /api/v1/history/{id}/metadata | Patch movement metadata |



## list

> Array&lt;Movement&gt; list(type, value)

Get wallet history

Returns the history of wallet movements ordered from newest to oldest. A movement represents any wallet operation that affects VTXOs—an arkoor send or receive, Lightning send or receive, board, offboard, or refresh. Each entry records which VTXOs were consumed and produced, the effective balance change (if any), fees paid, and the operation status. Supplying the &#x60;type&#x60; and &#x60;value&#x60; query parameters (together) restricts the result to movements involving that single payment method, such as all payments sent to one address.

### Example

```ts
import {
  Configuration,
  HistoryApi,
} from '@secondts/barkd';
import type { ListRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new HistoryApi(config);

  const body = {
    // string | Payment method type tag to filter by, e.g. `ark`, `bitcoin`, `output-script`, `invoice`, `offer`, `lightning-address`, `lnurl` or `custom`. Must be supplied together with `value`. (optional)
    type: type_example,
    // string | Payment method value to filter by, e.g. the destination address or invoice. Must be supplied together with `type`. (optional)
    value: value_example,
  } satisfies ListRequest;

  try {
    const data = await api.list(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **type** | `string` | Payment method type tag to filter by, e.g. &#x60;ark&#x60;, &#x60;bitcoin&#x60;, &#x60;output-script&#x60;, &#x60;invoice&#x60;, &#x60;offer&#x60;, &#x60;lightning-address&#x60;, &#x60;lnurl&#x60; or &#x60;custom&#x60;. Must be supplied together with &#x60;value&#x60;. | [Optional] [Defaults to `undefined`] |
| **value** | `string` | Payment method value to filter by, e.g. the destination address or invoice. Must be supplied together with &#x60;type&#x60;. | [Optional] [Defaults to `undefined`] |

### Return type

[**Array&lt;Movement&gt;**](Movement.md)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

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


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Returns the wallet history |  -  |
| **400** | Bad request |  -  |
| **500** | Internal server error |  -  |

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


## updateMetadata

> updateMetadata(id, body)

Patch movement metadata

Applies an [RFC 7396](https://www.rfc-editor.org/rfc/rfc7396) JSON Merge Patch to a movement\&#39;s metadata. Use this to annotate history entries after the fact (e.g. refund notes, counterparty info). Keys set to &#x60;null&#x60; are removed; other values are recursively merged.

### Example

```ts
import {
  Configuration,
  HistoryApi,
} from '@secondts/barkd';
import type { UpdateMetadataRequest } from '@secondts/barkd';

async function example() {
  console.log("🚀 Testing @secondts/barkd SDK...");
  const config = new Configuration({ 
    // Configure HTTP bearer authorization: bearer
    accessToken: "YOUR BEARER TOKEN",
  });
  const api = new HistoryApi(config);

  const body = {
    // number | Movement identifier.
    id: 56,
    // any | RFC 7396 JSON Merge Patch. The body is applied directly to the movement\'s metadata object: any field with value `null` is removed, every other field is recursively merged.
    body: ...,
  } satisfies UpdateMetadataRequest;

  try {
    const data = await api.updateMetadata(body);
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description  | Notes |
|------------- | ------------- | ------------- | -------------|
| **id** | `number` | Movement identifier. | [Defaults to `undefined`] |
| **body** | `any` | RFC 7396 JSON Merge Patch. The body is applied directly to the movement\&#39;s metadata object: any field with value &#x60;null&#x60; is removed, every other field is recursively merged. | |

### Return type

`void` (Empty response body)

### Authorization

[bearer](../README.md#bearer)

### HTTP request headers

- **Content-Type**: `application/merge-patch+json`
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Metadata updated |  -  |
| **500** | Internal server error |  -  |

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

