Skip to content

Commit 3355bed

Browse files
authored
Merge pull request #1 from Eppo-exp/setup
Implement Assignment Logic
2 parents 66921c5 + 6ae6352 commit 3355bed

33 files changed

+1431
-28
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ logs/
66
temp
77
.env
88
yarn-error.log
9+
10+
test/assignmentTestData

docs/js-client-sdk.dummy.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

docs/js-client-sdk.getinstance.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [getInstance](./js-client-sdk.getinstance.md)
4+
5+
## getInstance() function
6+
7+
Used to access a singleton SDK client instance. Use the method after calling init() to initialize the client.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export declare function getInstance(): IEppoClient;
13+
```
14+
<b>Returns:</b>
15+
16+
[IEppoClient](./js-client-sdk.ieppoclient.md)
17+
18+
a singleton client instance
19+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [IClientConfig](./js-client-sdk.iclientconfig.md) &gt; [apiKey](./js-client-sdk.iclientconfig.apikey.md)
4+
5+
## IClientConfig.apiKey property
6+
7+
Eppo API key
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
apiKey: string;
13+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [IClientConfig](./js-client-sdk.iclientconfig.md) &gt; [baseUrl](./js-client-sdk.iclientconfig.baseurl.md)
4+
5+
## IClientConfig.baseUrl property
6+
7+
Base URL of the Eppo API. Clients should use the default setting in most cases.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
baseUrl?: string;
13+
```
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [IClientConfig](./js-client-sdk.iclientconfig.md)
4+
5+
## IClientConfig interface
6+
7+
Configuration used for initializing the Eppo client
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export interface IClientConfig
13+
```
14+
15+
## Properties
16+
17+
| Property | Type | Description |
18+
| --- | --- | --- |
19+
| [apiKey](./js-client-sdk.iclientconfig.apikey.md) | string | Eppo API key |
20+
| [baseUrl?](./js-client-sdk.iclientconfig.baseurl.md) | string | <i>(Optional)</i> Base URL of the Eppo API. Clients should use the default setting in most cases. |
21+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [IEppoClient](./js-client-sdk.ieppoclient.md) &gt; [getAssignment](./js-client-sdk.ieppoclient.getassignment.md)
4+
5+
## IEppoClient.getAssignment() method
6+
7+
Maps a subject to a variation for a given experiment.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
getAssignment(subjectKey: string, experimentKey: string, subjectAttributes?: Record<string, any>): string;
13+
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| subjectKey | string | an identifier of the experiment subject, for example a user ID. |
20+
| experimentKey | string | experiment identifier |
21+
| subjectAttributes | Record&lt;string, any&gt; | <i>(Optional)</i> optional attributes associated with the subject, for example name and email. The subject attributes are used for evaluating any targeting rules tied to the experiment. |
22+
23+
<b>Returns:</b>
24+
25+
string
26+
27+
a variation value if the subject is part of the experiment sample, otherwise null
28+

docs/js-client-sdk.ieppoclient.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [IEppoClient](./js-client-sdk.ieppoclient.md)
4+
5+
## IEppoClient interface
6+
7+
Client for assigning experiment variations.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export interface IEppoClient
13+
```
14+
15+
## Methods
16+
17+
| Method | Description |
18+
| --- | --- |
19+
| [getAssignment(subjectKey, experimentKey, subjectAttributes)](./js-client-sdk.ieppoclient.getassignment.md) | Maps a subject to a variation for a given experiment. |
20+

docs/js-client-sdk.init.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@eppo/js-client-sdk](./js-client-sdk.md) &gt; [init](./js-client-sdk.init.md)
4+
5+
## init() function
6+
7+
Initializes the Eppo client with configuration parameters. This method should be called once on application startup. After invocation of this method, the SDK will poll Eppo's API at regular intervals to retrieve assignment configurations.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export declare function init(config: IClientConfig): Promise<IEppoClient>;
13+
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| config | [IClientConfig](./js-client-sdk.iclientconfig.md) | client configuration |
20+
21+
<b>Returns:</b>
22+
23+
Promise&lt;[IEppoClient](./js-client-sdk.ieppoclient.md)<!-- -->&gt;
24+

docs/js-client-sdk.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,13 @@
88

99
| Function | Description |
1010
| --- | --- |
11-
| [dummy()](./js-client-sdk.dummy.md) | Test documentation |
11+
| [getInstance()](./js-client-sdk.getinstance.md) | Used to access a singleton SDK client instance. Use the method after calling init() to initialize the client. |
12+
| [init(config)](./js-client-sdk.init.md) | Initializes the Eppo client with configuration parameters. This method should be called once on application startup. After invocation of this method, the SDK will poll Eppo's API at regular intervals to retrieve assignment configurations. |
13+
14+
## Interfaces
15+
16+
| Interface | Description |
17+
| --- | --- |
18+
| [IClientConfig](./js-client-sdk.iclientconfig.md) | Configuration used for initializing the Eppo client |
19+
| [IEppoClient](./js-client-sdk.ieppoclient.md) | Client for assigning experiment variations. |
1220

0 commit comments

Comments
 (0)