// ── SDK v2 — PositionsClient ─────────────────────────────────────────────────── // // Covers: // POST /v2/positions // GET /v2/positions // GET /v2/positions/:id // PATCH /v2/positions/:id // DELETE /v2/positions/:id import type { Fetcher } from "../http/fetcher"; import type { RequestOptions } from "../http/types"; import type { Position, PositionCreate, PositionUpdate, ListParams, Paginated, } from "../types/index"; export class PositionsClient { constructor(private readonly fetcher: Fetcher) {} /** * Lists positions with cursor pagination and optional DSL filtering. * * @example * ```ts * const page = await client.positions.list({ q: "team_id.eq:'team-abc'" }); * ``` */ list(params?: ListParams, opts?: RequestOptions): Promise> { return this.fetcher.list("/positions", params, opts); } /** * Creates a new position. * * @example * ```ts * const position = await client.positions.create({ team_id: "team-abc", name: "Senior Engineer" }); * ``` */ create(data: PositionCreate, opts?: RequestOptions): Promise { return this.fetcher.post("/positions", data, opts); } /** * Gets a single position by ID. * * @throws {NotFoundError} when no position with `id` exists. */ get(id: string, opts?: RequestOptions): Promise { return this.fetcher.get(`/positions/${id}`, undefined, opts); } /** * Partially updates a position. * * @throws {NotFoundError} when no position with `id` exists. */ update(id: string, data: PositionUpdate, opts?: RequestOptions): Promise { return this.fetcher.patch(`/positions/${id}`, data, opts); } /** * Deletes a position. * * @throws {NotFoundError} when no position with `id` exists. */ delete(id: string, opts?: RequestOptions): Promise { return this.fetcher.delete(`/positions/${id}`, opts); } }