Comparing version 3.0.0-beta.1 to 3.0.0-beta.2
@@ -42,2 +42,32 @@ "use strict"; | ||
class WhatsApp { | ||
constructor(client, base_path) { | ||
_defineProperty(this, "delivery", "whatsapp"); | ||
this.client = client; | ||
this.base_path = base_path; | ||
} | ||
endpoint(path) { | ||
return `${this.base_path}/${this.delivery}/${path}`; | ||
} | ||
send(data) { | ||
return (0, _shared.request)(this.client, { | ||
method: "POST", | ||
url: this.endpoint("send"), | ||
data | ||
}); | ||
} | ||
loginOrCreate(data) { | ||
return (0, _shared.request)(this.client, { | ||
method: "POST", | ||
url: this.endpoint("login_or_create"), | ||
data | ||
}); | ||
} | ||
} | ||
class OTPs { | ||
@@ -49,2 +79,3 @@ constructor(client) { | ||
this.sms = new SMS(client, this.base_path); | ||
this.whatsapp = new WhatsApp(client, this.base_path); | ||
} | ||
@@ -51,0 +82,0 @@ |
{ | ||
"name": "stytch", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-beta.2", | ||
"description": "A wrapper for the Stytch API", | ||
@@ -5,0 +5,0 @@ "types": "./types/lib/index.d.ts", |
@@ -23,2 +23,22 @@ import type { AxiosInstance } from "axios"; | ||
} | ||
export interface OTPWhatsAppSendRequest { | ||
phone_number: string; | ||
expiration_minutes?: bigint; | ||
attributes?: Attributes; | ||
} | ||
export interface OTPWhatsAppSendResponse extends BaseResponse { | ||
user_id: string; | ||
phone_id: string; | ||
} | ||
export interface OTPWhatsAppLoginOrCreateRequest { | ||
phone_number: string; | ||
expiration_minutes?: bigint; | ||
attributes?: Attributes; | ||
create_user_as_pending?: boolean; | ||
} | ||
export interface OTPWhatsAppLoginOrCreateResponse extends BaseResponse { | ||
user_id: string; | ||
phone_id: string; | ||
user_created: boolean; | ||
} | ||
export interface AuthenticateRequest { | ||
@@ -46,5 +66,15 @@ method_id: string; | ||
} | ||
declare class WhatsApp { | ||
base_path: string; | ||
delivery: string; | ||
private client; | ||
constructor(client: AxiosInstance, base_path: string); | ||
private endpoint; | ||
send(data: OTPWhatsAppSendRequest): Promise<OTPWhatsAppSendResponse>; | ||
loginOrCreate(data: OTPWhatsAppLoginOrCreateRequest): Promise<OTPWhatsAppLoginOrCreateResponse>; | ||
} | ||
export declare class OTPs { | ||
base_path: string; | ||
sms: SMS; | ||
whatsapp: WhatsApp; | ||
private client; | ||
@@ -51,0 +81,0 @@ constructor(client: AxiosInstance); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
28871
642
0