-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
강보원
authored and
강보원
committed
Jan 16, 2025
1 parent
c4733e4
commit 02e992b
Showing
4 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use reqwest::Client; | ||
use serde::Serialize; | ||
|
||
#[derive(Serialize)] | ||
struct KorcenRequest { | ||
input: String, | ||
#[serde(rename = "replace-front")] | ||
replace_front: String, | ||
#[serde(rename = "replace-end")] | ||
replace_end: String, | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), Box<dyn std::error::Error>> { | ||
let url = "https://korcen.shibadogs.net/api/v1/korcen"; | ||
|
||
let data = KorcenRequest { | ||
input: "욕설이 포함될수 있는 메시지".to_string(), | ||
replace_front: "감지된 욕설 앞부분에 넣을 메시지 (옵션)".to_string(), | ||
replace_end: "감지된 욕설 뒷부분에 넣을 메시지 (옵션)".to_string(), | ||
}; | ||
|
||
let client = Client::new(); | ||
|
||
let response = client | ||
.post(url) | ||
.header("accept", "application/json") | ||
.header("Content-Type", "application/json") | ||
.json(&data) | ||
.send() | ||
.await?; | ||
|
||
println!("{}", response.status()); | ||
|
||
let text = response.text().await?; | ||
println!("{}", text); | ||
|
||
Ok(()) | ||
} |