backend and clients

This commit is contained in:
Alexander Petric
2025-01-29 14:28:37 -05:00
parent 31f61ab7a2
commit 3f042a9d50
6 changed files with 50 additions and 0 deletions
@@ -0,0 +1,2 @@
ALTER TABLE workspace_settings DROP COLUMN teams_command_script;
ALTER TABLE workspace_settings DROP COLUMN teams_team_id;
@@ -0,0 +1,2 @@
ALTER TABLE workspace_settings ADD COLUMN teams_command_script TEXT DEFAULT NULL;
ALTER TABLE workspace_settings ADD COLUMN teams_team_id TEXT DEFAULT NULL;
+31
View File
@@ -3278,6 +3278,37 @@ paths:
items:
$ref: '#/components/schemas/TeamInfo'
/teams/activities:
post:
summary: send update to Microsoft Teams activity
description: Respond to a Microsoft Teams activity after a workspace command is run
operationId: updateActivity
tags:
- teams
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- activity_id
- text
properties:
activity_id:
type: string
description: The ID of the Teams conversation/activity
success:
type: boolean
description: Indicates if the activity was successful and used for styling the card conditionally
default: true
text:
type: string
description: The message text to be sent in the Teams card
responses:
'200':
description: Activity processed successfully
/w/{workspace}/resources/create:
post:
summary: create resource
+2
View File
@@ -166,8 +166,10 @@ struct Workspace {
pub struct WorkspaceSettings {
pub workspace_id: String,
pub slack_team_id: Option<String>,
pub teams_team_id: Option<String>,
pub slack_name: Option<String>,
pub slack_command_script: Option<String>,
pub teams_command_script: Option<String>,
pub slack_email: String,
pub auto_invite_domain: Option<String>,
pub auto_invite_operator: Option<bool>,
+11
View File
@@ -708,6 +708,13 @@ class Windmill:
Indeed, in the viewer context WM_USERNAME is set to the username of the viewer but WM_EMAIL is set to the email of the creator of the app.
"""
return self.get(f"/w/{self.workspace}/users/username_to_email/{username}").text
def update_teams_activity(self, activity_id: str, text: str, success: bool = True):
"""
Send an update to a Microsoft Teams activity after a workspace command is run
"""
return self.post(f"/teams/activities", json={"activity_id": activity_id, "text": text, "success": success})
def init_global_client(f):
@@ -1068,6 +1075,10 @@ def request_interactive_slack_approval(
dynamic_enums_json=dynamic_enums_json,
)
@init_global_client
def update_teams_activity(activity_id: str, text: str, success: bool):
return _client.update_teams_activity(activity_id, text, success)
@init_global_client
def cancel_running() -> dict:
"""Cancel currently running executions of the same script."""
+2
View File
@@ -6,6 +6,7 @@ import {
MetricsService,
OidcService,
UserService,
TeamsService
} from "./index";
import { OpenAPI } from "./index";
// import type { DenoS3LightClientSettings } from "./index";
@@ -25,6 +26,7 @@ export {
SettingsService,
UserService,
WorkspaceService,
TeamsService,
} from "./index";
export type Sql = string;