Skip to content

Commit 961d084

Browse files
committed
extract tiptap url generation
1 parent e7a45c6 commit 961d084

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

domain/src/gateway/tiptap.rs

+9-8
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ impl TiptapDocument {
5454
}
5555

5656
pub async fn create(&self, document_name: &str) -> Result<(), Error> {
57-
let url = format!(
58-
"{}/api/documents/{}?format=json",
59-
self.base_url, document_name
60-
);
57+
let url = self.format_url(document_name);
6158
let response = self
6259
.client
6360
.post(url)
@@ -85,10 +82,7 @@ impl TiptapDocument {
8582
}
8683

8784
pub async fn delete(&self, document_name: &str) -> Result<(), Error> {
88-
let url = format!(
89-
"{}/api/documents/{}?format=json",
90-
self.base_url, document_name
91-
);
85+
let url = self.format_url(document_name);
9286
let response = self.client.delete(url).send().await.map_err(|e| {
9387
warn!("Failed to send request: {:?}", e);
9488
Error {
@@ -111,4 +105,11 @@ impl TiptapDocument {
111105
})
112106
}
113107
}
108+
109+
fn format_url(&self, document_name: &str) -> String {
110+
format!(
111+
"{}/api/documents/{}?format=json",
112+
self.base_url, document_name
113+
)
114+
}
114115
}

0 commit comments

Comments
 (0)