Move Account interface to types/ directory

merge-requests/1084/head
Alex Gleason 3 years ago
parent 8c7a7fd7dc
commit 6e61cb525c
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -1,45 +1,8 @@
import { Map as ImmutableMap, List as ImmutableList, Record } from 'immutable';
import { IAccount } from 'soapbox/types';
import { mergeDefined } from 'soapbox/utils/normalizers';
interface Account {
acct: string;
avatar: string;
avatar_static: string;
birthday: Date | undefined;
bot: boolean;
created_at: Date;
display_name: string;
emojis: ImmutableList<any>;
fields: ImmutableList<any>;
followers_count: number;
following_count: number;
fqn: string;
header: string;
header_static: string;
id: string;
last_status_at: Date;
location: string;
locked: boolean;
moved: null;
note: string;
pleroma: ImmutableMap<any, any>;
source: ImmutableMap<any, any>;
statuses_count: number;
uri: string;
url: string;
username: string;
verified: boolean;
// Internal fields
display_name_html: string;
note_emojified: string;
note_plain: string;
patron: ImmutableMap<any, any>;
relationship: ImmutableList<any>;
should_refetch: boolean;
}
const AccountRecord = Record({
acct: '',
avatar: '',
@ -130,7 +93,7 @@ const normalizeLocation = (account: ImmutableMap<string, any>) => {
});
};
export const normalizeAccount = (account: ImmutableMap<string, any>): Account => {
export const normalizeAccount = (account: ImmutableMap<string, any>): IAccount => {
return AccountRecord(
account.withMutations(account => {
normalizePleromaLegacyFields(account);

@ -0,0 +1,44 @@
/**
* Account entity.
* https://docs.joinmastodon.org/entities/account/
**/
interface IAccount {
acct: string;
avatar: string;
avatar_static: string;
birthday: Date | undefined;
bot: boolean;
created_at: Date;
display_name: string;
emojis: Iterable<any>;
fields: Iterable<any>;
followers_count: number;
following_count: number;
fqn: string;
header: string;
header_static: string;
id: string;
last_status_at: Date;
location: string;
locked: boolean;
moved: null;
note: string;
pleroma: Record<any, any>;
source: Record<any, any>;
statuses_count: number;
uri: string;
url: string;
username: string;
verified: boolean;
// Internal fields
display_name_html: string;
note_emojified: string;
note_plain: string;
patron: Record<any, any>;
relationship: Iterable<any>;
should_refetch: boolean;
}
export { IAccount };

@ -0,0 +1,3 @@
import { IAccount } from './account';
export { IAccount };
Loading…
Cancel
Save