(Accounting.LedgerAccounts)
- List - List Ledger Accounts
- Create - Create Ledger Account
- Get - Get Ledger Account
- Update - Update Ledger Account
- Delete - Delete Ledger Account
List Ledger Accounts
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/types"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.LedgerAccounts.List(ctx, operations.AccountingLedgerAccountsAllRequest{
ServiceID: sdkgo.String("salesforce"),
Filter: &components.LedgerAccountsFilter{
UpdatedSince: types.MustNewTimeFromString("2020-09-30T07:43:32.000Z"),
},
Sort: &components.LedgerAccountsSort{
By: components.LedgerAccountsSortByUpdatedAt.ToPointer(),
},
PassThrough: map[string]any{
"search": "San Francisco",
},
Fields: sdkgo.String("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetLedgerAccountsResponse != nil {
for {
// handle items
res, err = res.Next()
if err != nil {
// handle error
}
if res == nil {
break
}
}
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingLedgerAccountsAllRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingLedgerAccountsAllResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Create Ledger Account
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/types"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.LedgerAccounts.Create(ctx, operations.AccountingLedgerAccountsAddRequest{
ServiceID: sdkgo.String("salesforce"),
LedgerAccount: components.LedgerAccountInput{
DisplayID: sdkgo.String("1-12345"),
Code: sdkgo.String("453"),
Classification: components.ClassificationAsset.ToPointer(),
Type: components.LedgerAccountTypeBank.ToPointer(),
SubType: sdkgo.String("CHECKING_ACCOUNT"),
Name: sdkgo.String("Bank account"),
FullyQualifiedName: sdkgo.String("Asset.Bank.Checking_Account"),
Description: sdkgo.String("Main checking account"),
OpeningBalance: sdkgo.Float64(75000),
CurrentBalance: sdkgo.Float64(20000),
Currency: components.CurrencyUsd.ToPointer(),
TaxType: sdkgo.String("NONE"),
TaxRate: &components.LinkedTaxRateInput{
ID: sdkgo.String("123456"),
Rate: sdkgo.Float64(10),
},
Level: sdkgo.Float64(1),
Active: sdkgo.Bool(true),
Status: components.AccountStatusActive.ToPointer(),
Header: sdkgo.Bool(true),
BankAccount: &components.BankAccount{
BankName: sdkgo.String("Monzo"),
AccountNumber: sdkgo.String("123465"),
AccountName: sdkgo.String("SPACEX LLC"),
AccountType: components.AccountTypeCreditCard.ToPointer(),
Iban: sdkgo.String("CH2989144532982975332"),
Bic: sdkgo.String("AUDSCHGGXXX"),
RoutingNumber: sdkgo.String("012345678"),
BsbNumber: sdkgo.String("062-001"),
BranchIdentifier: sdkgo.String("001"),
BankCode: sdkgo.String("BNH"),
Currency: components.CurrencyUsd.ToPointer(),
},
ParentAccount: &components.ParentAccount{
ID: sdkgo.String("12345"),
Name: sdkgo.String("Bank Accounts"),
DisplayID: sdkgo.String("1-1100"),
},
SubAccount: sdkgo.Bool(false),
LastReconciliationDate: types.MustNewDateFromString("2020-09-30"),
CustomFields: []components.CustomField{
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueFour(
components.Four{},
)),
},
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueBoolean(
true,
)),
},
},
RowVersion: sdkgo.String("1-12345"),
PassThrough: []components.PassThroughBody{
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.CreateLedgerAccountResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingLedgerAccountsAddRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingLedgerAccountsAddResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Get Ledger Account
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.LedgerAccounts.Get(ctx, operations.AccountingLedgerAccountsOneRequest{
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
Fields: sdkgo.String("id,updated_at"),
})
if err != nil {
log.Fatal(err)
}
if res.GetLedgerAccountResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingLedgerAccountsOneRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingLedgerAccountsOneResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Update Ledger Account
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/components"
"github.com/apideck-libraries/sdk-go/types"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.LedgerAccounts.Update(ctx, operations.AccountingLedgerAccountsUpdateRequest{
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
LedgerAccount: components.LedgerAccountInput{
DisplayID: sdkgo.String("1-12345"),
Code: sdkgo.String("453"),
Classification: components.ClassificationAsset.ToPointer(),
Type: components.LedgerAccountTypeBank.ToPointer(),
SubType: sdkgo.String("CHECKING_ACCOUNT"),
Name: sdkgo.String("Bank account"),
FullyQualifiedName: sdkgo.String("Asset.Bank.Checking_Account"),
Description: sdkgo.String("Main checking account"),
OpeningBalance: sdkgo.Float64(75000),
CurrentBalance: sdkgo.Float64(20000),
Currency: components.CurrencyUsd.ToPointer(),
TaxType: sdkgo.String("NONE"),
TaxRate: &components.LinkedTaxRateInput{
ID: sdkgo.String("123456"),
Rate: sdkgo.Float64(10),
},
Level: sdkgo.Float64(1),
Active: sdkgo.Bool(true),
Status: components.AccountStatusActive.ToPointer(),
Header: sdkgo.Bool(true),
BankAccount: &components.BankAccount{
BankName: sdkgo.String("Monzo"),
AccountNumber: sdkgo.String("123465"),
AccountName: sdkgo.String("SPACEX LLC"),
AccountType: components.AccountTypeCreditCard.ToPointer(),
Iban: sdkgo.String("CH2989144532982975332"),
Bic: sdkgo.String("AUDSCHGGXXX"),
RoutingNumber: sdkgo.String("012345678"),
BsbNumber: sdkgo.String("062-001"),
BranchIdentifier: sdkgo.String("001"),
BankCode: sdkgo.String("BNH"),
Currency: components.CurrencyUsd.ToPointer(),
},
ParentAccount: &components.ParentAccount{
ID: sdkgo.String("12345"),
Name: sdkgo.String("Bank Accounts"),
DisplayID: sdkgo.String("1-1100"),
},
SubAccount: sdkgo.Bool(false),
LastReconciliationDate: types.MustNewDateFromString("2020-09-30"),
CustomFields: []components.CustomField{
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueFour(
components.Four{},
)),
},
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueBoolean(
true,
)),
},
components.CustomField{
ID: sdkgo.String("2389328923893298"),
Name: sdkgo.String("employee_level"),
Description: sdkgo.String("Employee Level"),
Value: sdkgo.Pointer(components.CreateValueArrayOf6(
[]components.Six{
components.Six{},
components.Six{},
},
)),
},
},
RowVersion: sdkgo.String("1-12345"),
PassThrough: []components.PassThroughBody{
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
components.PassThroughBody{
ServiceID: "<id>",
ExtendPaths: []components.ExtendPaths{
components.ExtendPaths{
Path: "$.nested.property",
Value: map[string]any{
"TaxClassificationRef": map[string]any{
"value": "EUC-99990201-V1-00020000",
},
},
},
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
if res.UpdateLedgerAccountResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingLedgerAccountsUpdateRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingLedgerAccountsUpdateResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |
Delete Ledger Account
package main
import(
"context"
"os"
sdkgo "github.com/apideck-libraries/sdk-go"
"github.com/apideck-libraries/sdk-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := sdkgo.New(
sdkgo.WithSecurity(os.Getenv("APIDECK_API_KEY")),
sdkgo.WithConsumerID("test-consumer"),
sdkgo.WithAppID("dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX"),
)
res, err := s.Accounting.LedgerAccounts.Delete(ctx, operations.AccountingLedgerAccountsDeleteRequest{
ID: "<id>",
ServiceID: sdkgo.String("salesforce"),
})
if err != nil {
log.Fatal(err)
}
if res.DeleteLedgerAccountResponse != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AccountingLedgerAccountsDeleteRequest | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AccountingLedgerAccountsDeleteResponse, error
Error Type | Status Code | Content Type |
---|---|---|
apierrors.BadRequestResponse | 400 | application/json |
apierrors.UnauthorizedResponse | 401 | application/json |
apierrors.PaymentRequiredResponse | 402 | application/json |
apierrors.NotFoundResponse | 404 | application/json |
apierrors.UnprocessableResponse | 422 | application/json |
apierrors.APIError | 4XX, 5XX | */* |