Acathur 4 лет назад
Родитель
Сommit
e60c63bbc1
4 измененных файлов с 52 добавлено и 0 удалено
  1. 42 0
      dist/lib/ids.d.ts
  2. 2 0
      dist/lib/index.d.ts
  3. 7 0
      dist/lib/request.d.ts
  4. 1 0
      tsconfig.json

+ 42 - 0
dist/lib/ids.d.ts

@@ -0,0 +1,42 @@
+export interface IdsConfig {
+    endpoint: string;
+    accessKeyId: string;
+    accessKeySecret: string;
+}
+export declare enum IdsChannel {
+    Csdn = 1,
+    Wechat = 2,
+    Zhihu = 3,
+    Juejin = 4
+}
+export declare type IdsCrawlRule = 'fulldata' | 'extdata';
+export interface IdsArticle {
+    author_id: string | number;
+    cover_url: string;
+    code: IdsChannel;
+    title: string;
+    author_name?: string;
+    sn_code: string;
+    original_url?: string;
+    source_address?: string;
+    is_headline?: 0 | 1;
+    label?: string;
+    published_at: Date;
+    body: string;
+    is_original?: 0 | 1;
+    external_read_num?: number;
+    external_see_num?: number;
+    external_like_num?: number;
+    external_comment_num?: number;
+}
+export declare class Ids {
+    config: IdsConfig;
+    constructor(config: IdsConfig);
+    private request;
+    getCrawlAuthors(channel: IdsChannel): Promise<any>;
+    getCrawlArticleRules(params: {
+        ids: string[];
+        channel: IdsChannel;
+    }): Promise<any>;
+    putArticle(data: IdsArticle, rule: IdsCrawlRule): Promise<any>;
+}

+ 2 - 0
dist/lib/index.d.ts

@@ -0,0 +1,2 @@
+export { request } from './request';
+export { Ids, IdsConfig, IdsChannel, IdsCrawlRule, IdsArticle } from './ids';

+ 7 - 0
dist/lib/request.d.ts

@@ -0,0 +1,7 @@
+import { AxiosRequestConfig, AxiosResponse } from 'axios';
+export declare const axios: import("axios").AxiosInstance;
+export interface RequestConfig extends AxiosRequestConfig {
+    timeout?: number;
+    maxRetries?: number;
+}
+export declare const request: (config: RequestConfig, retries?: number) => Promise<AxiosResponse<any>>;

+ 1 - 0
tsconfig.json

@@ -12,6 +12,7 @@
     "experimentalDecorators": true,
     "strictPropertyInitialization": false,
     "noImplicitAny": false,
+    "declaration": true,
     "types": [
       "@types/node"
     ]