Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Inconsistent return types #149

@PaperMtn

Description

@PaperMtn

The Problem

For list_ functions, there is no consistent return type. Some return a dict formatted as:

{'key': [{foo}, {bar}]}

Examples:

  • ChronicleClient.list_rules()
  • ChronicleClient.list_dashboards()

Where others return a list of results:

[{foo}, {bar}]

Examples:

  • ChronicleClient.list_data_tables()
  • ChronicleClient.list_feeds()

This inconsistency makes it harder for users to predict function behaviour and integrate results smoothly.

Potential Solution

Adopt a standard return type for all list operations.

Recommendation:
Return a flat list whenever possible. This approach:

  • Aligns with common Python SDK conventions
  • Keeps results predictable and iterable
  • Works naturally with built-in operations like slicing and filtering

To ensure consistency, a shared utility function could be introduced to handle list responses. Additionally, a centralised paginated_request helper will standardise pagination logic across modules.

Potential Impact

This could be a breaking change for current users of the SDK that are using functions currently returning dictionaries. Considering the project still hasn’t had a major release, this may be an acceptable/expected disruption.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions