id: freshservice
name: Freshservice
version: 1.0.0
description: "Freshservice (REST API v2) — IT service management: create, read, update and list tickets, add notes (public or private), and list agents. API-key (Basic) authentication; stdlib-only, no extra Python dependencies."
changelog: "1.0.0 — Initial release: create/get/update/list tickets, add note, list agents."
category: ticketing

# Per-instance configuration. Auth is HTTP Basic with '<api_key>:X'.
config_schema:
  properties:
    domain:
      type: string
      description: "Freshservice domain (the X in https://X.freshservice.com)"
    api_key:
      type: string
      description: "Freshservice API key"
      x-soar-sensitive: true
  required:
    - domain
    - api_key

commands:
  - id: create_ticket
    name: freshservice-create-ticket
    description: "Create a ticket."
    inputs_schema:
      properties:
        subject: { type: string, description: "Ticket subject" }
        description: { type: string, description: "Ticket description (HTML allowed)" }
        email: { type: string, description: "Requester email" }
        priority: { type: number, description: "1 (low) - 4 (urgent), default 1" }
        status: { type: number, description: "2 (open) - 5 (closed), default 2" }
        tags: { type: string, description: "Comma-separated tags" }
      required: [subject, description, email]
    outputs_schema: { properties: {} }
  - id: get_ticket
    name: freshservice-get-ticket
    description: "Get a ticket by ID."
    risk: read
    inputs_schema:
      properties:
        ticket_id: { type: string, description: "Ticket ID" }
      required: [ticket_id]
    outputs_schema: { properties: {} }
  - id: update_ticket
    name: freshservice-update-ticket
    description: "Update a ticket (status, priority, or assignment)."
    inputs_schema:
      properties:
        ticket_id: { type: string, description: "Ticket ID" }
        status: { type: number, description: "2 (open) - 5 (closed)" }
        priority: { type: number, description: "1-4" }
        responder_id: { type: string, description: "Assigned agent ID" }
      required: [ticket_id]
    outputs_schema: { properties: {} }
  - id: list_tickets
    name: freshservice-list-tickets
    description: "List tickets."
    risk: read
    inputs_schema:
      properties:
        page: { type: number, description: "Page number (default 1)" }
        per_page: { type: number, description: "Page size (default 30, max 100)" }
      required: []
    outputs_schema: { properties: {} }
  - id: add_note
    name: freshservice-add-note
    description: "Add a note to a ticket (public or private)."
    inputs_schema:
      properties:
        ticket_id: { type: string, description: "Ticket ID" }
        body: { type: string, description: "Note body (HTML allowed)" }
        private: { type: boolean, description: "Private note (default true)" }
      required: [ticket_id, body]
    outputs_schema: { properties: {} }
  - id: list_agents
    name: freshservice-list-agents
    description: "List agents."
    risk: read
    inputs_schema:
      properties:
        email: { type: string, description: "Optional email filter" }
      required: []
    outputs_schema: { properties: {} }

  - id: test_connection
    name: freshservice-test-connection
    description: "Verify connectivity and the API key (used by the Test button)."
    risk: read
    inputs_schema:
      properties: {}
      required: []
    outputs_schema: { properties: {} }
