Skip to content

Commit

Permalink
add create connection method
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaneshbs committed Jan 6, 2025
1 parent f4161ea commit 990f629
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { PromiseClient } from '@connectrpc/connect';
import GrpcConnect from './connect';
import CoreClient from './core';
import { ConnectionService } from './pkg/grpc/scalekit/v1/connections/connections_connect';
import { GetConnectionResponse, ToggleConnectionResponse, ListConnectionsResponse } from './pkg/grpc/scalekit/v1/connections/connections_pb';
import { CreateConnection, CreateConnectionResponse, GetConnectionResponse, ToggleConnectionResponse, ListConnectionsResponse } from './pkg/grpc/scalekit/v1/connections/connections_pb';


export default class ConnectionClient {
private client: PromiseClient<typeof ConnectionService>;
Expand All @@ -13,6 +14,22 @@ export default class ConnectionClient {
this.client = this.grpcConncet.createClient(ConnectionService);
}

/**
* Create a new connection
* @param organizationId The organization id
* @param connection The data for the new connection
* @returns {Promise<CreateConnectionResponse>} The created connection
*/
async createConnection(organizationId: string, connection: CreateConnection): Promise<CreateConnectionResponse> {
return this.coreClient.connectExec(
this.client.createConnection,
{
organizationId,
connection
},
);
}

/**
* Get a connection by id and organization id
* @param organizationId The organization id
Expand Down

0 comments on commit 990f629

Please sign in to comment.