Home Manual Reference Source Repository

src/plugins/easycurrency/resolvers/CurrencyResolver.js

/**
 * Provides information about available currencies.
 * This is an abstract class which resolvers should extend from.
 * @public
 */
export default class CurrencyResolver {
    /**
     * List the available currencies.
     * @return {String[]}
     * @throws {Error} - CurrencyResolver should implement listCurrencyCodes
     */
    async listCurrencyCodes() {
        throw Error('CurrencyResolver should implement listCurrencyCodes');
    }


    /**
     * Get conversion rate for a specific currency pair.
     * @param {String}	from
     * @param {String}	to
     * @return {Number}
     * @throws {Error} - CurrencyResolver should implement getConversionRate
     */
    async getConversionRate(from, to) {
        throw Error('CurrencyResolver should implement getConversionRate');
    }
}