Skip to content

Commit

Permalink
version 0.10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Apr 15, 2024
1 parent a201a8b commit 59c3e41
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const def = DefineFunction({
output_parameters: { properties: {}, required: [] },
});

import { SlackAPIClient } from "https://deno.land/x/[email protected].2/mod.ts";
import { SlackAPIClient } from "https://deno.land/x/[email protected].4/mod.ts";

export default SlackFunction(def, async ({ token }) => {
const client = new SlackAPIClient(token, {
Expand Down
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": "slack-web-api-client",
"version": "0.10.3",
"version": "0.10.4",
"description": "Streamlined Slack Web API client for TypeScript",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions scripts/generate-deno-source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ src_dir=${script_dir}/../src
src_deno_dir=${script_dir}/../src_deno

cp -p ${src_deno_dir}/deno.json . && \
cp -p ${src_deno_dir}/README.md deno_README.md && \
rm -rf ${src_deno_dir}/* && \
cp -pr ${src_dir}/* ${src_deno_dir}/ && \
mv ./deno.json ${src_deno_dir}/ && \
mv ./deno_README.md ${src_deno_dir}/README.md && \
cd ${script_dir} && \
ruby ./deno_source_formatter.rb && \
cd - && \
Expand Down
72 changes: 72 additions & 0 deletions src_deno/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
## Slack Web API Client for TypeScript

The **slack-web-api-client** library is a type-safe Slack Web API client that
provides several key benefits, including:

- **A fetch-based implementation**, which is compatible with most runtimes
- **Strong types for Web API responses and Block Kit**, which make coding
enjoyable and predictable
- **Zero additional dependencies**, allowing developers to integrate this
library into their projects without any obstacles

### Getting Started

The **slack-web-api-client** library also offers a native package for the
[Deno runtime](https://deno.com/). To import the module for
[Slack's automation platform](https://api.slack.com/automation), use the
following syntax:

```typescript
import { SlackFunction } from "deno-slack-sdk/mod.ts.ts";

export const def = DefineFunction({
callback_id: "hello",
title: "Hello World",
source_file: "functions/hello.ts",
input_parameters: { properties: {}, required: [] },
output_parameters: { properties: {}, required: [] },
});

import { SlackAPIClient } from "https://deno.land/x/[email protected]/mod.ts.ts";

export default SlackFunction(def, async ({ token }) => {
const client = new SlackAPIClient(token, {
throwSlackAPIError: false, // for the compatibility with deno-slack-api library
});
const response = await client.chat.postMessage({
channel: "#random",
text: ":wave: what's up?",
});

// ....
});
```

This allows you to use the powerful features of the **slack-web-api-client**
library in your Deno projects with ease.

<img width="600" src="https://user-images.githubusercontent.com/19658/252261924-75522081-0ceb-47c3-9d0a-2cc99772ff7f.png">

An alternative way is to use skypack CDN. If you prefer this way, you need to
add `"cdn.skypack.dev"` to `outgoingDomains` in `manifest.ts`.

An alternative way to use the **slack-web-api-client** library is through the
skypack CDN. To do this, simply add `"cdn.skypack.dev"` to the `outgoingDomains`
section in your `manifest.ts` file. This allows you to use the library within
your project:

```typescript
import { SlackAPIClient } from "https://cdn.skypack.dev/slack-web-api-client?dts.ts";
```

Lastly, Slack's automation platform doesn't support jsr.io yet, though this
library can be accessed there as well:
https://jsr.io/@seratch/slack-web-api-client

```typescript
// deno add @seratch/slack-web-api-client
import { SlackAPIClient } from "@seratch/slack-web-api-client.ts";
```

When you need this library for Deno apps outside of the automation platform,
relying on jsr.io could be a simpler approach for resolving dependencies.
2 changes: 1 addition & 1 deletion src_deno/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@seratch/slack-web-api-client",
"version": "0.10.3",
"version": "0.10.4",
"exports": "./mod.ts",
"lint": {
"rules": {
Expand Down

0 comments on commit 59c3e41

Please sign in to comment.