pub struct OssService;Expand description
OSS 服务
Implementations§
Source§impl OssService
impl OssService
Sourcepub async fn get_upload_credential(
state: &AppState,
episode_id: i32,
post_name: String,
filename: String,
) -> ApiResult<OssCredential>
pub async fn get_upload_credential( state: &AppState, episode_id: i32, post_name: String, filename: String, ) -> ApiResult<OssCredential>
获取 COS 文件上传预签名凭证。
§返回值
返回 OssCredential,包含预签名上传 URL 和对象 Key。
§Errors
AppError::business("文件后缀不允许上传喵")— 后缀不在白名单AppError::business("文件超出XXMB限制喵")— 文件超过大小限制
Sourcepub async fn get_image_upload_credential(
state: &AppState,
image_type: String,
filename: String,
) -> ApiResult<OssCredential>
pub async fn get_image_upload_credential( state: &AppState, image_type: String, filename: String, ) -> ApiResult<OssCredential>
获取图片上传凭证
Sourcepub async fn get_download_credential(
state: &AppState,
episode_id: i32,
post_name: String,
) -> ApiResult<OssCredential>
pub async fn get_download_credential( state: &AppState, episode_id: i32, post_name: String, ) -> ApiResult<OssCredential>
获取文件下载预签名 URL。
§返回值
返回 OssCredential,presigned_url 为 CDN 鉴权链接。
§Errors
AppError::DownloadUnAuth— 无下载权限
Sourcepub async fn download_redirect_target(
state: &AppState,
episode_id: i32,
post_name: String,
) -> ApiResult<(String, String)>
pub async fn download_redirect_target( state: &AppState, episode_id: i32, post_name: String, ) -> ApiResult<(String, String)>
Auto Trait Implementations§
impl Freeze for OssService
impl RefUnwindSafe for OssService
impl Send for OssService
impl Sync for OssService
impl Unpin for OssService
impl UnsafeUnpin for OssService
impl UnwindSafe for OssService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request