remove unused
This commit is contained in:
1 parent
301dab1ca5
commit
ea1c3413a5
88 files changed
+29
-5766
No files matched your search
@@ -1,6 +1,3 @@
|
||||
import { IDocument } from '../document';
|
||||
import { IService } from '../service';
|
||||
|
||||
export interface IForm {
|
||||
queries?: {
|
||||
[key: string]: string;
|
||||
@@ -73,9 +70,7 @@ export interface IApi {
|
||||
request_id: string;
|
||||
responses: IResponse[];
|
||||
response_ids: string[];
|
||||
document?: IDocument;
|
||||
document_id?: string;
|
||||
service?: IService;
|
||||
packages?: IPackage[];
|
||||
service_id?: string;
|
||||
created_at?: string;
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { IApi } from '../api';
|
||||
import { IProxy } from '../proxy';
|
||||
|
||||
export enum IApplicationType {
|
||||
API = 'Api',
|
||||
PROXY = 'Proxy'
|
||||
API = 'Api'
|
||||
}
|
||||
|
||||
export enum ICredentialType {
|
||||
@@ -24,7 +22,6 @@ export interface ICredential {
|
||||
export interface IApplication {
|
||||
id?: string;
|
||||
api?: IApi;
|
||||
proxy?: IProxy;
|
||||
type?: IApplicationType;
|
||||
api_id?: string;
|
||||
proxy_id?: string;
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './models';
|
||||
export * from './operator';
|
||||
@@ -1,30 +0,0 @@
|
||||
import { IApi } from '../api/models';
|
||||
import { IProxy } from '../proxy';
|
||||
|
||||
export enum IDocumentType {
|
||||
API = 'Api',
|
||||
TEXT = 'Text',
|
||||
PROXY = 'Proxy'
|
||||
}
|
||||
|
||||
export interface IDocument {
|
||||
id?: string;
|
||||
name?: string;
|
||||
type: IDocumentType;
|
||||
title?: string;
|
||||
content?: string;
|
||||
rank?: number;
|
||||
api?: IApi;
|
||||
proxy?: IProxy;
|
||||
api_id?: string;
|
||||
proxy_id?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface IDocumentListResponse {
|
||||
count: number;
|
||||
items: IDocument[];
|
||||
}
|
||||
|
||||
export type IDocumentDetailResponse = IDocument;
|
||||
@@ -1,43 +0,0 @@
|
||||
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import { httpClient } from '../instance';
|
||||
import { IDocument, IDocumentDetailResponse, IDocumentListResponse } from './models';
|
||||
|
||||
export interface IDocumentQuery {
|
||||
limit: number;
|
||||
offset: number;
|
||||
ordering: string;
|
||||
private: boolean;
|
||||
}
|
||||
|
||||
class DocumentOperator {
|
||||
key = 'documents';
|
||||
|
||||
async getAll(query: IDocumentQuery, config?: AxiosRequestConfig): Promise<AxiosResponse<IDocumentListResponse>> {
|
||||
return await httpClient.get(`/${this.key}/`, {
|
||||
...config,
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
async get(id: string, config?: AxiosRequestConfig): Promise<AxiosResponse<IDocumentDetailResponse>> {
|
||||
return await httpClient.get(`/${this.key}/${id}`, config);
|
||||
}
|
||||
|
||||
async create(data: IDocument, config?: AxiosRequestConfig): Promise<AxiosResponse<IDocumentDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/`, data, config);
|
||||
}
|
||||
|
||||
async update(
|
||||
id: string,
|
||||
data: IDocument,
|
||||
config?: AxiosRequestConfig
|
||||
): Promise<AxiosResponse<IDocumentDetailResponse>> {
|
||||
return await httpClient.put(`/${this.key}/${id}`, data, config);
|
||||
}
|
||||
|
||||
async delete(id: string, config?: AxiosRequestConfig): Promise<AxiosResponse<null>> {
|
||||
return await httpClient.delete(`/${this.key}/${id}`, config);
|
||||
}
|
||||
}
|
||||
|
||||
export const documentOperator = new DocumentOperator();
|
||||
@@ -1,8 +1,4 @@
|
||||
export * from './instance';
|
||||
export * from './application';
|
||||
export * from './service';
|
||||
export * from './user';
|
||||
export * from './api';
|
||||
export * from './document';
|
||||
export * from './order';
|
||||
export * from './proxy';
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './models';
|
||||
export * from './operator';
|
||||
@@ -1,31 +0,0 @@
|
||||
import { IApplication } from '../application';
|
||||
|
||||
export enum OrderState {
|
||||
PENDING = 'Pending',
|
||||
PAID = 'Paid',
|
||||
EXPIRED = 'Expired',
|
||||
FAILED = 'Failed'
|
||||
}
|
||||
|
||||
export interface IOrder {
|
||||
id?: string;
|
||||
description?: string;
|
||||
state?: OrderState;
|
||||
price?: number;
|
||||
amount?: number;
|
||||
user_id?: number;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
application?: IApplication;
|
||||
application_id?: string;
|
||||
wechatpay_url?: string;
|
||||
alipay_url?: string;
|
||||
pay_way?: string;
|
||||
}
|
||||
|
||||
export interface IOrderListResponse {
|
||||
count: number;
|
||||
items: IOrder[];
|
||||
}
|
||||
|
||||
export type IOrderDetailResponse = IOrder;
|
||||
@@ -1,47 +0,0 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { httpClient } from '../instance';
|
||||
import { IOrder, IOrderDetailResponse, IOrderListResponse } from './models';
|
||||
|
||||
export interface IOrderQuery {
|
||||
user_id?: string;
|
||||
package_id?: string;
|
||||
offset?: number;
|
||||
limit?: number;
|
||||
ordering: string;
|
||||
}
|
||||
|
||||
class OrderService {
|
||||
key = 'orders';
|
||||
|
||||
async getAll(query: IOrderQuery): Promise<AxiosResponse<IOrderListResponse>> {
|
||||
return await httpClient.get(`/${this.key}/`, {
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
async get(id: string): Promise<AxiosResponse<IOrderDetailResponse>> {
|
||||
return await httpClient.get(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
async create(data: IOrder): Promise<AxiosResponse<IOrderDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/`, data);
|
||||
}
|
||||
|
||||
async update(id: string, data: IOrder): Promise<AxiosResponse<IOrderDetailResponse>> {
|
||||
return await httpClient.put(`/${this.key}/${id}`, data);
|
||||
}
|
||||
|
||||
async refresh(id: string): Promise<AxiosResponse<IOrderDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/${id}/refresh/`);
|
||||
}
|
||||
|
||||
async pay(id: string, data: IOrder): Promise<AxiosResponse<IOrderDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/${id}/pay/`, data);
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<AxiosResponse<null>> {
|
||||
return await httpClient.delete(`/${this.key}/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const orderOperator = new OrderService();
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './models';
|
||||
export * from './operator';
|
||||
@@ -1,36 +0,0 @@
|
||||
import { IPackage } from '../api';
|
||||
import { IDocument } from '../document';
|
||||
import { IService } from '../service';
|
||||
|
||||
export enum IProxyUnit {
|
||||
MB = 'MB'
|
||||
}
|
||||
|
||||
export interface IProxy {
|
||||
id: string;
|
||||
path: string;
|
||||
endpoint: string;
|
||||
unit?: IProxyUnit;
|
||||
price?: number;
|
||||
title?: string;
|
||||
introduction?: string;
|
||||
applied_count?: number;
|
||||
free_amount?: number;
|
||||
applied?: boolean;
|
||||
application_id?: string;
|
||||
tags?: string[];
|
||||
document?: IDocument;
|
||||
document_id?: string;
|
||||
service?: IService;
|
||||
packages?: IPackage[];
|
||||
service_id?: string;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface IProxyListResponse {
|
||||
count: number;
|
||||
items: IProxy[];
|
||||
}
|
||||
|
||||
export type IProxyDetailResponse = IProxy;
|
||||
@@ -1,43 +0,0 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { httpClient } from '../instance';
|
||||
import { IProxy, IProxyDetailResponse, IProxyListResponse } from '../proxy/models';
|
||||
|
||||
export interface IProxyQuery {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
ordering?: string;
|
||||
}
|
||||
|
||||
class ProxyOperator {
|
||||
key = 'proxies';
|
||||
|
||||
async getAll(query: IProxyQuery): Promise<AxiosResponse<IProxyListResponse>> {
|
||||
return await httpClient.get(`/${this.key}/`, {
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
async get(id: string): Promise<AxiosResponse<IProxyDetailResponse>> {
|
||||
return await httpClient.get(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
async create(data: IProxy): Promise<AxiosResponse<IProxyDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/`, data);
|
||||
}
|
||||
|
||||
async update(id: string, data: IProxy): Promise<AxiosResponse<IProxyDetailResponse>> {
|
||||
return await httpClient.put(`/${this.key}/${id}`, data);
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<AxiosResponse<null>> {
|
||||
return await httpClient.delete(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
async getAllForService(serviceId: string, query: IProxyQuery): Promise<AxiosResponse<IProxyListResponse>> {
|
||||
return await httpClient.get(`/services/${serviceId}/${this.key}/`, {
|
||||
params: query
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const proxyOperator = new ProxyOperator();
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './models';
|
||||
export * from './operator';
|
||||
@@ -1,23 +0,0 @@
|
||||
import { IApi } from '../api/models';
|
||||
|
||||
export interface IService {
|
||||
id: string;
|
||||
title: string;
|
||||
unit?: string;
|
||||
price?: number;
|
||||
description?: string;
|
||||
tags?: string[];
|
||||
thumbnail?: string;
|
||||
introduction?: string;
|
||||
api_ids?: string[];
|
||||
apis?: IApi[];
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface IServiceListResponse {
|
||||
count: number;
|
||||
items: IService[];
|
||||
}
|
||||
|
||||
export type IServiceDetailResponse = IService;
|
||||
@@ -1,38 +0,0 @@
|
||||
import { AxiosResponse } from 'axios';
|
||||
import { httpClient } from '../instance';
|
||||
import { IService, IServiceDetailResponse, IServiceListResponse } from './models';
|
||||
|
||||
export interface IServiceQuery {
|
||||
limit: number;
|
||||
offset: number;
|
||||
ordering: string;
|
||||
private: boolean;
|
||||
}
|
||||
|
||||
class ServiceOperator {
|
||||
key = 'services';
|
||||
|
||||
async getAll(query: IServiceQuery): Promise<AxiosResponse<IServiceListResponse>> {
|
||||
return await httpClient.get(`/${this.key}/`, {
|
||||
params: query
|
||||
});
|
||||
}
|
||||
|
||||
async get(id: string): Promise<AxiosResponse<IServiceDetailResponse>> {
|
||||
return await httpClient.get(`/${this.key}/${id}`);
|
||||
}
|
||||
|
||||
async create(data: IService): Promise<AxiosResponse<IServiceDetailResponse>> {
|
||||
return await httpClient.post(`/${this.key}/`, data);
|
||||
}
|
||||
|
||||
async update(id: string, data: IService): Promise<AxiosResponse<IServiceDetailResponse>> {
|
||||
return await httpClient.put(`/${this.key}/${id}`, data);
|
||||
}
|
||||
|
||||
async delete(id: string): Promise<AxiosResponse<null>> {
|
||||
return await httpClient.delete(`/${this.key}/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
export const serviceOperator = new ServiceOperator();
|
||||
Reference in new issue
Block a user