|
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 | + ``` |
0 commit comments