From a80d63f9c0ad026405c9cc8087ed775b71d5a72e Mon Sep 17 00:00:00 2001 From: "Yan (kpkr)" Date: Mon, 9 Jun 2025 13:51:52 +0400 Subject: [PATCH 1/7] feat: add types page. update freebet manual --- pages/hub/apps/guides/freebets/_meta.json | 3 +- pages/hub/apps/guides/freebets/types.mdx | 309 ++++++++++++++++++ .../hub/apps/guides/freebets/use-freebets.mdx | 34 +- 3 files changed, 317 insertions(+), 29 deletions(-) create mode 100644 pages/hub/apps/guides/freebets/types.mdx diff --git a/pages/hub/apps/guides/freebets/_meta.json b/pages/hub/apps/guides/freebets/_meta.json index 682aacf..981da6c 100644 --- a/pages/hub/apps/guides/freebets/_meta.json +++ b/pages/hub/apps/guides/freebets/_meta.json @@ -5,5 +5,6 @@ "type": "hidden", "display": "hidden" }, - "use-freebets": "Use Freebets" + "use-freebets": "Use Freebets", + "types": "Data types" } diff --git a/pages/hub/apps/guides/freebets/types.mdx b/pages/hub/apps/guides/freebets/types.mdx new file mode 100644 index 0000000..a41d683 --- /dev/null +++ b/pages/hub/apps/guides/freebets/types.mdx @@ -0,0 +1,309 @@ +import { Callout } from 'components' +import { Tab, Tabs } from 'nextra-theme-docs' + +# Data types + + + This diagram serves as a supplement to the api documentation. + The up-to-date diagrams can be found in the documentation. + + +#### Development +https://dev-api.onchainfeed.org/api/v1/public/gateway/docs +#### Production +https://api.onchainfeed.org/api/v1/public/gateway/docs + + +## Enums + +### BonusType + + +| Value | Description | +|-------|-------------| +| **FreeBet** | Represents a free bet bonus type | + + + ```typescript + enum BonusType { + FreeBet = 'FreeBet' + } + ``` + + + +### BonusStatus + + +| Value | Description | +|-------|-------------| +| **Used** | The bonus has been used | +| **Available** | The bonus is available for use | + + + ```typescript + enum BonusStatus { + Used = 'Used', + Available = 'Available' + } + ``` + + + +### FreebetBonusType + + +| Value | Description | +|-------|-------------| +| **OnlyWin** | The bettor receives only the winnings; the stake amount is returned to the pool. `isSponsoredBetReturnable = true` | +| **AllWin** | The bettor receives both the full stake and the winnings; the stake amount is not returned to the pool. `isSponsoredBetReturnable = false` | + + + ```typescript + enum FreebetBonusType { + OnlyWin = 'OnlyWin', + AllWin = 'AllWin' + } + ``` + + + +### BetRestrictionBetType + + +| Value | Description | +|-------|-------------| +| **All** | All bet types are allowed | +| **Ordinar** | Only ordinar bets are allowed | +| **Combo** | Only combo bets are allowed | + + + ```typescript + enum BetRestrictionBetType { + All = 'All', + Ordinar = 'Ordinar', + Combo = 'Combo' + } + ``` + + + +### EventRestrictionEventStatus + + +| Value | Description | +|-------|-------------| +| **All** | All event statuses are allowed | +| **Live** | Only live events are allowed | +| **Prematch** | Only prematch events are allowed | + + + ```typescript + enum EventRestrictionEventStatus { + All = 'All', + Live = 'Live', + Prematch = 'Prematch' + } + ``` + + + +## Common types + +### FreebetSettings + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **bonusType** | [FreebetBonusType](#freebetbonustype) | Type of the freebet bonus | Yes | +| **feeSponsored** | boolean | Indicates if fee is sponsored | Yes | +| **betRestriction** | [BetRestriction](#betrestriction) | Restrictions applied to bets | Yes | +| **eventRestriction** | [EventRestriction](#eventrestriction) | Restrictions applied to events | Yes | +| **periodOfValidityMs** | number | Period of validity in milliseconds | Yes | + + + ```typescript + interface FreebetSettings { + bonusType: FreebetBonusType; + feeSponsored: boolean; + betRestriction: BetRestriction; + eventRestriction: EventRestriction; + periodOfValidityMs: number; + } + ``` + + + +### BetRestriction + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **betType** | [BetRestrictionBetType](#betrestrictionbettype) | Type of bet restriction | Yes | +| **minOdds** | string | Minimum odds allowed | Yes | +| **maxOdds** | string | Maximum odds allowed | No | + + + ```typescript + interface BetRestriction { + betType: BetRestrictionBetType; + minOdds: string; + maxOdds?: string; + } + ``` + + + +### EventRestriction + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **eventStatus** | [EventRestrictionEventStatus](#eventrestrictioneventstatus) | Status of event restriction | Yes | +| **eventFilter** | [EventFilter](#eventfilter) | Filter for events | No | + + + ```typescript + interface EventRestriction { + eventStatus: EventRestrictionEventStatus; + eventFilter?: EventFilter; + } + ``` + + + +### EventFilter + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **exclude** | boolean | If `exclude = true`, it means `"allow all, except."`. If `exclude = false`, it means `"deny all, except."` | Yes | +| **filter** | [FilterItem](#filteritem)[] | List of filter items | Yes | + + + ```typescript + interface EventFilter { + exclude: boolean; + filter: FilterItem[]; + } + ``` + + + +### FilterItem + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **sportId** | string | ID of the sport | Yes | +| **leagues** | string[] | List of leagues | No | +| **markets** | [Market](#market)[] | List of markets | No | + + + ```typescript + interface FilterItem { + sportId: string; + leagues?: string[]; + markets?: Market[]; + } + ``` + + + +### Market + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **marketId** | number | ID of the market | Yes | +| **gamePeriodId** | number | ID of the game period | Yes | +| **gameTypeId** | number | ID of the game type | Yes | + + + ```typescript + interface Market { + marketId: number; + gamePeriodId: number; + gameTypeId: number; + } + ``` + + + +## Public types + +### GetClientBonusesResponse + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **bonuses** | [ClientBonus](#clientbonus)[] | Array of bonus objects | Yes | + + + ```typescript + interface GetClientBonusesResponse { + bonuses: ClientBonus[]; + } + ``` + + + +### ClientBonus + + +| Field | Type | Description | Required | +|-------|------|-------------|----------| +| **id** | string | Unique identifier of the bonus | Yes | +| **bonusType** | [BonusType](#bonustype) | Type of the bonus | Yes | +| **freebetParam** | [FreebetParam](#freebetparam) | Parameters specific to freebet | Yes | +| **publicCustomData** | object | This field is custom and arbitrary, meaning it is defined by the offer creators. It is used for any additional technical information that may be needed for integration with your systems. It prohibits dangerous constructs such as `