#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Resource {
Clients,
Invoices,
Payments,
Quotes,
Credits,
Vendors,
Expenses,
Projects,
Tasks,
Locations,
Products,
RecurringInvoices,
PurchaseOrders,
RecurringExpenses,
RecurringQuotes,
BankTransactions,
BankIntegrations,
BankTransactionRules,
GroupSettings,
ExpenseCategories,
TaxRates,
PaymentTerms,
TaskSchedulers,
TaskStatuses,
Activities,
SystemLogs,
Documents,
Designs,
Templates,
Users,
Companies,
CompanyGateways,
CompanyLedger,
CompanyUsers,
Tokens,
Webhooks,
Subscriptions,
ClientGatewayTokens,
}
impl Resource {
pub fn path(self) -> &'static str {
match self {
Self::Clients => "clients",
Self::Invoices => "invoices",
Self::Payments => "payments",
Self::Quotes => "quotes",
Self::Credits => "credits",
Self::Vendors => "vendors",
Self::Expenses => "expenses",
Self::Projects => "projects",
Self::Tasks => "tasks",
Self::Locations => "locations",
Self::Products => "products",
Self::RecurringInvoices => "recurring_invoices",
Self::PurchaseOrders => "purchase_orders",
Self::RecurringExpenses => "recurring_expenses",
Self::RecurringQuotes => "recurring_quotes",
Self::BankTransactions => "bank_transactions",
Self::BankIntegrations => "bank_integrations",
Self::BankTransactionRules => "bank_transaction_rules",
Self::GroupSettings => "group_settings",
Self::ExpenseCategories => "expense_categories",
Self::TaxRates => "tax_rates",
Self::PaymentTerms => "payment_terms",
Self::TaskSchedulers => "task_schedulers",
Self::TaskStatuses => "task_statuses",
Self::Activities => "activities",
Self::SystemLogs => "system_logs",
Self::Documents => "documents",
Self::Designs => "designs",
Self::Templates => "templates",
Self::Users => "users",
Self::Companies => "companies",
Self::CompanyGateways => "company_gateways",
Self::CompanyLedger => "company_ledger",
Self::CompanyUsers => "company_users",
Self::Tokens => "tokens",
Self::Webhooks => "webhooks",
Self::Subscriptions => "subscriptions",
Self::ClientGatewayTokens => "client_gateway_tokens",
}
}
pub fn label(self) -> &'static str {
match self {
Self::RecurringInvoices => "recurring invoices",
Self::PurchaseOrders => "purchase orders",
Self::RecurringExpenses => "recurring expenses",
Self::RecurringQuotes => "recurring quotes",
Self::BankTransactions => "bank transactions",
Self::BankIntegrations => "bank integrations",
Self::BankTransactionRules => "bank transaction rules",
Self::GroupSettings => "group settings",
Self::ExpenseCategories => "expense categories",
Self::TaxRates => "tax rates",
Self::PaymentTerms => "payment terms",
Self::TaskSchedulers => "task schedulers",
Self::TaskStatuses => "task statuses",
Self::SystemLogs => "system logs",
Self::CompanyGateways => "company gateways",
Self::CompanyLedger => "company ledger",
Self::CompanyUsers => "company users",
Self::ClientGatewayTokens => "client gateway tokens",
_ => self.path(),
}
}
pub fn upload_method(self) -> &'static str {
match self {
Self::Invoices => "PUT",
_ => "POST",
}
}
}