jamespot-user-api 1.0.43 → 1.0.44

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.
Files changed (121) hide show
  1. package/documentation/classes/JApplication.html +1 -1
  2. package/documentation/classes/JApplicationApi.html +8 -8
  3. package/documentation/classes/JArticleApi.html +1 -1
  4. package/documentation/classes/JAudienceApi.html +1 -1
  5. package/documentation/classes/JBaseApi.html +1 -1
  6. package/documentation/classes/JBaseObject.html +1 -1
  7. package/documentation/classes/JBookmark.html +1 -1
  8. package/documentation/classes/JBookmarkApi.html +1 -1
  9. package/documentation/classes/JCommunityApi.html +1 -1
  10. package/documentation/classes/JConcept.html +1 -1
  11. package/documentation/classes/JConceptApi.html +1 -1
  12. package/documentation/classes/JDiapazoneApi.html +1 -1
  13. package/documentation/classes/JFileApi.html +1 -1
  14. package/documentation/classes/JFilebankApi.html +1 -1
  15. package/documentation/classes/JGroupApi.html +1 -1
  16. package/documentation/classes/JLandApi.html +1 -1
  17. package/documentation/classes/JMessengerApi.html +1 -1
  18. package/documentation/classes/JSearchApi.html +6 -6
  19. package/documentation/classes/JUser.html +1 -1
  20. package/documentation/classes/JUserApi.html +3 -3
  21. package/documentation/classes/JWedocApi.html +1 -1
  22. package/documentation/classes/JamespotUserApi.html +1 -1
  23. package/documentation/classes/Network.html +1 -1
  24. package/documentation/enums/JApplicationStatus.html +1 -1
  25. package/documentation/interfaces/ApiError.html +1 -1
  26. package/documentation/interfaces/ApiWrapper.html +1 -1
  27. package/documentation/interfaces/AseiGroups.html +1 -1
  28. package/documentation/interfaces/AseiInstitution.html +1 -1
  29. package/documentation/interfaces/AseiRights.html +1 -1
  30. package/documentation/interfaces/AseiTicket.html +1 -1
  31. package/documentation/interfaces/BaseAutocomplete.html +1 -1
  32. package/documentation/interfaces/BaseMessage.html +1 -1
  33. package/documentation/interfaces/Category.html +1 -1
  34. package/documentation/interfaces/CreateGroup.html +1 -1
  35. package/documentation/interfaces/FileBankProps.html +1 -1
  36. package/documentation/interfaces/FileOption.html +1 -1
  37. package/documentation/interfaces/FolderProps.html +1 -1
  38. package/documentation/interfaces/ListFilterSpec.html +1 -1
  39. package/documentation/interfaces/OF.html +1 -1
  40. package/documentation/interfaces/PagingResults.html +1 -1
  41. package/documentation/interfaces/Result.html +1 -1
  42. package/documentation/interfaces/RootFolderProps.html +1 -1
  43. package/documentation/interfaces/SearchCategoryModel.html +1 -1
  44. package/documentation/interfaces/SearchConfig.html +1 -1
  45. package/documentation/interfaces/SearchFacetModel.html +1 -1
  46. package/documentation/interfaces/SearchFacetValueModel.html +1 -1
  47. package/documentation/interfaces/SearchQuery.html +1 -1
  48. package/documentation/interfaces/SearchQueryFilterModel.html +1 -1
  49. package/documentation/interfaces/SearchQueryOption.html +1 -1
  50. package/documentation/interfaces/SearchQueryResult.html +1 -1
  51. package/documentation/interfaces/SearchQuerySortModel.html +1 -1
  52. package/documentation/interfaces/SearchResultCatProps.html +1 -1
  53. package/documentation/interfaces/SearchResultProps.html +1 -1
  54. package/documentation/interfaces/SpotProps.html +1 -1
  55. package/documentation/interfaces/Taxonomy.html +1 -1
  56. package/documentation/interfaces/TaxonomyCreate.html +1 -1
  57. package/documentation/interfaces/TmpApplication.html +1 -1
  58. package/documentation/interfaces/TmpUser.html +1 -1
  59. package/documentation/interfaces/UserModel.html +1 -1
  60. package/documentation/modules.html +1 -1
  61. package/package.json +1 -1
  62. package/src/apis/application.ts +0 -132
  63. package/src/apis/article.ts +0 -74
  64. package/src/apis/asei.ts +0 -73
  65. package/src/apis/audience.ts +0 -18
  66. package/src/apis/base.ts +0 -9
  67. package/src/apis/bookmark.ts +0 -110
  68. package/src/apis/community.ts +0 -20
  69. package/src/apis/concept.ts +0 -31
  70. package/src/apis/diapazone.ts +0 -65
  71. package/src/apis/file.ts +0 -14
  72. package/src/apis/filebank.ts +0 -50
  73. package/src/apis/group.ts +0 -48
  74. package/src/apis/index.ts +0 -17
  75. package/src/apis/jamespotUserApi.ts +0 -69
  76. package/src/apis/jland.ts +0 -51
  77. package/src/apis/messenger.ts +0 -25
  78. package/src/apis/search.ts +0 -85
  79. package/src/apis/taxonomy.ts +0 -30
  80. package/src/apis/user.ts +0 -53
  81. package/src/apis/wedoc.ts +0 -77
  82. package/src/classes/JApplication.ts +0 -55
  83. package/src/classes/JBaseObject.ts +0 -64
  84. package/src/classes/JBookmark.ts +0 -44
  85. package/src/classes/JConcept.ts +0 -3
  86. package/src/classes/JDiapazone.ts +0 -42
  87. package/src/classes/JFile.ts +0 -37
  88. package/src/classes/JUser.ts +0 -7
  89. package/src/classes/index.ts +0 -5
  90. package/src/index.ts +0 -21
  91. package/src/indexMock.ts +0 -17
  92. package/src/mock/data/autocomplete/audience/data.json +0 -191
  93. package/src/mock/data/autocomplete/community/data.json +0 -47
  94. package/src/mock/data/autocomplete/taxonomy/data.json +0 -35
  95. package/src/mock/data/autocomplete/user/data.json +0 -107
  96. package/src/mock/data/bookmarks/addBookmark/data.json +0 -54
  97. package/src/mock/data/bookmarks/addLink/data.json +0 -63
  98. package/src/mock/data/bookmarks/bookmarkList/data.json +0 -271
  99. package/src/mock/data/bookmarks/delete/data.json +0 -12
  100. package/src/mock/data/community/sendRequest/data.json +0 -12
  101. package/src/mock/data/file/create/data.json +0 -18
  102. package/src/mock/data/messenger/newMessage/data.json +0 -47
  103. package/src/mock/data/misc/tokenCSRF/data.json +0 -7
  104. package/src/mock/data/search/getConfig/data.json +0 -318
  105. package/src/mock/data/search/lastQueries/data.json +0 -7
  106. package/src/mock/data/search/proposition/data.json +0 -125
  107. package/src/mock/data/spot/create/data.json +0 -7
  108. package/src/mock/data/spot/get-available-widget/data.json +0 -56
  109. package/src/mock/data/spot/get-categories/data.json +0 -28
  110. package/src/mock/data/user/signIn/data.json +0 -197
  111. package/src/mock/windowMock.ts +0 -113
  112. package/src/types/asei.ts +0 -33
  113. package/src/types/autocomplete.ts +0 -17
  114. package/src/types/group.ts +0 -27
  115. package/src/types/index.ts +0 -7
  116. package/src/types/listWrapper.ts +0 -6
  117. package/src/types/search.ts +0 -105
  118. package/src/types/taxonomy.ts +0 -47
  119. package/src/types/user.ts +0 -14
  120. package/src/types/utils.ts +0 -66
  121. package/src/util/network.ts +0 -96
@@ -1,74 +0,0 @@
1
- import { JBaseApi } from './base';
2
- import { ApiWrapper, BaseMessages, Filters, Little, Orders, PagingResults } from '../types';
3
- import { OF } from '../util/network';
4
-
5
- export type ArticleListConfig = {
6
- type: string;
7
- format: string;
8
- query?: string;
9
- limit?: number;
10
- page?: number;
11
- orders?: Orders;
12
- filters?: Filters;
13
- };
14
-
15
- export type ArticleGetConfig = {
16
- uri?: string;
17
- idArticle?: number;
18
- format?: string;
19
- };
20
-
21
- export type ArticleCreation = {
22
- title: string;
23
- description: string;
24
- };
25
-
26
- export type BaseArticle = {
27
- id: number;
28
- type: string;
29
- dateCreation: string;
30
- dateModified: string;
31
- title: string;
32
- };
33
-
34
- export class JArticleApi extends JBaseApi {
35
- public list(config: ArticleListConfig): Promise<ApiWrapper<PagingResults<{ title: string }>>> {
36
- return this.network.post({
37
- o: 'ObjectListJamespot',
38
- f: 'ArticleQueryList',
39
- ...config,
40
- } as OF);
41
- }
42
-
43
- public get<T extends Little = Little>(config: ArticleGetConfig): Promise<ApiWrapper<T>> {
44
- return this.network.post({
45
- o: 'article',
46
- f: 'get',
47
- ...config,
48
- } as OF);
49
- }
50
-
51
- public create<T>(article: ArticleCreation): Promise<ApiWrapper<BaseArticle & T>> {
52
- return this.network.post({
53
- o: 'article',
54
- f: 'create',
55
- ...article,
56
- } as OF);
57
- }
58
-
59
- public update<T extends { uri: string }>(article: T): Promise<ApiWrapper<never, BaseMessages>> {
60
- return this.network.post({
61
- o: 'article',
62
- f: 'update',
63
- ...article,
64
- } as OF);
65
- }
66
-
67
- public count(type: string): Promise<ApiWrapper<number>> {
68
- return this.network.post({
69
- o: 'article',
70
- f: 'count',
71
- type,
72
- } as OF);
73
- }
74
- }
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
- }
@@ -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
@@ -1,9 +0,0 @@
1
- import { Network } from '../util/network';
2
-
3
- export class JBaseApi {
4
- public network: Network;
5
-
6
- public constructor(network: Network) {
7
- this.network = network;
8
- }
9
- }
@@ -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
- }
@@ -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
- }
@@ -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
- }
@@ -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
- }
@@ -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
- }
@@ -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
- }