Help us shape the future of Go! Take the 2026 Go Developer Survey

dinariapisdk

package module
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

README

Dinari Go API Library

Go Reference

The Dinari Go library provides convenient access to the Dinari REST API from applications written in Go.

It is generated with Stainless.

Installation

import (
	"github.com/dinaricrypto/dinari-api-sdk-go" // imported as dinariapisdk
)

Or to pin the version:

go get -u 'github.com/dinaricrypto/dinari-api-sdk-go@v0.1.0-alpha.1'

Requirements

This library requires Go 1.18+.

Usage

The full API of this library can be found in api.md.

package main

import (
	"context"
	"fmt"

	"github.com/dinaricrypto/dinari-api-sdk-go"
	"github.com/dinaricrypto/dinari-api-sdk-go/option"
)

func main() {
	client := dinariapisdk.NewClient(
		option.WithAPIKey("My API Key"), // defaults to os.LookupEnv("DINARI_API_KEY")
	)
	response, err := client.API.V2.GetHealth(context.TODO())
	if err != nil {
		panic(err.Error())
	}
	fmt.Printf("%+v\n", response.Status)
}

Request fields

The dinariapisdk library uses the omitzero semantics from the Go 1.24+ encoding/json release for request fields.

Required primitive fields (int64, string, etc.) feature the tag `json:"...,required"`. These fields are always serialized, even their zero values.

Optional primitive types are wrapped in a param.Opt[T]. These fields can be set with the provided constructors, dinariapisdk.String(string), dinariapisdk.Int(int64), etc.

Any param.Opt[T], map, slice, struct or string enum uses the tag `json:"...,omitzero"`. Its zero value is considered omitted.

params := dinariapisdk.ExampleParams{
	ID:   "id_xxx",                   // required property
	Name: dinariapisdk.String("..."), // optional property

	Point: dinariapisdk.Point{
		X: 0,                   // required field will serialize as 0
		Y: dinariapisdk.Int(1), // optional field will serialize as 1
		// ... omitted non-required fields will not be serialized
	},

	Origin: dinariapisdk.Origin{}, // the zero value of [Origin] is considered omitted
}

To send null instead of a param.Opt[T], use param.NullOpt[T](). To send null instead of a struct T, use param.NullObj[T]().

params.Description = param.NullOpt[string]() // explicit null string property
params.Point = param.NullObj[Point]()        // explicit null struct property

Request structs contain a .WithExtraFields(map[string]any) method which can send non-conforming fields in the request body. Extra fields overwrite any struct fields with a matching key. For security reasons, only use WithExtraFields with trusted data.

To send a custom value instead of a struct, use param.OverrideObj[T](value).

// In cases where the API specifies a given type,
// but you want to send something else, use [WithExtraFields]:
params.WithExtraFields(map[string]any{
	"x": 0.01, // send "x" as a float instead of int
})

// Send a number instead of an object
custom := param.OverrideObj[dinariapisdk.FooParams](12)

When available, use the .IsPresent() method to check if an optional parameter is not omitted or null. The param.IsOmitted(any) function can confirm the presence of any omitzero field.

Request unions

Unions are represented as a struct with fields prefixed by "Of" for each of it's variants, only one field can be non-zero. The non-zero field will be serialized.

Sub-properties of the union can be accessed via methods on the union struct. These methods return a mutable pointer to the underlying data, if present.

// Only one field can be non-zero, use param.IsOmitted() to check if a field is set
type AnimalUnionParam struct {
	OfCat *Cat `json:",omitzero,inline`
	OfDog *Dog `json:",omitzero,inline`
}

animal := AnimalUnionParam{
	OfCat: &Cat{
		Name: "Whiskers",
		Owner: PersonParam{
			Address: AddressParam{Street: "3333 Coyote Hill Rd", Zip: 0},
		},
	},
}

// Mutating a field
if address := animal.GetOwner().GetAddress(); address != nil {
	address.ZipCode = 94304
}
Response objects

All fields in response structs are ordinary value types (not pointers or wrappers). Response structs also include a special JSON field containing metadata about each property.

type Animal struct {
	Name   string `json:"name,nullable"`
	Owners int    `json:"owners"`
	Age    int    `json:"age"`
	JSON   struct {
		Name        resp.Field
		Owner       resp.Field
		Age         resp.Field
		ExtraFields map[string]resp.Field
	} `json:"-"`
}

To handle optional data, use the IsPresent() method on the JSON field. If a field is null, not present, or invalid, the corresponding field will simply be its zero value.

raw := `{"owners": 1, "name": null}`

var res Animal
json.Unmarshal([]byte(raw), &res)

// Use the IsPresent() method to handle optional fields
res.Owners                  // 1
res.JSON.Owners.IsPresent() // true
res.JSON.Owners.Raw()       // "1"

res.Age                  // 0
res.JSON.Age.IsPresent() // false
res.JSON.Age.Raw()       // ""

// Use the IsExplicitNull() method to differentiate null and omitted
res.Name                       // ""
res.JSON.Name.IsPresent()      // false
res.JSON.Name.Raw()            // "null"
res.JSON.Name.IsExplicitNull() // true

These .JSON structs also include an ExtraFields map containing any properties in the json response that were not specified in the struct. This can be useful for API features not yet present in the SDK.

body := res.JSON.ExtraFields["my_unexpected_field"].Raw()
Response Unions

In responses, unions are represented by a flattened struct containing all possible fields from each of the object variants. To convert it to a variant use the .AsFooVariant() method or the .AsAny() method if present.

If a response value union contains primitive values, primitive fields will be alongside the properties but prefixed with Of and feature the tag json:"...,inline".

type AnimalUnion struct {
	// From variants [Dog], [Cat]
	Owner Person `json:"owner"`
	// From variant [Dog]
	DogBreed string `json:"dog_breed"`
	// From variant [Cat]
	CatBreed string `json:"cat_breed"`
	// ...
	JSON struct {
		Owner resp.Field
		// ...
	} `json:"-"`
}

// If animal variant
if animal.Owner.Address.ZipCode == "" {
	panic("missing zip code")
}

// Switch on the variant
switch variant := animal.AsAny().(type) {
case Dog:
case Cat:
default:
	panic("unexpected type")
}
RequestOptions

This library uses the functional options pattern. Functions defined in the option package return a RequestOption, which is a closure that mutates a RequestConfig. These options can be supplied to the client or at individual requests. For example:

client := dinariapisdk.NewClient(
	// Adds a header to every request made by the client
	option.WithHeader("X-Some-Header", "custom_header_info"),
)

client.API.V2.GetHealth(context.TODO(), ...,
	// Override the header
	option.WithHeader("X-Some-Header", "some_other_custom_header_info"),
	// Add an undocumented field to the request body, using sjson syntax
	option.WithJSONSet("some.json.path", map[string]string{"my": "object"}),
)

See the full list of request options.

Pagination

This library provides some conveniences for working with paginated list endpoints.

You can use .ListAutoPaging() methods to iterate through items across all pages:

Or you can use simple .List() methods to fetch a single page and receive a standard response object with additional helper methods like .GetNextPage(), e.g.:

Errors

When the API returns a non-success status code, we return an error with type *dinariapisdk.Error. This contains the StatusCode, *http.Request, and *http.Response values of the request, as well as the JSON of the error body (much like other response objects in the SDK).

To handle errors, we recommend that you use the errors.As pattern:

_, err := client.API.V2.GetHealth(context.TODO())
if err != nil {
	var apierr *dinariapisdk.Error
	if errors.As(err, &apierr) {
		println(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request
		println(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response
	}
	panic(err.Error()) // GET "/api/v2/_health/": 400 Bad Request { ... }
}

When other errors occur, they are returned unwrapped; for example, if HTTP transport fails, you might receive *url.Error wrapping *net.OpError.

Timeouts

Requests do not time out by default; use context to configure a timeout for a request lifecycle.

Note that if a request is retried, the context timeout does not start over. To set a per-retry timeout, use option.WithRequestTimeout().

// This sets the timeout for the request, including all the retries.
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
defer cancel()
client.API.V2.GetHealth(
	ctx,
	// This sets the per-retry timeout
	option.WithRequestTimeout(20*time.Second),
)
File uploads

Request parameters that correspond to file uploads in multipart requests are typed as io.Reader. The contents of the io.Reader will by default be sent as a multipart form part with the file name of "anonymous_file" and content-type of "application/octet-stream".

The file name and content-type can be customized by implementing Name() string or ContentType() string on the run-time type of io.Reader. Note that os.File implements Name() string, so a file returned by os.Open will be sent with the file name on disk.

We also provide a helper dinariapisdk.File(reader io.Reader, filename string, contentType string) which can be used to wrap any io.Reader with the appropriate file name and content type.

Retries

Certain errors will be automatically retried 2 times by default, with a short exponential backoff. We retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit, and >=500 Internal errors.

You can use the WithMaxRetries option to configure or disable this:

// Configure the default for all requests:
client := dinariapisdk.NewClient(
	option.WithMaxRetries(0), // default is 2
)

// Override per-request:
client.API.V2.GetHealth(context.TODO(), option.WithMaxRetries(5))
Accessing raw response data (e.g. response headers)

You can access the raw HTTP response data by using the option.WithResponseInto() request option. This is useful when you need to examine response headers, status codes, or other details.

// Create a variable to store the HTTP response
var response *http.Response
response, err := client.API.V2.GetHealth(context.TODO(), option.WithResponseInto(&response))
if err != nil {
	// handle error
}
fmt.Printf("%+v\n", response)

fmt.Printf("Status Code: %d\n", response.StatusCode)
fmt.Printf("Headers: %+#v\n", response.Header)
Making custom/undocumented requests

This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.

Undocumented endpoints

To make requests to undocumented endpoints, you can use client.Get, client.Post, and other HTTP verbs. RequestOptions on the client, such as retries, will be respected when making these requests.

var (
    // params can be an io.Reader, a []byte, an encoding/json serializable object,
    // or a "…Params" struct defined in this library.
    params map[string]any

    // result can be an []byte, *http.Response, a encoding/json deserializable object,
    // or a model defined in this library.
    result *http.Response
)
err := client.Post(context.Background(), "/unspecified", params, &result)
if err != nil {
    …
}
Undocumented request params

To make requests using undocumented parameters, you may use either the option.WithQuerySet() or the option.WithJSONSet() methods.

params := FooNewParams{
    ID:   "id_xxxx",
    Data: FooNewParamsData{
        FirstName: dinariapisdk.String("John"),
    },
}
client.Foo.New(context.Background(), params, option.WithJSONSet("data.last_name", "Doe"))
Undocumented response properties

To access undocumented response properties, you may either access the raw JSON of the response as a string with result.JSON.RawJSON(), or get the raw JSON of a particular field on the result with result.JSON.Foo.Raw().

Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.

Middleware

We provide option.WithMiddleware which applies the given middleware to requests.

func Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {
	// Before the request
	start := time.Now()
	LogReq(req)

	// Forward the request to the next handler
	res, err = next(req)

	// Handle stuff after the request
	end := time.Now()
	LogRes(res, err, start - end)

    return res, err
}

client := dinariapisdk.NewClient(
	option.WithMiddleware(Logger),
)

When multiple middlewares are provided as variadic arguments, the middlewares are applied left to right. If option.WithMiddleware is given multiple times, for example first in the client then the method, the middleware in the client will run first and the middleware given in the method will run next.

You may also replace the default http.Client with option.WithHTTPClient(client). Only one http client is accepted (this overwrites any previous client) and receives requests after any middleware has been applied.

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Contributing

See the contributing documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b bool) param.Opt[bool]

func BoolPtr

func BoolPtr(v bool) *bool

func DefaultClientOptions

func DefaultClientOptions() []option.RequestOption

DefaultClientOptions read from the environment (DINARI_API_KEY, DINARI_BASE_URL). This should be used to initialize new clients.

func File

func File(rdr io.Reader, filename string, contentType string) file

func Float

func Float(f float64) param.Opt[float64]

func FloatPtr

func FloatPtr(v float64) *float64

func Int

func Int(i int64) param.Opt[int64]

func IntPtr

func IntPtr(v int64) *int64

func Opt

func Opt[T comparable](v T) param.Opt[T]

func Ptr

func Ptr[T any](v T) *T

func String

func String(s string) param.Opt[string]

func StringPtr

func StringPtr(v string) *string

func Time

func Time(t time.Time) param.Opt[time.Time]

func TimePtr

func TimePtr(v time.Time) *time.Time

Types

type APIService

type APIService struct {
	Options []option.RequestOption
	V2      APIV2Service
}

APIService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIService method instead.

func NewAPIService

func NewAPIService(opts ...option.RequestOption) (r APIService)

NewAPIService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

type APIV2AccountOrderFulfillmentService

type APIV2AccountOrderFulfillmentService struct {
	Options []option.RequestOption
}

APIV2AccountOrderFulfillmentService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2AccountOrderFulfillmentService method instead.

func NewAPIV2AccountOrderFulfillmentService

func NewAPIV2AccountOrderFulfillmentService(opts ...option.RequestOption) (r APIV2AccountOrderFulfillmentService)

NewAPIV2AccountOrderFulfillmentService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2AccountOrderFulfillmentService) Get

func (r *APIV2AccountOrderFulfillmentService) Get(ctx context.Context, accountID string, fulfillmentID string, opts ...option.RequestOption) (res *OrderFulfillment, err error)

Retrieves details of a specific order fulfillment by its ID.

func (*APIV2AccountOrderFulfillmentService) Query

func (r *APIV2AccountOrderFulfillmentService) Query(ctx context.Context, accountID string, opts ...option.RequestOption) (res *[]OrderFulfillment, err error)

Queries all order fulfillments under the account.

type APIV2AccountOrderGetEstimatedFeeParams

type APIV2AccountOrderGetEstimatedFeeParams struct {
	// Chain where the order is placed
	ChainID int64 `json:"chain_id,required"`
	// Order contract address
	ContractAddress string `json:"contract_address,required" format:"eth_address"`
	// Order data from which to calculate the fees. To be specified in the future
	OrderData map[string]string `json:"order_data,omitzero,required"`
	// contains filtered or unexported fields
}

func (APIV2AccountOrderGetEstimatedFeeParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2AccountOrderGetEstimatedFeeParams) MarshalJSON

func (r APIV2AccountOrderGetEstimatedFeeParams) MarshalJSON() (data []byte, err error)

type APIV2AccountOrderRequestNewLimitBuyParams

type APIV2AccountOrderRequestNewLimitBuyParams struct {
	// Input parameters for placing a limit order.
	LimitOrderRequestInput LimitOrderRequestInputParam
	// contains filtered or unexported fields
}

func (APIV2AccountOrderRequestNewLimitBuyParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2AccountOrderRequestNewLimitBuyParams) MarshalJSON

func (r APIV2AccountOrderRequestNewLimitBuyParams) MarshalJSON() (data []byte, err error)

type APIV2AccountOrderRequestNewLimitSellParams

type APIV2AccountOrderRequestNewLimitSellParams struct {
	// Input parameters for placing a limit order.
	LimitOrderRequestInput LimitOrderRequestInputParam
	// contains filtered or unexported fields
}

func (APIV2AccountOrderRequestNewLimitSellParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2AccountOrderRequestNewLimitSellParams) MarshalJSON

func (r APIV2AccountOrderRequestNewLimitSellParams) MarshalJSON() (data []byte, err error)

type APIV2AccountOrderRequestNewMarketBuyParams

type APIV2AccountOrderRequestNewMarketBuyParams struct {
	// Amount of USD to pay or receive for the order. Must be a positive number with a
	// precision of up to 2 decimal places.
	PaymentAmount float64 `json:"payment_amount,required"`
	// ID of stock, as returned by the `/stocks` endpoint, e.g. 1
	StockID string `json:"stock_id,required" format:"bigint"`
	// Whether to include fees in the `payment_amount` input field.
	IncludeFees param.Opt[bool] `json:"include_fees,omitzero"`
	// contains filtered or unexported fields
}

func (APIV2AccountOrderRequestNewMarketBuyParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2AccountOrderRequestNewMarketBuyParams) MarshalJSON

func (r APIV2AccountOrderRequestNewMarketBuyParams) MarshalJSON() (data []byte, err error)

type APIV2AccountOrderRequestNewMarketSellParams

type APIV2AccountOrderRequestNewMarketSellParams struct {
	// Quantity of stock to trade. Must be a positive number with a precision of up to
	// 9 decimal places.
	AssetQuantity float64 `json:"asset_quantity,required"`
	// ID of stock, as returned by the `/stocks` endpoint, e.g. 1
	StockID string `json:"stock_id,required" format:"bigint"`
	// contains filtered or unexported fields
}

func (APIV2AccountOrderRequestNewMarketSellParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2AccountOrderRequestNewMarketSellParams) MarshalJSON

func (r APIV2AccountOrderRequestNewMarketSellParams) MarshalJSON() (data []byte, err error)

type APIV2AccountOrderRequestService

type APIV2AccountOrderRequestService struct {
	Options []option.RequestOption
}

APIV2AccountOrderRequestService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2AccountOrderRequestService method instead.

func NewAPIV2AccountOrderRequestService

func NewAPIV2AccountOrderRequestService(opts ...option.RequestOption) (r APIV2AccountOrderRequestService)

NewAPIV2AccountOrderRequestService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2AccountOrderRequestService) Get

func (r *APIV2AccountOrderRequestService) Get(ctx context.Context, accountID string, requestID string, opts ...option.RequestOption) (res *OrderRequest, err error)

Retrieves details of a specific managed order request by its ID.

func (*APIV2AccountOrderRequestService) List

func (r *APIV2AccountOrderRequestService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *[]OrderRequest, err error)

Lists managed order requests.

func (*APIV2AccountOrderRequestService) NewLimitBuy

Creates a managed limit buy request.

func (*APIV2AccountOrderRequestService) NewLimitSell

Creates a managed limit sell request.

func (*APIV2AccountOrderRequestService) NewMarketBuy

Creates a managed market buy request.

func (*APIV2AccountOrderRequestService) NewMarketSell

Creates a managed market sell request.

type APIV2AccountOrderService

type APIV2AccountOrderService struct {
	Options []option.RequestOption
}

APIV2AccountOrderService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2AccountOrderService method instead.

func NewAPIV2AccountOrderService

func NewAPIV2AccountOrderService(opts ...option.RequestOption) (r APIV2AccountOrderService)

NewAPIV2AccountOrderService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2AccountOrderService) Cancel

func (r *APIV2AccountOrderService) Cancel(ctx context.Context, accountID string, orderID string, opts ...option.RequestOption) (res *Order, err error)

Cancels an order by its ID. Note that this requires the order ID, not the order request ID.

func (*APIV2AccountOrderService) Get

func (r *APIV2AccountOrderService) Get(ctx context.Context, accountID string, orderID string, opts ...option.RequestOption) (res *Order, err error)

Retrieves details of a specific order by its ID.

func (*APIV2AccountOrderService) GetEstimatedFee

Gets estimated fee data for an order to be placed directly through our contracts.

func (*APIV2AccountOrderService) GetFulfillments

func (r *APIV2AccountOrderService) GetFulfillments(ctx context.Context, accountID string, orderID string, opts ...option.RequestOption) (res *[]OrderFulfillment, err error)

Retrieves order fulfillments for a specific order.

func (*APIV2AccountOrderService) List

func (r *APIV2AccountOrderService) List(ctx context.Context, accountID string, opts ...option.RequestOption) (res *[]Order, err error)

Lists all orders under the account.

type APIV2AccountService

type APIV2AccountService struct {
	Options           []option.RequestOption
	Wallet            APIV2AccountWalletService
	Orders            APIV2AccountOrderService
	OrderFulfillments APIV2AccountOrderFulfillmentService
	OrderRequests     APIV2AccountOrderRequestService
}

APIV2AccountService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2AccountService method instead.

func NewAPIV2AccountService

func NewAPIV2AccountService(opts ...option.RequestOption) (r APIV2AccountService)

NewAPIV2AccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2AccountService) Deactivate

func (r *APIV2AccountService) Deactivate(ctx context.Context, accountID string, opts ...option.RequestOption) (res *Account, err error)

Sets the account to be inactive.

func (*APIV2AccountService) Get

func (r *APIV2AccountService) Get(ctx context.Context, accountID string, opts ...option.RequestOption) (res *Account, err error)

Retrieves a specific account by its ID.

func (*APIV2AccountService) GetCash

func (r *APIV2AccountService) GetCash(ctx context.Context, accountID string, opts ...option.RequestOption) (res *Apiv2AccountGetCashResponse, err error)

Retrieves the cash amount in the account.

func (*APIV2AccountService) GetDividendPayments

func (r *APIV2AccountService) GetDividendPayments(ctx context.Context, accountID string, opts ...option.RequestOption) (res *[]Apiv2AccountGetDividendPaymentsResponse, err error)

Retrieves dividend payments made to the account.

func (*APIV2AccountService) GetInterestPayments

func (r *APIV2AccountService) GetInterestPayments(ctx context.Context, accountID string, opts ...option.RequestOption) (res *[]Apiv2AccountGetInterestPaymentsResponse, err error)

Retrieves interest payments made to the account.

func (*APIV2AccountService) GetPortfolio

func (r *APIV2AccountService) GetPortfolio(ctx context.Context, accountID string, opts ...option.RequestOption) (res *Apiv2AccountGetPortfolioResponse, err error)

Retrieves the portfolio of the account, sans cash equivalents.

type APIV2AccountWalletExternalConnectParams

type APIV2AccountWalletExternalConnectParams struct {
	// Blockchain the wallet to link is on
	ChainID int64 `json:"chain_id,required"`
	// Nonce used to sign the wallet connection message
	Nonce string `json:"nonce,required" format:"uuid"`
	// Signature payload from signing the wallet connection message with the wallet
	Signature string `json:"signature,required" format:"hex_string"`
	// Address of the wallet
	WalletAddress string `json:"wallet_address,required" format:"eth_address"`
	// contains filtered or unexported fields
}

func (APIV2AccountWalletExternalConnectParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2AccountWalletExternalConnectParams) MarshalJSON

func (r APIV2AccountWalletExternalConnectParams) MarshalJSON() (data []byte, err error)

type APIV2AccountWalletExternalGetNonceParams

type APIV2AccountWalletExternalGetNonceParams struct {
	// Address of the wallet to connect
	WalletAddress string `query:"wallet_address,required" format:"eth_address" json:"-"`
	// contains filtered or unexported fields
}

func (APIV2AccountWalletExternalGetNonceParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2AccountWalletExternalGetNonceParams) URLQuery

URLQuery serializes APIV2AccountWalletExternalGetNonceParams's query parameters as `url.Values`.

type APIV2AccountWalletExternalService

type APIV2AccountWalletExternalService struct {
	Options []option.RequestOption
}

APIV2AccountWalletExternalService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2AccountWalletExternalService method instead.

func NewAPIV2AccountWalletExternalService

func NewAPIV2AccountWalletExternalService(opts ...option.RequestOption) (r APIV2AccountWalletExternalService)

NewAPIV2AccountWalletExternalService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2AccountWalletExternalService) Connect

Connects a wallet to the account using the nonce and signature

func (*APIV2AccountWalletExternalService) GetNonce

Gets a nonce and message to be signed in order to verify wallet ownership.

type APIV2AccountWalletService

type APIV2AccountWalletService struct {
	Options  []option.RequestOption
	External APIV2AccountWalletExternalService
}

APIV2AccountWalletService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2AccountWalletService method instead.

func NewAPIV2AccountWalletService

func NewAPIV2AccountWalletService(opts ...option.RequestOption) (r APIV2AccountWalletService)

NewAPIV2AccountWalletService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2AccountWalletService) Get

func (r *APIV2AccountWalletService) Get(ctx context.Context, accountID string, opts ...option.RequestOption) (res *Wallet, err error)

Retrieves details of the wallet connected to the account.

type APIV2EntityAccountListParams

type APIV2EntityAccountListParams struct {
	Page     param.Opt[int64] `query:"page,omitzero" json:"-"`
	PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (APIV2EntityAccountListParams) IsPresent

func (f APIV2EntityAccountListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2EntityAccountListParams) URLQuery

func (r APIV2EntityAccountListParams) URLQuery() (v url.Values, err error)

URLQuery serializes APIV2EntityAccountListParams's query parameters as `url.Values`.

type APIV2EntityAccountService

type APIV2EntityAccountService struct {
	Options []option.RequestOption
}

APIV2EntityAccountService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2EntityAccountService method instead.

func NewAPIV2EntityAccountService

func NewAPIV2EntityAccountService(opts ...option.RequestOption) (r APIV2EntityAccountService)

NewAPIV2EntityAccountService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2EntityAccountService) List

func (r *APIV2EntityAccountService) List(ctx context.Context, entityID string, query APIV2EntityAccountListParams, opts ...option.RequestOption) (res *[]Account, err error)

Retrieves a list of Accounts that belong to a specific Entity.

func (*APIV2EntityAccountService) New

func (r *APIV2EntityAccountService) New(ctx context.Context, entityID string, opts ...option.RequestOption) (res *Account, err error)

Creates a new Account for the given Entity.

type APIV2EntityKYCService

type APIV2EntityKYCService struct {
	Options []option.RequestOption
}

APIV2EntityKYCService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2EntityKYCService method instead.

func NewAPIV2EntityKYCService

func NewAPIV2EntityKYCService(opts ...option.RequestOption) (r APIV2EntityKYCService)

NewAPIV2EntityKYCService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2EntityKYCService) Get

func (r *APIV2EntityKYCService) Get(ctx context.Context, entityID string, opts ...option.RequestOption) (res *KYCInfo, err error)

Retrieves KYC data of the entity.

func (*APIV2EntityKYCService) GetURL

func (r *APIV2EntityKYCService) GetURL(ctx context.Context, entityID string, opts ...option.RequestOption) (res *Apiv2EntityKYCGetURLResponse, err error)

Gets an iframe URL for managed (self-service) KYC.

func (*APIV2EntityKYCService) Submit

func (r *APIV2EntityKYCService) Submit(ctx context.Context, entityID string, body APIV2EntityKYCSubmitParams, opts ...option.RequestOption) (res *KYCInfo, err error)

Submits KYC data manually (for Partner KYC-enabled entities).

func (*APIV2EntityKYCService) UploadDocument

Uploads KYC-related documentation (for Partner KYC-enabled entities).

type APIV2EntityKYCSubmitParams

type APIV2EntityKYCSubmitParams struct {
	// Object consisting of KYC data for an entity
	Data KYCDataParam `json:"data,omitzero,required"`
	// Name of the KYC provider that provided the KYC information
	ProviderName string `json:"provider_name,required"`
	// contains filtered or unexported fields
}

func (APIV2EntityKYCSubmitParams) IsPresent

func (f APIV2EntityKYCSubmitParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2EntityKYCSubmitParams) MarshalJSON

func (r APIV2EntityKYCSubmitParams) MarshalJSON() (data []byte, err error)

type APIV2EntityKYCUploadDocumentParams

type APIV2EntityKYCUploadDocumentParams struct {
	// Type of the document to be uploaded
	//
	// Any of "GOVERNMENT_ID", "SELFIE", "RESIDENCY", "UNKNOWN".
	DocumentType KYCDocumentType `json:"document_type,omitzero,required"`
	// contains filtered or unexported fields
}

func (APIV2EntityKYCUploadDocumentParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2EntityKYCUploadDocumentParams) MarshalJSON

func (r APIV2EntityKYCUploadDocumentParams) MarshalJSON() (data []byte, err error)

type APIV2EntityNewParams

type APIV2EntityNewParams struct {
	// Name of the entity
	Name string `json:"name,required"`
	// contains filtered or unexported fields
}

func (APIV2EntityNewParams) IsPresent

func (f APIV2EntityNewParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2EntityNewParams) MarshalJSON

func (r APIV2EntityNewParams) MarshalJSON() (data []byte, err error)

type APIV2EntityService

type APIV2EntityService struct {
	Options  []option.RequestOption
	Accounts APIV2EntityAccountService
	KYC      APIV2EntityKYCService
}

APIV2EntityService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2EntityService method instead.

func NewAPIV2EntityService

func NewAPIV2EntityService(opts ...option.RequestOption) (r APIV2EntityService)

NewAPIV2EntityService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2EntityService) Get

func (r *APIV2EntityService) Get(ctx context.Context, entityID string, opts ...option.RequestOption) (res *Entity, err error)

Retrieves a specific customer Entity of your organization by their ID.

func (*APIV2EntityService) GetCurrent

func (r *APIV2EntityService) GetCurrent(ctx context.Context, opts ...option.RequestOption) (res *Entity, err error)

Returns the current authenticated Entity.

func (*APIV2EntityService) List

func (r *APIV2EntityService) List(ctx context.Context, opts ...option.RequestOption) (res *[]Entity, err error)

Returns a list of all direct Entities your organization manages. An Entity represents an individual customer of your organization.

func (*APIV2EntityService) New

func (r *APIV2EntityService) New(ctx context.Context, body APIV2EntityNewParams, opts ...option.RequestOption) (res *Entity, err error)

Creates a new Entity to be managed by your organization. The Entity represents an individual customer of your organization.

type APIV2MarketDataService

type APIV2MarketDataService struct {
	Options []option.RequestOption
	Stocks  APIV2MarketDataStockService
}

APIV2MarketDataService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2MarketDataService method instead.

func NewAPIV2MarketDataService

func NewAPIV2MarketDataService(opts ...option.RequestOption) (r APIV2MarketDataService)

NewAPIV2MarketDataService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2MarketDataService) GetMarketHours

Returns an object containing the market hours for the current day and next open trading day.

type APIV2MarketDataStockGetHistoricalPricesParams

type APIV2MarketDataStockGetHistoricalPricesParams struct {
	// The timespan of the historical prices to query.
	//
	// Any of "DAY", "WEEK", "MONTH", "YEAR".
	Timespan APIV2MarketDataStockGetHistoricalPricesParamsTimespan `query:"timespan,omitzero,required" json:"-"`
	// contains filtered or unexported fields
}

func (APIV2MarketDataStockGetHistoricalPricesParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2MarketDataStockGetHistoricalPricesParams) URLQuery

URLQuery serializes APIV2MarketDataStockGetHistoricalPricesParams's query parameters as `url.Values`.

type APIV2MarketDataStockGetHistoricalPricesParamsTimespan

type APIV2MarketDataStockGetHistoricalPricesParamsTimespan string

The timespan of the historical prices to query.

const (
	APIV2MarketDataStockGetHistoricalPricesParamsTimespanDay   APIV2MarketDataStockGetHistoricalPricesParamsTimespan = "DAY"
	APIV2MarketDataStockGetHistoricalPricesParamsTimespanWeek  APIV2MarketDataStockGetHistoricalPricesParamsTimespan = "WEEK"
	APIV2MarketDataStockGetHistoricalPricesParamsTimespanMonth APIV2MarketDataStockGetHistoricalPricesParamsTimespan = "MONTH"
	APIV2MarketDataStockGetHistoricalPricesParamsTimespanYear  APIV2MarketDataStockGetHistoricalPricesParamsTimespan = "YEAR"
)

type APIV2MarketDataStockGetNewsParams

type APIV2MarketDataStockGetNewsParams struct {
	// The number of news articles to return, default is 10 max is 25
	Limit param.Opt[int64] `query:"limit,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (APIV2MarketDataStockGetNewsParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2MarketDataStockGetNewsParams) URLQuery

func (r APIV2MarketDataStockGetNewsParams) URLQuery() (v url.Values, err error)

URLQuery serializes APIV2MarketDataStockGetNewsParams's query parameters as `url.Values`.

type APIV2MarketDataStockListParams

type APIV2MarketDataStockListParams struct {
	Page     param.Opt[int64] `query:"page,omitzero" json:"-"`
	PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// List of stock symbols to query. If not provided, all stocks are returned.
	Symbols []string `query:"symbols,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (APIV2MarketDataStockListParams) IsPresent

func (f APIV2MarketDataStockListParams) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2MarketDataStockListParams) URLQuery

func (r APIV2MarketDataStockListParams) URLQuery() (v url.Values, err error)

URLQuery serializes APIV2MarketDataStockListParams's query parameters as `url.Values`.

type APIV2MarketDataStockService

type APIV2MarketDataStockService struct {
	Options []option.RequestOption
	Splits  APIV2MarketDataStockSplitService
}

APIV2MarketDataStockService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2MarketDataStockService method instead.

func NewAPIV2MarketDataStockService

func NewAPIV2MarketDataStockService(opts ...option.RequestOption) (r APIV2MarketDataStockService)

NewAPIV2MarketDataStockService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2MarketDataStockService) GetDividends

Returns a list of announced stock dividend details for a specified stock. Note that this data applies only to actual stocks. Yield received for holding dShares may differ from this.

func (*APIV2MarketDataStockService) GetHistoricalPrices

Returns a list of historical prices for a specified stock. Each index in the array represents a single tick in a price chart.

func (*APIV2MarketDataStockService) GetNews

Get the most recent news articles relating to a stock, including a summary of the article and a link to the original source

func (*APIV2MarketDataStockService) GetQuote

Returns a stock quote for a specified stock.

func (*APIV2MarketDataStockService) List

Returns a list of stocks available for trading.

type APIV2MarketDataStockSplitGetParams

type APIV2MarketDataStockSplitGetParams struct {
	Page     param.Opt[int64] `query:"page,omitzero" json:"-"`
	PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (APIV2MarketDataStockSplitGetParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2MarketDataStockSplitGetParams) URLQuery

func (r APIV2MarketDataStockSplitGetParams) URLQuery() (v url.Values, err error)

URLQuery serializes APIV2MarketDataStockSplitGetParams's query parameters as `url.Values`.

type APIV2MarketDataStockSplitListParams

type APIV2MarketDataStockSplitListParams struct {
	Page     param.Opt[int64] `query:"page,omitzero" json:"-"`
	PageSize param.Opt[int64] `query:"page_size,omitzero" json:"-"`
	// contains filtered or unexported fields
}

func (APIV2MarketDataStockSplitListParams) IsPresent

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (APIV2MarketDataStockSplitListParams) URLQuery

func (r APIV2MarketDataStockSplitListParams) URLQuery() (v url.Values, err error)

URLQuery serializes APIV2MarketDataStockSplitListParams's query parameters as `url.Values`.

type APIV2MarketDataStockSplitService

type APIV2MarketDataStockSplitService struct {
	Options []option.RequestOption
}

APIV2MarketDataStockSplitService contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2MarketDataStockSplitService method instead.

func NewAPIV2MarketDataStockSplitService

func NewAPIV2MarketDataStockSplitService(opts ...option.RequestOption) (r APIV2MarketDataStockSplitService)

NewAPIV2MarketDataStockSplitService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2MarketDataStockSplitService) Get

Returns a list of stock splits for a given stock id. The splits are ordered by the date they were created, with the most recent split first.

In an example 10-for-1 stock split, trading will be halted for the stock at the end of the `payable_date`, as the split transitions from `PENDING` to `IN_PROGRESS`. This usually occurs over a weekend to minimize trading disruptions. Each share of stock owned by a shareholder will then be converted into 10 shares, and the split becomes `COMPLETE` as trading resumes on the `ex_date` with new split-adjusted prices.

func (*APIV2MarketDataStockSplitService) List

Returns a list of stock splits. The splits are ordered by the date they were created, with the most recent split first.

In an example 10-for-1 stock split, trading will be halted for the stock at the end of the `payable_date`, as the split transitions from `PENDING` to `IN_PROGRESS`. This usually occurs over a weekend to minimize trading disruptions. Each share of stock owned by a shareholder will then be converted into 10 shares, and the split becomes `COMPLETE` as trading resumes on the `ex_date` with new split-adjusted prices.

type APIV2Service

type APIV2Service struct {
	Options    []option.RequestOption
	MarketData APIV2MarketDataService
	Entities   APIV2EntityService
	Accounts   APIV2AccountService
}

APIV2Service contains methods and other services that help with interacting with the dinari API.

Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewAPIV2Service method instead.

func NewAPIV2Service

func NewAPIV2Service(opts ...option.RequestOption) (r APIV2Service)

NewAPIV2Service generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.

func (*APIV2Service) GetHealth

func (r *APIV2Service) GetHealth(ctx context.Context, opts ...option.RequestOption) (res *Apiv2GetHealthResponse, err error)

Get Health Status

type Account

type Account struct {
	// Unique identifier for the account
	ID string `json:"id,required" format:"uuid"`
	// Timestamp when the account was created
	CreatedDt time.Time `json:"created_dt,required" format:"date-time"`
	// Identifier for the Entity that owns the account
	EntityID string `json:"entity_id,required" format:"uuid"`
	// Indicates whether the account is active
	IsActive bool `json:"is_active,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID          resp.Field
		CreatedDt   resp.Field
		EntityID    resp.Field
		IsActive    resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about an account owned by an entity

func (Account) RawJSON

func (r Account) RawJSON() string

Returns the unmodified JSON received from the API

func (*Account) UnmarshalJSON

func (r *Account) UnmarshalJSON(data []byte) error

type Apiv2AccountGetCashResponse

type Apiv2AccountGetCashResponse struct {
	// Total amount of cash and cash equivalents
	Amount float64 `json:"amount,required"`
	// Currency (e.g. USD)
	Currency string `json:"currency,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Amount      resp.Field
		Currency    resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Balance of cash and cash equivalents currently in the account.

func (Apiv2AccountGetCashResponse) RawJSON

func (r Apiv2AccountGetCashResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*Apiv2AccountGetCashResponse) UnmarshalJSON

func (r *Apiv2AccountGetCashResponse) UnmarshalJSON(data []byte) error

type Apiv2AccountGetDividendPaymentsResponse

type Apiv2AccountGetDividendPaymentsResponse struct {
	// Amount of the dividend paid.
	Amount float64 `json:"amount,required"`
	// Currency in which the dividend was paid. (e.g. USD)
	Currency string `json:"currency,required"`
	// Date the dividend was distributed to the account.
	PaymentDate time.Time `json:"payment_date,required" format:"date"`
	// ID of the stock for which the dividend was paid.
	StockID string `json:"stock_id,required" format:"bigint"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Amount      resp.Field
		Currency    resp.Field
		PaymentDate resp.Field
		StockID     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

AccountDividendPayment represents a stock dividend payment event for an account.

func (Apiv2AccountGetDividendPaymentsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountGetDividendPaymentsResponse) UnmarshalJSON

func (r *Apiv2AccountGetDividendPaymentsResponse) UnmarshalJSON(data []byte) error

type Apiv2AccountGetInterestPaymentsResponse

type Apiv2AccountGetInterestPaymentsResponse struct {
	// Amount of interest paid
	Amount float64 `json:"amount,required"`
	// Type of currency (e.g. USD)
	Currency string `json:"currency,required"`
	// Date of interest payment. In US Eastern time zone
	PaymentDate time.Time `json:"payment_date,required" format:"date"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Amount      resp.Field
		Currency    resp.Field
		PaymentDate resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

An object representing interest payment details.

func (Apiv2AccountGetInterestPaymentsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountGetInterestPaymentsResponse) UnmarshalJSON

func (r *Apiv2AccountGetInterestPaymentsResponse) UnmarshalJSON(data []byte) error

type Apiv2AccountGetPortfolioResponse

type Apiv2AccountGetPortfolioResponse struct {
	// Stock Balance details for all owned stocks
	Assets []Apiv2AccountGetPortfolioResponseAsset `json:"assets,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Assets      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

This is an object representing the balance of cash and stock assets in your account.

func (Apiv2AccountGetPortfolioResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountGetPortfolioResponse) UnmarshalJSON

func (r *Apiv2AccountGetPortfolioResponse) UnmarshalJSON(data []byte) error

type Apiv2AccountGetPortfolioResponseAsset

type Apiv2AccountGetPortfolioResponseAsset struct {
	// Total amount of the stock
	Amount float64 `json:"amount,required"`
	// Total market value of the stock
	MarketValue float64 `json:"market_value,required"`
	// ID of Stock
	StockID string `json:"stock_id,required" format:"bigint"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Amount      resp.Field
		MarketValue resp.Field
		StockID     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Balance of a stock in the account

func (Apiv2AccountGetPortfolioResponseAsset) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountGetPortfolioResponseAsset) UnmarshalJSON

func (r *Apiv2AccountGetPortfolioResponseAsset) UnmarshalJSON(data []byte) error

type Apiv2AccountOrderGetEstimatedFeeResponse

type Apiv2AccountOrderGetEstimatedFeeResponse struct {
	// Chain where the order is placed
	ChainID int64 `json:"chain_id,required"`
	// FeeQuote structure to pass into contracts
	FeeQuote Apiv2AccountOrderGetEstimatedFeeResponseFeeQuote `json:"fee_quote,required"`
	// Signed FeeQuote structure to pass into contracts
	FeeQuoteSignature string `json:"fee_quote_signature,required" format:"hex_string"`
	// Breakdown of fees
	Fees []Apiv2AccountOrderGetEstimatedFeeResponseFee `json:"fees,required"`
	// Address of payment token used for fees
	PaymentToken string `json:"payment_token,required" format:"eth_address"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ChainID           resp.Field
		FeeQuote          resp.Field
		FeeQuoteSignature resp.Field
		Fees              resp.Field
		PaymentToken      resp.Field
		ExtraFields       map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Apiv2AccountOrderGetEstimatedFeeResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountOrderGetEstimatedFeeResponse) UnmarshalJSON

func (r *Apiv2AccountOrderGetEstimatedFeeResponse) UnmarshalJSON(data []byte) error

type Apiv2AccountOrderGetEstimatedFeeResponseFee

type Apiv2AccountOrderGetEstimatedFeeResponseFee struct {
	// The quantity of the fee paid via payment token in ETH
	// <a href='https://ethereum.org/en/developers/docs/intro-to-ether/#what-is-ether' target='_blank'>(what
	// is ETH?)</a>
	FeeInEth float64 `json:"fee_in_eth,required"`
	// The quantity of the fee paid via payment token in wei
	// <a href='https://ethereum.org/en/developers/docs/intro-to-ether/#denominations' target='_blank'>(what
	// is wei?)</a>
	FeeInWei string `json:"fee_in_wei,required" format:"bigint"`
	// Type of fee
	//
	// Any of "SPONSORED_NETWORK", "NETWORK", "TRADING", "ORDER", "PARTNER_ORDER",
	// "PARTNER_TRADING".
	Type string `json:"type,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		FeeInEth    resp.Field
		FeeInWei    resp.Field
		Type        resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Apiv2AccountOrderGetEstimatedFeeResponseFee) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountOrderGetEstimatedFeeResponseFee) UnmarshalJSON

func (r *Apiv2AccountOrderGetEstimatedFeeResponseFee) UnmarshalJSON(data []byte) error

type Apiv2AccountOrderGetEstimatedFeeResponseFeeQuote

type Apiv2AccountOrderGetEstimatedFeeResponseFeeQuote struct {
	Deadline  int64  `json:"deadline,required"`
	Fee       string `json:"fee,required" format:"bigint"`
	OrderID   string `json:"orderId,required" format:"bigint"`
	Requester string `json:"requester,required" format:"eth_address"`
	Timestamp int64  `json:"timestamp,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Deadline    resp.Field
		Fee         resp.Field
		OrderID     resp.Field
		Requester   resp.Field
		Timestamp   resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

FeeQuote structure to pass into contracts

func (Apiv2AccountOrderGetEstimatedFeeResponseFeeQuote) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountOrderGetEstimatedFeeResponseFeeQuote) UnmarshalJSON

type Apiv2AccountWalletExternalGetNonceResponse

type Apiv2AccountWalletExternalGetNonceResponse struct {
	// Message to be signed by the wallet
	Message string `json:"message,required"`
	// Single-use identifier
	Nonce string `json:"nonce,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Message     resp.Field
		Nonce       resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Wallet connection message for Dinari-managed wallets

func (Apiv2AccountWalletExternalGetNonceResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2AccountWalletExternalGetNonceResponse) UnmarshalJSON

func (r *Apiv2AccountWalletExternalGetNonceResponse) UnmarshalJSON(data []byte) error

type Apiv2EntityKYCGetURLResponse

type Apiv2EntityKYCGetURLResponse struct {
	// URL of a managed KYC flow interface for the entity. This URL is unique per KYC
	// attempt.
	EmbedURL string `json:"embed_url,required"`
	// Timestamp at which the KYC request will be expired
	ExpirationDt time.Time `json:"expiration_dt,required" format:"date-time"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		EmbedURL     resp.Field
		ExpirationDt resp.Field
		ExtraFields  map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

URL for a managed KYC flow for the entity that can be shown in an iframe

func (Apiv2EntityKYCGetURLResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2EntityKYCGetURLResponse) UnmarshalJSON

func (r *Apiv2EntityKYCGetURLResponse) UnmarshalJSON(data []byte) error

type Apiv2EntityKYCUploadDocumentResponse

type Apiv2EntityKYCUploadDocumentResponse struct {
	// ID of the document
	ID string `json:"id,required" format:"uuid"`
	// Type of the document
	//
	// Any of "GOVERNMENT_ID", "SELFIE", "RESIDENCY", "UNKNOWN".
	DocumentType KYCDocumentType `json:"document_type,required"`
	// Filename of the document
	Filename string `json:"filename,required"`
	// URL to access the document. Expires in 1 hour
	URL string `json:"url,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID           resp.Field
		DocumentType resp.Field
		Filename     resp.Field
		URL          resp.Field
		ExtraFields  map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Document associated with KYC for an entity

func (Apiv2EntityKYCUploadDocumentResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2EntityKYCUploadDocumentResponse) UnmarshalJSON

func (r *Apiv2EntityKYCUploadDocumentResponse) UnmarshalJSON(data []byte) error

type Apiv2GetHealthResponse

type Apiv2GetHealthResponse struct {
	// Status of server
	Status string `json:"status,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Status      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Apiv2GetHealthResponse) RawJSON

func (r Apiv2GetHealthResponse) RawJSON() string

Returns the unmodified JSON received from the API

func (*Apiv2GetHealthResponse) UnmarshalJSON

func (r *Apiv2GetHealthResponse) UnmarshalJSON(data []byte) error

type Apiv2MarketDataGetMarketHoursResponse

type Apiv2MarketDataGetMarketHoursResponse struct {
	// Whether or not the market is open
	IsMarketOpen bool `json:"is_market_open,required"`
	// Timestamp in ISO 8601 format at which the next session closes
	NextSessionCloseDt time.Time `json:"next_session_close_dt,required" format:"date-time"`
	// Timestamp in ISO 8601 format at which the next session opens
	NextSessionOpenDt time.Time `json:"next_session_open_dt,required" format:"date-time"`
	// Timestamp in ISO 8601 format at which the current session closes or null if the
	// market is currently closed
	CurrentSessionCloseDt time.Time `json:"current_session_close_dt" format:"date-time"`
	// Timestamp in ISO 8601 format at which the current session opened or null if the
	// market is currently closed
	CurrentSessionOpenDt time.Time `json:"current_session_open_dt" format:"date-time"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		IsMarketOpen          resp.Field
		NextSessionCloseDt    resp.Field
		NextSessionOpenDt     resp.Field
		CurrentSessionCloseDt resp.Field
		CurrentSessionOpenDt  resp.Field
		ExtraFields           map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Apiv2MarketDataGetMarketHoursResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2MarketDataGetMarketHoursResponse) UnmarshalJSON

func (r *Apiv2MarketDataGetMarketHoursResponse) UnmarshalJSON(data []byte) error

type Apiv2MarketDataStockGetDividendsResponse

type Apiv2MarketDataStockGetDividendsResponse struct {
	// Cash amount of the dividend per share owned.
	CashAmount float64 `json:"cash_amount"`
	// Currency in which the dividend is paid.
	Currency string `json:"currency"`
	// Date on which the dividend was announced.
	DeclarationDate string `json:"declaration_date"`
	// Type of dividend. Dividends that have been paid and/or are expected to be paid
	// on consistent schedules are denoted as CD. Special Cash dividends that have been
	// paid that are infrequent or unusual, and/or can not be expected to occur in the
	// future are denoted as SC. Long-Term and Short-Term capital gain distributions
	// are denoted as LT and ST, respectively.
	DividendType string `json:"dividend_type"`
	// Date on or after which a stock is traded without the right to receive the next
	// dividend payment. (If you purchase a stock on or after the ex-dividend date, you
	// will not receive the upcoming dividend.)
	ExDividendDate string `json:"ex_dividend_date"`
	// Frequency of the dividend. The following values are possible:
	//
	//	1 - Annual
	//
	//	2 - Semi-Annual
	//
	//	4 - Quarterly
	//
	//	12 - Monthly
	//
	//	52 - Weekly
	//
	//	365 - Daily
	Frequency int64 `json:"frequency"`
	// Date that the dividend is paid out.
	PayDate string `json:"pay_date"`
	// Date that the stock must be held to receive the dividend; set by the company.
	RecordDate string `json:"record_date"`
	// Ticker symbol of the stock.
	Ticker string `json:"ticker"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		CashAmount      resp.Field
		Currency        resp.Field
		DeclarationDate resp.Field
		DividendType    resp.Field
		ExDividendDate  resp.Field
		Frequency       resp.Field
		PayDate         resp.Field
		RecordDate      resp.Field
		Ticker          resp.Field
		ExtraFields     map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Details of a dividend announcement for a stock.

func (Apiv2MarketDataStockGetDividendsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2MarketDataStockGetDividendsResponse) UnmarshalJSON

func (r *Apiv2MarketDataStockGetDividendsResponse) UnmarshalJSON(data []byte) error

type Apiv2MarketDataStockGetHistoricalPricesResponse

type Apiv2MarketDataStockGetHistoricalPricesResponse struct {
	// Close price of the stock in the given time period.
	Close float64 `json:"close,required"`
	// Highest price of the stock in the given time period.
	High float64 `json:"high,required"`
	// Lowest price of the stock in the given time period.
	Low float64 `json:"low,required"`
	// Open price of the stock in the given time period.
	Open float64 `json:"open,required"`
	// The Unix timestamp in seconds for the start of the aggregate window.
	Timestamp int64 `json:"timestamp,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Close       resp.Field
		High        resp.Field
		Low         resp.Field
		Open        resp.Field
		Timestamp   resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Datapoint of historical price data for a stock.

func (Apiv2MarketDataStockGetHistoricalPricesResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2MarketDataStockGetHistoricalPricesResponse) UnmarshalJSON

type Apiv2MarketDataStockGetNewsResponse

type Apiv2MarketDataStockGetNewsResponse struct {
	// URL of the news article
	ArticleURL string `json:"article_url,required"`
	// Description of the news article
	Description string `json:"description,required"`
	// URL of the image for the news article
	ImageURL string `json:"image_url,required"`
	// Timestamp when the article was published
	PublishedDt time.Time `json:"published_dt,required" format:"date-time"`
	// The publisher of the news article
	Publisher string `json:"publisher,required"`
	// The mobile friendly Accelerated Mobile Page (AMP) URL of the news article if
	// available
	AmpURL string `json:"amp_url"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ArticleURL  resp.Field
		Description resp.Field
		ImageURL    resp.Field
		PublishedDt resp.Field
		Publisher   resp.Field
		AmpURL      resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

This represents a news article relating to a stock ticker symbol which includes a summary of the article and a link to the original source.

func (Apiv2MarketDataStockGetNewsResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2MarketDataStockGetNewsResponse) UnmarshalJSON

func (r *Apiv2MarketDataStockGetNewsResponse) UnmarshalJSON(data []byte) error

type Apiv2MarketDataStockGetQuoteResponse

type Apiv2MarketDataStockGetQuoteResponse struct {
	// The ask price.
	Price   float64 `json:"price,required"`
	StockID string  `json:"stock_id,required" format:"bigint"`
	// The change in price from the previous close.
	Change float64 `json:"change"`
	// The percentage change in price from the previous close.
	ChangePercent float64 `json:"change_percent"`
	// The close price for the stock in the given time period.
	Close float64 `json:"close"`
	// The highest price for the stock in the given time period
	High float64 `json:"high"`
	// The lowest price for the stock in the given time period.
	Low float64 `json:"low"`
	// The most recent close price of the ticker multiplied by weighted outstanding
	// shares
	MarketCap int64 `json:"market_cap"`
	// The open price for the stock in the given time period.
	Open float64 `json:"open"`
	// The close price for the stock for the previous trading day.
	PreviousClose float64 `json:"previous_close"`
	// The trading volume of the stock in the given time period.
	Volume float64 `json:"volume"`
	// The number of shares outstanding in the given time period
	WeightedSharesOutstanding int64 `json:"weighted_shares_outstanding"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Price                     resp.Field
		StockID                   resp.Field
		Change                    resp.Field
		ChangePercent             resp.Field
		Close                     resp.Field
		High                      resp.Field
		Low                       resp.Field
		MarketCap                 resp.Field
		Open                      resp.Field
		PreviousClose             resp.Field
		Volume                    resp.Field
		WeightedSharesOutstanding resp.Field
		ExtraFields               map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Apiv2MarketDataStockGetQuoteResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2MarketDataStockGetQuoteResponse) UnmarshalJSON

func (r *Apiv2MarketDataStockGetQuoteResponse) UnmarshalJSON(data []byte) error

type Apiv2MarketDataStockListResponse

type Apiv2MarketDataStockListResponse struct {
	// Unique identifier for the stock
	ID string `json:"id,required" format:"bigint"`
	// Whether the stock allows for fractional trading. If it is not fractionable,
	// Dinari only supports limit orders for the stock.
	IsFractionable bool `json:"is_fractionable,required"`
	// Stock Name
	Name string `json:"name,required"`
	// Ticker symbol of the stock
	Symbol string `json:"symbol,required"`
	// SEC Central Index Key. Refer to
	// [this link](https://www.sec.gov/submit-filings/filer-support-resources/how-do-i-guides/understand-utilize-edgar-ciks-passphrases-access-codes)
	Cik string `json:"cik,nullable"`
	// Composite FIGI ID. Refer to [this link](https://www.openfigi.com/about/figi)
	CompositeFigi string `json:"composite_figi,nullable"`
	// CUSIP ID. Refer to [this link](https://www.cusip.com/identifiers.html)
	Cusip string `json:"cusip,nullable"`
	// Description of the company and what they do/offer.
	Description string `json:"description,nullable"`
	// Name of Stock for application display
	DisplayName string `json:"display_name,nullable"`
	// The URL of the logo of the stock. The preferred format is svg.
	LogoURL string `json:"logo_url,nullable"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID             resp.Field
		IsFractionable resp.Field
		Name           resp.Field
		Symbol         resp.Field
		Cik            resp.Field
		CompositeFigi  resp.Field
		Cusip          resp.Field
		Description    resp.Field
		DisplayName    resp.Field
		LogoURL        resp.Field
		ExtraFields    map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about stock available for trading.

func (Apiv2MarketDataStockListResponse) RawJSON

Returns the unmodified JSON received from the API

func (*Apiv2MarketDataStockListResponse) UnmarshalJSON

func (r *Apiv2MarketDataStockListResponse) UnmarshalJSON(data []byte) error

type Client

type Client struct {
	Options []option.RequestOption
	API     APIService
}

Client creates a struct with services and top level methods that help with interacting with the dinari API. You should not instantiate this client directly, and instead use the NewClient method instead.

func NewClient

func NewClient(opts ...option.RequestOption) (r Client)

NewClient generates a new client with the default option read from the environment (DINARI_API_KEY, DINARI_BASE_URL). The option passed in as arguments are applied after these default arguments, and all option will be passed down to the services and requests that this client makes.

func (*Client) Delete

func (r *Client) Delete(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Delete makes a DELETE request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Execute

func (r *Client) Execute(ctx context.Context, method string, path string, params any, res any, opts ...option.RequestOption) error

Execute makes a request with the given context, method, URL, request params, response, and request options. This is useful for hitting undocumented endpoints while retaining the base URL, auth, retries, and other options from the client.

If a byte slice or an io.Reader is supplied to params, it will be used as-is for the request body.

The params is by default serialized into the body using encoding/json. If your type implements a MarshalJSON function, it will be used instead to serialize the request. If a URLQuery method is implemented, the returned url.Values will be used as query strings to the url.

If your params struct uses param.Field, you must provide either [MarshalJSON], [URLQuery], and/or [MarshalForm] functions. It is undefined behavior to use a struct uses param.Field without specifying how it is serialized.

Any "…Params" object defined in this library can be used as the request argument. Note that 'path' arguments will not be forwarded into the url.

The response body will be deserialized into the res variable, depending on its type:

  • A pointer to a *http.Response is populated by the raw response.
  • A pointer to a byte array will be populated with the contents of the request body.
  • A pointer to any other type uses this library's default JSON decoding, which respects UnmarshalJSON if it is defined on the type.
  • A nil value will not read the response body.

For even greater flexibility, see option.WithResponseInto and option.WithResponseBodyInto.

func (*Client) Get

func (r *Client) Get(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Get makes a GET request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Patch

func (r *Client) Patch(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Patch makes a PATCH request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Post

func (r *Client) Post(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Post makes a POST request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

func (*Client) Put

func (r *Client) Put(ctx context.Context, path string, params any, res any, opts ...option.RequestOption) error

Put makes a PUT request with the given URL, params, and optionally deserializes to a response. See [Execute] documentation on the params and response.

type Entity

type Entity struct {
	// Unique identifier for the entity
	ID string `json:"id,required" format:"uuid"`
	// Type of entity
	//
	// Any of "INDIVIDUAL", "ORGANIZATION".
	EntityType EntityEntityType `json:"entity_type,required"`
	// Indicates if Entity completed KYC
	IsKYCComplete bool `json:"is_kyc_complete,required"`
	// Name of Entity
	Name string `json:"name"`
	// Nationality of the entity
	Nationality string `json:"nationality"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID            resp.Field
		EntityType    resp.Field
		IsKYCComplete resp.Field
		Name          resp.Field
		Nationality   resp.Field
		ExtraFields   map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about an entity, which can be either an individual or an organization.

func (Entity) RawJSON

func (r Entity) RawJSON() string

Returns the unmodified JSON received from the API

func (*Entity) UnmarshalJSON

func (r *Entity) UnmarshalJSON(data []byte) error

type EntityEntityType

type EntityEntityType string

Type of entity

const (
	EntityEntityTypeIndividual   EntityEntityType = "INDIVIDUAL"
	EntityEntityTypeOrganization EntityEntityType = "ORGANIZATION"
)

type Error

type Error = apierror.Error

type KYCData

type KYCData struct {
	// ISO 3166-1 alpha 2 country code of citizenship or the country the organization
	// is based out of.
	CountryCode string `json:"country_code,required"`
	// Last name of the person
	LastName string `json:"last_name,required"`
	// City of address. Not all international addresses use this attribute.
	AddressCity string `json:"address_city"`
	// ZIP or postal code of residence address. Not all international addresses use
	// this attribute.
	AddressPostalCode string `json:"address_postal_code"`
	// Street name of address.
	AddressStreet1 string `json:"address_street_1"`
	// Extension of address, usually apartment or suite number.
	AddressStreet2 string `json:"address_street_2"`
	// State or subdivision of address. In the US, this should be the unabbreviated
	// name. Not all international addresses use this attribute.
	AddressSubdivision string `json:"address_subdivision"`
	// Birth date of the individual
	BirthDate time.Time `json:"birth_date" format:"date"`
	// Email address
	Email string `json:"email,nullable"`
	// First name of the person, or name of the organization
	FirstName string `json:"first_name,nullable"`
	// Middle name of the user
	MiddleName string `json:"middle_name,nullable"`
	// ID number of the official tax document of the country the entity belongs to
	TaxIDNumber string `json:"tax_id_number"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		CountryCode        resp.Field
		LastName           resp.Field
		AddressCity        resp.Field
		AddressPostalCode  resp.Field
		AddressStreet1     resp.Field
		AddressStreet2     resp.Field
		AddressSubdivision resp.Field
		BirthDate          resp.Field
		Email              resp.Field
		FirstName          resp.Field
		MiddleName         resp.Field
		TaxIDNumber        resp.Field
		ExtraFields        map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Object consisting of KYC data for an entity

func (KYCData) RawJSON

func (r KYCData) RawJSON() string

Returns the unmodified JSON received from the API

func (KYCData) ToParam

func (r KYCData) ToParam() KYCDataParam

ToParam converts this KYCData to a KYCDataParam.

Warning: the fields of the param type will not be present. ToParam should only be used at the last possible moment before sending a request. Test for this with KYCDataParam.IsOverridden()

func (*KYCData) UnmarshalJSON

func (r *KYCData) UnmarshalJSON(data []byte) error

type KYCDataParam

type KYCDataParam struct {
	// ISO 3166-1 alpha 2 country code of citizenship or the country the organization
	// is based out of.
	CountryCode string `json:"country_code,required"`
	// Last name of the person
	LastName string `json:"last_name,required"`
	// Email address
	Email param.Opt[string] `json:"email,omitzero"`
	// First name of the person, or name of the organization
	FirstName param.Opt[string] `json:"first_name,omitzero"`
	// Middle name of the user
	MiddleName param.Opt[string] `json:"middle_name,omitzero"`
	// City of address. Not all international addresses use this attribute.
	AddressCity param.Opt[string] `json:"address_city,omitzero"`
	// ZIP or postal code of residence address. Not all international addresses use
	// this attribute.
	AddressPostalCode param.Opt[string] `json:"address_postal_code,omitzero"`
	// Street name of address.
	AddressStreet1 param.Opt[string] `json:"address_street_1,omitzero"`
	// Extension of address, usually apartment or suite number.
	AddressStreet2 param.Opt[string] `json:"address_street_2,omitzero"`
	// State or subdivision of address. In the US, this should be the unabbreviated
	// name. Not all international addresses use this attribute.
	AddressSubdivision param.Opt[string] `json:"address_subdivision,omitzero"`
	// Birth date of the individual
	BirthDate param.Opt[time.Time] `json:"birth_date,omitzero" format:"date"`
	// ID number of the official tax document of the country the entity belongs to
	TaxIDNumber param.Opt[string] `json:"tax_id_number,omitzero"`
	// contains filtered or unexported fields
}

Object consisting of KYC data for an entity

The properties CountryCode, LastName are required.

func (KYCDataParam) IsPresent

func (f KYCDataParam) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (KYCDataParam) MarshalJSON

func (r KYCDataParam) MarshalJSON() (data []byte, err error)

type KYCDocumentType

type KYCDocumentType string
const (
	KYCDocumentTypeGovernmentID KYCDocumentType = "GOVERNMENT_ID"
	KYCDocumentTypeSelfie       KYCDocumentType = "SELFIE"
	KYCDocumentTypeResidency    KYCDocumentType = "RESIDENCY"
	KYCDocumentTypeUnknown      KYCDocumentType = "UNKNOWN"
)

type KYCInfo

type KYCInfo struct {
	// Unique identifier for the KYC check
	ID string `json:"id,required" format:"bigint"`
	// KYC status
	//
	// Any of "PASS", "FAIL", "PENDING", "INCOMPLETE".
	Status KYCInfoStatus `json:"status,required"`
	// Timestamp when the KYC was last checked
	CheckedDt time.Time `json:"checked_dt" format:"date-time"`
	// Object consisting of KYC data for an entity
	Data KYCData `json:"data"`
	// Name of the KYC provider that provided the KYC check
	ProviderName string `json:"provider_name"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID           resp.Field
		Status       resp.Field
		CheckedDt    resp.Field
		Data         resp.Field
		ProviderName resp.Field
		ExtraFields  map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

KYC information for an entity

func (KYCInfo) RawJSON

func (r KYCInfo) RawJSON() string

Returns the unmodified JSON received from the API

func (*KYCInfo) UnmarshalJSON

func (r *KYCInfo) UnmarshalJSON(data []byte) error

type KYCInfoStatus

type KYCInfoStatus string

KYC status

const (
	KYCInfoStatusPass       KYCInfoStatus = "PASS"
	KYCInfoStatusFail       KYCInfoStatus = "FAIL"
	KYCInfoStatusPending    KYCInfoStatus = "PENDING"
	KYCInfoStatusIncomplete KYCInfoStatus = "INCOMPLETE"
)

type LimitOrderRequestInputParam

type LimitOrderRequestInputParam struct {
	// Quantity of stock to trade. Must be a positive integer.
	AssetQuantity int64 `json:"asset_quantity,required"`
	// Price at which to execute the order. Must be a positive number with a precision
	// of up to 2 decimal places.
	LimitPrice float64 `json:"limit_price,required"`
	// ID of stock, as returned by the `/stocks` endpoint, e.g. 1
	StockID string `json:"stock_id,required" format:"bigint"`
	// contains filtered or unexported fields
}

Input parameters for placing a limit order.

The properties AssetQuantity, LimitPrice, StockID are required.

func (LimitOrderRequestInputParam) IsPresent

func (f LimitOrderRequestInputParam) IsPresent() bool

IsPresent returns true if the field's value is not omitted and not the JSON "null". To check if this field is omitted, use param.IsOmitted.

func (LimitOrderRequestInputParam) MarshalJSON

func (r LimitOrderRequestInputParam) MarshalJSON() (data []byte, err error)

type Order

type Order struct {
	// Identifier of the order
	ID string `json:"id,required" format:"uuid"`
	// Total amount of assets involved
	AssetTokenQuantity float64 `json:"asset_token_quantity,required"`
	// Status of the order
	//
	// Any of "PENDING_SUBMIT", "PENDING_CANCEL", "PENDING_ESCROW", "PENDING_FILL",
	// "ESCROWED", "SUBMITTED", "CANCELLED", "FILLED", "REJECTED", "REQUIRING_CONTACT",
	// "ERROR".
	BrokerageOrderStatus OrderBrokerageOrderStatus `json:"brokerage_order_status,required"`
	// Blockchain that transaction was run on
	ChainID int64 `json:"chain_id,required"`
	// Smart Contract address that order came from
	OrderContractAddress string `json:"order_contract_address,required" format:"eth_address"`
	// Indicates if order is a buy or sell
	//
	// Any of "BUY", "SELL".
	OrderSide OrderOrderSide `json:"order_side,required"`
	// Indicates how long order is valid
	//
	// Any of "DAY", "GTC", "IOC", "FOK".
	OrderTif OrderOrderTif `json:"order_tif,required"`
	// Transaction hash for the order
	OrderTransactionHash string `json:"order_transaction_hash,required" format:"hex_string"`
	// Indicates what type of order
	//
	// Any of "MARKET", "LIMIT".
	OrderType OrderOrderType `json:"order_type,required"`
	// Total amount of payment involved
	PaymentTokenQuantity float64 `json:"payment_token_quantity,required"`
	// Unique identifier of this Order generated by the order contract.
	SmartContractOrderID string `json:"smart_contract_order_id,required"`
	// Transaction hash for cancellation of order
	CancelTransactionHash string `json:"cancel_transaction_hash" format:"hex_string"`
	// List of fees associated with order
	Fees []map[string]any `json:"fees"`
	// Total amount of network fee taken in USD
	NetworkFeeInUsd float64 `json:"network_fee_in_usd"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID                    resp.Field
		AssetTokenQuantity    resp.Field
		BrokerageOrderStatus  resp.Field
		ChainID               resp.Field
		OrderContractAddress  resp.Field
		OrderSide             resp.Field
		OrderTif              resp.Field
		OrderTransactionHash  resp.Field
		OrderType             resp.Field
		PaymentTokenQuantity  resp.Field
		SmartContractOrderID  resp.Field
		CancelTransactionHash resp.Field
		Fees                  resp.Field
		NetworkFeeInUsd       resp.Field
		ExtraFields           map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

func (Order) RawJSON

func (r Order) RawJSON() string

Returns the unmodified JSON received from the API

func (*Order) UnmarshalJSON

func (r *Order) UnmarshalJSON(data []byte) error

type OrderBrokerageOrderStatus

type OrderBrokerageOrderStatus string

Status of the order

const (
	OrderBrokerageOrderStatusPendingSubmit    OrderBrokerageOrderStatus = "PENDING_SUBMIT"
	OrderBrokerageOrderStatusPendingCancel    OrderBrokerageOrderStatus = "PENDING_CANCEL"
	OrderBrokerageOrderStatusPendingEscrow    OrderBrokerageOrderStatus = "PENDING_ESCROW"
	OrderBrokerageOrderStatusPendingFill      OrderBrokerageOrderStatus = "PENDING_FILL"
	OrderBrokerageOrderStatusEscrowed         OrderBrokerageOrderStatus = "ESCROWED"
	OrderBrokerageOrderStatusSubmitted        OrderBrokerageOrderStatus = "SUBMITTED"
	OrderBrokerageOrderStatusCancelled        OrderBrokerageOrderStatus = "CANCELLED"
	OrderBrokerageOrderStatusFilled           OrderBrokerageOrderStatus = "FILLED"
	OrderBrokerageOrderStatusRejected         OrderBrokerageOrderStatus = "REJECTED"
	OrderBrokerageOrderStatusRequiringContact OrderBrokerageOrderStatus = "REQUIRING_CONTACT"
	OrderBrokerageOrderStatusError            OrderBrokerageOrderStatus = "ERROR"
)

type OrderFulfillment

type OrderFulfillment struct {
	// Identifier of the order fulfillment
	ID string `json:"id,required" format:"uuid"`
	// Amount of asset token filled
	AssetTokenFilled float64 `json:"asset_token_filled,required"`
	// Amount of asset token spent
	AssetTokenSpent float64 `json:"asset_token_spent,required"`
	// Identifier of the order this fulfillment is for
	OrderID string `json:"order_id,required" format:"uuid"`
	// Amount of payment token filled
	PaymentTokenFilled float64 `json:"payment_token_filled,required"`
	// Amount of payment token spent
	PaymentTokenSpent float64 `json:"payment_token_spent,required"`
	// Time when transaction occurred
	TransactionDt time.Time `json:"transaction_dt,required" format:"date-time"`
	// Transaction hash for this fulfillment
	TransactionHash string `json:"transaction_hash,required" format:"hex_string"`
	// Fee amount of payment token spent
	PaymentTokenFee float64 `json:"payment_token_fee"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID                 resp.Field
		AssetTokenFilled   resp.Field
		AssetTokenSpent    resp.Field
		OrderID            resp.Field
		PaymentTokenFilled resp.Field
		PaymentTokenSpent  resp.Field
		TransactionDt      resp.Field
		TransactionHash    resp.Field
		PaymentTokenFee    resp.Field
		ExtraFields        map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about a fulfillment of an order. An order may be fulfilled in multiple transactions.

func (OrderFulfillment) RawJSON

func (r OrderFulfillment) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrderFulfillment) UnmarshalJSON

func (r *OrderFulfillment) UnmarshalJSON(data []byte) error

type OrderOrderSide

type OrderOrderSide string

Indicates if order is a buy or sell

const (
	OrderOrderSideBuy  OrderOrderSide = "BUY"
	OrderOrderSideSell OrderOrderSide = "SELL"
)

type OrderOrderTif

type OrderOrderTif string

Indicates how long order is valid

const (
	OrderOrderTifDay OrderOrderTif = "DAY"
	OrderOrderTifGtc OrderOrderTif = "GTC"
	OrderOrderTifIoc OrderOrderTif = "IOC"
	OrderOrderTifFok OrderOrderTif = "FOK"
)

type OrderOrderType

type OrderOrderType string

Indicates what type of order

const (
	OrderOrderTypeMarket OrderOrderType = "MARKET"
	OrderOrderTypeLimit  OrderOrderType = "LIMIT"
)

type OrderRequest

type OrderRequest struct {
	// ID of account placing the order
	AccountID string `json:"account_id,required" format:"uuid"`
	// Confirmation code of order request. This is the primary identifier for the
	// `/order_requests` endpoint
	ConfirmationCode string `json:"confirmation_code,required" format:"uuid"`
	// Timestamp at which the order request was created.
	CreatedDt time.Time `json:"created_dt,required" format:"date-time"`
	// Status of order request
	//
	// Any of "PENDING", "SUBMITTED", "ERROR", "CANCELLED".
	Status OrderRequestStatus `json:"status,required"`
	// ID of order created from the order request. This is the primary identifier for
	// the `/orders` endpoint
	OrderID string `json:"order_id" format:"uuid"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		AccountID        resp.Field
		ConfirmationCode resp.Field
		CreatedDt        resp.Field
		Status           resp.Field
		OrderID          resp.Field
		ExtraFields      map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Request to create an order

func (OrderRequest) RawJSON

func (r OrderRequest) RawJSON() string

Returns the unmodified JSON received from the API

func (*OrderRequest) UnmarshalJSON

func (r *OrderRequest) UnmarshalJSON(data []byte) error

type OrderRequestStatus

type OrderRequestStatus string

Status of order request

const (
	OrderRequestStatusPending   OrderRequestStatus = "PENDING"
	OrderRequestStatusSubmitted OrderRequestStatus = "SUBMITTED"
	OrderRequestStatusError     OrderRequestStatus = "ERROR"
	OrderRequestStatusCancelled OrderRequestStatus = "CANCELLED"
)

type StockSplit

type StockSplit struct {
	// Unique identifier for the stock split
	ID string `json:"id,required" format:"bigint"`
	// Ex-date of the split (Eastern Time Zone). First day the stock trades at
	// post-split prices. Typically is last in the process, and the main important date
	// for investors.
	ExDate time.Time `json:"ex_date,required" format:"date"`
	// Payable date (Eastern Time Zone) of the split. Date when company will send out
	// the new shares. Mainly for record keeping by brokerages, who forward the shares
	// to eventual owners. Typically is second in the process.
	PayableDate time.Time `json:"payable_date,required" format:"date"`
	// Record date (Eastern Time Zone) of the split, for company to determine where to
	// send their new shares. Mainly for record keeping by brokerages, who forward the
	// shares to eventual owners. Typically is first in the process.
	RecordDate time.Time `json:"record_date,required" format:"date"`
	// The number of shares before the split. In a 10-for-1 split, this would be 1.
	SplitFrom float64 `json:"split_from,required"`
	// The number of shares after the split. In a 10-for-1 split, this would be 10.
	SplitTo float64 `json:"split_to,required"`
	// The status of Dinari's processing of the split. Stocks for which a split is
	// `IN_PROGRESS` will not be available for trading.
	//
	// Any of "PENDING", "IN_PROGRESS", "COMPLETE".
	Status StockSplitStatus `json:"status,required"`
	// Reference to the id of the stock for this split
	StockID string `json:"stock_id,required" format:"bigint"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		ID          resp.Field
		ExDate      resp.Field
		PayableDate resp.Field
		RecordDate  resp.Field
		SplitFrom   resp.Field
		SplitTo     resp.Field
		Status      resp.Field
		StockID     resp.Field
		ExtraFields map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

StockSplit contains data for a stock split, including the stock id, the number of shares before and after the split, the record date, payable date, ex-date, and the status of the split.

func (StockSplit) RawJSON

func (r StockSplit) RawJSON() string

Returns the unmodified JSON received from the API

func (*StockSplit) UnmarshalJSON

func (r *StockSplit) UnmarshalJSON(data []byte) error

type StockSplitStatus

type StockSplitStatus string

The status of Dinari's processing of the split. Stocks for which a split is `IN_PROGRESS` will not be available for trading.

const (
	StockSplitStatusPending    StockSplitStatus = "PENDING"
	StockSplitStatusInProgress StockSplitStatus = "IN_PROGRESS"
	StockSplitStatusComplete   StockSplitStatus = "COMPLETE"
)

type Wallet

type Wallet struct {
	// Address of the wallet
	Address string `json:"address,required"`
	// Indicates whether the wallet is flagged for AML violations
	IsAmlFlagged bool `json:"is_aml_flagged,required"`
	// Indicates whether the wallet is a Dinari-managed wallet
	IsManagedWallet bool `json:"is_managed_wallet,required"`
	// Metadata for the response, check the presence of optional fields with the
	// [resp.Field.IsPresent] method.
	JSON struct {
		Address         resp.Field
		IsAmlFlagged    resp.Field
		IsManagedWallet resp.Field
		ExtraFields     map[string]resp.Field
		// contains filtered or unexported fields
	} `json:"-"`
}

Information about a digital wallet

func (Wallet) RawJSON

func (r Wallet) RawJSON() string

Returns the unmodified JSON received from the API

func (*Wallet) UnmarshalJSON

func (r *Wallet) UnmarshalJSON(data []byte) error

Directories

Path Synopsis
encoding/json
Package json implements encoding and decoding of JSON as defined in RFC 7159.
Package json implements encoding and decoding of JSON as defined in RFC 7159.
encoding/json/shims
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
This package provides shims over Go 1.2{2,3} APIs which are missing from Go 1.21, and used by the Go 1.24 encoding/json package.
packages
shared

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL