Skip to content

feat: expose getAvatar with custom API configuration#8

Open
chrisvdev wants to merge 1 commit into
ManzDev:mainfrom
chrisvdev:feat/expose_getAvatar
Open

feat: expose getAvatar with custom API configuration#8
chrisvdev wants to merge 1 commit into
ManzDev:mainfrom
chrisvdev:feat/expose_getAvatar

Conversation

@chrisvdev

Copy link
Copy Markdown
Contributor

📦 Descripción

Esta PR expone la funcionalidad de getAvatar para uso público, permitiendo a los desarrolladores obtener avatares de usuarios de Twitch y configurar proveedores de avatares personalizados.

✨ Cambios

  • ✅ Exporta función getAvatar para obtener avatares de usuarios
  • ✅ Exporta función setCustomApiFromJson para configurar APIs personalizadas
  • ✅ Exporta tipos CustomJsonApi y CustomJsonApiConfig
  • ✅ Incluye caché en memoria y localStorage (TTL 24h)
  • ✅ Soporte para múltiples proveedores (ivr, decapi, unavatar)

🔧 Uso

import { getAvatar } from 'mtmi';

// Uso básico con API por defecto (ivr)
const avatar = await getAvatar('auronplay');

// Usar proveedor específico
const avatar2 = await getAvatar('ibai', 'decapi');

🎨 Configuración personalizada

import { getAvatar, setCustomApiFromJson } from 'mtmi';

// Configurar API personalizada
setCustomApiFromJson({
  url: 'https://api.example.com/users/{{username}}',
  extract: 'data.avatar_url',
  transform: ['300x300', '70x70']
});

// Usar API personalizada
const customAvatar = await getAvatar('usuario', 'custom');

📋 Checklist

  • Exportaciones agregadas a index.ts
  • Tipos correctamente exportados
  • Código compila sin errores
  • Funcionalidad existente no afectada

- Export getAvatar function for public use
- Export setCustomApiFromJson for custom API configuration
- Export CustomJsonApi and CustomJsonApiConfig types
- Enable developers to configure custom avatar providers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant