shrub/pkg/npm/api/contacts/index.d.ts

79 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-01-27 08:45:18 +03:00
import { Path, Patp } from "..";
2021-02-17 05:35:28 +03:00
import {Resource} from "../groups/update.d";
2021-01-27 08:45:18 +03:00
export type ContactUpdate =
| ContactUpdateAdd
| ContactUpdateRemove
| ContactUpdateEdit
| ContactUpdateInitial
interface ContactUpdateAdd {
add: {
ship: Patp;
contact: Contact;
};
}
interface ContactUpdateRemove {
remove: {
ship: Patp;
};
}
interface ContactUpdateEdit {
edit: {
path: Path;
ship: Patp;
"edit-field": ContactEditField;
timestamp: number;
2021-01-27 08:45:18 +03:00
};
}
interface ContactUpdateAllowShips {
allow: {
ships: Patp[];
}
2021-01-27 08:45:18 +03:00
}
interface ContactUpdateAllowGroup {
allow: {
group: Path;
}
2021-01-27 08:45:18 +03:00
}
interface ContactUpdateSetPublic {
'set-public': boolean;
}
2021-01-27 08:45:18 +03:00
export interface ContactShare {
share: Patp;
}
2021-01-27 08:45:18 +03:00
interface ContactUpdateInitial {
initial: Rolodex;
}
2021-01-27 08:45:18 +03:00
export type Rolodex = {
2021-01-27 08:45:18 +03:00
[p in Patp]: Contact;
};
export interface Contact {
nickname: string;
bio: string;
status: string;
2021-01-27 08:45:18 +03:00
color: string;
avatar: string | null;
cover: string | null;
groups: Path[];
'last-updated': number;
2021-01-27 08:45:18 +03:00
}
type ContactKeys = keyof Contact;
export type ContactEditFieldPrim = Exclude<ContactKeys, "groups" | "last-updated">;
export type ContactEditField = Partial<Pick<Contact, ContactEditFieldPrim>> & {
'add-group'?: Resource;
'remove-group'?: Resource;
2021-01-27 08:45:18 +03:00
};