fansunited-sdk-esm 1.4.1 → 1.5.0
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/Core/Global/Constants/TestConstants.d.ts +33 -0
- package/Core/Global/Helper.d.ts +1 -0
- package/Core/Namespaces/Football/Facades/CompetitionsFacade.d.ts +1 -0
- package/Core/Namespaces/Football/Facades/FootballFacade.d.ts +2 -0
- package/Core/Namespaces/Football/Facades/TeamsFacade.d.ts +1 -0
- package/Core/Namespaces/Loyalty/Models/Filters/RankingsFilters.d.ts +1 -1
- package/Core/Namespaces/Profile/Builders/OwnProfileBuilder.d.ts +1 -2
- package/Core/Namespaces/Profile/Builders/ProfileBuilder.d.ts +1 -4
- package/Core/Namespaces/Profile/Interests/InterestsService.d.ts +0 -25
- package/Core/Namespaces/Profile/Models/Stats/SuccessRatePercent.d.ts +3 -0
- package/Core/Remapper/Profile/ProfileOperations.d.ts +56 -0
- package/Core/Remapper/SDKIdsRemapper.d.ts +12 -0
- package/index.js +12 -12
- package/index.js.map +3 -3
- package/package.json +1 -1
- package/Core/Global/SDKIdsRemapper.d.ts +0 -40
|
@@ -161,3 +161,36 @@ export declare const FOOTBALL_COMPETITIONS: {
|
|
|
161
161
|
})[];
|
|
162
162
|
};
|
|
163
163
|
};
|
|
164
|
+
export declare const FOOTBALL_TEAMS: {
|
|
165
|
+
data: {
|
|
166
|
+
meta: {
|
|
167
|
+
pagination: {
|
|
168
|
+
current_page: number;
|
|
169
|
+
items_per_page: number;
|
|
170
|
+
total_items: number;
|
|
171
|
+
number_of_pages: number;
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
data: {
|
|
175
|
+
id: string;
|
|
176
|
+
country: {
|
|
177
|
+
id: string;
|
|
178
|
+
alias: any;
|
|
179
|
+
country_code: string;
|
|
180
|
+
assets: {
|
|
181
|
+
flag: string;
|
|
182
|
+
};
|
|
183
|
+
name: string;
|
|
184
|
+
};
|
|
185
|
+
assets: {
|
|
186
|
+
logo: string;
|
|
187
|
+
};
|
|
188
|
+
national: boolean;
|
|
189
|
+
code: string;
|
|
190
|
+
gender: string;
|
|
191
|
+
name: string;
|
|
192
|
+
full_name: any;
|
|
193
|
+
short_name: any;
|
|
194
|
+
}[];
|
|
195
|
+
};
|
|
196
|
+
};
|
package/Core/Global/Helper.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare const transformIdsToBeUnique: (ids: string[]) => string[];
|
|
|
5
5
|
export declare const remapKeysToCamelCase: (obj: any) => any;
|
|
6
6
|
export declare const isDisabledCache: (disableCache: boolean) => boolean;
|
|
7
7
|
export declare const initDisableCache: () => string;
|
|
8
|
+
export declare const sortArrayInAscOrder: (array: string[]) => string[];
|
|
@@ -11,6 +11,7 @@ export default class CompetitionsFacade {
|
|
|
11
11
|
private idMapping;
|
|
12
12
|
constructor(localStorage: LocalStorage, https: FootballHttps, idMapping: IdMappingService);
|
|
13
13
|
getCompetitionsIdMapping: (filters?: CompetitionFilters, disableCache?: boolean) => Promise<CompetitionBasicModel[]>;
|
|
14
|
+
getCompetitionsMapWithNativeIds: (competitionIds: string[]) => Promise<Map<string, CompetitionBasicModel>>;
|
|
14
15
|
private getCompetitions;
|
|
15
16
|
getCompetitionByIdIdMapping: (id: string, disableCache?: boolean) => Promise<CompetitionFullModel>;
|
|
16
17
|
private getCompetitionById;
|
|
@@ -29,11 +29,13 @@ export default class FootballFacade {
|
|
|
29
29
|
getCompetitions: (filters?: CompetitionFilters, disableCache?: boolean) => Promise<CompetitionBasicModel[]>;
|
|
30
30
|
getCompetitionById: (id: string, disableCache?: boolean) => Promise<CompetitionFullModel>;
|
|
31
31
|
getTopCompetitions: (disableCache?: boolean) => Promise<CompetitionBasicModel[]>;
|
|
32
|
+
getCompetitionsMapWithNativeIds: (competitionIds: string[]) => Promise<Map<string, CompetitionBasicModel>>;
|
|
32
33
|
getTeams: (filters?: TeamFilters, disableCache?: boolean) => Promise<FootballPaginationModel>;
|
|
33
34
|
getTeamById: (id: string, disableCache?: boolean) => Promise<TeamFullModel>;
|
|
34
35
|
getTopTeams: (disableCache?: boolean) => Promise<TeamBasicModel[]>;
|
|
35
36
|
getNextMatchForTeam: (id: string, disableCache?: boolean) => Promise<MatchFullModel>;
|
|
36
37
|
getPrevMatchForTeam: (id: string, disableCache?: boolean) => Promise<MatchFullModel>;
|
|
38
|
+
getTeamsMapWithNativeIds: (teamIds: string[]) => Promise<Map<string, TeamBasicModel>>;
|
|
37
39
|
getPlayers: (filters?: PlayerFilters, disableCache?: boolean) => Promise<FootballPaginationModel>;
|
|
38
40
|
getPlayerById: (id: string, disableCache?: boolean) => Promise<PlayerFullModel>;
|
|
39
41
|
getTopPlayers: (disableCache?: boolean) => Promise<TopPlayerModel[]>;
|
|
@@ -12,6 +12,7 @@ export default class TeamsFacade {
|
|
|
12
12
|
private idMapping;
|
|
13
13
|
constructor(config: SDKConfigurationModel, https: FootballHttps, idMapping: IdMappingService);
|
|
14
14
|
getTeamsIdMapping: (filters?: TeamFilters, disableCache?: boolean) => Promise<FootballPaginationModel>;
|
|
15
|
+
getTeamsMapWithNativeIds: (teamIds: string[]) => Promise<Map<string, TeamBasicModel>>;
|
|
15
16
|
private getTeams;
|
|
16
17
|
getTeamByIdIdMapping: (id: string, disableCache?: boolean) => Promise<TeamFullModel>;
|
|
17
18
|
private getTeamById;
|
|
@@ -5,7 +5,7 @@ import LoyaltyFilters from "./LoyaltyFilters";
|
|
|
5
5
|
export default class RankingsFilters extends LoyaltyFilters implements FiltersInterface {
|
|
6
6
|
sortOrder?: SortOrder;
|
|
7
7
|
type?: RankingsType;
|
|
8
|
-
|
|
8
|
+
leaderboardIds?: string[];
|
|
9
9
|
constructor(filters: any);
|
|
10
10
|
constructFiltersUrl: () => string;
|
|
11
11
|
}
|
|
@@ -10,12 +10,11 @@ import FollowFilters from "../Models/FollowFilters";
|
|
|
10
10
|
import PaginationModel from "../../../Global/Models/Pagination/PaginationModel";
|
|
11
11
|
import ProfileStatsModel from "../Models/Stats/ProfileStatsModel";
|
|
12
12
|
import ActivityHttps from "../../../Https/ActivityHttps";
|
|
13
|
-
import SDKIdsRemapper from "../../../
|
|
13
|
+
import SDKIdsRemapper from "../../../Remapper/SDKIdsRemapper";
|
|
14
14
|
export default class OwnProfileBuilder {
|
|
15
15
|
private idsRemapper;
|
|
16
16
|
private profileHttps;
|
|
17
17
|
private profileService;
|
|
18
|
-
private activityHttps;
|
|
19
18
|
private localStorage;
|
|
20
19
|
private profileFacade;
|
|
21
20
|
private interestsService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import LocalStorage from "../../../Global/LocalStorage";
|
|
2
2
|
import PaginationModel from "../../../Global/Models/Pagination/PaginationModel";
|
|
3
|
-
import SDKIdsRemapper from "../../../
|
|
3
|
+
import SDKIdsRemapper from "../../../Remapper/SDKIdsRemapper";
|
|
4
4
|
import ActivityHttps from "../../../Https/ActivityHttps";
|
|
5
5
|
import ProfileHttps from "../../../Https/ProfileHttps";
|
|
6
6
|
import IdMappingService from "../../../IdMapping/IdMappingService";
|
|
@@ -14,9 +14,6 @@ export default class ProfileBuilder {
|
|
|
14
14
|
private idsRemapper;
|
|
15
15
|
private profileHttps;
|
|
16
16
|
private activityHttps;
|
|
17
|
-
private footballFacade;
|
|
18
|
-
private localStorage;
|
|
19
|
-
private idMapping;
|
|
20
17
|
private profileFacade;
|
|
21
18
|
private interestsService;
|
|
22
19
|
private profileId;
|
|
@@ -5,31 +5,6 @@ export default class InterestsService {
|
|
|
5
5
|
private idMapping;
|
|
6
6
|
private footballFacade;
|
|
7
7
|
constructor(idMapping: IdMappingService, footballFacade: FootballFacade);
|
|
8
|
-
/**
|
|
9
|
-
* Initializing object objectIds with key type and value id from interests.
|
|
10
|
-
* Passing that object to function getEntitiesByIds in IdMappingFacade.
|
|
11
|
-
* For replacing the new ids there is a object interestsByType with key type and
|
|
12
|
-
* value interests. The order in interestsByType is same as objectIds.
|
|
13
|
-
* We aren't remapping any custom or native interests.
|
|
14
|
-
* @param interests
|
|
15
|
-
* @returns Remapped interests from native to idSchema.
|
|
16
|
-
*/
|
|
17
|
-
private remapInterestsToIdSchema;
|
|
18
|
-
/**
|
|
19
|
-
* Using id and type from @param interest to initialize object which we are passing
|
|
20
|
-
* to @function getEntitiesByIds in @class IdMappingFacade.
|
|
21
|
-
* We are using this function when we want to add or remove interest from our profile.
|
|
22
|
-
* @param interest
|
|
23
|
-
* @returns Remapped interest from idSchema to native.
|
|
24
|
-
*/
|
|
25
|
-
remapInterestToNative: (interest: InterestModel) => Promise<InterestModel>;
|
|
26
|
-
/**
|
|
27
|
-
* Extracting custom interests from list of interests in profile.
|
|
28
|
-
* We are using this function when we want to show interests from profile.
|
|
29
|
-
* @param interests
|
|
30
|
-
* @returns Utilizing @function remapInterestsToIdSchema for remapping to idSchema.
|
|
31
|
-
*/
|
|
32
|
-
inquiryCustomInterests: (interests: InterestModel[]) => Promise<InterestModel[]>;
|
|
33
8
|
/**
|
|
34
9
|
* Using FootballFacade to get information for teams, players or competitions with remapped ids.
|
|
35
10
|
* In case we have custom interest we don't remap the id. When the id for the entity is not remaped successfully or
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import CompetitionBasicModel from "../../../Football/Models/Competition/CompetitionBasicModel";
|
|
2
|
+
import TeamBasicModel from "../../../Football/Models/Team/TeamBasicModel";
|
|
1
3
|
export default class SuccessRatePercent {
|
|
2
4
|
successRatePercent: number;
|
|
5
|
+
model: CompetitionBasicModel | TeamBasicModel;
|
|
3
6
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import SDKConfigurationModel from "../../Configurator/Models/SDKConfiguraitonModel";
|
|
2
|
+
import IdMappingService from "../../IdMapping/IdMappingService";
|
|
3
|
+
import FootballFacade from "../../Namespaces/Football/Facades/FootballFacade";
|
|
4
|
+
import InterestModel from "../../Namespaces/Profile/Models/InterestModel";
|
|
5
|
+
import ProfileStatsModel from "../../Namespaces/Profile/Models/Stats/ProfileStatsModel";
|
|
6
|
+
export default class ProfileOperations {
|
|
7
|
+
private idMapping;
|
|
8
|
+
private idSchema;
|
|
9
|
+
private readonly native;
|
|
10
|
+
private footballFacade;
|
|
11
|
+
constructor(config: SDKConfigurationModel, footballFacade: FootballFacade, idMapping: IdMappingService);
|
|
12
|
+
/**
|
|
13
|
+
* Method is used to remaped competition and team ids from entities in successRates field.
|
|
14
|
+
* @param profileStats Profile stats from Loyalty API.
|
|
15
|
+
* @returns A new successRates with remaped ids keys.
|
|
16
|
+
*/
|
|
17
|
+
remapSuccessRatesEntities: (profileStats: ProfileStatsModel) => Promise<ProfileStatsModel>;
|
|
18
|
+
private setModels;
|
|
19
|
+
/**
|
|
20
|
+
* Keys for success rates entiteis are ids. This method extracts them in string array.
|
|
21
|
+
* @param record The record containing native ids keys.
|
|
22
|
+
* @returns New list of native ids.
|
|
23
|
+
*/
|
|
24
|
+
private getIdsKeys;
|
|
25
|
+
/**
|
|
26
|
+
* Initializing object objectIds with key type and value id from interests.
|
|
27
|
+
* Passing that object to function getEntitiesByIds in IdMappingFacade.
|
|
28
|
+
* For replacing the new ids there is a object interestsByType with key type and
|
|
29
|
+
* value interests. The order in interestsByType is same as objectIds.
|
|
30
|
+
* We aren't remapping any custom or native interests.
|
|
31
|
+
* @param interests
|
|
32
|
+
* @returns Remapped interests from native to idSchema.
|
|
33
|
+
*/
|
|
34
|
+
private remapInterestsToIdSchema;
|
|
35
|
+
/**
|
|
36
|
+
* Using id and type from @param interest to initialize object which we are passing
|
|
37
|
+
* to @function getEntitiesByIds in @class IdMappingFacade.
|
|
38
|
+
* We are using this function when we want to add or remove interest from our profile.
|
|
39
|
+
* @param interest
|
|
40
|
+
* @returns Remapped interest from idSchema to native.
|
|
41
|
+
*/
|
|
42
|
+
remapInterestToNative: (interest: InterestModel) => Promise<InterestModel>;
|
|
43
|
+
/**
|
|
44
|
+
* Extracting custom interests from list of interests in profile.
|
|
45
|
+
* We are using this function when we want to show interests from profile.
|
|
46
|
+
* @param interests
|
|
47
|
+
* @returns Utilizing @function remapInterestsToIdSchema for remapping to idSchema.
|
|
48
|
+
*/
|
|
49
|
+
inquiryCustomInterests: (interests: InterestModel[]) => Promise<InterestModel[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Calls id mapping facade to fetch id entities from storage or Id Mapping API.
|
|
52
|
+
* @param idsObj Object which key is entity and value is string array of ids.
|
|
53
|
+
* @returns Remapped ids by entities.
|
|
54
|
+
*/
|
|
55
|
+
private remapIdsObj;
|
|
56
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import SDKConfigurationModel from "../Configurator/Models/SDKConfiguraitonModel";
|
|
2
|
+
import FootballFacade from "../Namespaces/Football/Facades/FootballFacade";
|
|
3
|
+
import InterestModel from "../Namespaces/Profile/Models/InterestModel";
|
|
4
|
+
import ProfileStatsModel from "../Namespaces/Profile/Models/Stats/ProfileStatsModel";
|
|
5
|
+
export default class SDKIdsRemapper {
|
|
6
|
+
private idMapping;
|
|
7
|
+
private profileOperations;
|
|
8
|
+
constructor(config: SDKConfigurationModel, footballFacade: FootballFacade);
|
|
9
|
+
remapSuccessRatesEntities: (profileStats: ProfileStatsModel) => Promise<ProfileStatsModel>;
|
|
10
|
+
remapInterestToNative: (interest: InterestModel) => Promise<InterestModel>;
|
|
11
|
+
inquiryCustomInterests: (interests: InterestModel[]) => Promise<InterestModel[]>;
|
|
12
|
+
}
|