add getFile implementation
-use crate::core::requests::RequestContext;
-//TODO:: need implementation
+use crate::core::requests::{RequestContext, RequestFuture, ResponseResult, Request};
+use crate::core::types::File;
+use crate::core::network;
+/// Use this method to get basic info about a file and prepare it for downloading.
+/// For the moment, bots can download files of up to 20MB in size.
+/// On success, a File object is returned.
+/// The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>,
+/// where <file_path> is taken from the response.
+/// It is guaranteed that the link will be valid for at least 1 hour.
+/// When the link expires, a new one can be requested by calling getFile again.
#[derive(Debug, Clone, Serialize)]
struct GetFile<'a> {
#[serde(skip_serializing)]
ctx: RequestContext<'a>,
+ /// File identifier to get info about
+ file_id: String
+}
+
+
+impl<'a> Request<'a> for GetFile<'a> {
+ type ReturnValue = File;
+
+ fn send(self) -> RequestFuture<'a, ResponseResult<Self::ReturnValue>> {
+ Box::pin(async move {
+ network::request_json(
+ &self.ctx.client,
+ &self.ctx.token,
+ "getFile",
+ &self,
+ )
+ .await
+ })
+ }
+}
+
+
+impl<'a> GetFile<'a>{
+ pub fn file_id<T>(mut self, file_id: T) -> Self
+ where
+ T: Into<String>,
+ {
+ self.file_id = message_id.into();
+ self
+ }
}
