File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments