@gethydra/sdk 0.1.58 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +123 -2
- package/dist/index.js +53 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -23731,12 +23731,29 @@ interface ListDirectoryListingsParams {
|
|
|
23731
23731
|
cursor?: string;
|
|
23732
23732
|
sort?: 'created_at' | 'updated_at' | 'name' | 'city';
|
|
23733
23733
|
order?: 'asc' | 'desc';
|
|
23734
|
+
fields?: string;
|
|
23734
23735
|
city?: string;
|
|
23736
|
+
region?: string;
|
|
23737
|
+
postcode?: string;
|
|
23738
|
+
country?: string;
|
|
23739
|
+
slug?: string;
|
|
23735
23740
|
category_key?: string;
|
|
23736
23741
|
listing_tier?: string;
|
|
23737
23742
|
status?: 'draft' | 'active' | 'pending' | 'suspended';
|
|
23743
|
+
service_mode?: 'location' | 'mobile' | 'online' | 'hybrid';
|
|
23744
|
+
price_range?: string;
|
|
23745
|
+
verified?: boolean;
|
|
23746
|
+
/** Filter by claim status. `true` = claimed, `false` = unclaimed. */
|
|
23747
|
+
claimed?: boolean;
|
|
23738
23748
|
search?: string;
|
|
23739
|
-
|
|
23749
|
+
/** Filter by services (comma-separated). Listings must contain ALL specified values. */
|
|
23750
|
+
services?: string;
|
|
23751
|
+
/** Filter by amenities (comma-separated). Listings must contain ALL specified values. */
|
|
23752
|
+
amenities?: string;
|
|
23753
|
+
/** Filter by brands (comma-separated). Listings must contain ALL specified values. */
|
|
23754
|
+
brands?: string;
|
|
23755
|
+
/** Filter by accreditations (comma-separated). Listings must contain ALL specified values. */
|
|
23756
|
+
accreditations?: string;
|
|
23740
23757
|
}
|
|
23741
23758
|
interface CreateDirectoryListingBody {
|
|
23742
23759
|
name: string;
|
|
@@ -23811,6 +23828,109 @@ declare class DirectoryResource {
|
|
|
23811
23828
|
}>>;
|
|
23812
23829
|
}
|
|
23813
23830
|
|
|
23831
|
+
interface GeoCountrySummary {
|
|
23832
|
+
code: string;
|
|
23833
|
+
name: string;
|
|
23834
|
+
region_count: number;
|
|
23835
|
+
}
|
|
23836
|
+
interface GeoCountry {
|
|
23837
|
+
code: string;
|
|
23838
|
+
name: string;
|
|
23839
|
+
subdivisions: string[];
|
|
23840
|
+
region_count: number;
|
|
23841
|
+
}
|
|
23842
|
+
interface GeoRegion {
|
|
23843
|
+
slug: string;
|
|
23844
|
+
name: string;
|
|
23845
|
+
country_code: string;
|
|
23846
|
+
parent: string;
|
|
23847
|
+
type: string;
|
|
23848
|
+
}
|
|
23849
|
+
interface ListGeoRegionsParams {
|
|
23850
|
+
country?: string;
|
|
23851
|
+
parent?: string;
|
|
23852
|
+
type?: string;
|
|
23853
|
+
}
|
|
23854
|
+
interface GeoOutcode {
|
|
23855
|
+
outcode: string;
|
|
23856
|
+
area: string;
|
|
23857
|
+
latitude: number;
|
|
23858
|
+
longitude: number;
|
|
23859
|
+
postcode_count: number;
|
|
23860
|
+
county?: string;
|
|
23861
|
+
region?: string;
|
|
23862
|
+
country?: string;
|
|
23863
|
+
}
|
|
23864
|
+
interface ListGeoOutcodesParams {
|
|
23865
|
+
area?: string;
|
|
23866
|
+
country?: string;
|
|
23867
|
+
q?: string;
|
|
23868
|
+
}
|
|
23869
|
+
interface GeoPostcode {
|
|
23870
|
+
postcode: string;
|
|
23871
|
+
outcode: string;
|
|
23872
|
+
latitude: number;
|
|
23873
|
+
longitude: number;
|
|
23874
|
+
county?: string;
|
|
23875
|
+
district?: string;
|
|
23876
|
+
region?: string;
|
|
23877
|
+
country?: string;
|
|
23878
|
+
}
|
|
23879
|
+
interface GeoCity {
|
|
23880
|
+
slug: string;
|
|
23881
|
+
name: string;
|
|
23882
|
+
region_slug: string;
|
|
23883
|
+
country_code: string;
|
|
23884
|
+
latitude: number;
|
|
23885
|
+
longitude: number;
|
|
23886
|
+
postcode_area: string;
|
|
23887
|
+
}
|
|
23888
|
+
interface ListGeoCitiesParams {
|
|
23889
|
+
region?: string;
|
|
23890
|
+
country?: string;
|
|
23891
|
+
q?: string;
|
|
23892
|
+
}
|
|
23893
|
+
declare class GeoResource {
|
|
23894
|
+
private client;
|
|
23895
|
+
constructor(client: Hydra);
|
|
23896
|
+
/** List all supported countries with region counts. */
|
|
23897
|
+
countries(): Promise<{
|
|
23898
|
+
data: GeoCountrySummary[];
|
|
23899
|
+
}>;
|
|
23900
|
+
/** Get a single country by ISO 3166-1 alpha-2 code. */
|
|
23901
|
+
country(code: string): Promise<{
|
|
23902
|
+
data: GeoCountry;
|
|
23903
|
+
}>;
|
|
23904
|
+
/** List regions, optionally filtered by country, parent subdivision, or type. */
|
|
23905
|
+
regions(params?: ListGeoRegionsParams): Promise<{
|
|
23906
|
+
data: GeoRegion[];
|
|
23907
|
+
}>;
|
|
23908
|
+
/** Get a single region by slug. */
|
|
23909
|
+
region(slug: string): Promise<{
|
|
23910
|
+
data: GeoRegion;
|
|
23911
|
+
}>;
|
|
23912
|
+
/** List postcode outcodes (districts), filtered by area, country, or prefix. At least one filter required. */
|
|
23913
|
+
outcodes(params: ListGeoOutcodesParams): Promise<{
|
|
23914
|
+
data: GeoOutcode[];
|
|
23915
|
+
}>;
|
|
23916
|
+
/** Get a single outcode by code (e.g. 'S40', 'LE1'). */
|
|
23917
|
+
outcode(code: string): Promise<{
|
|
23918
|
+
data: GeoOutcode;
|
|
23919
|
+
}>;
|
|
23920
|
+
/** Lookup a full UK postcode (e.g. 'S40 1AB'). Returns coordinates, county, district, region. */
|
|
23921
|
+
postcode(code: string): Promise<{
|
|
23922
|
+
data: GeoPostcode;
|
|
23923
|
+
}>;
|
|
23924
|
+
/** List cities/towns, filtered by region slug, country code, or name prefix. At least one filter required. */
|
|
23925
|
+
cities(params: ListGeoCitiesParams): Promise<{
|
|
23926
|
+
data: GeoCity[];
|
|
23927
|
+
}>;
|
|
23928
|
+
/** Get a single city/town by slug. */
|
|
23929
|
+
city(slug: string): Promise<{
|
|
23930
|
+
data: GeoCity;
|
|
23931
|
+
}>;
|
|
23932
|
+
}
|
|
23933
|
+
|
|
23814
23934
|
interface AppInfo {
|
|
23815
23935
|
/** Integration/plugin name (e.g. "MyShopTheme") */
|
|
23816
23936
|
name: string;
|
|
@@ -23909,6 +24029,7 @@ declare class Hydra {
|
|
|
23909
24029
|
readonly directory: DirectoryResource;
|
|
23910
24030
|
readonly directoryCategories: DirectoryCategoriesResource;
|
|
23911
24031
|
readonly directoryTiers: DirectoryTiersResource;
|
|
24032
|
+
readonly geo: GeoResource;
|
|
23912
24033
|
constructor(config: HydraConfig);
|
|
23913
24034
|
request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
|
|
23914
24035
|
/** Multipart upload for file-based endpoints (e.g. images) */
|
|
@@ -23990,4 +24111,4 @@ declare class HydraIdempotencyError extends HydraError {
|
|
|
23990
24111
|
constructor(body: HydraErrorBody, headers: Headers);
|
|
23991
24112
|
}
|
|
23992
24113
|
|
|
23993
|
-
export { AddressesResource, type AnalyticsActionItems$1 as AnalyticsActionItems, type AnalyticsOrdersSeries$1 as AnalyticsOrdersSeries, AnalyticsResource, type AnalyticsSummary$1 as AnalyticsSummary, type AnalyticsTimeSeries$1 as AnalyticsTimeSeries, type AnalyticsTopProduct$1 as AnalyticsTopProduct, type AppInfo, type Appointment$1 as Appointment, type AuthCustomer, AuthResource, type AvailabilityOverride$1 as AvailabilityOverride, BookingsResource, type Cart$1 as Cart, type CartItem, CartResource, type ChangePasswordBody, type Channel$1 as Channel, ChannelsResource, type CheckoutCreate$1 as CheckoutCreate, type CheckoutGet$1 as CheckoutGet, type CheckoutListItem$1 as CheckoutListItem, CheckoutResource, CheckoutsResource, type ClaimListingBody, type Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, type CreateDirectoryCategoryBody, type CreateDirectoryListingBody, type CreateDirectoryTierBody, type CreateGiftCardBody, type CreditBalance, type Customer$1 as Customer, type CustomerGroup$1 as CustomerGroup, CustomerGroupsResource, type CustomerMembership$1 as CustomerMembership, type CustomerPhoto$1 as CustomerPhoto, CustomerPhotosResource, CustomersResource, type DataResponse, type DayAvailability$1 as DayAvailability, DirectoryCategoriesResource, type DirectoryCategory, type DirectoryClaim, type DirectoryListing, DirectoryResource, type DirectorySettings, type DirectoryTier, type DirectoryTierRule, DirectoryTiersResource, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, type FormDefinition$1 as FormDefinition, type FormField$1 as FormField, type FormFieldPublic, type FormPublic$1 as FormPublic, type FormSubmission$1 as FormSubmission, FormSubmissionsResource, FormsResource, type Fulfillment$1 as Fulfillment, type FulfillmentOrder$2 as FulfillmentOrder, FulfillmentOrdersResource, FulfillmentsResource, type GenerateVariantsResult$1 as GenerateVariantsResult, type GiftCard, type GiftCardConvertResult, type CreditDebitBody as GiftCardCreditDebitBody, type GiftCardLookup, type GiftCardTransaction, GiftCardsResource, Hydra, HydraAuthenticationError, type HydraConfig, HydraConnectionError, HydraError, type HydraErrorBody, HydraIdempotencyError, HydraNotFoundError, HydraPermissionError, HydraRateLimitError, HydraValidationError, type Image$2 as Image, ImagesResource, IntegrationsResource, type InventoryLevel$1 as InventoryLevel, InventoryResource, type ListDirectoryListingsParams, type ListGiftCardTransactionsParams, type ListGiftCardsParams, type ListResponse, type Location$1 as Location, LocationsResource, type LoginBody, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type LoyaltySummary, type CreateAddressBody as MeCreateAddressBody, type MeOrdersParams, MeResource, type UpdateAddressBody as MeUpdateAddressBody, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, type MessageResponse, MetafieldsResource, type NotificationLog$1 as NotificationLog, NotificationsResource, type Order$2 as Order, OrdersResource, type PaginateOptions, type Pagination, type PosAnalyticsDashboard, type Post$1 as Post, PostsResource, type Product$1 as Product, type ProductStats$1 as ProductStats, ProductsResource, type Promotion$1 as Promotion, PromotionsResource, type PurchaseOrder$1 as PurchaseOrder, PurchaseOrdersResource, type Redirect$1 as Redirect, RedirectsResource, type Refund$1 as Refund, RefundsResource, type RegisterBody, type ReorderDirectoryCategoriesBody, type ReorderDirectoryTiersBody, type RequestOptions, type ResourceRequestOptions, type Return$1 as Return, ReturnsResource, SearchResource, type ShippingRate$1 as ShippingRate, ShippingResource, type ShippingZone$1 as ShippingZone, type Slot, type Store$1 as Store, StoreCreditResource, StoreResource, type SuggestedSlot$1 as SuggestedSlot, type Tag$1 as Tag, TagsResource, type TaxExemption$1 as TaxExemption, type TaxGroup$1 as TaxGroup, type TaxRate$1 as TaxRate, TaxResource, type TokenResponse, type UpdateDirectoryCategoryBody, type UpdateDirectoryListingBody, type UpdateDirectorySettingsBody, type UpdateDirectoryTierBody, type UpdateGiftCardBody, type UpdateProfileBody, type Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
|
|
24114
|
+
export { AddressesResource, type AnalyticsActionItems$1 as AnalyticsActionItems, type AnalyticsOrdersSeries$1 as AnalyticsOrdersSeries, AnalyticsResource, type AnalyticsSummary$1 as AnalyticsSummary, type AnalyticsTimeSeries$1 as AnalyticsTimeSeries, type AnalyticsTopProduct$1 as AnalyticsTopProduct, type AppInfo, type Appointment$1 as Appointment, type AuthCustomer, AuthResource, type AvailabilityOverride$1 as AvailabilityOverride, BookingsResource, type Cart$1 as Cart, type CartItem, CartResource, type ChangePasswordBody, type Channel$1 as Channel, ChannelsResource, type CheckoutCreate$1 as CheckoutCreate, type CheckoutGet$1 as CheckoutGet, type CheckoutListItem$1 as CheckoutListItem, CheckoutResource, CheckoutsResource, type ClaimListingBody, type Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, type CreateDirectoryCategoryBody, type CreateDirectoryListingBody, type CreateDirectoryTierBody, type CreateGiftCardBody, type CreditBalance, type Customer$1 as Customer, type CustomerGroup$1 as CustomerGroup, CustomerGroupsResource, type CustomerMembership$1 as CustomerMembership, type CustomerPhoto$1 as CustomerPhoto, CustomerPhotosResource, CustomersResource, type DataResponse, type DayAvailability$1 as DayAvailability, DirectoryCategoriesResource, type DirectoryCategory, type DirectoryClaim, type DirectoryListing, DirectoryResource, type DirectorySettings, type DirectoryTier, type DirectoryTierRule, DirectoryTiersResource, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, type FormDefinition$1 as FormDefinition, type FormField$1 as FormField, type FormFieldPublic, type FormPublic$1 as FormPublic, type FormSubmission$1 as FormSubmission, FormSubmissionsResource, FormsResource, type Fulfillment$1 as Fulfillment, type FulfillmentOrder$2 as FulfillmentOrder, FulfillmentOrdersResource, FulfillmentsResource, type GenerateVariantsResult$1 as GenerateVariantsResult, type GeoCity, type GeoCountry, type GeoCountrySummary, type GeoOutcode, type GeoPostcode, type GeoRegion, GeoResource, type GiftCard, type GiftCardConvertResult, type CreditDebitBody as GiftCardCreditDebitBody, type GiftCardLookup, type GiftCardTransaction, GiftCardsResource, Hydra, HydraAuthenticationError, type HydraConfig, HydraConnectionError, HydraError, type HydraErrorBody, HydraIdempotencyError, HydraNotFoundError, HydraPermissionError, HydraRateLimitError, HydraValidationError, type Image$2 as Image, ImagesResource, IntegrationsResource, type InventoryLevel$1 as InventoryLevel, InventoryResource, type ListDirectoryListingsParams, type ListGeoCitiesParams, type ListGeoOutcodesParams, type ListGeoRegionsParams, type ListGiftCardTransactionsParams, type ListGiftCardsParams, type ListResponse, type Location$1 as Location, LocationsResource, type LoginBody, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type LoyaltySummary, type CreateAddressBody as MeCreateAddressBody, type MeOrdersParams, MeResource, type UpdateAddressBody as MeUpdateAddressBody, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, type MessageResponse, MetafieldsResource, type NotificationLog$1 as NotificationLog, NotificationsResource, type Order$2 as Order, OrdersResource, type PaginateOptions, type Pagination, type PosAnalyticsDashboard, type Post$1 as Post, PostsResource, type Product$1 as Product, type ProductStats$1 as ProductStats, ProductsResource, type Promotion$1 as Promotion, PromotionsResource, type PurchaseOrder$1 as PurchaseOrder, PurchaseOrdersResource, type Redirect$1 as Redirect, RedirectsResource, type Refund$1 as Refund, RefundsResource, type RegisterBody, type ReorderDirectoryCategoriesBody, type ReorderDirectoryTiersBody, type RequestOptions, type ResourceRequestOptions, type Return$1 as Return, ReturnsResource, SearchResource, type ShippingRate$1 as ShippingRate, ShippingResource, type ShippingZone$1 as ShippingZone, type Slot, type Store$1 as Store, StoreCreditResource, StoreResource, type SuggestedSlot$1 as SuggestedSlot, type Tag$1 as Tag, TagsResource, type TaxExemption$1 as TaxExemption, type TaxGroup$1 as TaxGroup, type TaxRate$1 as TaxRate, TaxResource, type TokenResponse, type UpdateDirectoryCategoryBody, type UpdateDirectoryListingBody, type UpdateDirectorySettingsBody, type UpdateDirectoryTierBody, type UpdateGiftCardBody, type UpdateProfileBody, type Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
|
package/dist/index.js
CHANGED
|
@@ -2148,6 +2148,56 @@ var DirectoryTiersResource = class {
|
|
|
2148
2148
|
}
|
|
2149
2149
|
};
|
|
2150
2150
|
|
|
2151
|
+
// src/resources/geo.ts
|
|
2152
|
+
var GeoResource = class {
|
|
2153
|
+
constructor(client) {
|
|
2154
|
+
this.client = client;
|
|
2155
|
+
}
|
|
2156
|
+
client;
|
|
2157
|
+
/** List all supported countries with region counts. */
|
|
2158
|
+
async countries() {
|
|
2159
|
+
return this.client.request("GET", "/v1/geo/countries");
|
|
2160
|
+
}
|
|
2161
|
+
/** Get a single country by ISO 3166-1 alpha-2 code. */
|
|
2162
|
+
async country(code) {
|
|
2163
|
+
return this.client.request("GET", `/v1/geo/countries/${code}`);
|
|
2164
|
+
}
|
|
2165
|
+
/** List regions, optionally filtered by country, parent subdivision, or type. */
|
|
2166
|
+
async regions(params) {
|
|
2167
|
+
return this.client.request("GET", "/v1/geo/regions", {
|
|
2168
|
+
params
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
2171
|
+
/** Get a single region by slug. */
|
|
2172
|
+
async region(slug) {
|
|
2173
|
+
return this.client.request("GET", `/v1/geo/regions/${slug}`);
|
|
2174
|
+
}
|
|
2175
|
+
/** List postcode outcodes (districts), filtered by area, country, or prefix. At least one filter required. */
|
|
2176
|
+
async outcodes(params) {
|
|
2177
|
+
return this.client.request("GET", "/v1/geo/outcodes", {
|
|
2178
|
+
params
|
|
2179
|
+
});
|
|
2180
|
+
}
|
|
2181
|
+
/** Get a single outcode by code (e.g. 'S40', 'LE1'). */
|
|
2182
|
+
async outcode(code) {
|
|
2183
|
+
return this.client.request("GET", `/v1/geo/outcodes/${code}`);
|
|
2184
|
+
}
|
|
2185
|
+
/** Lookup a full UK postcode (e.g. 'S40 1AB'). Returns coordinates, county, district, region. */
|
|
2186
|
+
async postcode(code) {
|
|
2187
|
+
return this.client.request("GET", `/v1/geo/postcodes/${code.replace(/\s+/g, "")}`);
|
|
2188
|
+
}
|
|
2189
|
+
/** List cities/towns, filtered by region slug, country code, or name prefix. At least one filter required. */
|
|
2190
|
+
async cities(params) {
|
|
2191
|
+
return this.client.request("GET", "/v1/geo/cities", {
|
|
2192
|
+
params
|
|
2193
|
+
});
|
|
2194
|
+
}
|
|
2195
|
+
/** Get a single city/town by slug. */
|
|
2196
|
+
async city(slug) {
|
|
2197
|
+
return this.client.request("GET", `/v1/geo/cities/${slug}`);
|
|
2198
|
+
}
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2151
2201
|
// src/client.ts
|
|
2152
2202
|
var SDK_VERSION = "0.1.0";
|
|
2153
2203
|
var INITIAL_RETRY_DELAY = 0.5;
|
|
@@ -2257,6 +2307,8 @@ var Hydra = class {
|
|
|
2257
2307
|
directory = new DirectoryResource(this);
|
|
2258
2308
|
directoryCategories = new DirectoryCategoriesResource(this);
|
|
2259
2309
|
directoryTiers = new DirectoryTiersResource(this);
|
|
2310
|
+
// P15: Geo Reference Data
|
|
2311
|
+
geo = new GeoResource(this);
|
|
2260
2312
|
constructor(config) {
|
|
2261
2313
|
for (const key of Object.keys(config)) {
|
|
2262
2314
|
if (!VALID_CONFIG_KEYS.has(key)) {
|
|
@@ -2496,6 +2548,7 @@ export {
|
|
|
2496
2548
|
FormsResource,
|
|
2497
2549
|
FulfillmentOrdersResource,
|
|
2498
2550
|
FulfillmentsResource,
|
|
2551
|
+
GeoResource,
|
|
2499
2552
|
GiftCardsResource,
|
|
2500
2553
|
Hydra,
|
|
2501
2554
|
HydraAuthenticationError,
|