phonesinc 2.0.2 → 2.1.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 CHANGED
@@ -1,4 +1,4 @@
1
- import type { VirtualPhone, VirtualPhoneHost, VirtualPhoneTarget, ApiResponse, App, AppiumRequest, AppRequest, ClientOptions, Endpoint, FileExport, Identity, KeyRequest, Media, MediaImported, MediaImportFailed, MediaImporting, MediaImportStatusRequest, MediaSource, MediaUploadRequest, OptionalEndpoint, Phone, PhoneFile, PhoneResult, PhoneSelection, PhoneTargets, RequestOptions, ScreenRequest, Screenshot, Session, Stream, TouchRequest, TypeRequest } from "./types.js";
1
+ import type { VirtualPhone, VirtualPhoneHost, VirtualPhoneTarget, ApiResponse, App, AppiumRequest, AppRequest, AuthenticatorAddRequest, AuthenticatorCode, AuthenticatorEntry, AuthenticatorUpdateRequest, ClientOptions, Endpoint, FileExport, Identity, KeyRequest, Media, MediaImported, MediaImportFailed, MediaImporting, MediaImportStatusRequest, MediaSource, MediaUploadRequest, OptionalEndpoint, Phone, PhoneFile, PhoneResult, PhoneSelection, PhoneTargets, Rental, RentRequest, RequestOptions, ScreenRequest, Screenshot, Session, Stream, TouchRequest, TypeRequest, VerificationService } from "./types.js";
2
2
  export type * from "./types.js";
3
3
  /** Public phone operations. A request is sent once; actions are never replayed. */
4
4
  export declare class PhonesInc {
@@ -131,6 +131,36 @@ export declare class PhonesInc {
131
131
  }, PhoneResult[]>;
132
132
  };
133
133
  readonly stream: OptionalEndpoint<PhoneSelection, Stream>;
134
+ /** The organization's 2FA codes. */
135
+ readonly authenticator: {
136
+ get: OptionalEndpoint<{
137
+ phone?: string;
138
+ }, AuthenticatorEntry[]>;
139
+ add: Endpoint<AuthenticatorAddRequest, AuthenticatorEntry>;
140
+ code: Endpoint<{
141
+ id: string;
142
+ }, AuthenticatorCode>;
143
+ update: Endpoint<AuthenticatorUpdateRequest, AuthenticatorEntry>;
144
+ delete: Endpoint<{
145
+ id: string;
146
+ }, {
147
+ id: string;
148
+ }>;
149
+ };
150
+ /** Rent an email address or phone number for a service and read the code sent to it. */
151
+ readonly verification: {
152
+ services: OptionalEndpoint<{
153
+ search?: string;
154
+ }, VerificationService[]>;
155
+ rent: Endpoint<RentRequest, Rental>;
156
+ rental: Endpoint<{
157
+ id: string;
158
+ }, Rental>;
159
+ rentals: OptionalEndpoint<Record<never, never>, Rental[]>;
160
+ cancel: Endpoint<{
161
+ id: string;
162
+ }, Rental>;
163
+ };
134
164
  /** Raw WebDriver responses, including WebDriver errors, are returned unchanged. */
135
165
  readonly appium: ((body: AppiumRequest, options?: RequestOptions) => Promise<Response>) & {
136
166
  readonly endpoint: string;
package/dist/index.js CHANGED
@@ -191,6 +191,22 @@ export class PhonesInc {
191
191
  set: this.required("/v1/clipboard/set"),
192
192
  };
193
193
  stream = this.optional("/v1/stream");
194
+ /** The organization's 2FA codes. */
195
+ authenticator = {
196
+ get: this.optional("/v1/authenticator"),
197
+ add: this.required("/v1/authenticator/add"),
198
+ code: this.required("/v1/authenticator/code"),
199
+ update: this.required("/v1/authenticator/update"),
200
+ delete: this.required("/v1/authenticator/delete"),
201
+ };
202
+ /** Rent an email address or phone number for a service and read the code sent to it. */
203
+ verification = {
204
+ services: this.optional("/v1/verification/services"),
205
+ rent: this.required("/v1/verification/rent"),
206
+ rental: this.required("/v1/verification/rental"),
207
+ rentals: this.optional("/v1/verification/rentals"),
208
+ cancel: this.required("/v1/verification/cancel"),
209
+ };
194
210
  /** Raw WebDriver responses, including WebDriver errors, are returned unchanged. */
195
211
  appium = this.custom("/v1/appium", async (path, request, options) => {
196
212
  const base = `${this.baseUrl}${path}`;
package/dist/types.d.ts CHANGED
@@ -60,6 +60,35 @@ export type Media = {
60
60
  url: string;
61
61
  createdAt: string;
62
62
  };
63
+ export type AuthenticatorApp = "tiktok" | "instagram";
64
+ /** A 2FA (TOTP) entry with its current code; the secret is never returned. */
65
+ export type AuthenticatorEntry = {
66
+ id: string;
67
+ app: AuthenticatorApp;
68
+ label: string;
69
+ phone: string | null;
70
+ code: string;
71
+ expiresAt: string;
72
+ createdAt: string;
73
+ };
74
+ export type AuthenticatorCode = {
75
+ code: string;
76
+ expiresAt: string;
77
+ };
78
+ /** `secret` is the setup key or an otpauth:// URI. */
79
+ export type AuthenticatorAddRequest = {
80
+ app: AuthenticatorApp;
81
+ label: string;
82
+ secret: string;
83
+ phone?: string;
84
+ };
85
+ /** `phone: null` unlinks the phone. */
86
+ export type AuthenticatorUpdateRequest = {
87
+ id: string;
88
+ label?: string;
89
+ app?: AuthenticatorApp;
90
+ phone?: string | null;
91
+ };
63
92
  export type Identity = {
64
93
  organization: {
65
94
  id: string;
@@ -95,6 +124,33 @@ export type Screenshot = {
95
124
  elements?: Element[];
96
125
  annotatedImageUrl?: string;
97
126
  };
127
+ /** A service you can rent an email address or phone number for. */
128
+ export type VerificationService = {
129
+ id: string;
130
+ name: string;
131
+ email: {
132
+ available: number;
133
+ };
134
+ phone: {
135
+ available: boolean;
136
+ };
137
+ };
138
+ /** A rented email address or phone number and the code sent to it. */
139
+ export type Rental = {
140
+ id: string;
141
+ type: "email" | "phone";
142
+ service: string;
143
+ address: string;
144
+ status: "active" | "completed" | "expired" | "cancelled";
145
+ code: string | null;
146
+ codeReceivedAt: string | null;
147
+ expiresAt: string;
148
+ createdAt: string;
149
+ };
150
+ export type RentRequest = {
151
+ type: "email" | "phone";
152
+ service: string;
153
+ };
98
154
  export type FileExport = {
99
155
  url: string;
100
156
  filename: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phonesinc",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "The public Phones Inc API client",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",