Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/soda/mod.ts>SodaQuery

SODA (Socrata) Client for Deno/Node
Latest
class SodaQuery
import { SodaQuery } from "https://deno.land/x/soda@0.4.5/mod.ts";

Constructors

new
SodaQuery(
domain: string,
authOpts?: AuthOpts,
opts?: Options,
)

Create a new Query instance

Properties

private
readonly
requestHeaders: Record<string, string>
readonly
headers: { raw: Headers | null; lastModified: string | null | undefined; etag: string | null | undefined; fields: string | null | undefined; types: string | null | undefined; outOfDate: string | null | undefined; }

Get the last response headers

Methods

private
getPath(): string
private
requestData<T>(url: string, opts?: RequesOpts): DataResponse<T | null>

Return a query object that can be used to build a query string

clear(): this
execute(queryID?: string, signal?: AbortSignal): DataResponse<Array<T & ExtraDataFields>>
executeGeoJSON(queryID?: string, signal?: AbortSignal): DataResponse<unknown>
getDevURL(): string

Get the Socrata docs URL for the dataset

getURL(queryID?: string): string

Get the URL that will be used to make the request, can be used for debugging

groupBy(...group: Array<string | FieldImpl>): this
having(...having: Array<string | Record<string, string> | Where>): this
limit(limit: number): this
offset(offset: number): this
orderBy(...order: Array<string | Order>): this
prepare(queryID: string): this

Build a query object and store it in the query map, then clear the query to start a new one

search(q: string): this

Full text search

select(...selects: Array<string | SelectImpl | FieldImpl>): this
simple(query: Record<string, string | number>): this

Make a simple query, this will override any other query that has been set

single(queryID?: string, signal?: AbortSignal): DataResponse<T & ExtraDataFields>
soql(query: string): this

Make a soql query, this will override any other query that has been set (except simple)

Similar to SQL, clauses must be specified in a specific order:

  • SELECT
  • WHERE
  • ORDER BY
  • GROUP BY
  • LIMIT
  • OFFSET
where(...where: Array<string | Record<string, string> | Where>): this
withDataset(datasetId: string): this

Set the dataset to work against. This can be called multiple times, but only if strict mode is disabled.

Include system fields in the response