File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -54,10 +54,7 @@ impl TiptapDocument {
54
54
}
55
55
56
56
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) ;
61
58
let response = self
62
59
. client
63
60
. post ( url)
@@ -85,10 +82,7 @@ impl TiptapDocument {
85
82
}
86
83
87
84
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) ;
92
86
let response = self . client . delete ( url) . send ( ) . await . map_err ( |e| {
93
87
warn ! ( "Failed to send request: {:?}" , e) ;
94
88
Error {
@@ -111,4 +105,11 @@ impl TiptapDocument {
111
105
} )
112
106
}
113
107
}
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
+ }
114
115
}
You can’t perform that action at this time.
0 commit comments