@atproto/api
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -6,2 +6,3 @@ import { Client as XrpcClient, ServiceClient as XrpcServiceClient } from '@atproto/xrpc'; | ||
import * as ComAtprotoAccountGet from './types/com/atproto/account/get'; | ||
import * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete'; | ||
import * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset'; | ||
@@ -70,2 +71,3 @@ import * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword'; | ||
export * as ComAtprotoAccountGet from './types/com/atproto/account/get'; | ||
export * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete'; | ||
export * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset'; | ||
@@ -203,2 +205,3 @@ export * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword'; | ||
get(params?: ComAtprotoAccountGet.QueryParams, opts?: ComAtprotoAccountGet.CallOptions): Promise<ComAtprotoAccountGet.Response>; | ||
requestDelete(data?: ComAtprotoAccountRequestDelete.InputSchema, opts?: ComAtprotoAccountRequestDelete.CallOptions): Promise<ComAtprotoAccountRequestDelete.Response>; | ||
requestPasswordReset(data?: ComAtprotoAccountRequestPasswordReset.InputSchema, opts?: ComAtprotoAccountRequestPasswordReset.CallOptions): Promise<ComAtprotoAccountRequestPasswordReset.Response>; | ||
@@ -205,0 +208,0 @@ resetPassword(data?: ComAtprotoAccountResetPassword.InputSchema, opts?: ComAtprotoAccountResetPassword.CallOptions): Promise<ComAtprotoAccountResetPassword.Response>; |
@@ -1,8 +0,14 @@ | ||
import { Headers } from '@atproto/xrpc'; | ||
import { Headers, XRPCError } from '@atproto/xrpc'; | ||
export interface QueryParams { | ||
} | ||
export declare type InputSchema = undefined; | ||
export interface InputSchema { | ||
did: string; | ||
password: string; | ||
token: string; | ||
[k: string]: unknown; | ||
} | ||
export interface CallOptions { | ||
headers?: Headers; | ||
qp?: QueryParams; | ||
encoding: 'application/json'; | ||
} | ||
@@ -13,2 +19,8 @@ export interface Response { | ||
} | ||
export declare class ExpiredTokenError extends XRPCError { | ||
constructor(src: XRPCError); | ||
} | ||
export declare class InvalidTokenError extends XRPCError { | ||
constructor(src: XRPCError); | ||
} | ||
export declare function toKnownErr(e: any): any; |
{ | ||
"name": "@atproto/api", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -13,2 +13,3 @@ /** | ||
import * as ComAtprotoAccountGet from './types/com/atproto/account/get' | ||
import * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete' | ||
import * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset' | ||
@@ -95,2 +96,3 @@ import * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword' | ||
export * as ComAtprotoAccountGet from './types/com/atproto/account/get' | ||
export * as ComAtprotoAccountRequestDelete from './types/com/atproto/account/requestDelete' | ||
export * as ComAtprotoAccountRequestPasswordReset from './types/com/atproto/account/requestPasswordReset' | ||
@@ -310,2 +312,13 @@ export * as ComAtprotoAccountResetPassword from './types/com/atproto/account/resetPassword' | ||
requestDelete( | ||
data?: ComAtprotoAccountRequestDelete.InputSchema, | ||
opts?: ComAtprotoAccountRequestDelete.CallOptions, | ||
): Promise<ComAtprotoAccountRequestDelete.Response> { | ||
return this._service.xrpc | ||
.call('com.atproto.account.requestDelete', opts?.qp, data, opts) | ||
.catch((e) => { | ||
throw ComAtprotoAccountRequestDelete.toKnownErr(e) | ||
}) | ||
} | ||
requestPasswordReset( | ||
@@ -312,0 +325,0 @@ data?: ComAtprotoAccountRequestPasswordReset.InputSchema, |
@@ -11,3 +11,8 @@ /** | ||
export type InputSchema = undefined | ||
export interface InputSchema { | ||
did: string | ||
password: string | ||
token: string | ||
[k: string]: unknown | ||
} | ||
@@ -17,2 +22,3 @@ export interface CallOptions { | ||
qp?: QueryParams | ||
encoding: 'application/json' | ||
} | ||
@@ -25,6 +31,20 @@ | ||
export class ExpiredTokenError extends XRPCError { | ||
constructor(src: XRPCError) { | ||
super(src.status, src.error, src.message) | ||
} | ||
} | ||
export class InvalidTokenError extends XRPCError { | ||
constructor(src: XRPCError) { | ||
super(src.status, src.error, src.message) | ||
} | ||
} | ||
export function toKnownErr(e: any) { | ||
if (e instanceof XRPCError) { | ||
if (e.error === 'ExpiredToken') return new ExpiredTokenError(e) | ||
if (e.error === 'InvalidToken') return new InvalidTokenError(e) | ||
} | ||
return e | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1
1402117
193
25737