Skip to content

Commit 6caf55f

Browse files
committed
Implement assignment logic
1 parent dd980d1 commit 6caf55f

24 files changed

+598
-5
lines changed

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
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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
| [subjectAttributes?](./js-client-sdk.iclientconfig.subjectattributes.md) | Record&lt;string, AttributeValueType&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+
| [subjectKey](./js-client-sdk.iclientconfig.subjectkey.md) | string | An identifier of the experiment subject, for example a user ID. |
23+
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; [subjectAttributes](./js-client-sdk.iclientconfig.subjectattributes.md)
4+
5+
## IClientConfig.subjectAttributes property
6+
7+
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.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
subjectAttributes?: Record<string, AttributeValueType>;
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; [subjectKey](./js-client-sdk.iclientconfig.subjectkey.md)
4+
5+
## IClientConfig.subjectKey property
6+
7+
An identifier of the experiment subject, for example a user ID.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
subjectKey: string;
13+
```

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&gt;
24+

docs/js-client-sdk.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,12 @@
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 |
1219

js-client-sdk.api.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@
44
55
```ts
66

7+
// Warning: (ae-forgotten-export) The symbol "IEppoClient" needs to be exported by the entry point index.d.ts
8+
//
79
// @public
8-
export function dummy(): string;
10+
export function getInstance(): IEppoClient;
11+
12+
// @public
13+
export interface IClientConfig {
14+
apiKey: string;
15+
baseUrl?: string;
16+
// Warning: (ae-forgotten-export) The symbol "AttributeValueType" needs to be exported by the entry point index.d.ts
17+
subjectAttributes?: Record<string, AttributeValueType>;
18+
subjectKey: string;
19+
}
20+
21+
// @public
22+
export function init(config: IClientConfig): Promise<IEppoClient>;
923

1024
// (No @packageDocumentation comment for this package)
1125

src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const REQUEST_TIMEOUT_MILLIS = 1000;
2+
export const BASE_URL = 'https://eppo.cloud/api';

0 commit comments

Comments
 (0)