Skip to content

SDK-Documentation Update #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
!.yarn/sdks
node_modules
.next
.env
17 changes: 15 additions & 2 deletions pages/sdks/sdk/methods/authenticateAsync.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
title: Authentication
description: Datalink Authentication
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# authenticateAsync

Primary resource used in authenticating the SDK

<Code>
```lua
local DatalinkSDK = require(Path.To.DatalinkSDK)
local DatalinkInstance = DatalinkSDK.new({
datalinkUserAccountId = YOUR_ACCOUNT_ID,
datalinkUserToken = YOUR_ACCOUNT_TOKEN
})

DatalinkInstance:authenticateAsync():andThen(function()
print('Hello from Datalink!')
end)
```
```typescript

```
</Code>
49 changes: 49 additions & 0 deletions pages/sdks/sdk/methods/fireCustomEvent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: FireCustomEvent - Method
description: Invoke a custom datalink event over to the dashboard!
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# fireCustomEvent

This method is used to invoke a custom developer event, a custom event allows the developer to send whatever information they would like to send over to the Datalink Service.

## Parameters

#### eventName: String

The `eventName` parameter should be used to define the name of the custom event the developer would like to invoke.

#### eventParameters: Dictionary ( [string]: [datatype](https://www.tutorialspoint.com/lua/lua_data_types.htm) )

The `eventParameters` parameter should be defined as a dictionary which contains the parameters the developer would like to attach to the custom event.

## Example

<Code>
```lua
local DatalinkSDK = require(Path.To.DatalinkSDK)
local DatalinkInstance = DatalinkSDK.new({
datalinkUserAccountId = YOUR_ACCOUNT_ID,
datalinkUserToken = YOUR_ACCOUNT_TOKEN
})

DatalinkInstance:authenticateAsync():andThen(function()
DatalinkInstance:fireCustomEvent(
"MyEventName", {
["MyEventParameter"] = "PlayerExperience",
["MyEventValue"] = Player.Experience
}
)
end)
```
```typescript

```
</Code>

<Callout type="warning" emoji="">
The above is just an **EXAMPLE** of what you're enabled to do with Datalink - you're able to send a lot more than just player information into the dashboard!
</Callout>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: Guide to using Datalink's server-side Lua SDK
import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# invokeEventAsync
# fireEconomyEvent

<Code>
```lua
Expand Down
15 changes: 15 additions & 0 deletions pages/sdks/sdk/methods/fireProgressionEvent.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# fireProgressionEvent

<Code>
```lua

```
</Code>
15 changes: 15 additions & 0 deletions pages/sdks/sdk/methods/getAllFastFlagsAsync.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# getAllFastFlagsAsync

<Code>
```lua

```
</Code>
41 changes: 41 additions & 0 deletions pages/sdks/sdk/methods/getAllGameLogsAsync.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: GetAllGameLogsAsync - Method
description: Get all game logs relative to the current place.
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# getAllGameLogsAsync

This method is used to retrieve all game logs for this expereince under the Datalink Service

## Example

<Code>
```lua
local DatalinkSDK = require(Path.To.DatalinkSDK)
local DatalinkInstance = DatalinkSDK.new({
datalinkUserAccountId = YOUR_ACCOUNT_ID,
datalinkUserToken = YOUR_ACCOUNT_TOKEN
})

DatalinkInstance:authenticateAsync():andThen(function()
DatalinkInstance:getAllGameLogsAsync():andThen(function(gameLogs)
if not gameLogs[1] then
return
end

print(gameLogs[1]) --[[{
["id"] = 1,
["type"] = "Error",
["trace"] = "erroringFunction()",
["message"] = "Attempted to index nil"
}]]--
end)
end)
```
```typescript

```
</Code>
47 changes: 47 additions & 0 deletions pages/sdks/sdk/methods/getGameLogAsync.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: getGameLogAsync - Method
description: Get a game log relative to the current place.
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# getGameLogAsync

This method is used to retrieve a specific game log for this expereince under the Datalink Service.

## Parameters

#### logId: Number

The `logId` parameter should be used to get details on a specific log object.

## Example

<Code>
```lua
local DatalinkSDK = require(Path.To.DatalinkSDK)
local DatalinkInstance = DatalinkSDK.new({
datalinkUserAccountId = YOUR_ACCOUNT_ID,
datalinkUserToken = YOUR_ACCOUNT_TOKEN
})

DatalinkInstance:authenticateAsync():andThen(function()
DatalinkInstance:getGameLogAsync(422):andThen(function(gameLogObject)
print(gameLogObject) --[[{
["id"] = 422,
["type"] = "Error",
["trace"] = "erroringFunction()",
["message"] = "Attempted to index nil"
}]]--
end)
end)
```
```typescript

```
</Code>

<Callout type="none" emoji="">
An example of why you might want to use this functionality, this feature enables a developer to display logs & errors on a dashboard in-game.
</Callout>
15 changes: 15 additions & 0 deletions pages/sdks/sdk/methods/getLocalVariable.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# getLocalVariable

<Code>
```lua

```
</Code>
15 changes: 15 additions & 0 deletions pages/sdks/sdk/methods/getLocalVariables.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# getLocalVariables

<Code>
```lua

```
</Code>
49 changes: 49 additions & 0 deletions pages/sdks/sdk/methods/getPlayerHash.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: GetPlayerHash - Method
description: Get Datalink anonimized player hashes
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# getPlayerHash

This method should be used to get the hash assigned to a player, this hash is generated via a sha256 algorithm & provides a way to link specific data to a player anonymously

## Parameters

#### player: Player

The `player` parameter is pretty self explanitory, the player you want to get the hash of

## Example

<Code>
```lua
local DatalinkSDK = require(Path.To.DatalinkSDK)
local DatalinkInstance = DatalinkSDK.new({
datalinkUserAccountId = YOUR_ACCOUNT_ID,
datalinkUserToken = YOUR_ACCOUNT_TOKEN
})

DatalinkInstance:authenticateAsync():andThen(function()
DatalinkInstance:fireCustomEvent(
"playerDrivenEvent", {
["playerHash"] = DatalinkInstance:getPlayerHash(player),
["playerEvent"] = "PlayerPartyStarted",
["playerInvites"] = {
DatalinkInstance:getPlayerHash(playerThatWasInvited)
}
}
)
end)
```
```typescript

```
</Code>

<Callout type="none" emoji="">
It's important that you keep the data sent to datalink anonymous.
Datalink is an anonymous data-driven platform — please respect our mission.
</Callout>
22 changes: 19 additions & 3 deletions pages/sdks/sdk/methods/isAuthenticated.mdx
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
title: isAuthenticated - Method
description: Datalink authentication validation
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# IsAuthenticated
# isAuthenticated

Primary resource for acknowledging if the SDK is or is not authenticated

<Code>
```lua
local DatalinkSDK = require(Path.To.DatalinkSDK)
local DatalinkInstance = DatalinkSDK.new({
datalinkUserAccountId = YOUR_ACCOUNT_ID,
datalinkUserToken = YOUR_ACCOUNT_TOKEN
})

local isDatalinkAuthenticated = DatalinkInstance:isAuthenticated()

if not isDatalinkAuthenticated then
...
end
```
```typescript


```
</Code>
14 changes: 12 additions & 2 deletions pages/sdks/sdk/methods/meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
{
"isAuthenticated": ":isAuthenticated",
"authenticateAsync": ":authenticateAsync",
"getFastFlagAsync": ":getFastFlagAsync",
"fireCustomEvent": ":fireCustomEvent",
"fireEconomyEvent": ":fireEconomyEvent",
"fireProgressionEvent": ":fireProgressionEvent",
"getFastIntAsync": ":getFastIntAsync",
"invokeEventAsync": ":invokeEventAsync"
"getFastFlagAsync": ":getFastFlagAsync",
"getAllFastFlagsAsync": ":getAllFastFlagsAsync",
"getAllGameLogsAsync": ":getAllGameLogsAsync",
"getGameLogAsync": ":getGameLogAsync",
"setVerboseLogging": ":setVerboseLogging",
"setLocalVariable": ":setLocalVariable",
"getLocalVariable": ":getLocalVariable",
"getLocalVariables": ":getLocalVariables",
"getPlayerHash": ":getPlayerHash"
}
15 changes: 15 additions & 0 deletions pages/sdks/sdk/methods/setLocalVariable.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# setLocalVariable

<Code>
```lua

```
</Code>
15 changes: 15 additions & 0 deletions pages/sdks/sdk/methods/setVerboseLogging.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Authenticating using the Server Side SDK
description: Guide to using Datalink's server-side Lua SDK
---

import {Code} from '../../../../components/code';
import Callout from 'nextra-theme-docs/callout';

# setVerboseLogging

<Code>
```lua

```
</Code>
Loading