jamespot-user-api 1.0.43 → 1.0.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/assets/search.js +1 -1
- package/documentation/classes/JApplication.html +1 -1
- package/documentation/classes/JApplicationApi.html +8 -8
- package/documentation/classes/JArticleApi.html +1 -1
- package/documentation/classes/JAudienceApi.html +1 -1
- package/documentation/classes/JBaseApi.html +1 -1
- package/documentation/classes/JBaseObject.html +1 -1
- package/documentation/classes/JBookmark.html +1 -1
- package/documentation/classes/JBookmarkApi.html +1 -1
- package/documentation/classes/JCommunityApi.html +1 -1
- package/documentation/classes/JConcept.html +1 -1
- package/documentation/classes/JConceptApi.html +1 -1
- package/documentation/classes/JDiapazoneApi.html +1 -1
- package/documentation/classes/JFileApi.html +1 -1
- package/documentation/classes/JFilebankApi.html +1 -1
- package/documentation/classes/JGroupApi.html +1 -1
- package/documentation/classes/JLandApi.html +1 -1
- package/documentation/classes/JMessengerApi.html +1 -1
- package/documentation/classes/JSearchApi.html +6 -6
- package/documentation/classes/JUser.html +1 -1
- package/documentation/classes/JUserApi.html +3 -3
- package/documentation/classes/JWedocApi.html +1 -1
- package/documentation/classes/JamespotUserApi.html +1 -1
- package/documentation/classes/Network.html +1 -1
- package/documentation/enums/JApplicationStatus.html +1 -1
- package/documentation/index.html +1 -1
- package/documentation/interfaces/ApiError.html +1 -1
- package/documentation/interfaces/ApiWrapper.html +1 -1
- package/documentation/interfaces/AseiGroups.html +1 -1
- package/documentation/interfaces/AseiInstitution.html +1 -1
- package/documentation/interfaces/AseiRights.html +1 -1
- package/documentation/interfaces/AseiTicket.html +1 -1
- package/documentation/interfaces/BaseAutocomplete.html +1 -1
- package/documentation/interfaces/BaseMessage.html +1 -1
- package/documentation/interfaces/Category.html +1 -1
- package/documentation/interfaces/CreateGroup.html +1 -1
- package/documentation/interfaces/FileBankProps.html +1 -1
- package/documentation/interfaces/FileOption.html +1 -1
- package/documentation/interfaces/FolderProps.html +1 -1
- package/documentation/interfaces/ListFilterSpec.html +1 -1
- package/documentation/interfaces/OF.html +1 -1
- package/documentation/interfaces/PagingResults.html +1 -1
- package/documentation/interfaces/Result.html +1 -1
- package/documentation/interfaces/RootFolderProps.html +1 -1
- package/documentation/interfaces/SearchCategoryModel.html +1 -1
- package/documentation/interfaces/SearchConfig.html +1 -1
- package/documentation/interfaces/SearchFacetModel.html +1 -1
- package/documentation/interfaces/SearchFacetValueModel.html +1 -1
- package/documentation/interfaces/SearchQuery.html +1 -1
- package/documentation/interfaces/SearchQueryFilterModel.html +1 -1
- package/documentation/interfaces/SearchQueryOption.html +1 -1
- package/documentation/interfaces/SearchQueryResult.html +1 -1
- package/documentation/interfaces/SearchQuerySortModel.html +1 -1
- package/documentation/interfaces/SearchResultCatProps.html +1 -1
- package/documentation/interfaces/SearchResultProps.html +1 -1
- package/documentation/interfaces/SpotProps.html +1 -1
- package/documentation/interfaces/Taxonomy.html +1 -1
- package/documentation/interfaces/TaxonomyCreate.html +1 -1
- package/documentation/interfaces/TmpApplication.html +1 -1
- package/documentation/interfaces/TmpUser.html +1 -1
- package/documentation/interfaces/UserModel.html +1 -1
- package/documentation/modules.html +1 -1
- package/lib/jamespot-user-api.js.map +1 -1
- package/lib/src/apis/search.d.ts +2 -2
- package/lib/src/types/search.d.ts +3 -0
- package/package.json +1 -1
- package/src/apis/application.ts +0 -132
- package/src/apis/article.ts +0 -74
- package/src/apis/asei.ts +0 -73
- package/src/apis/audience.ts +0 -18
- package/src/apis/base.ts +0 -9
- package/src/apis/bookmark.ts +0 -110
- package/src/apis/community.ts +0 -20
- package/src/apis/concept.ts +0 -31
- package/src/apis/diapazone.ts +0 -65
- package/src/apis/file.ts +0 -14
- package/src/apis/filebank.ts +0 -50
- package/src/apis/group.ts +0 -48
- package/src/apis/index.ts +0 -17
- package/src/apis/jamespotUserApi.ts +0 -69
- package/src/apis/jland.ts +0 -51
- package/src/apis/messenger.ts +0 -25
- package/src/apis/search.ts +0 -85
- package/src/apis/taxonomy.ts +0 -30
- package/src/apis/user.ts +0 -53
- package/src/apis/wedoc.ts +0 -77
- package/src/classes/JApplication.ts +0 -55
- package/src/classes/JBaseObject.ts +0 -64
- package/src/classes/JBookmark.ts +0 -44
- package/src/classes/JConcept.ts +0 -3
- package/src/classes/JDiapazone.ts +0 -42
- package/src/classes/JFile.ts +0 -37
- package/src/classes/JUser.ts +0 -7
- package/src/classes/index.ts +0 -5
- package/src/index.ts +0 -21
- package/src/indexMock.ts +0 -17
- package/src/mock/data/autocomplete/audience/data.json +0 -191
- package/src/mock/data/autocomplete/community/data.json +0 -47
- package/src/mock/data/autocomplete/taxonomy/data.json +0 -35
- package/src/mock/data/autocomplete/user/data.json +0 -107
- package/src/mock/data/bookmarks/addBookmark/data.json +0 -54
- package/src/mock/data/bookmarks/addLink/data.json +0 -63
- package/src/mock/data/bookmarks/bookmarkList/data.json +0 -271
- package/src/mock/data/bookmarks/delete/data.json +0 -12
- package/src/mock/data/community/sendRequest/data.json +0 -12
- package/src/mock/data/file/create/data.json +0 -18
- package/src/mock/data/messenger/newMessage/data.json +0 -47
- package/src/mock/data/misc/tokenCSRF/data.json +0 -7
- package/src/mock/data/search/getConfig/data.json +0 -318
- package/src/mock/data/search/lastQueries/data.json +0 -7
- package/src/mock/data/search/proposition/data.json +0 -125
- package/src/mock/data/spot/create/data.json +0 -7
- package/src/mock/data/spot/get-available-widget/data.json +0 -56
- package/src/mock/data/spot/get-categories/data.json +0 -28
- package/src/mock/data/user/signIn/data.json +0 -197
- package/src/mock/windowMock.ts +0 -113
- package/src/types/asei.ts +0 -33
- package/src/types/autocomplete.ts +0 -17
- package/src/types/group.ts +0 -27
- package/src/types/index.ts +0 -7
- package/src/types/listWrapper.ts +0 -6
- package/src/types/search.ts +0 -105
- package/src/types/taxonomy.ts +0 -47
- package/src/types/user.ts +0 -14
- package/src/types/utils.ts +0 -66
- package/src/util/network.ts +0 -96
package/src/apis/asei.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { JBaseApi } from './base';
|
|
2
|
-
import { OF } from '../util/network';
|
|
3
|
-
import { AseiGroups, AseiRights, AseiTicket, AseiTicketStatus, Filters, Orders } from '../types';
|
|
4
|
-
import { JArticleApi } from './article';
|
|
5
|
-
import { ApiWrapper, PagingResults } from '../types';
|
|
6
|
-
|
|
7
|
-
export class JAseiApi extends JBaseApi {
|
|
8
|
-
/**
|
|
9
|
-
* List Asei Clearance Tickets
|
|
10
|
-
* @param page page number
|
|
11
|
-
* @param limit number of elements per page
|
|
12
|
-
* @param filters filter object
|
|
13
|
-
* @param orders order object
|
|
14
|
-
*/
|
|
15
|
-
public list(
|
|
16
|
-
page: number,
|
|
17
|
-
limit: number,
|
|
18
|
-
filters?: Filters,
|
|
19
|
-
orders: Orders = [{ name: 'dateCreation', sort: 'DESC' }],
|
|
20
|
-
): Promise<ApiWrapper<PagingResults<AseiTicket>>> {
|
|
21
|
-
const articleApi = new JArticleApi(this.network);
|
|
22
|
-
return articleApi.list({
|
|
23
|
-
type: 'aseiClearanceTicket',
|
|
24
|
-
format: 'raw-view',
|
|
25
|
-
limit,
|
|
26
|
-
page,
|
|
27
|
-
orders,
|
|
28
|
-
filters,
|
|
29
|
-
}) as Promise<ApiWrapper<PagingResults<AseiTicket>>>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* change status of an Asei Ticket
|
|
34
|
-
*/
|
|
35
|
-
public requestStatus(
|
|
36
|
-
uri: string,
|
|
37
|
-
requestedStatus: AseiTicketStatus,
|
|
38
|
-
audience?: Array<string>,
|
|
39
|
-
): Promise<AseiTicket> {
|
|
40
|
-
return this.network
|
|
41
|
-
.post<AseiTicket>({ o: 'asei', f: 'setStatus', uri, requestedStatus, audience } as OF)
|
|
42
|
-
.then((res) => {
|
|
43
|
-
if (res && res.result) {
|
|
44
|
-
return res.result;
|
|
45
|
-
}
|
|
46
|
-
throw 'Bad response from backend';
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get asei dedicated groups (dsi, administrators)
|
|
52
|
-
*/
|
|
53
|
-
public getDedicatedGroups(): Promise<AseiGroups> {
|
|
54
|
-
return this.network.post<AseiGroups>({ o: 'asei', f: 'getDedicatedGroups' } as OF).then((res) => {
|
|
55
|
-
if (res && res.result) {
|
|
56
|
-
return res.result;
|
|
57
|
-
}
|
|
58
|
-
throw 'Bad response from backend';
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Get asei configuration (rights to access, rights to publish)
|
|
64
|
-
*/
|
|
65
|
-
public getConfiguration(): Promise<AseiRights> {
|
|
66
|
-
return this.network.post<{ right: AseiRights }>({ o: 'asei', f: 'configuration' }).then((res) => {
|
|
67
|
-
if (res && res.result) {
|
|
68
|
-
return res.result.right;
|
|
69
|
-
}
|
|
70
|
-
throw 'Bad response from backend';
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
}
|
package/src/apis/audience.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AudienceAutocomplete } from '../types/autocomplete';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
|
|
5
|
-
export class JAudienceApi extends JBaseApi {
|
|
6
|
-
/**
|
|
7
|
-
* autocomplete
|
|
8
|
-
* return the list of user and Spot
|
|
9
|
-
*/
|
|
10
|
-
public autocomplete(query: string): Promise<AudienceAutocomplete[]> {
|
|
11
|
-
return this.network.post({ o: 'autocomplete', f: 'audience', q: query } as OF).then((res) => {
|
|
12
|
-
if (Array.isArray(res.result)) {
|
|
13
|
-
return res.result;
|
|
14
|
-
}
|
|
15
|
-
throw 'Bad response from backend';
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/apis/base.ts
DELETED
package/src/apis/bookmark.ts
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { ApiWrapper, BaseMessagesOne } from '../types';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
import { JBookmark } from '../classes/JBookmark';
|
|
4
|
-
import { ListWrapper } from '../types/listWrapper';
|
|
5
|
-
import { OF } from '../util/network';
|
|
6
|
-
|
|
7
|
-
export interface ListFilterSpec {
|
|
8
|
-
query?: string;
|
|
9
|
-
page?: number;
|
|
10
|
-
limit?: number;
|
|
11
|
-
orders?: {
|
|
12
|
-
name: string;
|
|
13
|
-
sort: string;
|
|
14
|
-
}[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type Bookmark = Record<string, object>;
|
|
18
|
-
|
|
19
|
-
type BookmarkList = {
|
|
20
|
-
page: number;
|
|
21
|
-
cnt: number;
|
|
22
|
-
limit: number;
|
|
23
|
-
data: Bookmark[];
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export class JBookmarkApi extends JBaseApi {
|
|
27
|
-
public getList(filterSpecs: ListFilterSpec): Promise<ListWrapper<JBookmark>> {
|
|
28
|
-
return this.network
|
|
29
|
-
.post<BookmarkList>({
|
|
30
|
-
o: 'object',
|
|
31
|
-
f: 'list',
|
|
32
|
-
namespace: 'bookmarks',
|
|
33
|
-
view: 'list',
|
|
34
|
-
...filterSpecs,
|
|
35
|
-
} as OF)
|
|
36
|
-
.then((res) => {
|
|
37
|
-
const result = res.result;
|
|
38
|
-
|
|
39
|
-
if (Array.isArray(result.data)) {
|
|
40
|
-
const data: JBookmark[] = result.data.map((entry) => JBookmark.createFromObject(entry));
|
|
41
|
-
return { page: result.page, cnt: result.cnt, limit: result.limit, data };
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
throw {
|
|
45
|
-
error: res.error,
|
|
46
|
-
messages: res.messages,
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public addLink(targetId: number, targetType: string): Promise<JBookmark> {
|
|
52
|
-
return this.network
|
|
53
|
-
.post<Bookmark>({
|
|
54
|
-
o: 'custom',
|
|
55
|
-
f: 'actionAdd',
|
|
56
|
-
type: 'bookmarkLink',
|
|
57
|
-
targetId,
|
|
58
|
-
targetType,
|
|
59
|
-
format: 'list',
|
|
60
|
-
} as OF)
|
|
61
|
-
.then((res) => {
|
|
62
|
-
const result = res.result;
|
|
63
|
-
return JBookmark.createFromObject(result);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
public addBookmark(bookmark: JBookmark): Promise<JBookmark> {
|
|
68
|
-
return this.network
|
|
69
|
-
.postCSRF<Bookmark, BaseMessagesOne>({
|
|
70
|
-
o: 'bookmarks',
|
|
71
|
-
f: 'add',
|
|
72
|
-
...bookmark,
|
|
73
|
-
} as OF)
|
|
74
|
-
.then((res) => {
|
|
75
|
-
const result = res.result;
|
|
76
|
-
return JBookmark.createFromObject(result);
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
public delete(bookmark: JBookmark): Promise<ApiWrapper<null, BaseMessagesOne>> {
|
|
81
|
-
return this.network.postCSRF<null, BaseMessagesOne>({
|
|
82
|
-
o: 'bookmarks',
|
|
83
|
-
f: 'delete',
|
|
84
|
-
bookmarkID: bookmark.id,
|
|
85
|
-
} as OF);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public rename(bookmark: JBookmark): Promise<ApiWrapper<null, BaseMessagesOne>> {
|
|
89
|
-
return this.network.postCSRF<null, BaseMessagesOne>({
|
|
90
|
-
o: 'bookmarks',
|
|
91
|
-
f: 'rename',
|
|
92
|
-
bookmarkID: bookmark.id,
|
|
93
|
-
bookmarkLabel: bookmark.bookmarkLabel,
|
|
94
|
-
} as OF);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public move(
|
|
98
|
-
bookmark: JBookmark,
|
|
99
|
-
bookmarkReference: JBookmark,
|
|
100
|
-
position: 'before' | 'after',
|
|
101
|
-
): Promise<ApiWrapper<null, BaseMessagesOne>> {
|
|
102
|
-
return this.network.postCSRF<null, BaseMessagesOne>({
|
|
103
|
-
o: 'bookmarks',
|
|
104
|
-
f: 'move',
|
|
105
|
-
bookmarkID: bookmark.id,
|
|
106
|
-
bookmarkReference: bookmarkReference.id,
|
|
107
|
-
bookmarkPosition: position,
|
|
108
|
-
} as OF);
|
|
109
|
-
}
|
|
110
|
-
}
|
package/src/apis/community.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ApiWrapper, CommunityAutocomplete } from '../types';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
|
|
5
|
-
export class JCommunityApi extends JBaseApi {
|
|
6
|
-
public sendRequest(message: string, idUserTo: number): Promise<ApiWrapper<boolean, { code: number; msg: string }>> {
|
|
7
|
-
return this.network.post<boolean, { code: number; msg: string }>({
|
|
8
|
-
o: 'community',
|
|
9
|
-
f: 'sendRequest',
|
|
10
|
-
message,
|
|
11
|
-
idUserTo,
|
|
12
|
-
} as OF);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public autocomplete(q: string): Promise<CommunityAutocomplete[]> {
|
|
16
|
-
return this.network
|
|
17
|
-
.post<CommunityAutocomplete[]>({ o: 'autocomplete', f: 'community', q } as OF)
|
|
18
|
-
.then((res) => res.result);
|
|
19
|
-
}
|
|
20
|
-
}
|
package/src/apis/concept.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { JBaseApi } from './base';
|
|
2
|
-
import { JConcept } from '../classes';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
|
|
5
|
-
export class JConceptApi extends JBaseApi {
|
|
6
|
-
/**
|
|
7
|
-
* autocomplete return a list of tags
|
|
8
|
-
* @param idTaxonomy taxonomy id
|
|
9
|
-
* @param query search characters
|
|
10
|
-
*/
|
|
11
|
-
public autocomplete(idTaxonomy: string, query: string): Promise<JConcept[]> {
|
|
12
|
-
return this.network
|
|
13
|
-
.post<Array<{ id: string; type: string }>>({
|
|
14
|
-
o: 'autocomplete',
|
|
15
|
-
f: 'taxonomy',
|
|
16
|
-
q: query,
|
|
17
|
-
idTaxonomy,
|
|
18
|
-
idToUri: false,
|
|
19
|
-
} as OF)
|
|
20
|
-
.then((res) => {
|
|
21
|
-
if (Array.isArray(res.result)) {
|
|
22
|
-
return res.result.map((concept) => {
|
|
23
|
-
const jConcept = new JConcept(concept.id, concept.type);
|
|
24
|
-
jConcept.hydrate(concept);
|
|
25
|
-
return jConcept;
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
throw 'Bad response from backend';
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
package/src/apis/diapazone.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { JBaseApi } from './base';
|
|
2
|
-
import { ListWrapper } from '../types/listWrapper';
|
|
3
|
-
import { ApiWrapper } from '../types';
|
|
4
|
-
import { OF } from '../util/network';
|
|
5
|
-
|
|
6
|
-
import { JDiapazone } from '../classes/JDiapazone';
|
|
7
|
-
|
|
8
|
-
type Diapazone = Record<string, object>;
|
|
9
|
-
|
|
10
|
-
type DiapazoneList = {
|
|
11
|
-
page: number;
|
|
12
|
-
cnt: number;
|
|
13
|
-
limit: number;
|
|
14
|
-
data: Diapazone[];
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export class JDiapazoneApi extends JBaseApi {
|
|
18
|
-
public create(
|
|
19
|
-
type: string,
|
|
20
|
-
token: string,
|
|
21
|
-
title: string,
|
|
22
|
-
dateStart: string,
|
|
23
|
-
publishTo: Array<any>,
|
|
24
|
-
): Promise<ApiWrapper<string>> {
|
|
25
|
-
return this.network.post({
|
|
26
|
-
o: 'article',
|
|
27
|
-
f: 'create',
|
|
28
|
-
type,
|
|
29
|
-
token,
|
|
30
|
-
title,
|
|
31
|
-
dateStart,
|
|
32
|
-
publishTo,
|
|
33
|
-
} as OF);
|
|
34
|
-
}
|
|
35
|
-
public getList(
|
|
36
|
-
query = '',
|
|
37
|
-
filters: Array<any> = [],
|
|
38
|
-
orders: Array<any> = [],
|
|
39
|
-
page = 1,
|
|
40
|
-
format = 'list',
|
|
41
|
-
): Promise<ListWrapper<JDiapazone>> {
|
|
42
|
-
return this.network
|
|
43
|
-
.post<DiapazoneList>({
|
|
44
|
-
o: 'objectList',
|
|
45
|
-
f: 'diapazoneQueryList',
|
|
46
|
-
query,
|
|
47
|
-
filters,
|
|
48
|
-
orders,
|
|
49
|
-
page,
|
|
50
|
-
format,
|
|
51
|
-
} as OF)
|
|
52
|
-
.then((res) => {
|
|
53
|
-
const result = res.result;
|
|
54
|
-
if (Array.isArray(result.data)) {
|
|
55
|
-
const data: JDiapazone[] = result.data.map((entry) => JDiapazone.createFromObject(entry));
|
|
56
|
-
return { page: result.page, cnt: result.cnt, limit: result.limit, data };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
throw {
|
|
60
|
-
error: res.error,
|
|
61
|
-
messages: res.messages,
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}
|
package/src/apis/file.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { FileOption } from '../util/network';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
|
|
4
|
-
export class JFileApi extends JBaseApi {
|
|
5
|
-
// FIXME when doing the first file upload
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
-
public create(token: string, attrName: 'attachment' | 'image', file: File, options: FileOption): Promise<any> {
|
|
8
|
-
const body = new FormData();
|
|
9
|
-
body.append('token', token);
|
|
10
|
-
body.append('attrName', attrName);
|
|
11
|
-
body.append(attrName, file);
|
|
12
|
-
return this.network.postFile(body, options);
|
|
13
|
-
}
|
|
14
|
-
}
|
package/src/apis/filebank.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { JBaseApi } from './base';
|
|
2
|
-
import { OF } from '../util/network';
|
|
3
|
-
import { ListWrapper } from '../types/listWrapper';
|
|
4
|
-
import { Little, Rights } from '../types';
|
|
5
|
-
|
|
6
|
-
export interface RootFolderProps {
|
|
7
|
-
id: number;
|
|
8
|
-
title: string;
|
|
9
|
-
uri: string;
|
|
10
|
-
type: string;
|
|
11
|
-
mainType: string;
|
|
12
|
-
folderColor?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface SpotProps {
|
|
16
|
-
id: number;
|
|
17
|
-
title: string;
|
|
18
|
-
uri: string;
|
|
19
|
-
type: string;
|
|
20
|
-
mainType: string;
|
|
21
|
-
folderColor?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface FileBankProps {
|
|
25
|
-
recents: any[];
|
|
26
|
-
rootFolder: RootFolderProps;
|
|
27
|
-
spot: SpotProps;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface FolderProps extends Little {
|
|
31
|
-
mainType: string;
|
|
32
|
-
folderColor?: string;
|
|
33
|
-
parentURI?: string;
|
|
34
|
-
_right: Rights;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class JFilebankApi extends JBaseApi {
|
|
38
|
-
public getBanks(format = 'list'): Promise<Array<FileBankProps>> {
|
|
39
|
-
return this.network.post<Array<FileBankProps>>({ o: 'fileBank', f: 'getBanks', format } as OF).then((res) => {
|
|
40
|
-
return res.result;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
public getFolders(parentURI: string): Promise<ListWrapper<FolderProps>> {
|
|
44
|
-
return this.network
|
|
45
|
-
.post<Array<FolderProps>>({ o: 'fileBank', f: 'getFolders', parentURI } as OF)
|
|
46
|
-
.then((res) => {
|
|
47
|
-
return { data: res.result };
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/apis/group.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ApiWrapper, Category, CreateGroup, GroupWidgets, Little, PagingResults } from '../types';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
|
|
5
|
-
export class JGroupApi extends JBaseApi {
|
|
6
|
-
public create({ type, widgets, ...group }: CreateGroup): Promise<ApiWrapper<string>> {
|
|
7
|
-
return this.network.post({
|
|
8
|
-
o: 'spot',
|
|
9
|
-
f: 'create',
|
|
10
|
-
...group,
|
|
11
|
-
type: type || 'spot',
|
|
12
|
-
widgets: JSON.stringify(widgets),
|
|
13
|
-
} as OF);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public getApplications(): Promise<ApiWrapper<GroupWidgets>> {
|
|
17
|
-
return this.network.post({ o: 'spot', f: 'get-available-widget' });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public getCategories(): Promise<ApiWrapper<Category[]>> {
|
|
21
|
-
return this.network.post<Category[]>({ o: 'spot', f: 'get-categories' });
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Get the members of a group
|
|
26
|
-
* @param idSpot spot id
|
|
27
|
-
* @param query query string to search within user names
|
|
28
|
-
* @param limit limit per page
|
|
29
|
-
* @param page page number
|
|
30
|
-
* @return array of User
|
|
31
|
-
*/
|
|
32
|
-
public getObjectListJamespotSpotMembers(
|
|
33
|
-
idSpot: number | string,
|
|
34
|
-
query?: string,
|
|
35
|
-
limit?: number,
|
|
36
|
-
page = 1,
|
|
37
|
-
): Promise<ApiWrapper<PagingResults<Little>>> {
|
|
38
|
-
return this.network.post<PagingResults<Little>>({
|
|
39
|
-
o: 'objectListJamespot',
|
|
40
|
-
f: 'SpotMembers',
|
|
41
|
-
idSpot,
|
|
42
|
-
limit,
|
|
43
|
-
page,
|
|
44
|
-
format: 'raw-little',
|
|
45
|
-
query,
|
|
46
|
-
} as OF);
|
|
47
|
-
}
|
|
48
|
-
}
|
package/src/apis/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './application';
|
|
2
|
-
export * from './article';
|
|
3
|
-
export * from './audience';
|
|
4
|
-
export * from './base';
|
|
5
|
-
export * from './community';
|
|
6
|
-
export * from './concept';
|
|
7
|
-
export * from './file';
|
|
8
|
-
export * from './filebank';
|
|
9
|
-
export * from './group';
|
|
10
|
-
export * from './jamespotUserApi';
|
|
11
|
-
export * from './jland';
|
|
12
|
-
export * from './messenger';
|
|
13
|
-
export * from './search';
|
|
14
|
-
export * from './bookmark';
|
|
15
|
-
export * from './user';
|
|
16
|
-
export * from './diapazone';
|
|
17
|
-
export * from './wedoc';
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { JApplicationApi } from './application';
|
|
2
|
-
import { JArticleApi } from './article';
|
|
3
|
-
import { JAseiApi } from './asei';
|
|
4
|
-
import { JAudienceApi } from './audience';
|
|
5
|
-
import { JCommunityApi } from './community';
|
|
6
|
-
import { JConceptApi } from './concept';
|
|
7
|
-
import { JFileApi } from './file';
|
|
8
|
-
import { JFilebankApi } from './filebank';
|
|
9
|
-
import { JGroupApi } from './group';
|
|
10
|
-
import { JLandApi } from './jland';
|
|
11
|
-
import { JMessengerApi } from './messenger';
|
|
12
|
-
import { JSearchApi } from './search';
|
|
13
|
-
import { JBookmarkApi } from './bookmark';
|
|
14
|
-
import { JTaxonomyApi } from './taxonomy';
|
|
15
|
-
import { JUserApi } from './user';
|
|
16
|
-
import { JDiapazoneApi } from './diapazone';
|
|
17
|
-
import { JWedocApi } from './wedoc';
|
|
18
|
-
import { Network } from '../util/network';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* In browser usage, 'window' should be the window object.
|
|
22
|
-
* In server side usage, 'window' object given must implement the fetch method, used by the Apis.
|
|
23
|
-
* See tests implementation for a working Node sample.
|
|
24
|
-
*
|
|
25
|
-
* Each property (except {@link constants} and {@link window}) is an API providing access to a Jamespot.Pro backend.
|
|
26
|
-
*/
|
|
27
|
-
export class JamespotUserApi {
|
|
28
|
-
public version = '1.0';
|
|
29
|
-
public network: Network;
|
|
30
|
-
|
|
31
|
-
public application: JApplicationApi;
|
|
32
|
-
public article: JArticleApi;
|
|
33
|
-
public asei: JAseiApi;
|
|
34
|
-
public audience: JAudienceApi;
|
|
35
|
-
public community: JCommunityApi;
|
|
36
|
-
public concept: JConceptApi;
|
|
37
|
-
public file: JFileApi;
|
|
38
|
-
public filebank: JFilebankApi;
|
|
39
|
-
public group: JGroupApi;
|
|
40
|
-
public jland: JLandApi;
|
|
41
|
-
public messenger: JMessengerApi;
|
|
42
|
-
public search: JSearchApi;
|
|
43
|
-
public bookmark: JBookmarkApi;
|
|
44
|
-
public taxonomy: JTaxonomyApi;
|
|
45
|
-
public user: JUserApi;
|
|
46
|
-
public diapazone: JDiapazoneApi;
|
|
47
|
-
public wedoc: JWedocApi;
|
|
48
|
-
|
|
49
|
-
public constructor(network: Network) {
|
|
50
|
-
this.network = network;
|
|
51
|
-
this.application = new JApplicationApi(this.network);
|
|
52
|
-
this.article = new JArticleApi(this.network);
|
|
53
|
-
this.asei = new JAseiApi(this.network);
|
|
54
|
-
this.audience = new JAudienceApi(this.network);
|
|
55
|
-
this.community = new JCommunityApi(this.network);
|
|
56
|
-
this.concept = new JConceptApi(this.network);
|
|
57
|
-
this.file = new JFileApi(this.network);
|
|
58
|
-
this.filebank = new JFilebankApi(this.network);
|
|
59
|
-
this.group = new JGroupApi(this.network);
|
|
60
|
-
this.jland = new JLandApi(this.network);
|
|
61
|
-
this.messenger = new JMessengerApi(this.network);
|
|
62
|
-
this.search = new JSearchApi(this.network);
|
|
63
|
-
this.bookmark = new JBookmarkApi(this.network);
|
|
64
|
-
this.taxonomy = new JTaxonomyApi(this.network);
|
|
65
|
-
this.user = new JUserApi(this.network);
|
|
66
|
-
this.diapazone = new JDiapazoneApi(this.network);
|
|
67
|
-
this.wedoc = new JWedocApi(this.network);
|
|
68
|
-
}
|
|
69
|
-
}
|
package/src/apis/jland.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { JBaseApi } from './base';
|
|
2
|
-
import { ApiWrapper } from '../types';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
|
|
5
|
-
export type JLandLog = {
|
|
6
|
-
idLog: number;
|
|
7
|
-
slug: string;
|
|
8
|
-
dateCreation: string;
|
|
9
|
-
map: string;
|
|
10
|
-
mail: string;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type JLandStat = {
|
|
14
|
-
mail: string;
|
|
15
|
-
cnt: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export class JLandApi extends JBaseApi {
|
|
19
|
-
public getLogs({
|
|
20
|
-
dateEnd,
|
|
21
|
-
idLogMax,
|
|
22
|
-
}: {
|
|
23
|
-
dateEnd?: string;
|
|
24
|
-
idLogMax?: number;
|
|
25
|
-
}): Promise<ApiWrapper<Array<JLandLog>>> {
|
|
26
|
-
return this.network.post({
|
|
27
|
-
o: 'JLand',
|
|
28
|
-
f: 'adminLogs',
|
|
29
|
-
dateEnd,
|
|
30
|
-
idLogMax,
|
|
31
|
-
} as OF);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public getStats({
|
|
35
|
-
map,
|
|
36
|
-
dateStart,
|
|
37
|
-
dateEnd,
|
|
38
|
-
}: {
|
|
39
|
-
map: string;
|
|
40
|
-
dateStart?: string;
|
|
41
|
-
dateEnd?: string;
|
|
42
|
-
}): Promise<ApiWrapper<Array<JLandStat>>> {
|
|
43
|
-
return this.network.post({
|
|
44
|
-
o: 'JLand',
|
|
45
|
-
f: 'adminStats',
|
|
46
|
-
map,
|
|
47
|
-
dateStart,
|
|
48
|
-
dateEnd,
|
|
49
|
-
} as OF);
|
|
50
|
-
}
|
|
51
|
-
}
|
package/src/apis/messenger.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ApiWrapper } from '../types';
|
|
2
|
-
import { JBaseApi } from './base';
|
|
3
|
-
import { OF } from '../util/network';
|
|
4
|
-
|
|
5
|
-
export class JMessengerApi extends JBaseApi {
|
|
6
|
-
// FIXME fix return type, set as is since the return type has not been used yet
|
|
7
|
-
public sendMessage(message: string, idDiscussion: string): Promise<ApiWrapper<Record<string, never>>> {
|
|
8
|
-
return this.network.post({
|
|
9
|
-
o: 'messenger',
|
|
10
|
-
f: 'newMessage',
|
|
11
|
-
idDiscussion,
|
|
12
|
-
msg: { description: message },
|
|
13
|
-
} as OF);
|
|
14
|
-
}
|
|
15
|
-
public getOrCreateDiscussion(idSender: number, idUserTo: number): Promise<ApiWrapper<Record<string, never>>> {
|
|
16
|
-
const idDiscussion = idSender < idUserTo ? `${idSender}.${idUserTo}` : `${idUserTo}.${idSender}`;
|
|
17
|
-
return this.network.post({
|
|
18
|
-
o: 'messenger',
|
|
19
|
-
f: 'getDiscussion',
|
|
20
|
-
idDiscussion,
|
|
21
|
-
type: 'messengerUser',
|
|
22
|
-
idUserTo,
|
|
23
|
-
} as OF);
|
|
24
|
-
}
|
|
25
|
-
}
|