Skip to content

Commit 3fba4f4

Browse files
committed
v1.4.1
create declaration file
1 parent 145067b commit 3fba4f4

File tree

4 files changed

+160
-5
lines changed

4 files changed

+160
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Downloads](https://img.shields.io/npm/dm/bring-shopping.svg)](https://www.npmjs.com/package/bring-shopping)
44
![Build Status](https://github.com/foxriver76/node-bring-api/workflows/Test%20and%20Release/badge.svg)
55

6-
A node module for Bring! shopping lists.
6+
A node module for Bring! shopping lists entirely written in TypeScript.
77

88
## Disclaimer
99
The developers of this module are in no way endorsed by or affiliated with
@@ -45,7 +45,7 @@ More important methods are `getItems(listUUID)`, `getItemsDetails(listUUID)`, `s
4545
`moveToRecentList(listUuid, itemName)` and `getAllUsersFromList(listUuid)`.
4646

4747
## Changelog
48-
### 1.4.0 (2021-08-12)
48+
### 1.4.1 (2021-08-12)
4949
* (foxriver76) restructure to typescript
5050

5151
### 1.3.1 (2021-04-29)

build/bring.d.ts

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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;

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bring-shopping",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"engines": {
55
"node": ">=8.0.0"
66
},
@@ -47,5 +47,6 @@
4747
"build/",
4848
"LICENSE"
4949
],
50-
"main": "build/bring.js"
50+
"main": "build/bring.js",
51+
"types": "build/bring.d.ts"
5152
}

tsconfig.build.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"allowJs": false,
66
"checkJs": false,
77
"noEmit": false,
8-
"declaration": false
8+
"declaration": true
99
},
1010
"include": [
1111
"src/**/*.ts"

0 commit comments

Comments
 (0)