kanban-api-client
Advanced tools
Comparing version 1.0.1-beta to 1.0.2-beta
@@ -1,11 +0,199 @@ | ||
import { FunctionReturn, LoginFailed, LoginSuccess, Unauthorized } from './Types'; | ||
import { AddBoardMember, BoardInfo, BoardListRes, CardComments, CardInfo, CardListRes, ChangePassReq, ChangePasswordError, ChangePermissionReq, CommentInfo, CommentReactions, CreateAdminReq, CreateBoardError, CreateBoardReq, CreateCardError, CreateCardReq, CreateListErr, CreateOrUpdateLabelError, CreateOrUpdateLabelReq, CreateSwimlaneErr, CreateSwimlaneReq, CreateUserError, CreateUserReq, CustomFieldCard, EditListErr, EditListReq, EditProfileError, EditProfileReq, EditSwimlaneErr, EditSwimlaneReq, EditUserError, EditUserReq, FunctionReturn, Itegrations, ListRes, LoginFailed, LoginSuccess, SwimlaneListRes, UpdateBoardError, UpdateBoardReq, UpdateCardReq, UserInfo, UserListRes } from './Types'; | ||
export declare class KanbanApiClient { | ||
host: string; | ||
constructor({ host }: { | ||
token: string; | ||
constructor({ host, getToken }: { | ||
host: string; | ||
getToken: () => string; | ||
}); | ||
protected getPath: (path: string) => string; | ||
protected getToken: (token: string) => string; | ||
login(username: string, password: string): Promise<FunctionReturn<LoginSuccess | LoginFailed>>; | ||
logout(token: string): Promise<FunctionReturn<null | Unauthorized>>; | ||
protected getToken: () => string; | ||
protected getHeadersAuth: (options: any) => any; | ||
login(username: string, password: string): Promise<FunctionReturn<LoginSuccess, LoginFailed>>; | ||
logout(): Promise<FunctionReturn<{ | ||
message: string; | ||
}>>; | ||
getCurrentUser(): Promise<FunctionReturn<UserInfo>>; | ||
getListUsers(): Promise<FunctionReturn<UserListRes[]>>; | ||
getUserById(id: string): Promise<FunctionReturn<UserListRes[]>>; | ||
editProfile(req: EditProfileReq): Promise<FunctionReturn<UserInfo, EditProfileError>>; | ||
changePassword(req: ChangePassReq): Promise<FunctionReturn<{ | ||
message: string; | ||
}, ChangePasswordError>>; | ||
editUserById(req: EditUserReq, id: string): Promise<FunctionReturn<UserInfo, EditUserError>>; | ||
addBoardMember(boardId: string, userId: string, req: AddBoardMember): Promise<FunctionReturn<{ | ||
_id: string; | ||
title: string; | ||
}>>; | ||
removeBoardMember(boardId: string, userId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
title: string; | ||
}>>; | ||
registerAdmin(req: CreateAdminReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
forgotPassword(email: string): Promise<FunctionReturn<{ | ||
message: string; | ||
}>>; | ||
createUser(req: CreateUserReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateUserError>>; | ||
deleteUserById(id: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
getBoards(): Promise<FunctionReturn<BoardListRes[]>>; | ||
getBoardCount(): Promise<FunctionReturn<{ | ||
private: number; | ||
public: number; | ||
}>>; | ||
getBoardById(boardId: string): Promise<FunctionReturn<BoardInfo>>; | ||
createBoard(req: CreateBoardReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
defaultSwimlaneId: string; | ||
}, CreateBoardError>>; | ||
updateBoardById(boardId: string, req: UpdateBoardReq): Promise<FunctionReturn<number, UpdateBoardError>>; | ||
removeBoard(boardId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
createOrUpdateLabels(boardId: string, req: CreateOrUpdateLabelReq): Promise<FunctionReturn<string, CreateOrUpdateLabelError>>; | ||
changePermissionMemberInBoard(boardId: string, memberId: string, req: ChangePermissionReq): Promise<FunctionReturn<string>>; | ||
getCardsByList(boardId: string, listId: string): Promise<FunctionReturn<CardListRes[], { | ||
message: string; | ||
}>>; | ||
getCardById(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<CardInfo, { | ||
message: string; | ||
}>>; | ||
addNewCard(boardId: string, listId: string, req: CreateCardReq): Promise<FunctionReturn<CardInfo, { | ||
message: string; | ||
} | CreateCardError>>; | ||
totalCardInBoard(boardId: string): Promise<FunctionReturn<{ | ||
board_cards_count: number; | ||
}>>; | ||
totalCardInList(boardId: string, listId: string): Promise<FunctionReturn<{ | ||
list_cards_count: number; | ||
}, { | ||
message: string; | ||
}>>; | ||
updateCardInList(boardId: string, listId: string, cardId: string, req: UpdateCardReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
deleteCardById(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getCardCustomFields(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<CustomFieldCard[], { | ||
message: string; | ||
}>>; | ||
editCardCustomFields(boardId: string, listId: string, cardId: string, customFieldId: string, req: { | ||
value: string | number | boolean | Date | null; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
value: string | number | boolean | Date | null; | ||
}[], { | ||
message: string; | ||
}>>; | ||
getSwimlanesOfBoard(boardId: string): Promise<FunctionReturn<SwimlaneListRes[], { | ||
message: string; | ||
}>>; | ||
getSwimlaneById(boardId: string, swimlaneId: string): Promise<FunctionReturn<SwimlaneListRes, { | ||
message: string; | ||
}>>; | ||
createSwimlane(boardId: string, req: CreateSwimlaneReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateSwimlaneErr | { | ||
message: string; | ||
}>>; | ||
editSwimlane(boardId: string, swimlaneId: string, req: EditSwimlaneReq): Promise<FunctionReturn<SwimlaneListRes, EditSwimlaneErr | { | ||
message: string; | ||
}>>; | ||
deleteSwimlane(boardId: string, swimlaneId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getListsOfBoard(boardId: string): Promise<FunctionReturn<ListRes[], { | ||
message: string; | ||
}>>; | ||
getListById(boardId: string, listId: string): Promise<FunctionReturn<ListRes, { | ||
message: string; | ||
}>>; | ||
addNewList(boardId: string, req: CreateListErr): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateListErr>>; | ||
editList(boardId: string, listId: string, req: EditListReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, EditListErr>>; | ||
removeList(boardId: string, listId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
getAllComments(boardId: string, cardId: string): Promise<FunctionReturn<CardComments[], { | ||
message: string; | ||
}>>; | ||
getCommentById(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<CommentInfo, { | ||
message: string; | ||
}>>; | ||
createComment(boardId: string, cardId: string, req: { | ||
comment: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
comment: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
editComment(boardId: string, cardId: string, commentId: string, req: { | ||
newComment: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
removeComment(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getCommentReactions(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<CommentReactions[], { | ||
message: string; | ||
}>>; | ||
addCommentReaction(boardId: string, cardId: string, commentId: string, req: { | ||
icon: string; | ||
}): Promise<FunctionReturn<CommentReactions[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
removeCommentReaction(boardId: string, cardId: string, commentId: string, req: { | ||
icon: string; | ||
}): Promise<FunctionReturn<CommentReactions[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
getItegrations(boardId: string): Promise<FunctionReturn<Itegrations[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
editItegrations(boardId: string, inteId: string, req: { | ||
enabled?: boolean; | ||
title?: string; | ||
url?: string; | ||
token?: string; | ||
activities?: string[]; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
activities: string[]; | ||
}>>; | ||
createNewItegration(boardId: string, req: { | ||
url: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
removeItegration(boardId: string, inteId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
} |
@@ -1,7 +0,2 @@ | ||
export interface FunctionReturn<T> { | ||
status: number; | ||
message: string; | ||
data: T; | ||
} | ||
export interface Unauthorized { | ||
export interface WekanError { | ||
isClientSafe: true; | ||
@@ -14,8 +9,14 @@ error: string; | ||
} | ||
export interface LoginSuccess { | ||
token: string; | ||
export interface FunctionReturn<D, E = {}> { | ||
status: number; | ||
message: string; | ||
data?: D; | ||
error?: WekanError | E; | ||
} | ||
export interface LoginFailed { | ||
username: string; | ||
password: string; | ||
} | ||
export * from './types/Boards'; | ||
export * from './types/Users'; | ||
export * from './types/Cards'; | ||
export * from './types/Swimlanes'; | ||
export * from './types/Lists'; | ||
export * from './types/CardComments'; | ||
export * from './types/Itegrations'; |
@@ -1,11 +0,199 @@ | ||
import { FunctionReturn, LoginFailed, LoginSuccess, Unauthorized } from './Types'; | ||
import { AddBoardMember, BoardInfo, BoardListRes, CardComments, CardInfo, CardListRes, ChangePassReq, ChangePasswordError, ChangePermissionReq, CommentInfo, CommentReactions, CreateAdminReq, CreateBoardError, CreateBoardReq, CreateCardError, CreateCardReq, CreateListErr, CreateOrUpdateLabelError, CreateOrUpdateLabelReq, CreateSwimlaneErr, CreateSwimlaneReq, CreateUserError, CreateUserReq, CustomFieldCard, EditListErr, EditListReq, EditProfileError, EditProfileReq, EditSwimlaneErr, EditSwimlaneReq, EditUserError, EditUserReq, FunctionReturn, Itegrations, ListRes, LoginFailed, LoginSuccess, SwimlaneListRes, UpdateBoardError, UpdateBoardReq, UpdateCardReq, UserInfo, UserListRes } from './Types'; | ||
export declare class KanbanApiClient { | ||
host: string; | ||
constructor({ host }: { | ||
token: string; | ||
constructor({ host, getToken }: { | ||
host: string; | ||
getToken: () => string; | ||
}); | ||
protected getPath: (path: string) => string; | ||
protected getToken: (token: string) => string; | ||
login(username: string, password: string): Promise<FunctionReturn<LoginSuccess | LoginFailed>>; | ||
logout(token: string): Promise<FunctionReturn<null | Unauthorized>>; | ||
protected getToken: () => string; | ||
protected getHeadersAuth: (options: any) => any; | ||
login(username: string, password: string): Promise<FunctionReturn<LoginSuccess, LoginFailed>>; | ||
logout(): Promise<FunctionReturn<{ | ||
message: string; | ||
}>>; | ||
getCurrentUser(): Promise<FunctionReturn<UserInfo>>; | ||
getListUsers(): Promise<FunctionReturn<UserListRes[]>>; | ||
getUserById(id: string): Promise<FunctionReturn<UserListRes[]>>; | ||
editProfile(req: EditProfileReq): Promise<FunctionReturn<UserInfo, EditProfileError>>; | ||
changePassword(req: ChangePassReq): Promise<FunctionReturn<{ | ||
message: string; | ||
}, ChangePasswordError>>; | ||
editUserById(req: EditUserReq, id: string): Promise<FunctionReturn<UserInfo, EditUserError>>; | ||
addBoardMember(boardId: string, userId: string, req: AddBoardMember): Promise<FunctionReturn<{ | ||
_id: string; | ||
title: string; | ||
}>>; | ||
removeBoardMember(boardId: string, userId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
title: string; | ||
}>>; | ||
registerAdmin(req: CreateAdminReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
forgotPassword(email: string): Promise<FunctionReturn<{ | ||
message: string; | ||
}>>; | ||
createUser(req: CreateUserReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateUserError>>; | ||
deleteUserById(id: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
getBoards(): Promise<FunctionReturn<BoardListRes[]>>; | ||
getBoardCount(): Promise<FunctionReturn<{ | ||
private: number; | ||
public: number; | ||
}>>; | ||
getBoardById(boardId: string): Promise<FunctionReturn<BoardInfo>>; | ||
createBoard(req: CreateBoardReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
defaultSwimlaneId: string; | ||
}, CreateBoardError>>; | ||
updateBoardById(boardId: string, req: UpdateBoardReq): Promise<FunctionReturn<number, UpdateBoardError>>; | ||
removeBoard(boardId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
createOrUpdateLabels(boardId: string, req: CreateOrUpdateLabelReq): Promise<FunctionReturn<string, CreateOrUpdateLabelError>>; | ||
changePermissionMemberInBoard(boardId: string, memberId: string, req: ChangePermissionReq): Promise<FunctionReturn<string>>; | ||
getCardsByList(boardId: string, listId: string): Promise<FunctionReturn<CardListRes[], { | ||
message: string; | ||
}>>; | ||
getCardById(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<CardInfo, { | ||
message: string; | ||
}>>; | ||
addNewCard(boardId: string, listId: string, req: CreateCardReq): Promise<FunctionReturn<CardInfo, { | ||
message: string; | ||
} | CreateCardError>>; | ||
totalCardInBoard(boardId: string): Promise<FunctionReturn<{ | ||
board_cards_count: number; | ||
}>>; | ||
totalCardInList(boardId: string, listId: string): Promise<FunctionReturn<{ | ||
list_cards_count: number; | ||
}, { | ||
message: string; | ||
}>>; | ||
updateCardInList(boardId: string, listId: string, cardId: string, req: UpdateCardReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
deleteCardById(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getCardCustomFields(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<CustomFieldCard[], { | ||
message: string; | ||
}>>; | ||
editCardCustomFields(boardId: string, listId: string, cardId: string, customFieldId: string, req: { | ||
value: string | number | boolean | Date | null; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
value: string | number | boolean | Date | null; | ||
}[], { | ||
message: string; | ||
}>>; | ||
getSwimlanesOfBoard(boardId: string): Promise<FunctionReturn<SwimlaneListRes[], { | ||
message: string; | ||
}>>; | ||
getSwimlaneById(boardId: string, swimlaneId: string): Promise<FunctionReturn<SwimlaneListRes, { | ||
message: string; | ||
}>>; | ||
createSwimlane(boardId: string, req: CreateSwimlaneReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateSwimlaneErr | { | ||
message: string; | ||
}>>; | ||
editSwimlane(boardId: string, swimlaneId: string, req: EditSwimlaneReq): Promise<FunctionReturn<SwimlaneListRes, EditSwimlaneErr | { | ||
message: string; | ||
}>>; | ||
deleteSwimlane(boardId: string, swimlaneId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getListsOfBoard(boardId: string): Promise<FunctionReturn<ListRes[], { | ||
message: string; | ||
}>>; | ||
getListById(boardId: string, listId: string): Promise<FunctionReturn<ListRes, { | ||
message: string; | ||
}>>; | ||
addNewList(boardId: string, req: CreateListErr): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateListErr>>; | ||
editList(boardId: string, listId: string, req: EditListReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, EditListErr>>; | ||
removeList(boardId: string, listId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
getAllComments(boardId: string, cardId: string): Promise<FunctionReturn<CardComments[], { | ||
message: string; | ||
}>>; | ||
getCommentById(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<CommentInfo, { | ||
message: string; | ||
}>>; | ||
createComment(boardId: string, cardId: string, req: { | ||
comment: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
comment: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
editComment(boardId: string, cardId: string, commentId: string, req: { | ||
newComment: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
removeComment(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getCommentReactions(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<CommentReactions[], { | ||
message: string; | ||
}>>; | ||
addCommentReaction(boardId: string, cardId: string, commentId: string, req: { | ||
icon: string; | ||
}): Promise<FunctionReturn<CommentReactions[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
removeCommentReaction(boardId: string, cardId: string, commentId: string, req: { | ||
icon: string; | ||
}): Promise<FunctionReturn<CommentReactions[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
getItegrations(boardId: string): Promise<FunctionReturn<Itegrations[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
editItegrations(boardId: string, inteId: string, req: { | ||
enabled?: boolean; | ||
title?: string; | ||
url?: string; | ||
token?: string; | ||
activities?: string[]; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
activities: string[]; | ||
}>>; | ||
createNewItegration(boardId: string, req: { | ||
url: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
removeItegration(boardId: string, inteId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
} |
@@ -1,7 +0,2 @@ | ||
export interface FunctionReturn<T> { | ||
status: number; | ||
message: string; | ||
data: T; | ||
} | ||
export interface Unauthorized { | ||
export interface WekanError { | ||
isClientSafe: true; | ||
@@ -14,8 +9,14 @@ error: string; | ||
} | ||
export interface LoginSuccess { | ||
token: string; | ||
export interface FunctionReturn<D, E = {}> { | ||
status: number; | ||
message: string; | ||
data?: D; | ||
error?: WekanError | E; | ||
} | ||
export interface LoginFailed { | ||
username: string; | ||
password: string; | ||
} | ||
export * from './types/Boards'; | ||
export * from './types/Users'; | ||
export * from './types/Cards'; | ||
export * from './types/Swimlanes'; | ||
export * from './types/Lists'; | ||
export * from './types/CardComments'; | ||
export * from './types/Itegrations'; |
@@ -1,14 +0,103 @@ | ||
interface FunctionReturn<T> { | ||
status: number; | ||
message: string; | ||
data: T; | ||
interface BoardListRes { | ||
_id: string; | ||
title: string; | ||
description?: string; | ||
} | ||
interface Unauthorized { | ||
isClientSafe: true; | ||
error: string; | ||
reason: string; | ||
message: string; | ||
errorType: string; | ||
statusCode: number; | ||
declare const ALLOWED_COLORS: string[]; | ||
interface BoardInfo { | ||
_id: string; | ||
title: string; | ||
description?: string; | ||
slug: string; | ||
archived: boolean; | ||
archivedAt?: Date; | ||
createdAt?: Date; | ||
modifiedAt?: Date; | ||
stars: number; | ||
labels: { | ||
_id: string; | ||
name?: string; | ||
color: string; | ||
}[]; | ||
members: { | ||
userId: string; | ||
isAdmin: boolean; | ||
isActive: boolean; | ||
isNoComments?: boolean; | ||
isCommentOnly?: boolean; | ||
isWorker?: string; | ||
fullname?: string; | ||
username?: string; | ||
avatarUrl?: string; | ||
}[]; | ||
permission: 'public' | 'private'; | ||
color: string; | ||
allowsCardCounterList?: boolean; | ||
allowsBoardMemberList?: boolean; | ||
subtasksDefaultBoardId: string | null; | ||
subtasksDefaultListId: string | null; | ||
dateSettingsDefaultBoardId: string | null; | ||
dateSettingsDefaultListId: string | null; | ||
allowsSubtasks: boolean; | ||
allowsAttachments: boolean; | ||
allowsChecklists: boolean; | ||
allowsComments: boolean; | ||
allowsDescriptionTitle: boolean; | ||
allowsDescriptionText: boolean; | ||
allowsDescriptionTextOnMinicard: boolean; | ||
allowsCoverAttachmentOnMinicard: boolean; | ||
allowsBadgeAttachmentOnMinicard: boolean; | ||
allowsCardSortingByNumberOnMinicard: boolean; | ||
allowsCardNumber: boolean; | ||
allowsActivities: boolean; | ||
allowsLabels: boolean; | ||
allowsCreator: boolean; | ||
allowsAssignee: boolean; | ||
allowsMembers: boolean; | ||
allowsRequestedBy: boolean; | ||
allowsCardSortingByNumber: boolean; | ||
allowsShowLists: boolean; | ||
allowsAssignedBy: boolean; | ||
allowsReceivedDate: boolean; | ||
allowsStartDate: boolean; | ||
allowsEndDate: boolean; | ||
allowsDueDate: boolean; | ||
presentParentTask?: string; | ||
receivedAt?: Date; | ||
startAt?: Date; | ||
dueAt?: Date; | ||
endAt?: Date; | ||
spentTime?: number; | ||
isOvertime: boolean; | ||
type: string; | ||
sort: number; | ||
} | ||
interface CreateBoardReq { | ||
title: string; | ||
} | ||
type CreateBoardError = Record<keyof CreateBoardReq, string>; | ||
interface UpdateBoardReq { | ||
title: string; | ||
description: string; | ||
archived?: boolean; | ||
watch?: 'watching' | 'tracking' | 'muted'; | ||
} | ||
type UpdateBoardError = Record<keyof UpdateBoardReq, string>; | ||
interface CreateOrUpdateLabelReq { | ||
labels: { | ||
color: string; | ||
name: string; | ||
updateLabelId?: string; | ||
}; | ||
} | ||
interface CreateOrUpdateLabelError { | ||
label: string; | ||
} | ||
interface ChangePermissionReq { | ||
isAdmin: boolean; | ||
isNoComments: boolean; | ||
isCommentOnly: boolean; | ||
isWorker: boolean; | ||
} | ||
interface LoginSuccess { | ||
@@ -21,14 +110,538 @@ token: string; | ||
} | ||
interface UserListRes { | ||
_id: string; | ||
username: string; | ||
fullname: string; | ||
email: string; | ||
} | ||
interface EditProfileReq { | ||
username: string; | ||
email: string; | ||
fullname: string; | ||
loginDisabled?: boolean; | ||
} | ||
type EditProfileError = Record<keyof EditProfileReq, string>; | ||
interface ChangePassReq { | ||
newPassword: string; | ||
oldPassword: string; | ||
} | ||
type ChangePasswordError = Record<keyof ChangePassReq, string>; | ||
interface EditUserReq { | ||
username: string; | ||
email: string; | ||
fullname: string; | ||
password?: string; | ||
loginDisabled?: boolean; | ||
isAdmin?: boolean; | ||
} | ||
type EditUserError = Record<keyof EditUserReq, string>; | ||
interface AddBoardMember { | ||
isAdmin: boolean; | ||
isNoComments: boolean; | ||
isCommentOnly: boolean; | ||
isWorker: boolean; | ||
} | ||
interface CreateAdminReq { | ||
username: string; | ||
email: string; | ||
password: string; | ||
} | ||
interface CreateUserReq { | ||
username: string; | ||
email: string; | ||
password: string; | ||
} | ||
type CreateUserError = Record<keyof CreateUserReq, string>; | ||
interface UserInfo { | ||
_id: string; | ||
username: string; | ||
emails: [{ | ||
address: string; | ||
verified: boolean; | ||
}]; | ||
createdAt: Date; | ||
modifiedAt: Date; | ||
profile: { | ||
avatarUrl?: string; | ||
emailBuffer?: string[]; | ||
fullname?: string; | ||
showDesktopDragHandles?: boolean; | ||
hideCheckedItems?: boolean; | ||
cardMaximized?: boolean; | ||
customFieldsGrid?: boolean; | ||
hiddenSystemMessages?: boolean; | ||
hiddenMinicardLabelText?: boolean; | ||
initials?: string; | ||
invitedBoards?: string[]; | ||
language?: string; | ||
moveAndCopyDialog?: { | ||
boardId?: string; | ||
swimlaneId?: string; | ||
listId?: string; | ||
}; | ||
moveChecklistDialog?: { | ||
boardId?: string; | ||
swimlaneId?: string; | ||
listId?: string; | ||
cardId?: string; | ||
}; | ||
copyChecklistDialog?: { | ||
boardId?: string; | ||
swimlaneId?: string; | ||
listId?: string; | ||
cardId?: string; | ||
}; | ||
notifications?: { | ||
activity: string; | ||
read?: Date; | ||
_id?: string; | ||
userId?: string; | ||
activityType?: string; | ||
boardId?: string; | ||
listName?: string; | ||
listId?: string; | ||
cardId?: string; | ||
cardTitle?: string; | ||
swimlaneName?: string; | ||
swimlaneId?: string; | ||
createdAt?: string; | ||
modifiedAt?: string; | ||
}[]; | ||
rescueCardDescription?: boolean; | ||
startDayOfWeek: number; | ||
starredBoards?: string[]; | ||
icode?: string; | ||
boardView?: 'board-view-swimlanes' | 'board-view-lists' | 'board-view-cal'; | ||
listSortBy: '-modifiedAt' | 'modifiedAt' | '-title' | 'title' | '-sort' | 'sort'; | ||
templatesBoardId: string; | ||
cardTemplatesSwimlaneId: string; | ||
listTemplatesSwimlaneId: string; | ||
boardTemplatesSwimlaneId: string; | ||
listWidths: object; | ||
swimlaneHeights: object; | ||
}; | ||
services?: object; | ||
heartbeat?: Date; | ||
isAdmin?: boolean; | ||
createdThroughApi?: boolean; | ||
loginDisabled?: boolean; | ||
authenticationMethod: string; | ||
sessionData?: { | ||
totalHits?: true; | ||
}; | ||
importUsernames?: string[]; | ||
lastConnectionDate?: Date; | ||
boards?: { | ||
isAdmin: boolean; | ||
isActive: boolean; | ||
isNoComments: boolean; | ||
isCommentOnly: boolean; | ||
isWorker: boolean; | ||
boardId: string; | ||
boardName: string; | ||
}[]; | ||
} | ||
interface CardListRes { | ||
_id: string; | ||
title: string; | ||
description: string; | ||
receivedAt: Date; | ||
startAt: Date; | ||
endAt: Date; | ||
dueDate: Date; | ||
assignees: { | ||
fullname: string; | ||
username: string; | ||
avatarUrl?: string; | ||
}[]; | ||
labelIds: string[]; | ||
cardNumber: number; | ||
comments: number; | ||
attachments: number; | ||
linkedId?: string; | ||
checklists: number; | ||
checked: number; | ||
} | ||
interface CardInfo { | ||
_id: string; | ||
archived: boolean; | ||
archivedAt?: Date; | ||
parentId?: string; | ||
listId?: string; | ||
swimlaneId: string; | ||
boardId?: string; | ||
createdAt: Date; | ||
modifiedAt: Date; | ||
customFields: { | ||
_id: string; | ||
value: string | number | boolean | Date; | ||
}[]; | ||
dateLastActivity: Date; | ||
description?: string; | ||
labelIds?: string[]; | ||
assignees: { | ||
fullname: string; | ||
username: string; | ||
avatarUrl?: string; | ||
}[]; | ||
receivedAt?: Date; | ||
startAt?: Date; | ||
duaAt?: Date; | ||
endAt?: Date; | ||
userId: string; | ||
sort: number; | ||
linkedId?: string; | ||
targetId_gantt?: string[]; | ||
linkType_gantt?: string[]; | ||
linkId_gantt?: string[]; | ||
cardNumber: number; | ||
} | ||
interface CreateCardReq { | ||
title: string; | ||
swimlaneId: string; | ||
} | ||
type CreateCardError = Record<keyof CreateCardReq, string>; | ||
interface UpdateCardReq { | ||
title?: string; | ||
sort?: number; | ||
description?: string; | ||
labelIds?: string; | ||
receivedAt?: Date; | ||
startAt?: Date; | ||
endAt?: Date; | ||
dueDate?: Date; | ||
assignees?: string; | ||
newSwimlaneId?: string; | ||
newListId?: string; | ||
newBoardId?: string; | ||
watch?: 'watching' | 'muted'; | ||
archived?: boolean; | ||
} | ||
interface CustomFieldCard { | ||
_id: string; | ||
value: string | number | boolean | Date | null; | ||
name: string; | ||
type: string; | ||
settings: object; | ||
showOnCard: boolean; | ||
showLabelOnMiniCard: boolean; | ||
automaticallyOnCard: boolean; | ||
alwaysOnCard: boolean; | ||
showSumAtTopOfList: boolean; | ||
boardIds: string[]; | ||
createdAt: Date; | ||
modifiedAt: Date; | ||
} | ||
interface SwimlaneListRes { | ||
_id: string; | ||
title: string; | ||
boardId: string; | ||
sort: number; | ||
type: string; | ||
archived: boolean; | ||
createAt: Date; | ||
modifiedAt: Date; | ||
updatedAt: Date; | ||
color?: boolean; | ||
} | ||
interface CreateSwimlaneReq { | ||
title: string; | ||
} | ||
type CreateSwimlaneErr = Record<keyof CreateSwimlaneReq, string>; | ||
interface EditSwimlaneReq { | ||
title: string; | ||
color: string; | ||
index: number; | ||
archived?: boolean; | ||
} | ||
type EditSwimlaneErr = Record<keyof EditSwimlaneReq, string>; | ||
interface ListRes { | ||
_id: string; | ||
title: string; | ||
boardId: string; | ||
sort: number; | ||
type: string; | ||
starred: boolean; | ||
archived: boolean; | ||
swimlaneId: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
modifiedAt: Date; | ||
wipLimit: { | ||
value: number; | ||
enabled: boolean; | ||
soft: boolean; | ||
}; | ||
archivedAt: Date; | ||
color?: string; | ||
} | ||
interface CreateListReq { | ||
title: string; | ||
} | ||
type CreateListErr = Record<keyof CreateListReq, string>; | ||
interface EditListReq { | ||
title: string; | ||
index: number; | ||
} | ||
type EditListErr = Record<keyof EditListReq, string>; | ||
interface CardComments { | ||
_id: string; | ||
comment: string; | ||
authorId: string; | ||
} | ||
interface CommentInfo { | ||
_id: string; | ||
text: string; | ||
userId: string; | ||
boardId: string; | ||
cardId: string; | ||
createdAt?: Date; | ||
modifiedAt?: Date; | ||
} | ||
interface CommentReactions { | ||
_id: string; | ||
boardId: string; | ||
cardId: string; | ||
cardCommentId: string; | ||
reactions: { | ||
reactionCodepoint: string; | ||
userIds: string[]; | ||
users: { | ||
username: string; | ||
fullname: string; | ||
}; | ||
}[]; | ||
} | ||
interface Itegrations { | ||
_id: string; | ||
url: string; | ||
type: string; | ||
title: string; | ||
enabled: boolean; | ||
userId: string; | ||
boardId: string; | ||
activities: string[]; | ||
createdAt: Date; | ||
modifiedAt: Date; | ||
} | ||
interface WekanError { | ||
isClientSafe: true; | ||
error: string; | ||
reason: string; | ||
message: string; | ||
errorType: string; | ||
statusCode: number; | ||
} | ||
interface FunctionReturn<D, E = {}> { | ||
status: number; | ||
message: string; | ||
data?: D; | ||
error?: WekanError | E; | ||
} | ||
declare class KanbanApiClient { | ||
host: string; | ||
constructor({ host }: { | ||
token: string; | ||
constructor({ host, getToken }: { | ||
host: string; | ||
getToken: () => string; | ||
}); | ||
protected getPath: (path: string) => string; | ||
protected getToken: (token: string) => string; | ||
login(username: string, password: string): Promise<FunctionReturn<LoginSuccess | LoginFailed>>; | ||
logout(token: string): Promise<FunctionReturn<null | Unauthorized>>; | ||
protected getToken: () => string; | ||
protected getHeadersAuth: (options: any) => any; | ||
login(username: string, password: string): Promise<FunctionReturn<LoginSuccess, LoginFailed>>; | ||
logout(): Promise<FunctionReturn<{ | ||
message: string; | ||
}>>; | ||
getCurrentUser(): Promise<FunctionReturn<UserInfo>>; | ||
getListUsers(): Promise<FunctionReturn<UserListRes[]>>; | ||
getUserById(id: string): Promise<FunctionReturn<UserListRes[]>>; | ||
editProfile(req: EditProfileReq): Promise<FunctionReturn<UserInfo, EditProfileError>>; | ||
changePassword(req: ChangePassReq): Promise<FunctionReturn<{ | ||
message: string; | ||
}, ChangePasswordError>>; | ||
editUserById(req: EditUserReq, id: string): Promise<FunctionReturn<UserInfo, EditUserError>>; | ||
addBoardMember(boardId: string, userId: string, req: AddBoardMember): Promise<FunctionReturn<{ | ||
_id: string; | ||
title: string; | ||
}>>; | ||
removeBoardMember(boardId: string, userId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
title: string; | ||
}>>; | ||
registerAdmin(req: CreateAdminReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
forgotPassword(email: string): Promise<FunctionReturn<{ | ||
message: string; | ||
}>>; | ||
createUser(req: CreateUserReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateUserError>>; | ||
deleteUserById(id: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
getBoards(): Promise<FunctionReturn<BoardListRes[]>>; | ||
getBoardCount(): Promise<FunctionReturn<{ | ||
private: number; | ||
public: number; | ||
}>>; | ||
getBoardById(boardId: string): Promise<FunctionReturn<BoardInfo>>; | ||
createBoard(req: CreateBoardReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
defaultSwimlaneId: string; | ||
}, CreateBoardError>>; | ||
updateBoardById(boardId: string, req: UpdateBoardReq): Promise<FunctionReturn<number, UpdateBoardError>>; | ||
removeBoard(boardId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
createOrUpdateLabels(boardId: string, req: CreateOrUpdateLabelReq): Promise<FunctionReturn<string, CreateOrUpdateLabelError>>; | ||
changePermissionMemberInBoard(boardId: string, memberId: string, req: ChangePermissionReq): Promise<FunctionReturn<string>>; | ||
getCardsByList(boardId: string, listId: string): Promise<FunctionReturn<CardListRes[], { | ||
message: string; | ||
}>>; | ||
getCardById(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<CardInfo, { | ||
message: string; | ||
}>>; | ||
addNewCard(boardId: string, listId: string, req: CreateCardReq): Promise<FunctionReturn<CardInfo, { | ||
message: string; | ||
} | CreateCardError>>; | ||
totalCardInBoard(boardId: string): Promise<FunctionReturn<{ | ||
board_cards_count: number; | ||
}>>; | ||
totalCardInList(boardId: string, listId: string): Promise<FunctionReturn<{ | ||
list_cards_count: number; | ||
}, { | ||
message: string; | ||
}>>; | ||
updateCardInList(boardId: string, listId: string, cardId: string, req: UpdateCardReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
deleteCardById(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getCardCustomFields(boardId: string, listId: string, cardId: string): Promise<FunctionReturn<CustomFieldCard[], { | ||
message: string; | ||
}>>; | ||
editCardCustomFields(boardId: string, listId: string, cardId: string, customFieldId: string, req: { | ||
value: string | number | boolean | Date | null; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
value: string | number | boolean | Date | null; | ||
}[], { | ||
message: string; | ||
}>>; | ||
getSwimlanesOfBoard(boardId: string): Promise<FunctionReturn<SwimlaneListRes[], { | ||
message: string; | ||
}>>; | ||
getSwimlaneById(boardId: string, swimlaneId: string): Promise<FunctionReturn<SwimlaneListRes, { | ||
message: string; | ||
}>>; | ||
createSwimlane(boardId: string, req: CreateSwimlaneReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateSwimlaneErr | { | ||
message: string; | ||
}>>; | ||
editSwimlane(boardId: string, swimlaneId: string, req: EditSwimlaneReq): Promise<FunctionReturn<SwimlaneListRes, EditSwimlaneErr | { | ||
message: string; | ||
}>>; | ||
deleteSwimlane(boardId: string, swimlaneId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getListsOfBoard(boardId: string): Promise<FunctionReturn<ListRes[], { | ||
message: string; | ||
}>>; | ||
getListById(boardId: string, listId: string): Promise<FunctionReturn<ListRes, { | ||
message: string; | ||
}>>; | ||
addNewList(boardId: string, req: CreateListErr): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, CreateListErr>>; | ||
editList(boardId: string, listId: string, req: EditListReq): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, EditListErr>>; | ||
removeList(boardId: string, listId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
getAllComments(boardId: string, cardId: string): Promise<FunctionReturn<CardComments[], { | ||
message: string; | ||
}>>; | ||
getCommentById(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<CommentInfo, { | ||
message: string; | ||
}>>; | ||
createComment(boardId: string, cardId: string, req: { | ||
comment: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
comment: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
editComment(boardId: string, cardId: string, commentId: string, req: { | ||
newComment: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
removeComment(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}, { | ||
message: string; | ||
}>>; | ||
getCommentReactions(boardId: string, cardId: string, commentId: string): Promise<FunctionReturn<CommentReactions[], { | ||
message: string; | ||
}>>; | ||
addCommentReaction(boardId: string, cardId: string, commentId: string, req: { | ||
icon: string; | ||
}): Promise<FunctionReturn<CommentReactions[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
removeCommentReaction(boardId: string, cardId: string, commentId: string, req: { | ||
icon: string; | ||
}): Promise<FunctionReturn<CommentReactions[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
getItegrations(boardId: string): Promise<FunctionReturn<Itegrations[], { | ||
icon: string; | ||
} | { | ||
message: string; | ||
}>>; | ||
editItegrations(boardId: string, inteId: string, req: { | ||
enabled?: boolean; | ||
title?: string; | ||
url?: string; | ||
token?: string; | ||
activities?: string[]; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
activities: string[]; | ||
}>>; | ||
createNewItegration(boardId: string, req: { | ||
url: string; | ||
}): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
removeItegration(boardId: string, inteId: string): Promise<FunctionReturn<{ | ||
_id: string; | ||
}>>; | ||
} | ||
export { type FunctionReturn, KanbanApiClient, type LoginFailed, type LoginSuccess, type Unauthorized }; | ||
export { ALLOWED_COLORS, type AddBoardMember, type BoardInfo, type BoardListRes, type CardComments, type CardInfo, type CardListRes, type ChangePassReq, type ChangePasswordError, type ChangePermissionReq, type CommentInfo, type CommentReactions, type CreateAdminReq, type CreateBoardError, type CreateBoardReq, type CreateCardError, type CreateCardReq, type CreateListErr, type CreateListReq, type CreateOrUpdateLabelError, type CreateOrUpdateLabelReq, type CreateSwimlaneErr, type CreateSwimlaneReq, type CreateUserError, type CreateUserReq, type CustomFieldCard, type EditListErr, type EditListReq, type EditProfileError, type EditProfileReq, type EditSwimlaneErr, type EditSwimlaneReq, type EditUserError, type EditUserReq, type FunctionReturn, type Itegrations, KanbanApiClient, type ListRes, type LoginFailed, type LoginSuccess, type SwimlaneListRes, type UpdateBoardError, type UpdateBoardReq, type UpdateCardReq, type UserInfo, type UserListRes, type WekanError }; |
@@ -1,1 +0,1 @@ | ||
{"name":"kanban-api-client","version":"1.0.1-beta","description":"Kanban api client","scripts":{"test":"yarn test","build":"rm -rf dist && rollup -c --bundleConfigAsCjs","update-version":"node -r dotenv/config ./auto-update-version.js"},"author":"Eric Tran","license":"ISC","dependencies":{"@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.0.1","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-typescript":"^11.1.5","@types/npmlog":"^7.0.0","axios":"^1.6.2","dotenv":"^16.3.1","rollup":"^4.3.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-peer-deps-external":"^2.2.4","tslib":"^2.6.2","typescript":"^5"},"peerDependencies":{},"main":"dist/cjs/index.js","module":"dist/esm/index.js","files":["dist"],"types":"dist/index.d.ts"} | ||
{"name":"kanban-api-client","version":"1.0.2-beta","description":"Kanban api client","scripts":{"test":"yarn test","build":"rm -rf dist && rollup -c --bundleConfigAsCjs","update-version":"node -r dotenv/config ./auto-update-version.js"},"author":"Eric Tran","license":"ISC","dependencies":{"@rollup/plugin-commonjs":"^25.0.7","@rollup/plugin-json":"^6.0.1","@rollup/plugin-node-resolve":"^15.2.3","@rollup/plugin-typescript":"^11.1.5","@types/npmlog":"^7.0.0","axios":"^1.6.2","dotenv":"^16.3.1","rollup":"^4.3.0","rollup-plugin-dts":"^6.1.0","rollup-plugin-peer-deps-external":"^2.2.4","tslib":"^2.6.2","typescript":"^5"},"peerDependencies":{},"main":"dist/cjs/index.js","module":"dist/esm/index.js","files":["dist"],"types":"dist/index.d.ts"} |
deno run --unstable-sloppy-imports --allow-env --allow-read --allow-net ./test/test.ts | ||
(just test deno on linux) | ||
. |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1908870
31
39676
4