Documentation
¶
Index ¶
- type Balance
- type Category
- type Client
- func (c *Client) CreateExpense(p CreateExpenseParams) (*Expense, error)
- func (c *Client) CreatePayment(p CreateExpenseParams) (*Expense, error)
- func (c *Client) DeleteExpense(id int64) error
- func (c *Client) GetCurrentUser() (*User, error)
- func (c *Client) GetExpenses(p GetExpensesParams) ([]Expense, error)
- func (c *Client) GetFriends() ([]Friend, error)
- func (c *Client) GetGroup(id int64) (*Group, error)
- func (c *Client) GetGroups() ([]Group, error)
- func (c *Client) ResolveFriendByName(name string) (*Friend, error)
- func (c *Client) ResolveGroupByName(name string) (*Group, error)
- type CreateExpenseParams
- type Debt
- type Expense
- type ExpenseShare
- type Friend
- type FriendGroup
- type GetExpensesParams
- type Group
- type GroupMember
- type Repayment
- type ShareParam
- type User
- type UserPicture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a Splitwise API client.
func (*Client) CreateExpense ¶
func (c *Client) CreateExpense(p CreateExpenseParams) (*Expense, error)
CreateExpense creates a new expense.
func (*Client) CreatePayment ¶
func (c *Client) CreatePayment(p CreateExpenseParams) (*Expense, error)
CreatePayment records a settlement (payment) between users.
func (*Client) DeleteExpense ¶
DeleteExpense deletes an expense by ID.
func (*Client) GetCurrentUser ¶
GetCurrentUser returns the authenticated user.
func (*Client) GetExpenses ¶
func (c *Client) GetExpenses(p GetExpensesParams) ([]Expense, error)
GetExpenses returns expenses matching the given criteria.
func (*Client) GetFriends ¶
GetFriends returns all friends for the current user.
func (*Client) ResolveFriendByName ¶
ResolveFriendByName finds a friend by name (case-insensitive).
type CreateExpenseParams ¶
type CreateExpenseParams struct {
Description string
Cost string
CurrencyCode string
GroupID int64
SplitEqually bool
Date string
Shares []ShareParam
}
CreateExpenseParams holds parameters for creating an expense.
type Debt ¶
type Debt struct {
From int64 `json:"from"`
To int64 `json:"to"`
Amount string `json:"amount"`
CurrencyCode string `json:"currency_code"`
}
Debt represents a debt between two users.
type Expense ¶
type Expense struct {
ID int64 `json:"id"`
GroupID *int64 `json:"group_id"`
Description string `json:"description"`
Cost string `json:"cost"`
CurrencyCode string `json:"currency_code"`
Date string `json:"date"`
Payment bool `json:"payment"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
DeletedAt *string `json:"deleted_at"`
Details *string `json:"details"`
Repayments []Repayment `json:"repayments"`
Users []ExpenseShare `json:"users"`
Category *Category `json:"category"`
CreatedBy *User `json:"created_by"`
}
Expense represents a Splitwise expense.
type ExpenseShare ¶
type ExpenseShare struct {
}
type Friend ¶
type Friend struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
Balance []Balance `json:"balance"`
Groups []FriendGroup `json:"groups"`
}
Friend represents a Splitwise friend.
type FriendGroup ¶
type GetExpensesParams ¶
type GetExpensesParams struct {
GroupID int64
FriendID int64
DatedAfter string
DatedBefore string
Limit int
Offset int
}
GetExpensesParams holds query parameters for listing expenses.
type Group ¶
type Group struct {
ID int64 `json:"id"`
Name string `json:"name"`
GroupType string `json:"group_type"`
UpdatedAt string `json:"updated_at"`
SimplifyByDefault bool `json:"simplify_by_default"`
Members []GroupMember `json:"members"`
OriginalDebts []Debt `json:"original_debts"`
SimplifiedDebts []Debt `json:"simplified_debts"`
InviteLink string `json:"invite_link,omitempty"`
}
Group represents a Splitwise group.
type GroupMember ¶
type GroupMember struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
Balance []Balance `json:"balance"`
}
GroupMember is a user with group-specific balance info.
type ShareParam ¶
type ShareParam struct {
}
type User ¶
type User struct {
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email string `json:"email"`
RegistrationStatus string `json:"registration_status"`
DefaultCurrency string `json:"default_currency,omitempty"`
Locale string `json:"locale,omitempty"`
NotificationsCount int `json:"notifications_count,omitempty"`
Picture *UserPicture `json:"picture,omitempty"`
}
User represents a Splitwise user.