CategoryService

public struct CategoryService

Provides access to category operations

  • 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

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    lastKnowledgeOfServer

    If provided, only entities that have changed since lastKnowledgeOfServer will be included.

    Return Value

    A list of category groups

  • 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 -> Category

    Parameters

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    categoryId

    The id of the category

    Return Value

    A single category

  • Returns a single category for a specific budget month.

    Declaration

    Swift

    public func category(
        budgetId: String,
        month: String,
        categoryId: String
    ) async throws -> Category

    Parameters

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    month

    The budget month in ISO format (e.g. 2016-12-01) (“current” can also be used to specify the current calendar month (UTC))

    categoryId

    The id of the category

    Return Value

    A single category

  • Update a category

    Declaration

    Swift

    public func updateCategory(
        budgetId: String,
        categoryId: String,
        category: SaveCategory
    ) async throws -> (Category, ServerKnowledge)

    Parameters

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    categoryId

    The id of the category

    category

    The category details to be saved

    Return Value

    A single category

  • Update a category for a specific month.

    Declaration

    Swift

    public func updateCategory(
        budgetId: String,
        month: String,
        categoryId: String,
        budgeted: Int
    ) async throws -> Category

    Parameters

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    month

    The budget month in ISO format (e.g. 2016-12-01) (“current” can also be used to specify the current calendar month (UTC))

    categoryId

    The id of the category

    budgeted

    Budgeted amount for the category

    Return Value

    A single category

  • Create a new category

    Declaration

    Swift

    public func createCategory(
        budgetId: String,
        category: SaveCategory
    ) async throws -> (Category, ServerKnowledge)

    Parameters

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    category

    The category to create. Must include name and categoryGroupId.

    Return Value

    The created category and the server knowledge

  • Create a new category group

    Declaration

    Swift

    public func createCategoryGroup(
        budgetId: String,
        categoryGroup: SaveCategoryGroup
    ) async throws -> (CategoryGroup, ServerKnowledge)

    Parameters

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    categoryGroup

    The 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

    budgetId

    The id of the budget (last_used can also be used to specify the last used budget)

    categoryGroupId

    The id of the category group

    categoryGroup

    The category group details to be saved

    Return Value

    The updated category group and the server knowledge