Skip to content
This repository was archived by the owner on Jul 31, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/GameClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export interface IGameClientOptions {
* from the Interactive Studio on Mixer.com in the Code step.
*/
versionId: number;

/**
* Optional project sharecode to your Interactive Project Version. You can retrieve one
* from the Interactive Studio on Mixer.com in the Code step.
*/
sharecode?: string;

/**
* An OAuth Bearer token as defined in {@link https://art.tools.ietf.org/html/rfc6750| OAuth 2.0 Bearer Token Usage}.
*/
Expand All @@ -39,15 +46,20 @@ export class GameClient extends Client {
* Opens a connection to the interactive service using the provided options.
*/
public open(options: IGameClientOptions): Promise<this> {
const extraHeaders = {
'X-Interactive-Version': options.versionId,
};
if (options.sharecode) {
extraHeaders['X-Interactive-Sharecode'] = options.sharecode;
}

return this.discovery
.retrieveEndpoints(options.discoveryUrl)
.then(endpoints => {
return super.open({
authToken: options.authToken,
url: endpoints[0].address,
extraHeaders: {
'X-Interactive-Version': options.versionId,
},
extraHeaders: extraHeaders,
});
});
}
Expand Down