Skip to content
On this page

WebpagesView 类型

CreateViewRequest

ts
interface CreateViewRequest {
  /**
   * 视图的标题
   */
  title: string;
  /**
   * 视图的描述
   */
  description?: string;
  /**
   * 页面排序方式
   */
  sort?: WebpagesViewSortOrder;
  /**
   * 显示页面的数量
   */
  limit?: number;
  /**
   * limit 是否生效
   */
  enableLimit?: boolean;
  /**
   * view 的过滤条件
   */
  filters?: WebpagesViewFilter[];
  /**
   * filter 生效的规则
   */
  match?: WebpagesViewFilterMatchRule;
}

WebpagesView

ts
interface WebpagesView {
  id: string;
  title: string;
  /**
   * 视图的描述
   */
  description?: string;
  /**
   * limit 是否生效
   */
  enableLimit: boolean;
  /**
   * 显示页面的数量
   */
  limit: number;
  /**
   * 页面排序方式
   */
  sort: WebpagesViewSortOrder;
  /**
   * 页面的过滤方式
   */
  filters?: WithId<WebpagesViewFilter>[];
  /**
   * view 的创建时间
   */
  createdAt: number;
}

WebpagesViewFilterMatchRule

ts
/**
 * filter 生效的规则
 */
type WebpagesViewFilterMatchRule = "and" | "or";

WebpagesViewFilterType

ts
enum WebpagesViewFilterType {
  constant = 0,
  select = 1,
  multiple_selection = 2,
}

WebpagesViewFilter

ts
type WebpagesViewFilter =
  | {
      type: WebpagesViewFilterType.multiple_selection;
      key: "host";
      operator: boolean;
      rightOperand: string[];
    }
  | {
      type: WebpagesViewFilterType.constant;
      key: "liked";
      operator: boolean;
    }
  | {
      type: WebpagesViewFilterType.select;
      key: "annotation";
      operator: AnnotationFilterOperator.is;
      rightOperand: number;
    }
  | {
      type: WebpagesViewFilterType.select;
      key: "first-add-time";
      operator: FirstAddTimeFilterOperator.before;
      rightOperand: FirstAddTimeFilterRightOperands;
    }
  | {
      type: WebpagesViewFilterType.constant;
      key: "link-duplicate";
      operator: boolean;
    }
  | {
      type: WebpagesViewFilterType.constant;
      key: "title-duplicate";
      operator: boolean;
    };

PatchWebpagesViewRequest

ts
interface PatchWebpagesViewRequest {
  title?: string;
  description?: string;
  sort?: WebpagesViewSortOrder;
  limit?: number;
  enableLimit?: boolean;
  match?: WebpagesViewFilterMatchRule;
}