repos / neovimcraft

website that makes it easy to find neovim plugins
git clone https://github.com/neurosnap/neovimcraft.git

neovimcraft / src
Eric Bower · 11 Apr 23

types.ts

 1export interface Plugin {
 2  type: "github" | "srht";
 3  id: string;
 4  name: string;
 5  username: string;
 6  repo: string;
 7  link: string;
 8  tags: string[];
 9  homepage: string;
10  branch: string;
11  openIssues: number;
12  watchers: number;
13  forks: number;
14  stars: number;
15  subscribers: number;
16  network: number;
17  description: string;
18  createdAt: string;
19  updatedAt: string;
20}
21
22export type PluginMap = { [key: string]: Plugin };
23
24export interface Tag {
25  id: string;
26  count: number;
27}
28
29export type TagMap = { [key: string]: Tag };
30
31export interface PluginData {
32  plugins: Plugin[];
33  tags: Tag[];
34  tagDb: TagMap;
35}
36
37export interface Resource {
38  type: "github" | "srht";
39  username: string;
40  repo: string;
41  tags: string[];
42}
43
44export type ResourceMap = { [key: string]: Resource };
45
46export interface ApiSuccess<D = any> {
47  ok: true;
48  next?: string;
49  data: D;
50}
51
52export interface ApiFailure {
53  ok: false;
54  data: { status: number; error: Error };
55}
56
57export type Resp<D> = ApiSuccess<D> | ApiFailure;
58
59export interface FetchRepoProps {
60  username: string;
61  repo: string;
62  token: string;
63}