Skip to content

Commit

Permalink
feat: update ref
Browse files Browse the repository at this point in the history
  • Loading branch information
jamalavedra committed Jul 23, 2024
1 parent 0668ee5 commit 247a920
Show file tree
Hide file tree
Showing 19 changed files with 396 additions and 154 deletions.
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.62",
"version": "0.6.63",
"description": "OpenAPI client for Openfort API",
"author": "Openfort",
"repository": {
Expand Down
6 changes: 6 additions & 0 deletions src/apis/iamApiWrapper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import {
AdminAuthenticationApi,
AuthenticateOAuthRequest,
Authorize200Response,
AuthorizePlayerRequest,
AuthPlayerListQueries,
AuthPlayerListResponse,
AuthPlayerResponse,
Expand Down Expand Up @@ -155,4 +157,8 @@ export class IamApiWrapper extends BaseApiWrapper<AdminAuthenticationApi> {
public async listOAuthConfig(): Promise<OAuthConfigListResponse> {
return await this.api.listOAuthConfig();
}

public async authorize(req: AuthorizePlayerRequest): Promise<Authorize200Response> {
return await this.api.authorize(req);
}
}
8 changes: 4 additions & 4 deletions src/apis/sessionsApiWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ export class SessionsApiWrapper extends BaseApiWrapper<SessionsApi> {
* Creates the session for the account.
* @param req Parameters to create session
*/
public async create(req: CreateSessionRequest): Promise<SessionResponse> {
return await this.api.createSession(req);
public async create(req: CreateSessionRequest, behalfOf?: string): Promise<SessionResponse> {
return await this.api.createSession(req, behalfOf);
}

/**
Expand All @@ -46,8 +46,8 @@ export class SessionsApiWrapper extends BaseApiWrapper<SessionsApi> {
* Revokes the session for the account.
* @param req Parameters to revoke the session
*/
public async revoke(req: RevokeSessionRequest): Promise<SessionResponse> {
return await this.api.revokeSession(req);
public async revoke(req: RevokeSessionRequest, behalfOf?: string): Promise<SessionResponse> {
return await this.api.revokeSession(req, behalfOf);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/apis/transactionIntentsApiWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
EstimateTransactionIntentGasResult,
} from "../models";
import { BaseApiWrapper } from "./baseApiWrapper";
import { createConfiguration, ResponseContext, ServerConfiguration, TransactionIntentsApi } from "../generated";
import { TransactionIntentsApi } from "../generated";
import { httpErrorHandler } from "../utilities/httpErrorHandler";

@httpErrorHandler
Expand Down
80 changes: 80 additions & 0 deletions src/generated/apis/AdminAuthenticationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { AuthPlayerResponseWithRecoveryShare } from '../models/AuthPlayerRespons
import { AuthProvider } from '../models/AuthProvider';
import { AuthSessionResponse } from '../models/AuthSessionResponse';
import { AuthenticateOAuthRequest } from '../models/AuthenticateOAuthRequest';
import { Authorize200Response } from '../models/Authorize200Response';
import { AuthorizePlayerRequest } from '../models/AuthorizePlayerRequest';
import { CreateAuthPlayerRequest } from '../models/CreateAuthPlayerRequest';
import { OAuthConfig } from '../models/OAuthConfig';
import { OAuthConfigListResponse } from '../models/OAuthConfigListResponse';
Expand All @@ -29,6 +31,52 @@ import { SortOrder } from '../models/SortOrder';
*/
export class AdminAuthenticationApiRequestFactory extends BaseAPIRequestFactory {

/**
* @param authorizePlayerRequest
*/
public async authorize(authorizePlayerRequest: AuthorizePlayerRequest, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'authorizePlayerRequest' is not null or undefined
if (authorizePlayerRequest === null || authorizePlayerRequest === undefined) {
throw new RequiredError("AdminAuthenticationApi", "authorize", "authorizePlayerRequest");
}


// Path Params
const localVarPath = '/iam/v1/authorize';

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")


// Body Params
const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(authorizePlayerRequest, "AuthorizePlayerRequest", ""),
contentType
);
requestContext.setBody(serializedBody);

let authMethod: SecurityAuthentication | undefined;
// Apply auth methods
authMethod = _config.authMethods["sk"]
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}

const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}

return requestContext;
}

/**
* Creates an authenticated player. The player will be authenticated with the provider and an embedded account can be pre generated.
* Create an authenticated player.
Expand Down Expand Up @@ -484,6 +532,38 @@ export class AdminAuthenticationApiRequestFactory extends BaseAPIRequestFactory

export class AdminAuthenticationApiResponseProcessor {

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to authorize
* @throws ApiException if the response code was not in [200, 299]
*/
public async authorize(response: ResponseContext): Promise<Authorize200Response > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Authorize200Response = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Authorize200Response", ""
) as Authorize200Response;
return body;
}
if (isCodeInRange("401", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Error response.", undefined, response.headers);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: Authorize200Response = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Authorize200Response", ""
) as Authorize200Response;
return body;
}

throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down
80 changes: 0 additions & 80 deletions src/generated/apis/AuthenticationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { AuthPlayerResponse } from '../models/AuthPlayerResponse';
import { AuthProvider } from '../models/AuthProvider';
import { AuthResponse } from '../models/AuthResponse';
import { AuthenticateOAuthRequest } from '../models/AuthenticateOAuthRequest';
import { Authorize200Response } from '../models/Authorize200Response';
import { AuthorizePlayerRequest } from '../models/AuthorizePlayerRequest';
import { DeprecatedAuthenticatedPlayerResponse } from '../models/DeprecatedAuthenticatedPlayerResponse';
import { JwtKeyResponse } from '../models/JwtKeyResponse';
import { LoginRequest } from '../models/LoginRequest';
Expand Down Expand Up @@ -137,52 +135,6 @@ export class AuthenticationApiRequestFactory extends BaseAPIRequestFactory {
return requestContext;
}

/**
* @param authorizePlayerRequest
*/
public async authorize(authorizePlayerRequest: AuthorizePlayerRequest, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'authorizePlayerRequest' is not null or undefined
if (authorizePlayerRequest === null || authorizePlayerRequest === undefined) {
throw new RequiredError("AuthenticationApi", "authorize", "authorizePlayerRequest");
}


// Path Params
const localVarPath = '/iam/v1/authorize';

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")


// Body Params
const contentType = ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer.stringify(
ObjectSerializer.serialize(authorizePlayerRequest, "AuthorizePlayerRequest", ""),
contentType
);
requestContext.setBody(serializedBody);

let authMethod: SecurityAuthentication | undefined;
// Apply auth methods
authMethod = _config.authMethods["sk"]
if (authMethod?.applySecurityAuthentication) {
await authMethod?.applySecurityAuthentication(requestContext);
}

const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default
if (defaultAuth?.applySecurityAuthentication) {
await defaultAuth?.applySecurityAuthentication(requestContext);
}

return requestContext;
}

/**
* The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id.
* Authorize player with token.
Expand Down Expand Up @@ -1313,38 +1265,6 @@ export class AuthenticationApiResponseProcessor {
throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
*
* @params response Response returned by the server for a request to authorize
* @throws ApiException if the response code was not in [200, 299]
*/
public async authorize(response: ResponseContext): Promise<Authorize200Response > {
const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (isCodeInRange("200", response.httpStatusCode)) {
const body: Authorize200Response = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Authorize200Response", ""
) as Authorize200Response;
return body;
}
if (isCodeInRange("401", response.httpStatusCode)) {
throw new ApiException<undefined>(response.httpStatusCode, "Error response.", undefined, response.headers);
}

// Work around for missing responses in specification, e.g. for petstore.yaml
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body: Authorize200Response = ObjectSerializer.deserialize(
ObjectSerializer.parse(await response.body.text(), contentType),
"Authorize200Response", ""
) as Authorize200Response;
return body;
}

throw new ApiException<string | Buffer | undefined>(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers);
}

/**
* Unwraps the actual response sent by the server from the response context and deserializes the response content
* to the expected objects
Expand Down
14 changes: 12 additions & 2 deletions src/generated/apis/SessionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ export class SessionsApiRequestFactory extends BaseAPIRequestFactory {
* Creates a Session.
* Create a session key.
* @param createSessionRequest
* @param xBehalfOfProject
*/
public async createSession(createSessionRequest: CreateSessionRequest, _options?: Configuration): Promise<RequestContext> {
public async createSession(createSessionRequest: CreateSessionRequest, xBehalfOfProject?: string, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'createSessionRequest' is not null or undefined
Expand All @@ -37,13 +38,17 @@ export class SessionsApiRequestFactory extends BaseAPIRequestFactory {
}



// Path Params
const localVarPath = '/v1/sessions';

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")

// Header Params
requestContext.setHeaderParam("X-Behalf-Of-Project", ObjectSerializer.serialize(xBehalfOfProject, "string", ""));


// Body Params
const contentType = ObjectSerializer.getPreferredMediaType([
Expand Down Expand Up @@ -189,8 +194,9 @@ export class SessionsApiRequestFactory extends BaseAPIRequestFactory {
/**
* Revoke the session session key.
* @param revokeSessionRequest
* @param xBehalfOfProject
*/
public async revokeSession(revokeSessionRequest: RevokeSessionRequest, _options?: Configuration): Promise<RequestContext> {
public async revokeSession(revokeSessionRequest: RevokeSessionRequest, xBehalfOfProject?: string, _options?: Configuration): Promise<RequestContext> {
let _config = _options || this.configuration;

// verify required parameter 'revokeSessionRequest' is not null or undefined
Expand All @@ -199,13 +205,17 @@ export class SessionsApiRequestFactory extends BaseAPIRequestFactory {
}



// Path Params
const localVarPath = '/v1/sessions/revoke';

// Make Request Context
const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8")

// Header Params
requestContext.setHeaderParam("X-Behalf-Of-Project", ObjectSerializer.serialize(xBehalfOfProject, "string", ""));


// Body Params
const contentType = ObjectSerializer.getPreferredMediaType([
Expand Down
63 changes: 63 additions & 0 deletions src/generated/models/EmbeddedResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
* Openfort API
* Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
*
* OpenAPI spec version: 1.0.0
* Contact: founders@openfort.xyz
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

import { HttpFile } from '../http/http';

export class EmbeddedResponse {
'share': string;
'accountType': string;
'address': string;
'chainId': number;
'deviceId'?: string;

static readonly discriminator: string | undefined = undefined;

static readonly attributeTypeMap: Array<{name: string, baseName: string, type: string, format: string}> = [
{
"name": "share",
"baseName": "share",
"type": "string",
"format": ""
},
{
"name": "accountType",
"baseName": "accountType",
"type": "string",
"format": ""
},
{
"name": "address",
"baseName": "address",
"type": "string",
"format": ""
},
{
"name": "chainId",
"baseName": "chainId",
"type": "number",
"format": "double"
},
{
"name": "deviceId",
"baseName": "deviceId",
"type": "string",
"format": ""
} ];

static getAttributeTypeMap() {
return EmbeddedResponse.attributeTypeMap;
}

public constructor() {
}
}

Loading

0 comments on commit 247a920

Please sign in to comment.