|
| 1 | +interface BringOptions { |
| 2 | + mail: string; |
| 3 | + password: string; |
| 4 | + url?: string; |
| 5 | + uuid?: string; |
| 6 | +} |
| 7 | +interface GetItemsResponseEntry { |
| 8 | + specification: string; |
| 9 | + name: string; |
| 10 | +} |
| 11 | +interface GetItemsResponse { |
| 12 | + uuid: string; |
| 13 | + status: string; |
| 14 | + purchase: GetItemsResponseEntry[]; |
| 15 | + rececently: GetItemsResponseEntry[]; |
| 16 | +} |
| 17 | +interface GetAllUsersFromListEntry { |
| 18 | + publicUuid: string; |
| 19 | + name: string; |
| 20 | + email: string; |
| 21 | + photoPath: string; |
| 22 | + pushEnabled: boolean; |
| 23 | + plusTryOut: boolean; |
| 24 | + country: string; |
| 25 | + language: string; |
| 26 | +} |
| 27 | +interface GetAllUsersFromListResponse { |
| 28 | + users: GetAllUsersFromListEntry[]; |
| 29 | +} |
| 30 | +interface LoadListsEntry { |
| 31 | + listUuid: string; |
| 32 | + name: string; |
| 33 | + theme: string; |
| 34 | +} |
| 35 | +interface LoadListsFresponse { |
| 36 | + lists: LoadListsEntry[]; |
| 37 | +} |
| 38 | +interface GetItemsDetailsEntry { |
| 39 | + uuid: string; |
| 40 | + itemId: string; |
| 41 | + listUuid: string; |
| 42 | + userIconItemId: string; |
| 43 | + userSectionId: string; |
| 44 | + assignedTo: string; |
| 45 | + imageUrl: string; |
| 46 | +} |
| 47 | +interface UserSettingsEntry { |
| 48 | + key: string; |
| 49 | + value: string; |
| 50 | +} |
| 51 | +interface UserListSettingsEntry { |
| 52 | + listUuid: string; |
| 53 | + usersettings: UserSettingsEntry[]; |
| 54 | +} |
| 55 | +interface GetUserSettingsResponse { |
| 56 | + userSettings: UserSettingsEntry[]; |
| 57 | + userlistsettings: UserListSettingsEntry[]; |
| 58 | +} |
| 59 | +interface CatalogItemsEntry { |
| 60 | + itemId: string; |
| 61 | + name: string; |
| 62 | +} |
| 63 | +interface CatalogSectionsEntry { |
| 64 | + sectionId: string; |
| 65 | + name: string; |
| 66 | + items: CatalogItemsEntry[]; |
| 67 | +} |
| 68 | +interface LoadCatalogResponse { |
| 69 | + language: string; |
| 70 | + catalog: { |
| 71 | + sections: CatalogSectionsEntry[]; |
| 72 | + }; |
| 73 | +} |
| 74 | +interface GetPendingInvitationsResponse { |
| 75 | + invitations: any[]; |
| 76 | +} |
| 77 | +declare class Bring { |
| 78 | + private readonly mail; |
| 79 | + private readonly password; |
| 80 | + private readonly url; |
| 81 | + private uuid; |
| 82 | + private readonly headers; |
| 83 | + private name?; |
| 84 | + private bearerToken?; |
| 85 | + private refreshToken?; |
| 86 | + private putHeaders?; |
| 87 | + constructor(options: BringOptions); |
| 88 | + /** |
| 89 | + * Try to log into given account |
| 90 | + */ |
| 91 | + login(): Promise<void>; |
| 92 | + /** |
| 93 | + * Loads all shopping lists |
| 94 | + */ |
| 95 | + loadLists(): Promise<LoadListsFresponse>; |
| 96 | + /** |
| 97 | + * Get all items from the current selected shopping list |
| 98 | + */ |
| 99 | + getItems(listUuid: string): Promise<GetItemsResponse>; |
| 100 | + /** |
| 101 | + * Get detailed information about all items from the current selected shopping list |
| 102 | + */ |
| 103 | + getItemsDetails(listUuid: string): Promise<GetItemsDetailsEntry[]>; |
| 104 | + /** |
| 105 | + * Save an item to your current shopping list |
| 106 | + * |
| 107 | + * @param itemName The name of the item you want to send to the bring server |
| 108 | + * @param specification The litte description under the name of the item |
| 109 | + * @param listUuid The listUUID you want to receive a list of users from. |
| 110 | + * returns an empty string and answerHttpStatus should contain 204. If not -> error |
| 111 | + */ |
| 112 | + saveItem(listUuid: string, itemName: string, specification: string): Promise<string>; |
| 113 | + /** |
| 114 | + * remove an item from your current shopping list |
| 115 | + * |
| 116 | + * @param itemName Name of the item you want to delete from you shopping list |
| 117 | + * @param listUuid The lisUUID you want to receive a list of users from. |
| 118 | + * should return an empty string and $answerHttpStatus should contain 204. If not -> error |
| 119 | + */ |
| 120 | + removeItem(listUuid: string, itemName: string): Promise<string>; |
| 121 | + /** |
| 122 | + * move an item to recent items list |
| 123 | + * |
| 124 | + * @param itemName Name of the item you want to delete from you shopping list |
| 125 | + * @param listUuid The lisUUID you want to receive a list of users from. |
| 126 | + * should return an empty string and $answerHttpStatus should contain 204. If not -> error |
| 127 | + */ |
| 128 | + moveToRecentList(listUuid: string, itemName: string): Promise<string>; |
| 129 | + /** |
| 130 | + * Get all users from a shopping list |
| 131 | + * |
| 132 | + * @param listUuid The listUUID you want to receive a list of users from |
| 133 | + */ |
| 134 | + getAllUsersFromList(listUuid: string): Promise<GetAllUsersFromListResponse>; |
| 135 | + /** |
| 136 | + * Get the user settings |
| 137 | + */ |
| 138 | + getUserSettings(): Promise<GetUserSettingsResponse>; |
| 139 | + /** |
| 140 | + * Load translation file e. g. via 'de-DE' |
| 141 | + * @param locale from which country translations will be loaded |
| 142 | + */ |
| 143 | + loadTranslations(locale: string): Promise<Record<string, string>>; |
| 144 | + /** |
| 145 | + * Load translation file e. g. via 'de-DE' |
| 146 | + * @param locale from which country translations will be loaded |
| 147 | + */ |
| 148 | + loadCatalog(locale: string): Promise<LoadCatalogResponse>; |
| 149 | + /** |
| 150 | + * Get pending invitations |
| 151 | + */ |
| 152 | + getPendingInvitations(): Promise<GetPendingInvitationsResponse>; |
| 153 | +} |
| 154 | +export = Bring; |
0 commit comments