CategoryService
public struct CategoryService
Provides access to category operations
-
categories(budgetId:AsynchronouslastKnowledgeOfServer: ) Returns a list of budget categories.
Returns all categories grouped by category group. Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).
Declaration
Swift
public func categories( budgetId: String, lastKnowledgeOfServer: ServerKnowledge? = nil ) async throws -> ([CategoryGroupWithCategories], ServerKnowledge)Parameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
lastKnowledgeOfServerIf provided, only entities that have changed since
lastKnowledgeOfServerwill be included.Return Value
A list of category groups
-
category(budgetId:AsynchronouscategoryId: ) Returns a single category.
Amounts (budgeted, activity, balance, etc.) are specific to the current budget month (UTC).
Declaration
Swift
public func category(budgetId: String, categoryId: String) async throws -> CategoryParameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
categoryIdThe id of the category
Return Value
A single category
-
category(budgetId:Asynchronousmonth: categoryId: ) Returns a single category for a specific budget month.
Declaration
Swift
public func category( budgetId: String, month: String, categoryId: String ) async throws -> CategoryParameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
monthThe budget month in ISO format (e.g. 2016-12-01) (“current” can also be used to specify the current calendar month (UTC))
categoryIdThe id of the category
Return Value
A single category
-
updateCategory(budgetId:AsynchronouscategoryId: category: ) Update a category
Declaration
Swift
public func updateCategory( budgetId: String, categoryId: String, category: SaveCategory ) async throws -> (Category, ServerKnowledge)Parameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
categoryIdThe id of the category
categoryThe category details to be saved
Return Value
A single category
-
updateCategory(budgetId:Asynchronousmonth: categoryId: budgeted: ) Update a category for a specific month.
Declaration
Swift
public func updateCategory( budgetId: String, month: String, categoryId: String, budgeted: Int ) async throws -> CategoryParameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
monthThe budget month in ISO format (e.g. 2016-12-01) (“current” can also be used to specify the current calendar month (UTC))
categoryIdThe id of the category
budgetedBudgeted amount for the category
Return Value
A single category
-
createCategory(budgetId:Asynchronouscategory: ) Create a new category
Declaration
Swift
public func createCategory( budgetId: String, category: SaveCategory ) async throws -> (Category, ServerKnowledge)Parameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
categoryThe category to create. Must include
nameandcategoryGroupId.Return Value
The created category and the server knowledge
-
createCategoryGroup(budgetId:AsynchronouscategoryGroup: ) Create a new category group
Declaration
Swift
public func createCategoryGroup( budgetId: String, categoryGroup: SaveCategoryGroup ) async throws -> (CategoryGroup, ServerKnowledge)Parameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
categoryGroupThe category group to create
Return Value
The created category group and the server knowledge
-
Update a category group
Declaration
Swift
public func updateCategoryGroup( budgetId: String, categoryGroupId: String, categoryGroup: SaveCategoryGroup ) async throws -> (CategoryGroup, ServerKnowledge)Parameters
budgetIdThe id of the budget (last_used can also be used to specify the last used budget)
categoryGroupIdThe id of the category group
categoryGroupThe category group details to be saved
Return Value
The updated category group and the server knowledge
View on GitHub