/** * Fetches La Poste's list of its points of contact, the dataset `laposte-poincont2` * (« Liste des bureaux de poste, agences postales et relais poste ») on `data.laposte.fr`, * the source of the `fr-laposte-poincont` adapter and the French post offices of the structures layer. * * The portal is a data-fair instance. * The dataset record at `/data-fair/api/v1/datasets/laposte-poincont2` states the * license (`Licence Ouverte / Open Licence`), the record count and `dataUpdatedAt`. * * The rows are paged from `/lines` at 10,000 per request, following each answer's `next` link. * * The record is saved beside the rows as `dataset.json`, because it holds the publisher's * license statement and the update date Licence Ouverte asks a reuser to cite. * A pull whose row count differs from the record's `count` is refused, and the previous file stays. * * Invoke via `mailwoman corpus fetch fr-laposte-poincont`. */ import { APIClient } from "@mailwoman/core/api"; import { type PathBuilderLike } from "path-ts"; import type { BaseFetchOptions, FetchSummary, SourceManifest } from "#tools/fetch/download"; /** * The dataset's data-fair API root. */ export declare const LAPOSTE_POINCONT_API_URL = "https://data.laposte.fr/data-fair/api/v1/datasets/laposte-poincont2"; /** * The dataset's page. * It states the license. */ export declare const LAPOSTE_POINCONT_PAGE_URL = "https://data.laposte.fr/datasets/laposte-poincont2"; /** * The most rows one `/lines` request answers. */ export declare const LAPOSTE_POINCONT_PAGE_SIZE = 10000; /** * The file the dataset record is saved to, beside the rows. */ export declare const LAPOSTE_POINCONT_DATASET_FILENAME = "dataset.json"; /** * The parts of the data-fair dataset record a fetch reads. */ export interface DataFairDatasetRecord { title?: string; count?: number; dataUpdatedAt?: string; updatedAt?: string; origin?: string; license?: { title?: string; href?: string; }; } /** * What one run recorded. * * `publisher_version` is the record's `dataUpdatedAt`, the date Licence Ouverte asks a reuser to cite. */ export interface LaPostePoincontManifest extends SourceManifest { dataset_url: string; records: number; license_title: string | null; license_url: string | null; } /** * The first `/lines` URL, selecting the fields the adapter reads. */ export declare function laPostePoincontLinesURL(): string; /** * One `/lines` row with only the fields the adapter reads, in their declared order, * a field the row lacks written as `null`. */ export declare function selectLaPosteFields(row: Readonly>): Record; export interface DownloadLaPostePoincontOptions { outputDir: PathBuilderLike; signal?: AbortSignal; report?: (line: string) => void; } /** * Pages every row into `/laposte-poincont2.jsonl` and writes the manifest. * * @throws When the record states no count, a page answers no `results`, * or the rows written differ from the record's count. */ export declare function downloadLaPostePoincont(client: Pick, options: DownloadLaPostePoincontOptions): Promise; /** * The path `#fr/adapters/laposte-poincont/adapter` reads, given the root a fetch wrote under. */ export declare function laPostePoincontInputPath(outRoot: BaseFetchOptions["outRoot"]): PathBuilderLike; export interface FetchLaPostePoincontOptions extends BaseFetchOptions { signal?: AbortSignal; } /** * The registry entry. */ export declare function fetchLaPostePoincont(options: FetchLaPostePoincontOptions, report?: (line: string) => void): Promise; //# sourceMappingURL=laposte-poincont.d.ts.map