CategoryServiceType

public protocol CategoryServiceType : Sendable

Provides access to category operations

  • categories(planId:lastKnowledgeOfServer:) Default implementation, asynchronous

    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).

    Default Implementation

    Returns a list of plan categories, with optional parameters defaulted.

    Declaration

    Swift

    func categories(
        planId: String,
        lastKnowledgeOfServer: ServerKnowledge?
    ) async throws -> CategoriesResponse

    Parameters

    planId

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

    lastKnowledgeOfServer

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

    Return Value

    A list of category groups and the knowledge of the server

  • Returns a single category.

    Amounts (budgeted, activity, balance, etc.) are specific to the current plan month (UTC).

    Declaration

    Swift

    func category(planId: String, categoryId: String) async throws -> Category

    Parameters

    planId

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

    categoryId

    The id of the category

    Return Value

    A single category

  • Returns a single category for a specific plan month.

    Declaration

    Swift

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

    Parameters

    planId

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

    month

    The plan 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

    func updateCategory(
        planId: String,
        categoryId: String,
        category: SaveCategory
    ) async throws -> CategoryResponse

    Parameters

    planId

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

    categoryId

    The id of the category

    category

    The category details to be saved

    Return Value

    The updated category and the knowledge of the server

  • Update a category for a specific month.

    Declaration

    Swift

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

    Parameters

    planId

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

    month

    The plan 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

    func createCategory(
        planId: String,
        category: NewCategory
    ) async throws -> CategoryResponse

    Parameters

    planId

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

    category

    The category to create

    Return Value

    The created category and the knowledge of the server

  • Create a new category group

    Declaration

    Swift

    func createCategoryGroup(
        planId: String,
        categoryGroup: SaveCategoryGroup
    ) async throws -> CategoryGroupResponse

    Parameters

    planId

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

    categoryGroup

    The category group to create

    Return Value

    The created category group and the knowledge of the server

  • Update a category group

    Declaration

    Swift

    func updateCategoryGroup(
        planId: String,
        categoryGroupId: String,
        categoryGroup: SaveCategoryGroup
    ) async throws -> CategoryGroupResponse

    Parameters

    planId

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

    categoryGroupId

    The id of the category group

    categoryGroup

    The category group details to be saved

    Return Value

    The updated category group and the knowledge of the server