CategoryService
public struct CategoryService
Provides access to category operations
-
categories(planId:AsynchronouslastKnowledgeOfServer: ) Returns a list of plan categories.
Returns all categories grouped by category group. Amounts (budgeted, activity, balance, etc.) are specific to the current plan month (UTC).
Declaration
Swift
public func categories( planId: String, lastKnowledgeOfServer: ServerKnowledge? = nil ) async throws -> ([CategoryGroupWithCategories], ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
lastKnowledgeOfServerIf provided, only entities that have changed since
lastKnowledgeOfServerwill be included.Return Value
A list of category groups
-
category(planId:AsynchronouscategoryId: ) Returns a single category.
Amounts (budgeted, activity, balance, etc.) are specific to the current plan month (UTC).
Declaration
Swift
public func category(planId: String, categoryId: String) async throws -> CategoryParameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
categoryIdThe id of the category
Return Value
A single category
-
category(planId:Asynchronousmonth: categoryId: ) Returns a single category for a specific plan month.
Declaration
Swift
public func category( planId: String, month: String, categoryId: String ) async throws -> CategoryParameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
monthThe plan 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(planId:AsynchronouscategoryId: category: ) Update a category
Declaration
Swift
public func updateCategory( planId: String, categoryId: String, category: SaveCategory ) async throws -> (Category, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
categoryIdThe id of the category
categoryThe category details to be saved
Return Value
A single category
-
updateCategory(planId:Asynchronousmonth: categoryId: budgeted: ) Update a category for a specific month.
Declaration
Swift
public func updateCategory( planId: String, month: String, categoryId: String, budgeted: Int ) async throws -> CategoryParameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
monthThe plan 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(planId:Asynchronouscategory: ) Create a new category
Declaration
Swift
public func createCategory( planId: String, category: NewCategory ) async throws -> (Category, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
categoryThe category to create
Return Value
The created category and the server knowledge
-
createCategoryGroup(planId:AsynchronouscategoryGroup: ) Create a new category group
Declaration
Swift
public func createCategoryGroup( planId: String, categoryGroup: SaveCategoryGroup ) async throws -> (CategoryGroup, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
categoryGroupThe category group to create
Return Value
The created category group and the server knowledge
-
Update a category group
Declaration
Swift
public func updateCategoryGroup( planId: String, categoryGroupId: String, categoryGroup: SaveCategoryGroup ) async throws -> (CategoryGroup, ServerKnowledge)Parameters
planIdThe id of the plan (last_used can also be used to specify the last used plan)
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