OpenrelikWorkerCommon.Reporting.Report (openrelik_worker_common v0.1.0)

Copy Markdown View Source

Represents a task report (openrelik_worker_common.reporting.Report), inheriting behavior from MarkdownDocument.

Summary

Functions

Adds a section to the report.

Initializes a Report struct.

Generates a dictionary (string-keyed map) representation of the report.

Generates a JSON representation of the report.

Generates a Markdown representation of the report.

Types

t()

@type t() :: %OpenrelikWorkerCommon.Reporting.Report{
  fmt: OpenrelikWorkerCommon.Reporting.MarkdownFormatter.t(),
  priority: OpenrelikWorkerCommon.Reporting.Priority.t(),
  sections: [OpenrelikWorkerCommon.Reporting.MarkdownDocumentSection.t()],
  summary: String.t(),
  title: String.t() | nil
}

Functions

add_section(report)

Adds a section to the report.

Supports:

  • Report.add_section(report) -> {updated_report, section}
  • Report.add_section(report, %MarkdownDocumentSection{}) -> updated_report
  • Report.add_section(report, fn section -> ... end) -> updated_report

add_section(report, section)

new(title \\ nil, opts \\ [])

@spec new(String.t() | nil, keyword()) :: t()

Initializes a Report struct.

to_dict(report)

@spec to_dict(t()) :: %{required(String.t()) => term()}

Generates a dictionary (string-keyed map) representation of the report.

to_json(report)

@spec to_json(t()) :: String.t()

Generates a JSON representation of the report.

to_markdown(report)

@spec to_markdown(t()) :: String.t()

Generates a Markdown representation of the report.