@gethydra/sdk 0.1.36 → 0.1.37

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 CHANGED
@@ -20523,7 +20523,7 @@ type Customer = components['schemas']['Customer'];
20523
20523
  type ListParams$o = NonNullable<operations['listCustomers']['parameters']['query']>;
20524
20524
  type CreateBody$h = NonNullable<operations['createCustomer']['requestBody']>['content']['application/json'];
20525
20525
  type UpdateBody$k = NonNullable<operations['updateCustomer']['requestBody']>['content']['application/json'];
20526
- type CreateAddressBody$1 = NonNullable<operations['createCustomerAddress']['requestBody']>['content']['application/json'];
20526
+ type CreateAddressBody$2 = NonNullable<operations['createCustomerAddress']['requestBody']>['content']['application/json'];
20527
20527
  type CreateNoteBody$1 = NonNullable<operations['createCustomerNote']['requestBody']>['content']['application/json'];
20528
20528
  declare class CustomersResource {
20529
20529
  private client;
@@ -20538,7 +20538,7 @@ declare class CustomersResource {
20538
20538
  update(id: string, body: UpdateBody$k): Promise<DataResponse<Customer>>;
20539
20539
  delete(id: string): Promise<void>;
20540
20540
  listAddresses(customerId: string): Promise<DataResponse<unknown[]>>;
20541
- createAddress(customerId: string, body: CreateAddressBody$1): Promise<DataResponse<unknown>>;
20541
+ createAddress(customerId: string, body: CreateAddressBody$2): Promise<DataResponse<unknown>>;
20542
20542
  listNotes(customerId: string): Promise<DataResponse<unknown[]>>;
20543
20543
  createNote(customerId: string, body: CreateNoteBody$1): Promise<DataResponse<unknown>>;
20544
20544
  deleteNote(customerId: string, noteId: string): Promise<void>;
@@ -20856,8 +20856,8 @@ type Company = components['schemas']['Company'];
20856
20856
  type ListParams$e = NonNullable<operations['listCompanies']['parameters']['query']>;
20857
20857
  type CreateBody$a = NonNullable<operations['createCompany']['requestBody']>['content']['application/json'];
20858
20858
  type UpdateBody$a = NonNullable<operations['updateCompany']['requestBody']>['content']['application/json'];
20859
- type CreateAddressBody = NonNullable<operations['createCompanyAddress']['requestBody']>['content']['application/json'];
20860
- type UpdateAddressBody = NonNullable<operations['updateCompanyAddress']['requestBody']>['content']['application/json'];
20859
+ type CreateAddressBody$1 = NonNullable<operations['createCompanyAddress']['requestBody']>['content']['application/json'];
20860
+ type UpdateAddressBody$1 = NonNullable<operations['updateCompanyAddress']['requestBody']>['content']['application/json'];
20861
20861
  type CreateContactBody = NonNullable<operations['createCompanyContact']['requestBody']>['content']['application/json'];
20862
20862
  type UpdateContactBody = NonNullable<operations['updateCompanyContact']['requestBody']>['content']['application/json'];
20863
20863
  type CreateNoteBody = NonNullable<operations['createCompanyNote']['requestBody']>['content']['application/json'];
@@ -20874,8 +20874,8 @@ declare class CompaniesResource {
20874
20874
  update(id: string, body: UpdateBody$a): Promise<DataResponse<Company>>;
20875
20875
  delete(id: string): Promise<void>;
20876
20876
  listAddresses(companyId: string): Promise<DataResponse<unknown[]>>;
20877
- createAddress(companyId: string, body: CreateAddressBody): Promise<DataResponse<unknown>>;
20878
- updateAddress(companyId: string, addressId: string, body: UpdateAddressBody): Promise<DataResponse<unknown>>;
20877
+ createAddress(companyId: string, body: CreateAddressBody$1): Promise<DataResponse<unknown>>;
20878
+ updateAddress(companyId: string, addressId: string, body: UpdateAddressBody$1): Promise<DataResponse<unknown>>;
20879
20879
  deleteAddress(companyId: string, addressId: string): Promise<void>;
20880
20880
  listContacts(companyId: string): Promise<DataResponse<unknown[]>>;
20881
20881
  createContact(companyId: string, body: CreateContactBody): Promise<DataResponse<unknown>>;
@@ -21139,7 +21139,7 @@ declare class AnalyticsResource {
21139
21139
  }
21140
21140
 
21141
21141
  type CreditTransaction = NonNullable<operations['issueCustomerCredit']['responses']['201']['content']['application/json']['data']>;
21142
- type CreditBalance = NonNullable<operations['getCustomerCredit']['responses']['200']['content']['application/json']['data']>;
21142
+ type CreditBalance$1 = NonNullable<operations['getCustomerCredit']['responses']['200']['content']['application/json']['data']>;
21143
21143
  type ListParams$6 = NonNullable<operations['listCustomerCreditTransactions']['parameters']['query']>;
21144
21144
  type IssueCreditBody = NonNullable<operations['issueCustomerCredit']['requestBody']>['content']['application/json'];
21145
21145
  interface LoyaltySummary {
@@ -21158,7 +21158,7 @@ interface LoyaltySummary {
21158
21158
  declare class StoreCreditResource {
21159
21159
  private client;
21160
21160
  constructor(client: Hydra);
21161
- getBalance(customerId: string): Promise<DataResponse<CreditBalance>>;
21161
+ getBalance(customerId: string): Promise<DataResponse<CreditBalance$1>>;
21162
21162
  getLoyalty(customerId: string): Promise<DataResponse<LoyaltySummary>>;
21163
21163
  issue(customerId: string, body: IssueCreditBody, options?: ResourceRequestOptions): Promise<DataResponse<CreditTransaction>>;
21164
21164
  listTransactions(customerId: string, params?: ListParams$6): Promise<ListResponse<CreditTransaction>>;
@@ -21573,6 +21573,144 @@ declare class GiftCardsResource {
21573
21573
  lookup(code: string): Promise<DataResponse<GiftCardLookup>>;
21574
21574
  }
21575
21575
 
21576
+ interface AuthCustomer {
21577
+ id: string;
21578
+ email: string;
21579
+ first_name: string;
21580
+ last_name: string;
21581
+ phone: string | null;
21582
+ locale: string | null;
21583
+ email_verified: boolean;
21584
+ created_at: string;
21585
+ updated_at: string;
21586
+ }
21587
+ interface TokenResponse {
21588
+ access_token: string;
21589
+ refresh_token: string;
21590
+ expires_in: number;
21591
+ customer?: AuthCustomer;
21592
+ }
21593
+ interface MessageResponse {
21594
+ message: string;
21595
+ }
21596
+ interface RegisterBody {
21597
+ email: string;
21598
+ password: string;
21599
+ first_name: string;
21600
+ last_name: string;
21601
+ phone?: string;
21602
+ locale?: string;
21603
+ }
21604
+ interface LoginBody {
21605
+ email: string;
21606
+ password: string;
21607
+ }
21608
+ declare class AuthResource {
21609
+ private client;
21610
+ constructor(client: Hydra);
21611
+ /** Register a new customer account. Returns access + refresh tokens. */
21612
+ register(body: RegisterBody): Promise<TokenResponse>;
21613
+ /** Log in with email and password. Returns access + refresh tokens. */
21614
+ login(body: LoginBody): Promise<TokenResponse>;
21615
+ /** Exchange a refresh token for new access + refresh tokens (single-use rotation). */
21616
+ refreshToken(refreshToken: string): Promise<TokenResponse>;
21617
+ /** Invalidate a refresh token. Idempotent — succeeds even if already invalidated. */
21618
+ logout(refreshToken: string): Promise<void>;
21619
+ /** Request a password reset email. Always returns a generic message (prevents enumeration). */
21620
+ forgotPassword(email: string): Promise<MessageResponse>;
21621
+ /** Reset password using a token from the reset email. Invalidates all sessions. */
21622
+ resetPassword(token: string, password: string): Promise<MessageResponse>;
21623
+ /** Verify a customer's email using the token from the verification email. */
21624
+ verifyEmail(token: string): Promise<MessageResponse>;
21625
+ }
21626
+
21627
+ interface UpdateProfileBody {
21628
+ first_name?: string;
21629
+ last_name?: string;
21630
+ phone?: string | null;
21631
+ locale?: string | null;
21632
+ }
21633
+ interface ChangePasswordBody {
21634
+ current_password: string;
21635
+ new_password: string;
21636
+ }
21637
+ interface CreateAddressBody {
21638
+ first_name?: string | null;
21639
+ last_name?: string | null;
21640
+ company?: string | null;
21641
+ line1: string;
21642
+ line2?: string | null;
21643
+ city: string;
21644
+ state?: string | null;
21645
+ postal_code?: string | null;
21646
+ country: string;
21647
+ phone?: string | null;
21648
+ is_default?: boolean;
21649
+ }
21650
+ interface UpdateAddressBody {
21651
+ first_name?: string | null;
21652
+ last_name?: string | null;
21653
+ company?: string | null;
21654
+ line1?: string;
21655
+ line2?: string | null;
21656
+ city?: string;
21657
+ state?: string | null;
21658
+ postal_code?: string | null;
21659
+ country?: string;
21660
+ phone?: string | null;
21661
+ is_default?: boolean;
21662
+ }
21663
+ interface MeOrdersParams {
21664
+ limit?: number;
21665
+ cursor?: string;
21666
+ sort?: 'created_at';
21667
+ order?: 'asc' | 'desc';
21668
+ }
21669
+ interface CreditBalance {
21670
+ balance: number;
21671
+ available: number;
21672
+ pending: number;
21673
+ currency: string;
21674
+ }
21675
+ /**
21676
+ * Customer self-service resource for `/v1/me/*` endpoints.
21677
+ * Every method requires a customer access token (JWT).
21678
+ */
21679
+ declare class MeResource {
21680
+ private client;
21681
+ constructor(client: Hydra);
21682
+ private opts;
21683
+ /** Get the authenticated customer's profile. */
21684
+ getProfile(accessToken: string): Promise<DataResponse<unknown>>;
21685
+ /** Update profile fields (first_name, last_name, phone, locale). */
21686
+ updateProfile(accessToken: string, body: UpdateProfileBody): Promise<DataResponse<unknown>>;
21687
+ /** Change password. Invalidates all sessions and returns new tokens. */
21688
+ changePassword(accessToken: string, body: ChangePasswordBody): Promise<TokenResponse>;
21689
+ /** List the customer's order history. */
21690
+ listOrders(accessToken: string, params?: MeOrdersParams): Promise<ListResponse<unknown>>;
21691
+ /** List the customer's addresses. */
21692
+ listAddresses(accessToken: string): Promise<DataResponse<unknown[]>>;
21693
+ /** Create a new address. */
21694
+ createAddress(accessToken: string, body: CreateAddressBody): Promise<DataResponse<unknown>>;
21695
+ /** Update an existing address. */
21696
+ updateAddress(accessToken: string, id: string, body: UpdateAddressBody): Promise<DataResponse<unknown>>;
21697
+ /** Delete an address. */
21698
+ deleteAddress(accessToken: string, id: string): Promise<void>;
21699
+ /** Get store credit balance breakdown. */
21700
+ getCredit(accessToken: string): Promise<DataResponse<CreditBalance>>;
21701
+ /** List store credit transactions. */
21702
+ listCreditTransactions(accessToken: string, params?: {
21703
+ limit?: number;
21704
+ cursor?: string;
21705
+ sort?: string;
21706
+ order?: 'asc' | 'desc';
21707
+ }): Promise<ListResponse<unknown>>;
21708
+ /** List the customer's returns. */
21709
+ listReturns(accessToken: string): Promise<DataResponse<unknown[]>>;
21710
+ /** Get active membership. */
21711
+ getMembership(accessToken: string): Promise<DataResponse<unknown>>;
21712
+ }
21713
+
21576
21714
  interface AppInfo {
21577
21715
  /** Integration/plugin name (e.g. "MyShopTheme") */
21578
21716
  name: string;
@@ -21657,6 +21795,8 @@ declare class Hydra {
21657
21795
  readonly bookings: BookingsResource;
21658
21796
  readonly lookbooks: LookbooksResource;
21659
21797
  readonly giftCards: GiftCardsResource;
21798
+ readonly auth: AuthResource;
21799
+ readonly me: MeResource;
21660
21800
  constructor(config: HydraConfig);
21661
21801
  request<T>(method: string, path: string, options?: RequestOptions): Promise<T>;
21662
21802
  /** Multipart upload for file-based endpoints (e.g. images) */
@@ -21738,4 +21878,4 @@ declare class HydraIdempotencyError extends HydraError {
21738
21878
  constructor(body: HydraErrorBody, headers: Headers);
21739
21879
  }
21740
21880
 
21741
- 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 AvailabilityOverride$1 as AvailabilityOverride, BookingsResource, type Cart$1 as Cart, type CartItem, CartResource, type Channel$1 as Channel, ChannelsResource, type CheckoutCreate$1 as CheckoutCreate, type CheckoutGet$1 as CheckoutGet, type CheckoutListItem$1 as CheckoutListItem, CheckoutResource, CheckoutsResource, type Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, type CreateGiftCardBody, 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, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, 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 ListGiftCardTransactionsParams, type ListGiftCardsParams, type ListResponse, type Location$1 as Location, LocationsResource, type Lookbook$1 as Lookbook, type LookbookTag$1 as LookbookTag, LookbooksResource, type LoyaltySummary, type MembershipPlan$1 as MembershipPlan, MembershipPlansResource, 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 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 UpdateGiftCardBody, type Variant$2 as Variant, type VariantPrice$1 as VariantPrice, VariantsResource, type Webhook$1 as Webhook, WebhooksResource, paginate, toArray };
21881
+ 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 Collection$1 as Collection, CollectionsResource, CompaniesResource, type Company$1 as Company, ContentCategoriesResource, type ContentCategory$1 as ContentCategory, 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, type Discount$1 as Discount, DiscountsResource, type DraftOrder$1 as DraftOrder, DraftOrdersResource, type ExchangeRate$1 as ExchangeRate, ExchangeRatesResource, 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 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 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 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
@@ -1807,6 +1807,127 @@ var GiftCardsResource = class {
1807
1807
  }
1808
1808
  };
1809
1809
 
1810
+ // src/resources/auth.ts
1811
+ var AuthResource = class {
1812
+ constructor(client) {
1813
+ this.client = client;
1814
+ }
1815
+ client;
1816
+ /** Register a new customer account. Returns access + refresh tokens. */
1817
+ async register(body) {
1818
+ return this.client.request("POST", "/v1/auth/register", { body });
1819
+ }
1820
+ /** Log in with email and password. Returns access + refresh tokens. */
1821
+ async login(body) {
1822
+ return this.client.request("POST", "/v1/auth/login", { body });
1823
+ }
1824
+ /** Exchange a refresh token for new access + refresh tokens (single-use rotation). */
1825
+ async refreshToken(refreshToken) {
1826
+ return this.client.request("POST", "/v1/auth/token", {
1827
+ body: { refresh_token: refreshToken }
1828
+ });
1829
+ }
1830
+ /** Invalidate a refresh token. Idempotent — succeeds even if already invalidated. */
1831
+ async logout(refreshToken) {
1832
+ return this.client.request("POST", "/v1/auth/logout", {
1833
+ body: { refresh_token: refreshToken }
1834
+ });
1835
+ }
1836
+ /** Request a password reset email. Always returns a generic message (prevents enumeration). */
1837
+ async forgotPassword(email) {
1838
+ return this.client.request("POST", "/v1/auth/forgot-password", {
1839
+ body: { email }
1840
+ });
1841
+ }
1842
+ /** Reset password using a token from the reset email. Invalidates all sessions. */
1843
+ async resetPassword(token, password) {
1844
+ return this.client.request("POST", "/v1/auth/reset-password", {
1845
+ body: { token, password }
1846
+ });
1847
+ }
1848
+ /** Verify a customer's email using the token from the verification email. */
1849
+ async verifyEmail(token) {
1850
+ return this.client.request("POST", "/v1/auth/verify-email", {
1851
+ body: { token }
1852
+ });
1853
+ }
1854
+ };
1855
+
1856
+ // src/resources/me.ts
1857
+ var MeResource = class {
1858
+ constructor(client) {
1859
+ this.client = client;
1860
+ }
1861
+ client;
1862
+ opts(accessToken, extra) {
1863
+ return {
1864
+ ...extra,
1865
+ headers: {
1866
+ Authorization: `Bearer ${accessToken}`,
1867
+ ...extra?.headers
1868
+ }
1869
+ };
1870
+ }
1871
+ /** Get the authenticated customer's profile. */
1872
+ async getProfile(accessToken) {
1873
+ return this.client.request("GET", "/v1/me", this.opts(accessToken));
1874
+ }
1875
+ /** Update profile fields (first_name, last_name, phone, locale). */
1876
+ async updateProfile(accessToken, body) {
1877
+ return this.client.request("PATCH", "/v1/me", this.opts(accessToken, { body }));
1878
+ }
1879
+ /** Change password. Invalidates all sessions and returns new tokens. */
1880
+ async changePassword(accessToken, body) {
1881
+ return this.client.request("POST", "/v1/me/password", this.opts(accessToken, { body }));
1882
+ }
1883
+ /** List the customer's order history. */
1884
+ async listOrders(accessToken, params) {
1885
+ return this.client.request("GET", "/v1/me/orders", this.opts(accessToken, {
1886
+ params
1887
+ }));
1888
+ }
1889
+ /** List the customer's addresses. */
1890
+ async listAddresses(accessToken) {
1891
+ return this.client.request("GET", "/v1/me/addresses", this.opts(accessToken));
1892
+ }
1893
+ /** Create a new address. */
1894
+ async createAddress(accessToken, body) {
1895
+ return this.client.request("POST", "/v1/me/addresses", this.opts(accessToken, { body }));
1896
+ }
1897
+ /** Update an existing address. */
1898
+ async updateAddress(accessToken, id, body) {
1899
+ return this.client.request(
1900
+ "PATCH",
1901
+ `/v1/me/addresses/${id}`,
1902
+ this.opts(accessToken, { body })
1903
+ );
1904
+ }
1905
+ /** Delete an address. */
1906
+ async deleteAddress(accessToken, id) {
1907
+ return this.client.request("DELETE", `/v1/me/addresses/${id}`, this.opts(accessToken));
1908
+ }
1909
+ /** Get store credit balance breakdown. */
1910
+ async getCredit(accessToken) {
1911
+ return this.client.request("GET", "/v1/me/credit", this.opts(accessToken));
1912
+ }
1913
+ /** List store credit transactions. */
1914
+ async listCreditTransactions(accessToken, params) {
1915
+ return this.client.request(
1916
+ "GET",
1917
+ "/v1/me/credit/transactions",
1918
+ this.opts(accessToken, { params })
1919
+ );
1920
+ }
1921
+ /** List the customer's returns. */
1922
+ async listReturns(accessToken) {
1923
+ return this.client.request("GET", "/v1/me/returns", this.opts(accessToken));
1924
+ }
1925
+ /** Get active membership. */
1926
+ async getMembership(accessToken) {
1927
+ return this.client.request("GET", "/v1/me/membership", this.opts(accessToken));
1928
+ }
1929
+ };
1930
+
1810
1931
  // src/client.ts
1811
1932
  var SDK_VERSION = "0.1.0";
1812
1933
  var INITIAL_RETRY_DELAY = 0.5;
@@ -1893,6 +2014,9 @@ var Hydra = class {
1893
2014
  lookbooks = new LookbooksResource(this);
1894
2015
  // P11: Gift Cards
1895
2016
  giftCards = new GiftCardsResource(this);
2017
+ // P12: Customer Auth
2018
+ auth = new AuthResource(this);
2019
+ me = new MeResource(this);
1896
2020
  constructor(config) {
1897
2021
  for (const key of Object.keys(config)) {
1898
2022
  if (!VALID_CONFIG_KEYS.has(key)) {
@@ -2101,6 +2225,7 @@ var Hydra = class {
2101
2225
  export {
2102
2226
  AddressesResource,
2103
2227
  AnalyticsResource,
2228
+ AuthResource,
2104
2229
  BookingsResource,
2105
2230
  CartResource,
2106
2231
  ChannelsResource,
@@ -2132,6 +2257,7 @@ export {
2132
2257
  InventoryResource,
2133
2258
  LocationsResource,
2134
2259
  LookbooksResource,
2260
+ MeResource,
2135
2261
  MembershipPlansResource,
2136
2262
  MetafieldsResource,
2137
2263
  NotificationsResource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gethydra/sdk",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "description": "Official TypeScript SDK for the Hydra Commerce API",
5
5
  "license": "MIT",
6
6
  "author": "Grant Capital Group",