File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,32 @@ impl PostAPI for MisskeyApi {
116
116
}
117
117
118
118
async fn compose_with_picture ( & self , text : & str , media : & Vec < String > ) -> Result < ( ) , String > {
119
- todo ! ( )
119
+ let payload = NoteWithPicture {
120
+ i : & self . access_code ,
121
+ text : text. to_string ( ) ,
122
+ mediaIds : media. to_vec ( )
123
+ } ;
124
+
125
+ let res = reqwest:: Client :: new ( )
126
+ . post ( self . get_endpoint_url ( ENDPOINT :: notes:: create) )
127
+ . header ( "Content-Type" , "application/json" )
128
+ . json ( & payload)
129
+ . send ( ) . await ;
130
+
131
+ match res {
132
+ Ok ( r) => {
133
+ if r. status ( ) . as_u16 ( ) == 200 {
134
+ Ok ( ( ) )
135
+ }
136
+ else {
137
+ let e = r. json :: < CommonError > ( ) . await . unwrap ( ) ;
138
+ Err ( e. message . unwrap ( ) )
139
+ }
140
+ } ,
141
+ Err ( _) => {
142
+ Err ( "Unknown Error Occured" . to_string ( ) )
143
+ }
144
+ }
120
145
}
121
146
122
147
async fn upload_media ( & self , picture : Bytes ) -> Option < String > {
You can’t perform that action at this time.
0 commit comments