Add whitelisting and admin
This commit is contained in:
@@ -3879,6 +3879,142 @@ export class UserClient extends AuthorizedApiBase {
|
||||
}
|
||||
}
|
||||
|
||||
export class WhitelistClient extends AuthorizedApiBase {
|
||||
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
|
||||
private baseUrl: string;
|
||||
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
|
||||
|
||||
constructor(configuration: IConfig, baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
|
||||
super(configuration);
|
||||
this.http = http ? http : window as any;
|
||||
this.baseUrl = baseUrl ?? "http://localhost:5000";
|
||||
}
|
||||
|
||||
whitelist_GetWhitelistAccounts(pageNumber: number | undefined, pageSize: number | undefined, searchExternalEthereumAccount: string | null | undefined, searchTwitterAccount: string | null | undefined): Promise<PaginatedWhitelistAccountsResponse> {
|
||||
let url_ = this.baseUrl + "/api/Whitelist?";
|
||||
if (pageNumber === null)
|
||||
throw new Error("The parameter 'pageNumber' cannot be null.");
|
||||
else if (pageNumber !== undefined)
|
||||
url_ += "pageNumber=" + encodeURIComponent("" + pageNumber) + "&";
|
||||
if (pageSize === null)
|
||||
throw new Error("The parameter 'pageSize' cannot be null.");
|
||||
else if (pageSize !== undefined)
|
||||
url_ += "pageSize=" + encodeURIComponent("" + pageSize) + "&";
|
||||
if (searchExternalEthereumAccount !== undefined && searchExternalEthereumAccount !== null)
|
||||
url_ += "searchExternalEthereumAccount=" + encodeURIComponent("" + searchExternalEthereumAccount) + "&";
|
||||
if (searchTwitterAccount !== undefined && searchTwitterAccount !== null)
|
||||
url_ += "searchTwitterAccount=" + encodeURIComponent("" + searchTwitterAccount) + "&";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.transformOptions(options_).then(transformedOptions_ => {
|
||||
return this.http.fetch(url_, transformedOptions_);
|
||||
}).then((_response: Response) => {
|
||||
return this.processWhitelist_GetWhitelistAccounts(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processWhitelist_GetWhitelistAccounts(response: Response): Promise<PaginatedWhitelistAccountsResponse> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result200: any = null;
|
||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as PaginatedWhitelistAccountsResponse;
|
||||
return result200;
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<PaginatedWhitelistAccountsResponse>(null as any);
|
||||
}
|
||||
|
||||
whitelist_SetWhitelisted(id: number): Promise<WhitelistAccount> {
|
||||
let url_ = this.baseUrl + "/api/Whitelist/{id}/whitelist";
|
||||
if (id === undefined || id === null)
|
||||
throw new Error("The parameter 'id' must be defined.");
|
||||
url_ = url_.replace("{id}", encodeURIComponent("" + id));
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
let options_: RequestInit = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.transformOptions(options_).then(transformedOptions_ => {
|
||||
return this.http.fetch(url_, transformedOptions_);
|
||||
}).then((_response: Response) => {
|
||||
return this.processWhitelist_SetWhitelisted(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processWhitelist_SetWhitelisted(response: Response): Promise<WhitelistAccount> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result200: any = null;
|
||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as WhitelistAccount;
|
||||
return result200;
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<WhitelistAccount>(null as any);
|
||||
}
|
||||
|
||||
whitelist_ProcessPrivyWebhook(webhook: PrivyWebhookDto): Promise<WhitelistAccount> {
|
||||
let url_ = this.baseUrl + "/api/Whitelist/webhook";
|
||||
url_ = url_.replace(/[?&]$/, "");
|
||||
|
||||
const content_ = JSON.stringify(webhook);
|
||||
|
||||
let options_: RequestInit = {
|
||||
body: content_,
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json"
|
||||
}
|
||||
};
|
||||
|
||||
return this.transformOptions(options_).then(transformedOptions_ => {
|
||||
return this.http.fetch(url_, transformedOptions_);
|
||||
}).then((_response: Response) => {
|
||||
return this.processWhitelist_ProcessPrivyWebhook(_response);
|
||||
});
|
||||
}
|
||||
|
||||
protected processWhitelist_ProcessPrivyWebhook(response: Response): Promise<WhitelistAccount> {
|
||||
const status = response.status;
|
||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||
if (status === 200) {
|
||||
return response.text().then((_responseText) => {
|
||||
let result200: any = null;
|
||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as WhitelistAccount;
|
||||
return result200;
|
||||
});
|
||||
} else if (status !== 200 && status !== 204) {
|
||||
return response.text().then((_responseText) => {
|
||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||
});
|
||||
}
|
||||
return Promise.resolve<WhitelistAccount>(null as any);
|
||||
}
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
id?: number;
|
||||
name: string;
|
||||
@@ -5117,6 +5253,55 @@ export interface LoginRequest {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface PaginatedWhitelistAccountsResponse {
|
||||
accounts?: WhitelistAccount[] | null;
|
||||
totalCount?: number;
|
||||
pageNumber?: number;
|
||||
pageSize?: number;
|
||||
totalPages?: number;
|
||||
}
|
||||
|
||||
export interface WhitelistAccount {
|
||||
id?: number;
|
||||
privyId?: string | null;
|
||||
privyCreationDate?: Date;
|
||||
embeddedWallet?: string | null;
|
||||
externalEthereumAccount?: string | null;
|
||||
twitterAccount?: string | null;
|
||||
isWhitelisted?: boolean;
|
||||
createdAt?: Date;
|
||||
updatedAt?: Date | null;
|
||||
}
|
||||
|
||||
export interface PrivyWebhookDto {
|
||||
type?: string | null;
|
||||
user?: PrivyUserDto | null;
|
||||
wallet?: PrivyWalletDto | null;
|
||||
}
|
||||
|
||||
export interface PrivyUserDto {
|
||||
created_at?: number;
|
||||
has_accepted_terms?: boolean;
|
||||
id?: string | null;
|
||||
is_guest?: boolean;
|
||||
linked_accounts?: PrivyLinkedAccountDto[] | null;
|
||||
mfa_methods?: any[] | null;
|
||||
}
|
||||
|
||||
export interface PrivyLinkedAccountDto {
|
||||
address?: string | null;
|
||||
first_verified_at?: number | null;
|
||||
latest_verified_at?: number | null;
|
||||
type?: string | null;
|
||||
verified_at?: number | null;
|
||||
}
|
||||
|
||||
export interface PrivyWalletDto {
|
||||
type?: string | null;
|
||||
address?: string | null;
|
||||
chain_type?: string | null;
|
||||
}
|
||||
|
||||
export interface FileResponse {
|
||||
data: Blob;
|
||||
status: number;
|
||||
|
||||
Reference in New Issue
Block a user