Skip to content

Commit 71062ae

Browse files
authored
Merge pull request #17 from nanato12/feature/update
Update v0.1.0
2 parents c683c6a + 5f3307c commit 71062ae

File tree

3 files changed

+78
-4
lines changed

3 files changed

+78
-4
lines changed

Cargo.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,20 @@ name = "line-bot-sdk-rust"
33
version = "0.1.0"
44
authors = ["nanato12 <admin@nanato12.info>"]
55
edition = "2018"
6+
description = "LINE Messaging API SDK for Rust"
7+
readme = "README.md"
8+
repository = "https://github.com/nanato12/line-bot-sdk-rust/"
9+
license = "Apache-2.0"
10+
license-file = "LICENSE"
11+
keywords = ["line", "linebot", "line-bot-sdk", "line-messaging-api"]
12+
categories = ["api-bindings"]
613

7-
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
14+
[features]
15+
default = []
16+
rocket_support = ["rocket"]
817

918
[dependencies]
10-
rocket = "0.4"
19+
rocket = { version = "0.4", optional = true }
1120
reqwest = { version = "0.11.0", features = ["blocking", "json"] }
1221
serde = { version = "1.0", features = ["derive"] }
1322
serde_json = "1.0"

README.md

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,66 @@
1-
# line-bot-sdk-rust
2-
rust製 linebot sdk
1+
# LINE Messaging API SDK for Rust
2+
## Introduction
3+
The LINE Messaging API SDK for Rust makes it easy to develop bots using LINE Messaging API, and you can create a sample bot within minutes.
4+
## Documentation
5+
See the official API documentation for more information.
6+
- English: <https://developers.line.biz/en/docs/messaging-api/overview/>
7+
- Japanese: <https://developers.line.biz/ja/docs/messaging-api/overview/>
8+
## Requirements
9+
This library requires Rust nightly.
10+
## Installation
11+
```
12+
[dependencies]
13+
line-bot-sdk-rust = "0.1"
14+
```
15+
If you use `rocket support`.
16+
```
17+
[dependencies]
18+
line-bot-sdk-rust = { version = "0.1", features = ["rocket_support"] }
19+
```
20+
## Configuration
21+
```
22+
extern crate line_bot_sdk_rust as line;
23+
use line::bot::LineBot;
24+
25+
fn main() {
26+
let bot = LineBot::new("<channel secret>", "<channel access token>");
27+
}
28+
```
29+
## How to use
30+
The LINE Messaging API uses the JSON data format.
31+
parse_event_request() will help you to parse the HttpRequest content and return a Result<[Events](`events::Events`) , &'static str> Object.
32+
```
33+
let result: Result<Events, &'static str> =
34+
bot.parse_event_request(signature, body);
35+
```
36+
37+
```
38+
match result {
39+
Ok(events) => {
40+
for event in events.events {
41+
...
42+
}
43+
}
44+
Err(msg) => {}
45+
}
46+
```
47+
48+
## Contributing
49+
Please make a contribution 😆
50+
51+
## License
52+
```
53+
Copyright 2021 nanato12
54+
55+
Licensed under the Apache License, Version 2.0 (the "License");
56+
you may not use this file except in compliance with the License.
57+
You may obtain a copy of the License at
58+
59+
http://www.apache.org/licenses/LICENSE-2.0
60+
61+
Unless required by applicable law or agreed to in writing, software
62+
distributed under the License is distributed on an "AS IS" BASIS,
63+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64+
See the License for the specific language governing permissions and
65+
limitations under the License.
66+
```

src/support/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
//! Support for framework
22
3+
#[cfg(feature = "rocket_support")]
34
pub mod rocket_support;

0 commit comments

Comments
 (0)