harn-vm 0.7.25

Async bytecode virtual machine for the Harn programming language
Documentation
import { filter_nil } from "std/collections"
import { merge } from "std/json"

var slack_connector_config = {}

pub fn configure(config) {
  slack_connector_config = filter_nil(config ?? {})
  return slack_connector_config
}

pub fn reset() {
  slack_connector_config = {}
}

fn __call(method, params = {}) {
  return connector_call("slack", method, filter_nil(merge(slack_connector_config, params ?? {})))
}

pub fn post_message(channel, text, blocks = nil, options = nil) {
  return __call(
    "post_message",
    filter_nil((options ?? {}) + {channel: channel, text: text, blocks: blocks}),
  )
}

pub fn update_message(channel, ts, text, blocks = nil, options = nil) {
  return __call(
    "update_message",
    filter_nil((options ?? {}) + {channel: channel, ts: ts, text: text, blocks: blocks}),
  )
}

pub fn add_reaction(channel, ts, name, options = nil) {
  return __call("add_reaction", (options ?? {}) + {channel: channel, ts: ts, name: name})
}

pub fn open_view(trigger_id, view, options = nil) {
  return __call("open_view", (options ?? {}) + {trigger_id: trigger_id, view: view})
}

pub fn user_info(user_id, options = nil) {
  return __call("user_info", (options ?? {}) + {user_id: user_id})
}

pub fn api_call(method, args = nil, options = nil) {
  return __call("api_call", filter_nil((options ?? {}) + {method: method, args: args ?? {}}))
}

pub fn upload_file(filename, content, options = nil) {
  return __call("upload_file", (options ?? {}) + {filename: filename, content: content})
}