Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
강보원 authored and 강보원 committed Jan 16, 2025
1 parent c4733e4 commit 02e992b
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 4 deletions.
42 changes: 42 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,48 @@ fetch(url, {
console.error('Error:', error)
})
```
>Rust
```rs
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(())
}
```

# ⬇️ 설치 방법

Expand Down
4 changes: 2 additions & 2 deletions example/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const headers = {

const data = {
input: '욕설이 포함될수 있는 메시지',
'replace-front': '<',
'replace-end': '>'
'replace-front': '감지된 욕설 앞부분에 넣을 메시지 (옵션)',
'replace-end': '감지된 욕설 뒷부분에 넣을 메시지 (옵션)'
}

fetch(url, {
Expand Down
4 changes: 2 additions & 2 deletions example/example.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

data = {
'input' : '욕설이 포함될수 있는 메시지',
'replace-front': '<',
'replace-end' : '>'
'replace-front': '감지된 욕설 앞부분에 넣을 메시지 (옵션)',
'replace-end' : '감지된 욕설 뒷부분에 넣을 메시지 (옵션)'
}

response = requests.post(url, headers=headers, json=data)
Expand Down
39 changes: 39 additions & 0 deletions example/example.rs
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(())
}

0 comments on commit 02e992b

Please sign in to comment.