diff --git a/api.go b/api.go
index f894a46..83862e1 100644
--- a/api.go
+++ b/api.go
@@ -1,5 +1,7 @@
package luno
+// Code generated by sdkgen
+
import (
"context"
@@ -96,6 +98,48 @@ func (cl *Client) CreateAccount(ctx context.Context, req *CreateAccountRequest)
return &res, nil
}
+// CreateBeneficiaryRequest is the request struct for CreateBeneficiary.
+type CreateBeneficiaryRequest struct {
+ // Bank account type
+ //
+ // required: true
+ AccountType AccountType `json:"account_type" url:"account_type"`
+
+ // Beneficiary bank account number
+ //
+ // required: true
+ BankAccountNumber string `json:"bank_account_number" url:"bank_account_number"`
+
+ // Bank SWIFT code
+ //
+ // required: true
+ BankName string `json:"bank_name" url:"bank_name"`
+
+ // The owner of the recipient account
+ //
+ // required: true
+ BankRecipient string `json:"bank_recipient" url:"bank_recipient"`
+}
+
+// CreateBeneficiaryResponse is the response struct for CreateBeneficiary.
+type CreateBeneficiaryResponse struct {
+ Id string `json:"id"`
+}
+
+// CreateBeneficiary makes a call to POST /api/1/beneficiaries.
+//
+// Create a new beneficiary.
+//
+// Permissions required: Perm_W_Beneficiaries
+func (cl *Client) CreateBeneficiary(ctx context.Context, req *CreateBeneficiaryRequest) (*CreateBeneficiaryResponse, error) {
+ var res CreateBeneficiaryResponse
+ err := cl.do(ctx, "POST", "/api/1/beneficiaries", req, &res, true)
+ if err != nil {
+ return nil, err
+ }
+ return &res, nil
+}
+
// CreateFundingAddressRequest is the request struct for CreateFundingAddress.
type CreateFundingAddressRequest struct {
// Currency code of the asset.
@@ -213,6 +257,28 @@ func (cl *Client) CreateWithdrawal(ctx context.Context, req *CreateWithdrawalReq
return &res, nil
}
+// DeleteBeneficiaryRequest is the request struct for DeleteBeneficiary.
+type DeleteBeneficiaryRequest struct {
+ // ID of the Beneficiary to delete.
+ //
+ // required: true
+ Id int64 `json:"id" url:"id"`
+}
+
+// DeleteBeneficiary makes a call to DELETE /api/1/beneficiaries/{id}.
+//
+// # Delete a beneficiary
+//
+// Permissions required: Perm_W_Beneficiaries
+func (cl *Client) DeleteBeneficiary(ctx context.Context, req *DeleteBeneficiaryRequest) error {
+ var res struct{}
+ err := cl.do(ctx, "DELETE", "/api/1/beneficiaries/{id}", req, &res, true)
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
// GetBalancesRequest is the request struct for GetBalances.
type GetBalancesRequest struct {
// Only return balances for wallets with these currencies (if not provided,
@@ -926,21 +992,23 @@ func (cl *Client) GetWithdrawal(ctx context.Context, req *GetWithdrawalRequest)
return &res, nil
}
-// ListBeneficiariesResponseRequest is the request struct for ListBeneficiariesResponse.
-type ListBeneficiariesResponseRequest struct{}
+// ListBeneficiariesRequest is the request struct for ListBeneficiaries.
+type ListBeneficiariesRequest struct {
+ BankRecipient string `json:"bank_recipient" url:"bank_recipient"`
+}
-// ListBeneficiariesResponseResponse is the response struct for ListBeneficiariesResponse.
-type ListBeneficiariesResponseResponse struct {
+// ListBeneficiariesResponse is the response struct for ListBeneficiaries.
+type ListBeneficiariesResponse struct {
Beneficiaries []beneficiary `json:"beneficiaries"`
}
-// ListBeneficiariesResponse makes a call to GET /api/1/beneficiaries.
+// ListBeneficiaries makes a call to GET /api/1/beneficiaries.
//
// Returns a list of bank beneficiaries.
//
// Permissions required: Perm_R_Beneficiaries
-func (cl *Client) ListBeneficiariesResponse(ctx context.Context, req *ListBeneficiariesResponseRequest) (*ListBeneficiariesResponseResponse, error) {
- var res ListBeneficiariesResponseResponse
+func (cl *Client) ListBeneficiaries(ctx context.Context, req *ListBeneficiariesRequest) (*ListBeneficiariesResponse, error) {
+ var res ListBeneficiariesResponse
err := cl.do(ctx, "GET", "/api/1/beneficiaries", req, &res, true)
if err != nil {
return nil, err
diff --git a/types.go b/types.go
index 80d8615..212d3ed 100644
--- a/types.go
+++ b/types.go
@@ -25,11 +25,27 @@ type AccountBalance struct {
Unconfirmed decimal.Decimal `json:"unconfirmed"`
}
+type AccountType string
+
+const (
+ AccountTypeCurrentcheque AccountType = "Current/Cheque"
+ AccountTypeSavings AccountType = "Savings"
+ AccountTypeTransmission AccountType = "Transmission"
+)
+
type AddressMeta struct {
Label string `json:"label"`
Value string `json:"value"`
}
+type BankAccountType string
+
+const (
+ BankAccountTypeCurrentcheque BankAccountType = "Current/Cheque"
+ BankAccountTypeSavings BankAccountType = "Savings"
+ BankAccountTypeTransmission BankAccountType = "Transmission"
+)
+
type Candle struct {
// Closing price
Close decimal.Decimal `json:"close"`
@@ -566,15 +582,32 @@ type Withdrawal struct {
}
type beneficiary struct {
- BankAccountBranch string `json:"bank_account_branch"`
- BankAccountNumber string `json:"bank_account_number"`
- BankAccountType string `json:"bank_account_type"`
- BankCountry string `json:"bank_country"`
- BankName string `json:"bank_name"`
- BankRecipient string `json:"bank_recipient"`
- CreatedAt int64 `json:"created_at"`
- Id string `json:"id"`
- SupportsFastWithdrawals bool `json:"supports_fast_withdrawals"`
+ // Bank branch code
+ BankAccountBranch string `json:"bank_account_branch"`
+
+ // Beneficiary bank account number
+ BankAccountNumber string `json:"bank_account_number"`
+
+ // Bank account type
+ BankAccountType BankAccountType `json:"bank_account_type"`
+
+ // Bank country of origin
+ BankCountry string `json:"bank_country"`
+
+ // Bank SWIFT code
+ BankName string `json:"bank_name"`
+
+ // The owner of the recipient account
+ BankRecipient string `json:"bank_recipient"`
+
+ // Time of beneficiary creation
+ CreatedAt int64 `json:"created_at"`
+
+ // Unique id referencing beneficiary
+ Id string `json:"id"`
+
+ // If the bank account supports fast withdrawals
+ SupportsFastWithdrawals bool `json:"supports_fast_withdrawals"`
}
// vi: ft=go