import { ActiveProviderResponse, AuthenticationProvider, MappingFields } from '../models/authentication-provider'; import { AxiosResponse } from 'axios'; import apiClient from './clients/api-client'; export default class AuthProviderAPI { static async index (): Promise> { const res: AxiosResponse> = await apiClient.get('/api/auth_providers'); return res?.data; } static async get (id: number): Promise { const res: AxiosResponse = await apiClient.get(`/api/auth_providers/${id}`); return res?.data; } static async create (authProvider: AuthenticationProvider): Promise { const res: AxiosResponse = await apiClient.post('/api/auth_providers', authProvider); return res?.data; } static async update (authProvider: AuthenticationProvider): Promise { const res: AxiosResponse = await apiClient.put(`/api/auth_providers/${authProvider.id}`, authProvider); return res?.data; } static async delete (id: number): Promise { await apiClient.delete(`/api/auth_providers/${id}`); } static async mappingFields (): Promise { const res: AxiosResponse = await apiClient.get('/api/auth_providers/mapping_fields'); return res?.data; } static async strategyName (authProvider: AuthenticationProvider): Promise { const res: AxiosResponse = await apiClient.get(`/api/auth_providers/strategy_name?providable_type=${authProvider.providable_type}&name=${authProvider.name}`); return res?.data; } static async active (): Promise { const res: AxiosResponse = await apiClient.get('/api/auth_providers/active'); return res?.data; } }