diff --git a/CHANGELOG.md b/CHANGELOG.md index d72040b8..b36f0619 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- `formService.searchPointV3Addresses` +- `formService.getPointV3Address` + ## [23.4.2] - 2025-10-26 ### Fixed diff --git a/package-lock.json b/package-lock.json index 0009de25..481546a1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3102,7 +3102,7 @@ }, "node_modules/@oneblink/types": { "version": "1.0.0", - "resolved": "git+ssh://git@github.com/oneblink/types.git#c8eb1605b17f345cda345003db807ec37f5701c6", + "resolved": "git+ssh://git@github.com/oneblink/types.git#7ee44b17a3ad9c4462c87385b51ad37dfa70a492", "dev": true, "license": "GPL-3.0-only", "dependencies": { @@ -15683,7 +15683,7 @@ } }, "@oneblink/types": { - "version": "git+ssh://git@github.com/oneblink/types.git#c8eb1605b17f345cda345003db807ec37f5701c6", + "version": "git+ssh://git@github.com/oneblink/types.git#7ee44b17a3ad9c4462c87385b51ad37dfa70a492", "dev": true, "from": "@oneblink/types@github:oneblink/types", "requires": { diff --git a/src/services/integration-elements.ts b/src/services/integration-elements.ts index d522e433..c4f78841 100644 --- a/src/services/integration-elements.ts +++ b/src/services/integration-elements.ts @@ -9,6 +9,7 @@ import { SubmissionTypes, CPHCMSTypes, } from '@oneblink/types' + import OneBlinkAppsError from '../services/errors/oneBlinkAppsError' import { isOffline } from '../offline-service' import { @@ -305,6 +306,84 @@ export async function getPointCadastralParcel( } } +/** + * Search for Point addresses v3 based on a partial address. + * + * #### Example + * + * - + * + * Const formId = 1 const result = await + * formService.searchPointV3Addresses(formId, { address: '123 N', maxResults: 10 + * stateFilter: 'NSW' }) + * + * @param formId + * @param queryParams + * @param abortSignal + * @returns + */ +export async function searchPointV3Addresses( + formId: number, + queryParams: { + address: string + maxResults?: number + stateFilter?: string + dataset?: string + excludeAliases?: boolean + }, + abortSignal?: AbortSignal, +): Promise { + try { + return await searchRequest( + `${tenants.current.apiOrigin}/forms/${formId}/point/v3/addresses`, + queryParams, + abortSignal, + ) + } catch (err) { + throw generateGenericError(err, abortSignal) + } +} + +/** + * Get the details for a single Point address based on the Id of a Point address + * resource. + * + * #### Example + * + * ```js + * const formId = 1 + * const result = await formService.getPointV3Address(formId, { + * addressId: 'ABC123', + * additionalProperties: 'parcelBundle,localGovernmentArea', + * 'Accept-Crs': '', + * }) + * ``` + * + * @param formId + * @param queryParams + * @param abortSignal + * @returns + */ +export async function getPointV3Address( + formId: number, + queryParams: { + addressId: string + additionalProperties?: string + 'Accept-Crs'?: string + }, + abortSignal?: AbortSignal, +): Promise { + try { + return await searchRequest( + `${tenants.current.apiOrigin}/forms/${formId}/point/v3/address`, + queryParams, + abortSignal, + ) + } catch (err) { + throw generateGenericError(err, abortSignal) + } +} + /** * Search for street names in Civica *