/* generated using openapi-typescript-codegen -- do not edit */ /* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ import type { ApplicableOut } from '../models/ApplicableOut'; import type { CodeDetailOut } from '../models/CodeDetailOut'; import type { CodeDiffOut } from '../models/CodeDiffOut'; import type { CodeListOut } from '../models/CodeListOut'; import type { CodeSearchInput } from '../models/CodeSearchInput'; import type { CodeSearchOut } from '../models/CodeSearchOut'; import type { SectionAmendmentsOut } from '../models/SectionAmendmentsOut'; import type { SectionDetailOut } from '../models/SectionDetailOut'; import type { SectionsListOut } from '../models/SectionsListOut'; import type { CancelablePromise } from '../core/CancelablePromise'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; export class DataCodesService { /** * List all available building/electrical/plumbing/energy codes * List the 5 code families seeded in v1 with their default editions. * @returns CodeListOut Successful Response * @throws ApiError */ public static codesList(): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/codes/list', }); } /** * Get code metadata + adoption rollup stats * Return code metadata + per-edition adoption rollup across US jurisdictions. * @returns CodeDetailOut Successful Response * @throws ApiError */ public static codesGet({ codeId, }: { /** * Short code id: irc, ibc, nec, iecc, ipc */ codeId: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/codes/{code_id}', path: { 'code_id': codeId, }, errors: { 422: `Validation Error`, }, }); } /** * List sections for a code with optional filters * List sections with optional filters. Default edition = code's default_edition. * @returns SectionsListOut Successful Response * @throws ApiError */ public static codesListSections({ codeId, edition, chapter, topic, q, limit = 50, offset, }: { /** * Short code id */ codeId: string, /** * Edition filter (default: code's default_edition) */ edition?: (string | null), /** * Filter by chapter (e.g. '3', '7') */ chapter?: (string | null), /** * Filter by topic tag (matches if topic is in topic_tags) */ topic?: (string | null), /** * Full-text search on section_number/title/tags */ q?: (string | null), /** * Page size 1-200 */ limit?: number, /** * Skip N results */ offset?: number, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/codes/{code_id}/sections', path: { 'code_id': codeId, }, query: { 'edition': edition, 'chapter': chapter, 'topic': topic, 'q': q, 'limit': limit, 'offset': offset, }, errors: { 422: `Validation Error`, }, }); } /** * Get a single section with related calculator cross-references * Return one section + ``related_calc_kinds`` from ``app/codes/calc_links.py``. * @returns SectionDetailOut Successful Response * @throws ApiError */ public static codesGetSection({ codeId, sectionNumber, edition, }: { /** * Short code id */ codeId: string, /** * Section number, e.g. 'R311.7.5' */ sectionNumber: string, /** * Edition (default: code's default_edition) */ edition?: (string | null), }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/codes/{code_id}/sections/{section_number}', path: { 'code_id': codeId, 'section_number': sectionNumber, }, query: { 'edition': edition, }, errors: { 422: `Validation Error`, }, }); } /** * Which codes + editions apply in a given jurisdiction * Return all code adoptions for this jurisdiction (one row per code). * @returns ApplicableOut Successful Response * @throws ApiError */ public static codesJurisdictionApplicable({ jurisdiction, }: { /** * Jurisdiction code (e.g. 'CA' for California, 'TX' for Texas) */ jurisdiction: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/codes/jurisdictions/{jurisdiction}/applicable', path: { 'jurisdiction': jurisdiction, }, errors: { 422: `Validation Error`, }, }); } /** * Diff sections between two editions of the same code * Return added/removed/renamed sections between two editions. * * Diff semantics (per spec §3.X codes vertical): * - **added**: section_number present in to_edition but not from_edition. * - **removed**: section_number present in from_edition but not to_edition. * - **renamed**: same section_number both editions, different section_title. * * The diff is metadata-only (title + chapter + topic_tags) — no body-text * diff per ADR-0014 hybrid legal model. * @returns CodeDiffOut Successful Response * @throws ApiError */ public static codesDiff({ codeId, fromEdition, toEdition, }: { /** * Short code id: irc, ibc, nec, iecc, ipc */ codeId: string, /** * Source edition (e.g. '2021') */ fromEdition: string, /** * Target edition (e.g. '2024') */ toEdition: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/codes/{code_id}/diff', path: { 'code_id': codeId, }, query: { 'from_edition': fromEdition, 'to_edition': toEdition, }, errors: { 422: `Validation Error`, }, }); } /** * Per-jurisdiction amendments for a specific section * Return per-jurisdiction amendments touching this section. * * Reads from ``code_adoptions`` filtered by ``code_id`` — the * section-level granularity is approximate in v1 because * ``code_adoptions`` carries free-form ``amendment_notes`` at the * (jurisdiction, code, edition) tuple, not per-section. Until a * structured per-section amendments table lands (deferred per Q1), * this endpoint returns every adoption row for the code that has * ``has_amendments=True`` and surfaces the notes verbatim. Agents * should treat the response as "jurisdictions that have ANY amendments * to ``code_id``", not "jurisdictions that amended section X". * @returns SectionAmendmentsOut Successful Response * @throws ApiError */ public static codesSectionAmendments({ codeId, sectionNumber, }: { /** * Short code id: irc, ibc, nec, iecc, ipc */ codeId: string, /** * Section number, e.g. 'R311.7.5' */ sectionNumber: string, }): CancelablePromise { return __request(OpenAPI, { method: 'GET', url: '/v1/codes/{code_id}/sections/{section_number}/amendments', path: { 'code_id': codeId, 'section_number': sectionNumber, }, errors: { 422: `Validation Error`, }, }); } /** * Full-text search across code sections (FTS GIN-backed) * POST search across ``code_sections.search_tsv`` (GIN-indexed). * * Uses ``plainto_tsquery('english', ...)`` so callers don't need to * learn tsquery operators. Falls back to ILIKE on section_number / * section_title to remain useful when the TSV column isn't populated * (e.g. test fixtures). * * Method is POST because future iterations will accept array filters * (``topic_tags: list[str]``, ``editions: list[str]``) that don't * encode cleanly as query strings. * @returns CodeSearchOut Successful Response * @throws ApiError */ public static codesSearch({ requestBody, }: { requestBody: CodeSearchInput, }): CancelablePromise { return __request(OpenAPI, { method: 'POST', url: '/v1/codes/search', body: requestBody, mediaType: 'application/json', errors: { 422: `Validation Error`, }, }); } }