Documentation ¶
Index ¶
- Constants
- type CreateDebtAttributes
- type CreateDebtData
- type CreateDebtRequest
- type CreateDebtResponse
- type CreateEntryAttributes
- type CreateEntryData
- type CreateEntryRequest
- type CreateEntryResponse
- type CreateExpenseAttributes
- type CreateExpenseData
- type CreateExpenseRequest
- type CreateExpenseResponse
- type DebtAtrributes
- type DebtData
- type DebtLinks
- type DebtListItemData
- type DebtListItemLinks
- type DefaultLinks
- type DeleteDebtRequest
- type DeleteDebtResponse
- type DeleteEntryRequest
- type DeleteEntryResponse
- type DeleteExpenseRequest
- type DeleteExpenseResponse
- type EntryAtrributes
- type EntryData
- type EntryExpenseRelationship
- type EntryExpenseRelationshipLinks
- type EntryLinks
- type EntryListItemData
- type EntryListItemLinks
- type EntryMeta
- type EntryRelationships
- type Error
- type ErrorResponse
- type ExpenseAttributes
- type ExpenseData
- type ExpenseEntryRelationship
- type ExpenseEntryRelationshipLinks
- type ExpenseLinks
- type ExpenseListItemData
- type ExpenseListItemLinks
- type ExpenseRelationships
- type GetDebtRequest
- type GetDebtResponse
- type GetEntryRequest
- type GetEntryResponse
- type GetExpenseRequest
- type GetExpenseResponse
- type GetTotalParams
- type GetTotalResponse
- type HomeLink
- type LinkWithDetails
- type ListDebtLinks
- type ListDebtParams
- type ListDebtResponse
- type ListEntryLinks
- type ListEntryParams
- type ListEntryResponse
- type ListExpenseItemLinks
- type ListExpenseLinks
- type ListExpenseParams
- type ListExpenseResponse
- type MonetaryMutableValueAttributes
- type MonetaryValueAttributes
- type MonetaryValueCreationAttributes
- type PingLinks
- type PingResponse
- type ResourceID
- type Timestamps
- type TotalData
- type UpdateDebtAttributes
- type UpdateDebtData
- type UpdateDebtRequest
- type UpdateDebtResponse
- type UpdateEntryAttributes
- type UpdateEntryData
- type UpdateEntryRequest
- type UpdateEntryResponse
- type UpdateExpenseAttributes
- type UpdateExpenseData
- type UpdateExpenseRequest
- type UpdateExpenseResponse
Constants ¶
const DebtType = "debt"
const EntryType = "entry"
const ExpenseType = "expense"
const TotalType = "total"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateDebtAttributes ¶
type CreateDebtAttributes struct { Value MonetaryValueCreationAttributes `json:"value"` Person string `json:"person"` Details string `json:"details"` }
type CreateDebtData ¶
type CreateDebtData struct { Type string `json:"type"` Attributes CreateDebtAttributes `json:"attributes"` }
type CreateDebtRequest ¶
type CreateDebtRequest struct {
Data CreateDebtData `json:"data"`
}
type CreateDebtResponse ¶
type CreateDebtResponse struct { Data DebtData `json:"data"` Links DefaultLinks `json:"links"` }
type CreateEntryAttributes ¶
type CreateEntryData ¶
type CreateEntryData struct { Type string `json:"type" ` Attributes CreateEntryAttributes `json:"attributes"` }
type CreateEntryRequest ¶
type CreateEntryRequest struct {
Data CreateEntryData `json:"data"`
}
type CreateEntryResponse ¶
type CreateEntryResponse struct {
Data EntryData `json:"data"`
}
type CreateExpenseAttributes ¶
type CreateExpenseAttributes struct { Value MonetaryValueCreationAttributes `json:"value"` Name string `json:"name"` Description *string `json:"description,omitempty"` PaymentMethod *string `json:"payment_method,omitempty"` }
type CreateExpenseData ¶
type CreateExpenseData struct { Type string `json:"type"` Attributes CreateExpenseAttributes `json:"attributes"` }
type CreateExpenseRequest ¶
type CreateExpenseRequest struct {
Data CreateExpenseData `json:"data"`
}
type CreateExpenseResponse ¶
type CreateExpenseResponse struct {
Data ExpenseData `json:"data"`
}
type DebtAtrributes ¶
type DebtAtrributes struct { Person string `json:"person"` Value MonetaryValueAttributes `json:"value"` Details string `json:"details"` Timestamps }
type DebtData ¶
type DebtData struct { ResourceID Attributes DebtAtrributes `json:"attributes"` Links DebtLinks `json:"links"` }
type DebtListItemData ¶
type DebtListItemData struct { ResourceID Attributes DebtAtrributes `json:"attributes"` Links DebtListItemLinks `json:"links"` }
type DebtListItemLinks ¶
type DebtListItemLinks struct {
Self string `json:"self"`
}
type DefaultLinks ¶
type DefaultLinks struct {
Home string `json:"home"`
}
DefaultLinks allow the user to navigate back to the home page of the API.
type DeleteDebtRequest ¶
type DeleteDebtRequest struct { }
type DeleteDebtResponse ¶
type DeleteDebtResponse struct {
Data DebtData `json:"data"`
}
type DeleteEntryRequest ¶
type DeleteEntryRequest struct { }
type DeleteEntryResponse ¶
type DeleteEntryResponse struct {
Data EntryData `json:"data"`
}
type DeleteExpenseRequest ¶
type DeleteExpenseRequest struct { }
type DeleteExpenseResponse ¶
type DeleteExpenseResponse struct {
Data ExpenseData `json:"data"`
}
type EntryAtrributes ¶
type EntryAtrributes struct { Month int `json:"month"` Year int `json:"year"` Category string `json:"category"` Subcategory string `json:"subcategory"` ExpectedTotal MonetaryValueAttributes `json:"expected_total"` Recurring bool `json:"recurring"` Timestamps }
type EntryData ¶
type EntryData struct { ResourceID Attributes EntryAtrributes `json:"attributes"` Meta EntryMeta `json:"meta"` Links EntryLinks `json:"links"` Relationships EntryRelationships `json:"relationships"` }
type EntryExpenseRelationship ¶
type EntryExpenseRelationship struct {
Links EntryExpenseRelationshipLinks `json:"links"`
}
type EntryExpenseRelationshipLinks ¶
type EntryExpenseRelationshipLinks struct {
Related string `json:"related"`
}
type EntryLinks ¶
type EntryLinks struct {
Self string `json:"self"`
}
type EntryListItemData ¶
type EntryListItemData struct { ResourceID Attributes EntryAtrributes `json:"attributes"` Meta EntryMeta `json:"meta"` Links EntryListItemLinks `json:"links"` Relationships EntryRelationships `json:"relationships"` }
type EntryListItemLinks ¶
type EntryListItemLinks struct {
Self string `json:"self"`
}
type EntryRelationships ¶
type EntryRelationships struct {
Expenses EntryExpenseRelationship `json:"expenses"`
}
type Error ¶
type Error struct { Status int `json:"status"` Title string `json:"title"` Detail string `json:"detail"` }
func (Error) Error ¶
Error implements the error interface for public errors. This has two benefits:
- Go clients of the casheer API can unwrap the error from an ErrorResponse to an actual error; - In handlers that contain operations such as transactions, a public error can be set directly inside the transaction. Callers can check if that operation return a public error directly, instead of having to build one based on some internal errors encountered in the transaction.
type ErrorResponse ¶
type ErrorResponse struct {
Err Error `json:"error"`
}
Error represents an error message that is sent to the client in case the HTTP request returns an error.
The error message is modelled after the jsonapi specification: https://jsonapi.org/format/#error-objects. Many of the suggested fields had not been included, since they were unnecessary for the size of this project. In production, however, it is generally a good idea to stick to a well-defined standard.
See the Error struct below for the actual error content.
func (ErrorResponse) Error ¶
func (e ErrorResponse) Error() string
Error implements the error interface for error responses. It allows go clients to treat error responses as actual errors, if desired.
func (ErrorResponse) Unwrap ¶
func (e ErrorResponse) Unwrap() error
Unwrap is useful for go API clients, allowing to retrieve the underlying public error directly from the error response.
type ExpenseAttributes ¶
type ExpenseAttributes struct { Value MonetaryValueAttributes `json:"value"` Name string `json:"name"` Description string `json:"description"` PaymentMethod string `json:"payment_method"` Timestamps }
type ExpenseData ¶
type ExpenseData struct { ResourceID Attributes ExpenseAttributes `json:"attributes"` Links ExpenseLinks `json:"links"` Relationships ExpenseRelationships `json:"relationships"` }
type ExpenseEntryRelationship ¶
type ExpenseEntryRelationship struct {
Links ExpenseEntryRelationshipLinks `json:"links"`
}
type ExpenseEntryRelationshipLinks ¶
type ExpenseEntryRelationshipLinks struct {
Related string `json:"related"`
}
type ExpenseLinks ¶
type ExpenseLinks struct {
Self string `json:"self"`
}
type ExpenseListItemData ¶
type ExpenseListItemData struct { ResourceID Attributes ExpenseAttributes `json:"attributes"` Links ExpenseListItemLinks `json:"links"` }
type ExpenseListItemLinks ¶
type ExpenseListItemLinks struct {
Self string `json:"self"`
}
type ExpenseRelationships ¶
type ExpenseRelationships struct {
Entries ExpenseEntryRelationship `json:"entries"`
}
type GetDebtRequest ¶
type GetDebtRequest struct { }
type GetDebtResponse ¶
type GetDebtResponse struct {
Data DebtData `json:"data"`
}
type GetEntryRequest ¶
type GetEntryRequest struct { }
type GetEntryResponse ¶
type GetEntryResponse struct {
Data EntryData `json:"data"`
}
type GetExpenseRequest ¶
type GetExpenseRequest struct { }
type GetExpenseResponse ¶
type GetExpenseResponse struct {
Data ExpenseData `json:"data"`
}
type GetTotalParams ¶
type GetTotalResponse ¶
type GetTotalResponse struct {
Data TotalData `json:"data"`
}
type LinkWithDetails ¶
type ListDebtLinks ¶
type ListDebtParams ¶
type ListDebtParams struct {
Person *string `form:"person,omitempty"`
}
type ListDebtResponse ¶
type ListDebtResponse struct { Data []DebtListItemData `json:"data"` Links ListDebtLinks `json:"links"` }
type ListEntryLinks ¶
type ListEntryParams ¶
type ListEntryResponse ¶
type ListEntryResponse struct { Data []EntryListItemData `json:"data"` Links ListEntryLinks `json:"links"` }
type ListExpenseItemLinks ¶
type ListExpenseItemLinks struct {
Self string `json:"self"`
}
type ListExpenseLinks ¶
type ListExpenseParams ¶
type ListExpenseParams struct { AmountGt *int `json:"amount[gt],omitempty"` AmountLt *int `json:"amount[lt],omitempty"` Currency *string `json:"currency,omitempty"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` PaymentMethod *string `json:"payment_method,omitempty"` }
type ListExpenseResponse ¶
type ListExpenseResponse struct { Data []ExpenseListItemData `json:"data"` Links ListExpenseLinks `json:"links"` }
type MonetaryMutableValueAttributes ¶
type MonetaryMutableValueAttributes struct { Amount *int `json:"amount,omitempty"` Currency *string `json:"currency,omitempty"` Exponent *int `json:"exponent,omitempty"` }
MonetaryMutableValueAttributes is the same as MonetaryValueAttributes, except that it holds the fields that are mutable.
type MonetaryValueAttributes ¶
type MonetaryValueAttributes struct { Amount int `json:"amount"` Currency string `json:"currency"` Exponent int `json:"exponent"` }
MonetaryValueAttributes are used to define the "value" of something in a currency agnostic manner.
type MonetaryValueCreationAttributes ¶
type MonetaryValueCreationAttributes struct { Amount int `json:"amount"` Currency string `json:"currency"` Exponent *int `json:"exponent,omitempty"` }
MonetaryValueCreationAttributes is the same as MonetaryValueAttributes, but it is used when creating such an object to highlight the optional fields.
type PingLinks ¶
type PingLinks struct { Entries LinkWithDetails `json:"entries"` Debts LinkWithDetails `json:"debts"` Totals LinkWithDetails `json:"totals"` }
type PingResponse ¶
type ResourceID ¶
type Timestamps ¶
type UpdateDebtAttributes ¶
type UpdateDebtAttributes struct { MonetaryMutableValueAttributes Person *string `json:"person,omitempty"` Details *string `json:"details,omitempty"` }
type UpdateDebtData ¶
type UpdateDebtData struct { Type string `json:"type"` Attributes UpdateDebtAttributes `json:"attributes"` }
type UpdateDebtRequest ¶
type UpdateDebtRequest struct {
Data UpdateDebtData `json:"data" `
}
type UpdateDebtResponse ¶
type UpdateDebtResponse struct {
Data DebtData `json:"data"`
}
type UpdateEntryAttributes ¶
type UpdateEntryAttributes struct { Month *int `json:"month,omitempty"` Year *int `json:"year,omitempty"` Category *string `json:"category,omitempty"` Subcategory *string `json:"subcategory,omitempty"` Recurring *bool `json:"recurring,omitempty"` ExpectedTotal MonetaryMutableValueAttributes `json:"expected_total,omitempty"` }
type UpdateEntryData ¶
type UpdateEntryData struct { Type string `json:"type"` Attributes UpdateEntryAttributes `json:"attributes"` }
type UpdateEntryRequest ¶
type UpdateEntryRequest struct {
Data UpdateEntryData `json:"data"`
}
type UpdateEntryResponse ¶
type UpdateEntryResponse struct {
Data EntryData `json:"data"`
}
type UpdateExpenseAttributes ¶
type UpdateExpenseAttributes struct { Value MonetaryMutableValueAttributes `json:"value"` Name *string `json:"name,omitempty"` Description *string `json:"description,omitempty"` PaymentMethod *string `json:"payment_method,omitempty"` }
type UpdateExpenseData ¶
type UpdateExpenseData struct { Type string `json:"type"` Attributes UpdateExpenseAttributes `json:"attributes"` }
type UpdateExpenseRequest ¶
type UpdateExpenseRequest struct {
Data UpdateExpenseData `json:"data" `
}
type UpdateExpenseResponse ¶
type UpdateExpenseResponse struct {
Data ExpenseData `json:"data"`
}