pub struct AmazonSource { /* private fields */ }Implementations§
Source§impl AmazonSource
impl AmazonSource
pub fn new(app_handle: AppHandle) -> Self
pub fn is_authenticated(&self) -> Result<bool, AppError>
Sourcepub async fn login(&self) -> Result<(), AppError>
pub async fn login(&self) -> Result<(), AppError>
Fluxo de login: gera identidade de dispositivo local (PKCE + serial arbitrário),
abre a tela de login da Amazon, intercepta o redirect final e troca o código
obtido por tokens via register_device.
Observação: o esquema OpenID 2.0 usado aqui não tem parâmetro state —
diferente de GOG/Epic, não há validação de CSRF nesse retorno porque a própria
Amazon não devolve nada equivalente nesse fluxo.
Sourcepub async fn ensure_valid_token(&self) -> Result<String, AppError>
pub async fn ensure_valid_token(&self) -> Result<String, AppError>
Retorna um access_token válido, renovando via refresh_token se expirado.
Fluxo de refresh custom (não usa o refresh_access_token genérico) porque
o corpo esperado pela Amazon não segue o formato OAuth2 padrão.
Sourcepub async fn logout(&self) -> Result<(), AppError>
pub async fn logout(&self) -> Result<(), AppError>
Desconecta a conta: tenta desregistrar o dispositivo no servidor da Amazon, mas remove o token local mesmo se a chamada falhar (token já expirado, rede fora do ar).
Sourcepub async fn fetch_library_detailed(&self) -> Result<Vec<SourceGame>, AppError>
pub async fn fetch_library_detailed(&self) -> Result<Vec<SourceGame>, AppError>
Importa a biblioteca completa de entitlements possuídos na conta Amazon.
Trait Implementations§
Source§impl GameSource for AmazonSource
impl GameSource for AmazonSource
fn fetch_games<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<SourceGame>, AppError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for AmazonSource
impl !RefUnwindSafe for AmazonSource
impl Send for AmazonSource
impl Sync for AmazonSource
impl Unpin for AmazonSource
impl UnsafeUnpin for AmazonSource
impl !UnwindSafe for AmazonSource
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
§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>
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>
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 more