fansunited-sdk-umd 1.1.7 → 1.1.8
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/README.md +72 -72
- package/index.js +1 -1
- package/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
# Fans United JavaScript SDK
|
|
2
|
-
|
|
3
|
-
Welcome to the Fans United JavaScript SDK. This SDK works for client-side, server-side and React Native implementations.
|
|
4
|
-
The SDK has complete coverage of the Fans United APIs and is split into different namespaces depending on what you want
|
|
5
|
-
to achieve.
|
|
6
|
-
|
|
7
|
-
Operations supported by the SDK:
|
|
8
|
-
|
|
9
|
-
- [Profile Operations](https://docs.fansunitedmedia.com/sdks/js/profile)
|
|
10
|
-
- [Football Operations](https://docs.fansunitedmedia.com/sdks/js/football)
|
|
11
|
-
- [Predictor Operations](https://docs.fansunitedmedia.com/sdks/js/predictor)
|
|
12
|
-
- [Top X Operations](https://docs.fansunitedmedia.com/sdks/js/topx)
|
|
13
|
-
- [Match Quiz Operations](https://docs.fansunitedmedia.com/sdks/js/match.quiz)
|
|
14
|
-
|
|
15
|
-
## Install the SDK
|
|
16
|
-
|
|
17
|
-
The JavaScript SDK is distributed as NPM package. You can install it by running the following command:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm i fansunited-sdk-umd
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Use the SDK in your app
|
|
24
|
-
|
|
25
|
-
The SDK works with JWTs provided from OAuth2 provider. The default provider is Firebase Authentication, but if the
|
|
26
|
-
client has their own provider, it can be integrated into the platform.
|
|
27
|
-
|
|
28
|
-
The SDK comes with a configuration and an interface. The client needs to implement this interface and pass the implementation
|
|
29
|
-
in the config.
|
|
30
|
-
|
|
31
|
-
### Initiate the SDK
|
|
32
|
-
|
|
33
|
-
This is what the SDK config requires:
|
|
34
|
-
|
|
35
|
-
```javascript
|
|
36
|
-
import {FansUnitedSDK} from "fansunited-sdk-esm";
|
|
37
|
-
|
|
38
|
-
let fansUnitedSdk = FansUnitedSDK({
|
|
39
|
-
"apiKey": "your-api-key-here",
|
|
40
|
-
"environment": "dev|prod|sandbox|etc", // default: prod
|
|
41
|
-
"clientId": "your-client-id-here",
|
|
42
|
-
"lang": "BG|EN|RO", // default: EN
|
|
43
|
-
"idSchema": "native|enetpulse|sportradar|sportal365", // default: native
|
|
44
|
-
"authProvider": new myTokenProvider()
|
|
45
|
-
});
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
The interface being exported by the Fans United SDK:
|
|
49
|
-
|
|
50
|
-
```javascript
|
|
51
|
-
interface FansUnitedAuthInterface() {
|
|
52
|
-
getIdToken = () => {},
|
|
53
|
-
logout = () => {}
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
A client supplied class that implements the interface is provided:
|
|
58
|
-
|
|
59
|
-
```javascript
|
|
60
|
-
class myTokenProvider implements FansUnitedAuthInterface() {
|
|
61
|
-
getIdToken = () => {
|
|
62
|
-
// custom logic ...
|
|
63
|
-
return tokenString;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
logout = () => {
|
|
67
|
-
// custom logic to delete token...
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
The token is being stored in memory for security purposes.
|
|
1
|
+
# Fans United JavaScript SDK
|
|
2
|
+
|
|
3
|
+
Welcome to the Fans United JavaScript SDK. This SDK works for client-side, server-side and React Native implementations.
|
|
4
|
+
The SDK has complete coverage of the Fans United APIs and is split into different namespaces depending on what you want
|
|
5
|
+
to achieve.
|
|
6
|
+
|
|
7
|
+
Operations supported by the SDK:
|
|
8
|
+
|
|
9
|
+
- [Profile Operations](https://docs.fansunitedmedia.com/sdks/js/profile)
|
|
10
|
+
- [Football Operations](https://docs.fansunitedmedia.com/sdks/js/football)
|
|
11
|
+
- [Predictor Operations](https://docs.fansunitedmedia.com/sdks/js/predictor)
|
|
12
|
+
- [Top X Operations](https://docs.fansunitedmedia.com/sdks/js/topx)
|
|
13
|
+
- [Match Quiz Operations](https://docs.fansunitedmedia.com/sdks/js/match.quiz)
|
|
14
|
+
|
|
15
|
+
## Install the SDK
|
|
16
|
+
|
|
17
|
+
The JavaScript SDK is distributed as NPM package. You can install it by running the following command:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm i fansunited-sdk-umd
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Use the SDK in your app
|
|
24
|
+
|
|
25
|
+
The SDK works with JWTs provided from OAuth2 provider. The default provider is Firebase Authentication, but if the
|
|
26
|
+
client has their own provider, it can be integrated into the platform.
|
|
27
|
+
|
|
28
|
+
The SDK comes with a configuration and an interface. The client needs to implement this interface and pass the implementation
|
|
29
|
+
in the config.
|
|
30
|
+
|
|
31
|
+
### Initiate the SDK
|
|
32
|
+
|
|
33
|
+
This is what the SDK config requires:
|
|
34
|
+
|
|
35
|
+
```javascript
|
|
36
|
+
import {FansUnitedSDK} from "fansunited-sdk-esm";
|
|
37
|
+
|
|
38
|
+
let fansUnitedSdk = FansUnitedSDK({
|
|
39
|
+
"apiKey": "your-api-key-here",
|
|
40
|
+
"environment": "dev|prod|sandbox|etc", // default: prod
|
|
41
|
+
"clientId": "your-client-id-here",
|
|
42
|
+
"lang": "BG|EN|RO", // default: EN
|
|
43
|
+
"idSchema": "native|enetpulse|sportradar|sportal365", // default: native
|
|
44
|
+
"authProvider": new myTokenProvider()
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The interface being exported by the Fans United SDK:
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
interface FansUnitedAuthInterface() {
|
|
52
|
+
getIdToken = () => {},
|
|
53
|
+
logout = () => {}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
A client supplied class that implements the interface is provided:
|
|
58
|
+
|
|
59
|
+
```javascript
|
|
60
|
+
class myTokenProvider implements FansUnitedAuthInterface() {
|
|
61
|
+
getIdToken = () => {
|
|
62
|
+
// custom logic ...
|
|
63
|
+
return tokenString;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
logout = () => {
|
|
67
|
+
// custom logic to delete token...
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The token is being stored in memory for security purposes.
|
|
73
73
|
The Fans United SDK is monitoring for the validity/expiration of the token and issues a new token before expiry.
|