import Response from '../response'
import MisskeyEntity from './entity'
import MegalodonEntity from '../entity'
import WebSocket from './web_socket'
export declare const isEmojiArr: (item: any) => item is MisskeyEntity.Emoji[]
declare namespace MisskeyAPI {
	namespace Entity {
		type App = MisskeyEntity.App
		type Blocking = MisskeyEntity.Blocking
		type Choice = MisskeyEntity.Choice
		type CreatedNote = MisskeyEntity.CreatedNote
		type Emoji = MisskeyEntity.Emoji
		type EmojiKeyValue = MisskeyEntity.EmojiKeyValue
		type Favorite = MisskeyEntity.Favorite
		type File = MisskeyEntity.File
		type Follower = MisskeyEntity.Follower
		type Following = MisskeyEntity.Following
		type FollowRequest = MisskeyEntity.FollowRequest
		type Hashtag = MisskeyEntity.Hashtag
		type List = MisskeyEntity.List
		type Meta = MisskeyEntity.Meta
		type Mute = MisskeyEntity.Mute
		type Note = MisskeyEntity.Note
		type Notification = MisskeyEntity.Notification
		type Poll = MisskeyEntity.Poll
		type Reaction = MisskeyEntity.Reaction
		type Relation = MisskeyEntity.Relation
		type User = MisskeyEntity.User
		type UserDetail = MisskeyEntity.UserDetail
		type UserKey = MisskeyEntity.UserKey
		type Session = MisskeyEntity.Session
		type Stats = MisskeyEntity.Stats
		type APIEmoji = {
			emojis: Emoji[]
		}
	}
	namespace Converter {
		const emoji: (e: Entity.Emoji) => MegalodonEntity.Emoji
		const emojiConverter: (e: MisskeyEntity.EmojiKeyValue | MisskeyEntity.Emoji[]) => MisskeyEntity.Emoji[]
		const user: (u: Entity.User, host: string) => MegalodonEntity.Account
		const userDetail: (u: Entity.UserDetail, host: string) => MegalodonEntity.Account
		const visibility: (v: 'public' | 'home' | 'followers' | 'specified') => 'public' | 'unlisted' | 'private' | 'direct'
		const encodeVisibility: (v: 'public' | 'unlisted' | 'private' | 'direct') => 'public' | 'home' | 'followers' | 'specified'
		const fileType: (s: string) => 'unknown' | 'image' | 'gifv' | 'video' | 'audio'
		const file: (f: Entity.File) => MegalodonEntity.Attachment
		const follower: (f: Entity.Follower, host: string) => MegalodonEntity.Account
		const following: (f: Entity.Following, host: string) => MegalodonEntity.Account
		const relation: (r: Entity.Relation) => MegalodonEntity.Relationship
		const choice: (c: Entity.Choice) => MegalodonEntity.PollOption
		const poll: (p: Entity.Poll) => MegalodonEntity.Poll
		const note: (n: Entity.Note, host: string) => MegalodonEntity.Status
		const mapReactions: (
			host: string,
			r: {
				[key: string]: number
			},
			myReaction: string,
			emojiData: MisskeyEntity.Emoji[] | MisskeyEntity.EmojiKeyValue
		) => Array<MegalodonEntity.Reaction>
		const reactions: (r: Array<Entity.Reaction>, host: string, emojiData: MisskeyEntity.Emoji[] | MisskeyEntity.EmojiKeyValue) => Array<MegalodonEntity.Reaction>
		const noteToConversation: (n: Entity.Note, host: string) => MegalodonEntity.Conversation
		const list: (l: Entity.List) => MegalodonEntity.List
		const encodeNotificationType: (e: MegalodonEntity.NotificationType) => MisskeyEntity.NotificationType
		const decodeNotificationType: (e: MisskeyEntity.NotificationType) => MegalodonEntity.NotificationType
		const notification: (n: Entity.Notification, host: string) => MegalodonEntity.Notification
		const stats: (s: Entity.Stats) => MegalodonEntity.Stats
		const meta: (m: Entity.Meta, s: Entity.Stats) => MegalodonEntity.Instance
		const hashtag: (h: Entity.Hashtag) => MegalodonEntity.Tag
	}
	const DEFAULT_SCOPE: string[]
	interface Interface {
		post<T = any>(
			path: string,
			params?: any,
			headers?: {
				[key: string]: string
			}
		): Promise<Response<T>>
		cancel(): void
		socket(channel: 'user' | 'localTimeline' | 'hybridTimeline' | 'globalTimeline' | 'conversation' | 'list', listId?: string): WebSocket
	}
	class Client implements Interface {
		private accessToken
		private baseUrl
		private userAgent
		private abortController
		constructor(baseUrl: string, accessToken: string | null, userAgent?: string)
		post<T>(
			path: string,
			params?: any,
			headers?: {
				[key: string]: string
			}
		): Promise<Response<T>>
		cancel(): void
		socket(channel: 'user' | 'localTimeline' | 'hybridTimeline' | 'globalTimeline' | 'conversation' | 'list', listId?: string): WebSocket
	}
}
export default MisskeyAPI
