Skip to content

Commit

Permalink
OF-253 Add project settings methods support
Browse files Browse the repository at this point in the history
  • Loading branch information
tsviatkov committed Nov 1, 2023
1 parent 93a464c commit 071383f
Show file tree
Hide file tree
Showing 32 changed files with 909 additions and 243 deletions.
3 changes: 3 additions & 0 deletions example/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ async function example() {

const playerDeleteResponse = await openfort.players.delete(newPlayer.id);
console.info(playerDeleteResponse);

await openfort.settings.updateWebhook("http://openfor.xyz");
await openfort.settings.removeWebhook("http://openfor.xyz");
}

dotenv.config();
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfort/openfort-node",
"version": "0.6.20-rc",
"version": "0.6.21",
"description": "OpenAPI client for Openfort API",
"author": "Openfort",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions src/apis/playersApiWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
CreatePlayerSessionRequest,
GetPlayerRequest,
PlayerResponse,
PlayerCreateRequest,
CreatePlayerRequest,
PlayerListResponse,
RevokePlayerSessionRequest,
SessionResponse,
Expand All @@ -30,7 +30,7 @@ export class PlayersApiWrapper extends BaseApiWrapper<PlayersApi> {
* Creates a player object.
* @param req Parameters to create a player
*/
public async create(req: PlayerCreateRequest): Promise<PlayerResponse> {
public async create(req: CreatePlayerRequest): Promise<PlayerResponse> {
return await this.api.createPlayer(req);
}

Expand Down
54 changes: 54 additions & 0 deletions src/apis/settingsApiWrapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import {
PaymasterDepositorCreateRequest,
PaymasterDepositorResponse,
PaymasterDepositorListResponse,
PaymasterDepositorDeleteResponse,
} from "../models";
import { BaseApiWrapper } from "./baseApiWrapper";
import { SettingsApi } from "../generated";
import { httpErrorHandler } from "../utilities/httpErrorHandler";

@httpErrorHandler
export class SettingsApiWrapper extends BaseApiWrapper<SettingsApi> {
constructor(accessToken: string, basePath?: string) {
super(SettingsApi, accessToken, basePath);
}

/**
* Adds a depositor address to a project environment.
* @param req Parameters to add a depositor address to s project environment
*/
public async addDepositorAddress(req: PaymasterDepositorCreateRequest): Promise<PaymasterDepositorResponse> {
return await this.api.addDepositorAddress(req);
}

/**
* Lists the depositor addresses of a project.
*/
public async getDepositorAddresses(): Promise<PaymasterDepositorListResponse> {
return await this.api.getDepositorAddresses();
}

/**
* Removes a depositor address from a project.
* @param id Id of the depositor address to remove
*/
public async removeDepositorAddress(id: string): Promise<PaymasterDepositorDeleteResponse> {
return await this.api.removeDepositorAddress(id);
}

/**
* Creates or updates webhook address in a project environment configuration.
* @param url Url of the webhook
*/
public async updateWebhook(url: string): Promise<void> {
return await this.api.updateWebhook({url});
}

/**
* Removes the webhook configuration from the project environment.
*/
public async removeWebhook(): Promise<void> {
return await this.api.removeWebhook();
}
}
28 changes: 14 additions & 14 deletions src/generated/apis/PlayersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import { AccountListResponse } from '../models/AccountListResponse';
import { AccountResponse } from '../models/AccountResponse';
import { AccountResponseExpandable } from '../models/AccountResponseExpandable';
import { CreatePlayerAccountRequest } from '../models/CreatePlayerAccountRequest';
import { CreatePlayerRequest } from '../models/CreatePlayerRequest';
import { CreatePlayerSessionRequest } from '../models/CreatePlayerSessionRequest';
import { PlayerCancelTransferOwnershipRequest } from '../models/PlayerCancelTransferOwnershipRequest';
import { PlayerCreateRequest } from '../models/PlayerCreateRequest';
import { PlayerDeleteResponse } from '../models/PlayerDeleteResponse';
import { PlayerListResponse } from '../models/PlayerListResponse';
import { PlayerRequest } from '../models/PlayerRequest';
import { PlayerResponse } from '../models/PlayerResponse';
import { PlayerResponseExpandable } from '../models/PlayerResponseExpandable';
import { PlayerTransferOwnershipRequest } from '../models/PlayerTransferOwnershipRequest';
import { PlayerUpdateRequest } from '../models/PlayerUpdateRequest';
import { RevokeSessionPlayerRequest } from '../models/RevokeSessionPlayerRequest';
import { SessionResponse } from '../models/SessionResponse';
import { SortOrder } from '../models/SortOrder';
Expand Down Expand Up @@ -92,14 +92,14 @@ export class PlayersApiRequestFactory extends BaseAPIRequestFactory {
/**
* Add a new player to your player list in Openfort.
* Create a player object.
* @param playerCreateRequest
* @param createPlayerRequest
*/
public async createPlayer(playerCreateRequest: PlayerCreateRequest, _options?: Configuration): Promise<RequestContext> {
public async createPlayer(createPlayerRequest: CreatePlayerRequest, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'playerCreateRequest' is not null or undefined
if (playerCreateRequest === null || playerCreateRequest === undefined) {
throw new RequiredError("PlayersApi", "createPlayer", "playerCreateRequest");
// verify required parameter 'createPlayerRequest' is not null or undefined
if (createPlayerRequest === null || createPlayerRequest === undefined) {
throw new RequiredError("PlayersApi", "createPlayer", "createPlayerRequest");
}


Expand All @@ -117,7 +117,7 @@ export class PlayersApiRequestFactory extends BaseAPIRequestFactory {
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(playerCreateRequest, "PlayerCreateRequest", ""),
ObjectSerializer.serialize(createPlayerRequest, "CreatePlayerRequest", ""),
contentType
);
requestContext.setBody(serializedBody);
Expand Down Expand Up @@ -663,9 +663,9 @@ export class PlayersApiRequestFactory extends BaseAPIRequestFactory {
/**
* Updates a player object.
* @param id Specifies the unique player ID (starts with pla_).
* @param playerUpdateRequest
* @param playerRequest
*/
public async updatePlayer(id: string, playerUpdateRequest: PlayerUpdateRequest, _options?: Configuration): Promise<RequestContext> {
public async updatePlayer(id: string, playerRequest: PlayerRequest, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'id' is not null or undefined
Expand All @@ -674,9 +674,9 @@ export class PlayersApiRequestFactory extends BaseAPIRequestFactory {
}


// verify required parameter 'playerUpdateRequest' is not null or undefined
if (playerUpdateRequest === null || playerUpdateRequest === undefined) {
throw new RequiredError("PlayersApi", "updatePlayer", "playerUpdateRequest");
// verify required parameter 'playerRequest' is not null or undefined
if (playerRequest === null || playerRequest === undefined) {
throw new RequiredError("PlayersApi", "updatePlayer", "playerRequest");
}


Expand All @@ -695,7 +695,7 @@ export class PlayersApiRequestFactory extends BaseAPIRequestFactory {
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(playerUpdateRequest, "PlayerUpdateRequest", ""),
ObjectSerializer.serialize(playerRequest, "PlayerRequest", ""),
contentType
);
requestContext.setBody(serializedBody);
Expand Down
Loading

0 comments on commit 071383f

Please sign in to comment.