GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sdk-js/packages/epilot-sdk-v2/docs/address.md at main · epilot-dev/sdk-js

Expand file tree

/

address.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
378 lines (299 loc) · 6.91 KB
/

address.md

Copy path

File metadata and controls

378 lines (299 loc) · 6.91 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Address API

  • Base URL: https://address.sls.epilot.io
  • Full API Docs: https://docs.epilot.io/api/address

Usage

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.address.getAddressSuggestions(...)

Tree-shakeable import

import { getClient, authorize } from '@epilot/sdk/address'

const addressClient = getClient()
authorize(addressClient, () => '<token>')
const { data } = await addressClient.getAddressSuggestions(...)

Operations

Address Suggestion

  • getAddressSuggestions

Availability

  • availabilityCheck
  • validateAvailabilityFile

Location

  • resolveLocation

Schemas

  • ResolveLocationParams
  • ResolveLocationResult
  • AddressValue
  • AvailabilityCheckParams
  • AvailabilityFilters
  • AvailabilityDate
  • AvailabilityLocation
  • AvailabilityResult
  • ValidateAvailabilityFileResult
  • ValidateAvailabilityFileError
  • AddressSuggestion
  • AddressSuggestions
  • ErrorResponse

getAddressSuggestions

Get address suggestions for the given Availability File

GET /v1/public/suggestions

const { data } = await client.getAddressSuggestions({
  fileRef: 'example',
  countryCodeSearchTerm: 'example',
  postalCodeSearchTerm: 'example',
  streetSearchTerm: 'example',
})
Response
[
  {
    "country": "st",
    "postal_code": "string",
    "city": "string",
    "street": "string",
    "street_number": "string"
  }
]

availabilityCheck

Check for Entities that contain a matching availability range in related availability files.

POST /v1/public/availability

const { data } = await client.availabilityCheck(
  null,
  {},
)
Response
{
  "available_entities": [],
  "check_results": [
    {
      "entity_id": "72c803b2-2e5d-4bd6-bffc-fad998bbbe36",
      "matching_hits": 0
    },
    {
      "entity_id": "72c803b2-2e5d-4bd6-bffc-fad998bbbe37",
      "matching_hits": 0
    }
  ]
}

resolveLocation

Resolve or create the canonical Location for a raw address (find-or-create by canonical address_hash) and return its id. This is the dedup-safe way to create a Location — direct entity creation of `lo

POST /v1/public/location-service/resolve

const { data } = await client.resolveLocation(
  null,
  {
    address: {
      street: 'string',
      street_number: 'string',
      postal_code: 'string',
      city: 'string',
      suburb: 'string',
      state: 'string',
      country: 'string',
      latitude: 0,
      longitude: 0
    },
    entityId: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
    entitySlug: 'string'
  },
)
Response
{
  "locationId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "created": true
}

validateAvailabilityFile

Validates an already uploaded availability file, it returns an array of errors if any errors are found in the file.

GET /v1/availability/{id}/validate

const { data } = await client.validateAvailabilityFile({
  id: '123e4567-e89b-12d3-a456-426614174000',
})
Response
{
  "status": "success",
  "rules_parsed_count": 0,
  "errors": [
    {
      "line": 0,
      "message": "string",
      "data": "string"
    }
  ]
}

Schemas

ResolveLocationParams

type ResolveLocationParams = {
  address: {
    street?: string
    street_number?: string
    postal_code?: string
    city?: string
    suburb?: string
    state?: string
    country?: string
    latitude?: number
    longitude?: number
  }
  entityId?: string // uuid
  entitySlug?: string
}

ResolveLocationResult

type ResolveLocationResult = {
  locationId: string // uuid
  created: boolean
}

AddressValue

A raw address. Provide EITHER a street address (street + street_number + (postal_code or city)) OR coordinates (latitude + longitude). Only the string fields drive the canonical address hash; for a street address the coordinates are stored as-is on the Location, while a coordinate-only a

type AddressValue = {
  street?: string
  street_number?: string
  postal_code?: string
  city?: string
  suburb?: string
  state?: string
  country?: string
  latitude?: number
  longitude?: number
}

AvailabilityCheckParams

type AvailabilityCheckParams = {
  entities: string // uuid[]
  schemas?: string[]
  filters: {
    location: {
      street?: { ... }
      street_number?: { ... }
      postal_code?: { ... }
      city?: { ... }
      country?: { ... }
    }
    available_date?: string // date
  }
}

AvailabilityFilters

Availability filters dimensions

type AvailabilityFilters = {
  location: {
    street?: string
    street_number?: string
    postal_code?: string
    city?: string
    country?: string
  }
  available_date?: string // date
}

AvailabilityDate

A value to be matched against the availability window (start & end date)

type AvailabilityDate = string // date

AvailabilityLocation

type AvailabilityLocation = {
  street?: string
  street_number?: string
  postal_code?: string
  city?: string
  country?: string
}

AvailabilityResult

The availability check result payload

type AvailabilityResult = {
  available_entities: string[]
  check_results: Array<{
    entity_id: string // uuid
    matching_hits: number
    matching_error?: object
  }>
}

ValidateAvailabilityFileResult

The availability map file result payload

type ValidateAvailabilityFileResult = {
  status: "success" | "error"
  rules_parsed_count: number
  errors: Array<{
    line?: number
    message: string
    data?: string
  }>
}

ValidateAvailabilityFileError

The availability rule error

type ValidateAvailabilityFileError = {
  line?: number
  message: string
  data?: string
}

AddressSuggestion

The address suggestions entity

type AddressSuggestion = {
  country?: string
  postal_code?: string // postal-code
  city?: string // city
  street?: string // street-address
  street_number?: string // street-number
}

AddressSuggestions

The address suggestions entity array

type AddressSuggestions = Array<{
  country?: string
  postal_code?: string // postal-code
  city?: string // city
  street?: string // street-address
  street_number?: string // street-number
}>

ErrorResponse

type ErrorResponse = {
  error: string
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.