Skip to content

Commit

Permalink
Implement Tldraw client module with API integration and configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
SevenWaysDP committed Dec 10, 2024
1 parent a9842f2 commit ceb4003
Show file tree
Hide file tree
Showing 22 changed files with 1,037 additions and 6 deletions.
4 changes: 4 additions & 0 deletions apps/server/src/infra/tldraw-client/generated/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist
1 change: 1 addition & 0 deletions apps/server/src/infra/tldraw-client/generated/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.gitignore
.npmignore
.openapi-generator-ignore
api.ts
api/tldraw-config-api.ts
api/tldraw-document-api.ts
base.ts
common.ts
configuration.ts
git_push.sh
index.ts
models/index.ts
models/tldraw-public-config-response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.6.0
19 changes: 19 additions & 0 deletions apps/server/src/infra/tldraw-client/generated/api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tldraw API
* The Tldraw API to persist and share drawings
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/



export * from './api/tldraw-config-api';
export * from './api/tldraw-document-api';

141 changes: 141 additions & 0 deletions apps/server/src/infra/tldraw-client/generated/api/tldraw-config-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tldraw API
* The Tldraw API to persist and share drawings
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { TldrawPublicConfigResponse } from '../models';
/**
* TldrawConfigApi - axios parameter creator
* @export
*/
export const TldrawConfigApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Useable configuration for clients
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
publicConfig: async (options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/tldraw/config/public`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};

/**
* TldrawConfigApi - functional programming interface
* @export
*/
export const TldrawConfigApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = TldrawConfigApiAxiosParamCreator(configuration)
return {
/**
*
* @summary Useable configuration for clients
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async publicConfig(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<TldrawPublicConfigResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.publicConfig(options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['TldrawConfigApi.publicConfig']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};

/**
* TldrawConfigApi - factory interface
* @export
*/
export const TldrawConfigApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = TldrawConfigApiFp(configuration)
return {
/**
*
* @summary Useable configuration for clients
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
publicConfig(options?: any): AxiosPromise<TldrawPublicConfigResponse> {
return localVarFp.publicConfig(options).then((request) => request(axios, basePath));
},
};
};

/**
* TldrawConfigApi - interface
* @export
* @interface TldrawConfigApi
*/
export interface TldrawConfigApiInterface {
/**
*
* @summary Useable configuration for clients
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TldrawConfigApiInterface
*/
publicConfig(options?: RawAxiosRequestConfig): AxiosPromise<TldrawPublicConfigResponse>;

}

/**
* TldrawConfigApi - object-oriented interface
* @export
* @class TldrawConfigApi
* @extends {BaseAPI}
*/
export class TldrawConfigApi extends BaseAPI implements TldrawConfigApiInterface {
/**
*
* @summary Useable configuration for clients
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TldrawConfigApi
*/
public publicConfig(options?: RawAxiosRequestConfig) {
return TldrawConfigApiFp(this.configuration).publicConfig(options).then((request) => request(this.axios, this.basePath));
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tldraw API
* The Tldraw API to persist and share drawings
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
/**
* TldrawDocumentApi - axios parameter creator
* @export
*/
export const TldrawDocumentApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @param {string} parentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteByDocName: async (parentId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'parentId' is not null or undefined
assertParamExists('deleteByDocName', 'parentId', parentId)
const localVarPath = `/api/tldraw-document/{parentId}`
.replace(`{${"parentId"}}`, encodeURIComponent(String(parentId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}

const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;



setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};

/**
* TldrawDocumentApi - functional programming interface
* @export
*/
export const TldrawDocumentApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = TldrawDocumentApiAxiosParamCreator(configuration)
return {
/**
*
* @param {string} parentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async deleteByDocName(parentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.deleteByDocName(parentId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['TldrawDocumentApi.deleteByDocName']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};

/**
* TldrawDocumentApi - factory interface
* @export
*/
export const TldrawDocumentApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = TldrawDocumentApiFp(configuration)
return {
/**
*
* @param {string} parentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteByDocName(parentId: string, options?: any): AxiosPromise<void> {
return localVarFp.deleteByDocName(parentId, options).then((request) => request(axios, basePath));
},
};
};

/**
* TldrawDocumentApi - interface
* @export
* @interface TldrawDocumentApi
*/
export interface TldrawDocumentApiInterface {
/**
*
* @param {string} parentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TldrawDocumentApiInterface
*/
deleteByDocName(parentId: string, options?: RawAxiosRequestConfig): AxiosPromise<void>;

}

/**
* TldrawDocumentApi - object-oriented interface
* @export
* @class TldrawDocumentApi
* @extends {BaseAPI}
*/
export class TldrawDocumentApi extends BaseAPI implements TldrawDocumentApiInterface {
/**
*
* @param {string} parentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof TldrawDocumentApi
*/
public deleteByDocName(parentId: string, options?: RawAxiosRequestConfig) {
return TldrawDocumentApiFp(this.configuration).deleteByDocName(parentId, options).then((request) => request(this.axios, this.basePath));
}
}

Loading

0 comments on commit ceb4003

Please sign in to comment.