ids.d.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. export interface IdsConfig {
  2. endpoint: string;
  3. accessKeyId: string;
  4. accessKeySecret: string;
  5. }
  6. export declare enum IdsChannel {
  7. Csdn = 1,
  8. Wechat = 2,
  9. Zhihu = 3,
  10. Juejin = 4
  11. }
  12. export declare type IdsCrawlRule = 'fulldata' | 'extdata';
  13. export interface IdsArticle {
  14. code: IdsChannel;
  15. author_id: string | number;
  16. cover_url?: string;
  17. title: string;
  18. author_name?: string;
  19. sn_code: string;
  20. original_url?: string;
  21. source_address: string;
  22. is_headline?: 0 | 1;
  23. is_original: 0 | 1;
  24. body: string;
  25. label?: string;
  26. published_at: Date;
  27. external_read_num?: number;
  28. external_see_num?: number;
  29. external_like_num?: number;
  30. external_comment_num?: number;
  31. }
  32. export declare enum IdsSource {
  33. Manual = 0,
  34. User = 1,
  35. AliyunMarket = 2,
  36. TencentCloudMarket = 3,
  37. HuaweiCloudMarket = 4,
  38. Xiniu = 6,
  39. Website = 7
  40. }
  41. export interface IdsProvider {
  42. name: string;
  43. short_name?: string;
  44. tel?: string;
  45. email?: string;
  46. logo?: string;
  47. description?: string;
  48. service_time?: string;
  49. source: IdsSource;
  50. source_pid: string | number;
  51. source_url?: string;
  52. }
  53. export interface IdsSolutionExtra {
  54. api_gateway: {
  55. service_id: string;
  56. api_id: string;
  57. dep_api_id?: string[];
  58. };
  59. icon_padding?: number;
  60. }
  61. export interface IdsSolution {
  62. uid: number;
  63. title: string;
  64. description: string;
  65. images: string;
  66. details: string;
  67. plain_text?: string;
  68. service_type?: string[];
  69. dimension: 1 | 2;
  70. status: number;
  71. source: IdsSource;
  72. source_id: string;
  73. source_pid: string;
  74. source_dt?: string;
  75. source_url: string;
  76. source_tags?: string[];
  77. source_labels?: string;
  78. ext_sold?: number;
  79. ext_score?: number;
  80. skus?: any[];
  81. api?: any[];
  82. doc_path?: string;
  83. is_signed?: 1 | 0;
  84. type?: 'gateway';
  85. min_price?: number;
  86. max_price?: number;
  87. extra?: IdsSolutionExtra | string;
  88. }
  89. export declare const randomtail: () => string;
  90. export declare class Ids {
  91. config: IdsConfig;
  92. constructor(config: IdsConfig);
  93. private request;
  94. getCrawlAuthors(channel: IdsChannel): Promise<any>;
  95. getCrawlArticleRules(params: {
  96. ids: string[];
  97. channel: IdsChannel;
  98. }): Promise<any>;
  99. putArticle(data: IdsArticle, rule: IdsCrawlRule): Promise<any>;
  100. putProvider(data: IdsProvider): Promise<any>;
  101. putSolution(data: IdsSolution): Promise<any>;
  102. }