unify_api

A Unify API Wrapper

Examples

  group("Account", () {
    test("Client => isAuthorized", () {
      expect(client.isAuthorized, equals(true));
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getCache() => UnifyCache", () async {
      try {
        UnifyCache _data = await client.getCache();
        expect(_data is UnifyCache, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)), skip: true);

    test("getInfo() => AccountInfo", () async {
      try {
        AccountInfo _data = await client.getInfo();
        expect(_data is AccountInfo, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listUnifyAlerts() => List<UnifyAlert>", () async {
      try {
        List<UnifyAlert> _data = await client.listUnifyAlerts();
        expect(_data is List<UnifyAlert>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Contacts", () {
    test("listContacts() => List<Contact>", () async {
      try {
        List<Contact> _data = await client.listContacts();
        expect(_data is List<Contact>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getContactDetails() => ContactDetails", () async {
      try {
        List<Contact> _data = await client.listContacts();
        ContactDetails _info = await _data.first.getDetails();
        expect(_info is ContactDetails, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listContactDetailsTracker() => List<Tracker>", () async {
      try {
        List<Contact> _data = await client.listContacts();
        List<Tracker> _list = await _data.first.listTracker();
        expect(_list is List<Tracker>, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listContactDetailsNotes() => List<Note>", () async {
      try {
        List<Contact> _data = await client.listContacts();
        List<ContactNote> _list = await _data.first.listNotes();
        expect(_list is List<ContactNote>, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLoanHistory() => List<LoanHistory>", () async {
      try {
        List<Contact> _data = await client.listContacts();
        List<LoanHistory> _info = await _data.first.listLoans();
        expect(_info is List<LoanHistory>, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listContactLogResponses() => List<String>", () async {
      try {
        List<String> _data = await client.listContactLogResponses();
        expect(_data is List<String>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listCompanyCategories() => List<CompanyCategory>", () async {
      try {
        List<CompanyCategory> _data = await client.listCompanyCategories();
        expect(_data is List<CompanyCategory>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Leads", () {
    test("listLeads() => List<Lead>", () async {
      try {
        List<Lead> _data = await client.listLeads();
        expect(_data is List<Lead>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getLeadDetails() => LeadDetails", () async {
      try {
        List<Lead> _data = await client.listLeads();
        LeadDetails _info = await _data.first.getDetails();
        expect(_info is LeadDetails, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLeadDetailsTracker() => List<Tracker>", () async {
      try {
        List<Lead> _data = await client.listLeads();
        List<Tracker> _list = await _data.first.listTracker();
        expect(_list is List<Tracker>, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLeadDetailsNotes() => List<Note>", () async {
      try {
        List<Lead> _data = await client.listLeads();
        List<LeadNote> _list = await _data.first.listNotes();
        expect(_list is List<LeadNote>, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLeadLogResponses() => List<String>", () async {
      try {
        List<String> _data = await client.listLeadLogResponses();
        expect(_data is List<String>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Contact Groups", () {
    test("listContactGroups() => List of ContactGroup", () async {
      try {
        List<ContactGroup> _data = await client.listContactGroups();
        expect(_data is List<ContactGroup>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listContactsForContactGroup() => List<Contact>", () async {
      try {
        List<ContactGroup> _data = await client.listContactGroups();
        List<Contact> _info = await _data.first.listContacts();
        expect(_info is List<Contact>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listEmailsForContactGroup() => List<String>", () async {
      try {
        List<ContactGroup> _data = await client.listContactGroups();
        List<String> _info = await _data.first.listEmails();
        expect(_info is List<String>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Lead Groups", () {
    test("listLeadGroups() => List<LeadGroup>", () async {
      try {
        List<LeadGroup> _data = await client.listLeadGroups();
        expect(_data is List<LeadGroup>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLeadsForLeadGroup() => List<Lead>", () async {
      try {
        List<LeadGroup> _data = await client.listLeadGroups();
        List<Lead> _info = await _data.first.listLeads();
        expect(_info is List<Lead>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listEmailsForLeadGroup() => List<String>", () async {
      try {
        List<LeadGroup> _data = await client.listLeadGroups();
        List<String> _info = await _data.first.listEmails();
        expect(_info is List<String>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Dashboard Alerts", () {
    test("getStats() => DashboardStats", () async {
      try {
        DashboardStats _data = await client.getStats();
        expect(_data is DashboardStats, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listOpportunitiyAlerts() => List<DashboardAlert>", () async {
      try {
        List<DashboardAlert> _data = await client.listOpportunitiyAlerts();
        expect(_data is List<DashboardAlert>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listCustomerAlerts() => List<DashboardAlert>", () async {
      try {
        List<DashboardAlert> _data = await client.listCustomerAlerts();
        expect(_data is List<DashboardAlert>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listHotProspectAlerts() => List<DashboardAlert>", () async {
      try {
        List<DashboardAlert> _data = await client.listHotProspectAlerts();
        expect(_data is List<DashboardAlert>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listPipelineAlerts() => List<DashboardAlert>", () async {
      try {
        List<DashboardAlert> _data = await client.listPipelineAlerts();
        expect(_data is List<DashboardAlert>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listDashboardPartners() => List<DashboardPartners>", () async {
      try {
        List<DashboardPartners> _data = await client.listDashboardPartners();
        expect(_data is List<DashboardPartners>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Loans", () {
    test("listLoansAll() => List<Loan>", () async {
      try {
        List<Loan> _data = await client.listLoansAll();
        expect(_data is List<Loan>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLoansClosed() => List<Loan>", () async {
      try {
        List<Loan> _data = await client.listLoansClosed();
        expect(_data is List<Loan>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLoansMyPipeline() => List<Loan>", () async {
      try {
        List<Loan> _data = await client.listLoansMyPipeline();
        expect(_data is List<Loan>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLoansProspects() => List<Loan>", () async {
      try {
        List<Loan> _data = await client.listLoansProspects();
        expect(_data is List<Loan>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLoansOther() => List<Loan>", () async {
      try {
        List<Loan> _data = await client.listLoansOther();
        expect(_data is List<Loan>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getLoanDetails() => LoanDetails", () async {
      try {
        List<Loan> _data = await client.listLoansAll();
        LoanDetails _info = await _data.first.getDetails();
        expect(_info is LoanDetails, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getLoanStatus() => LoanProgress", () async {
      try {
        List<Loan> _data = await client.listLoansAll();
        LoanProgress _info = await _data.first.getProgress();
        expect(_info is LoanProgress, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listLoanContacts() => List<LoanContact>", () async {
      try {
        List<Loan> _data = await client.listLoansAll();
        List<LoanContact> _info = await _data.first.listContacts();
        expect(_info is List<LoanContact>, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Tasks", () {
    test("listTasksAll() => List<Task>", () async {
      try {
        List<Task> _data = await client.listTasksAll();
        expect(_data is List<Task>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listTasksContacts() => List<Task>", () async {
      try {
        List<Task> _data = await client.listTasksContacts();
        expect(_data is List<Task>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listTasksLeads() => List<Task>", () async {
      try {
        List<Task> _data = await client.listTasksLeads();
        expect(_data is List<Task>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listTasksCoreLeads() => List<Task>", () async {
      try {
        List<Task> _data = await client.listTasksCoreLeads();
        expect(_data is List<Task>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listTasksForContact() => List<Task>", () async {
      try {
        List<Contact> _data = await client.listContacts();
        List<Task> _list = await _data.first.listTasks();
        expect(_list is List<Task>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listTasksForLead() => List<Task>", () async {
      try {
        List<Lead> _data = await client.listLeads();
        List<Task> _list = await _data.first.listTasks();
        expect(_list is List<Task>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listTasksForCoreLead() => List<Task>", () async {
      try {
        List<CoreLead> _data = await client.listCoreLeads();
        List<Task> _list = await _data.first.listTasks();
        expect(_list is List<Task>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Core Leads", () {
    test("listCoreLeads() => List<CoreLead>", () async {
      try {
        List<CoreLead> _data = await client.listCoreLeads();
        expect(_data is List<CoreLead>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getCoreLeadDetails() => CoreLeadDetails", () async {
      try {
        List<CoreLead> _data = await client.listCoreLeads();
        CoreLeadDetails _info = await _data.first.getDetails();
        expect(_info is CoreLeadDetails, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Unify Video", () {
    test("getKalturaSession() => String", () async {
      try {
        AccountInfo _info = await client.getInfo();
        String _data = await client.getKalturaSession(_info?.kalturaId);
        expect(_data is String, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("Admin getKalturaSession() => String", () async {
      try {
        String _data = await client.getKalturaSession(null, admin: true);
        expect(_data is String, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
    test("listTemplates() => List<String>", () async {
      try {
        List<String> _data = await client.listTemplates();
        expect(_data is List<String>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listVideosAll() => List<Video>", () async {
      try {
        List<Video> _data = await client.listVideosAll();
        expect(_data is List<Video>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listVideosMyVideos() => List<Video>", () async {
      try {
        List<Video> _data = await client.listVideosMyVideos();
        expect(_data is List<Video>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listVideosArchived() => List<Video>", () async {
      try {
        List<Video> _data = await client.listVideosArchived();
        expect(_data is List<Video>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listVideosShared() => List<Video>", () async {
      try {
        List<Video> _data = await client.listVideosShared();
        expect(_data is List<Video>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getVideoDetails() => VideoDetails", () async {
      try {
        List<Video> _data = await client.listVideosAll();
        VideoDetails _info = await _data?.first?.getDetails();
        expect(_info is VideoDetails, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getVideoShareUrl() => String", () async {
      try {
        List<Video> _data = await client.listVideosAll();
        String _info = await _data?.first?.share();
        expect(_info is String, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getVideoPreview() => String", () async {
      try {
        List<Video> _data = await client.listVideosAll();
        String _info = await _data?.first?.preview();
        expect(_info is String, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getVideoTotalViews() => int", () async {
      try {
        int _info = await client.getVideoTotalViews();
        expect(_info is int, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Marketing", () {
    test("listMarketingSection() => List<MarketingSection>", () async {
      try {
        List<MarketingSection> _data = await client.listMarketingSection();
        expect(_data is List<MarketingSection>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listMarketingMaterial() => List<MarketingMaterial>", () async {
      try {
        List<MarketingMaterial> _data = await client.listMarketingMaterial();
        expect(_data is List<MarketingMaterial>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getMarketingDetails() => MarketingMaterialDetails", () async {
      try {
        List<MarketingMaterial> _data = await client.listMarketingMaterial();
        MarketingMaterialDetails _info = await _data.first.getDetails();
        expect(_info is MarketingMaterialDetails, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listMarketingCampaigns() => List<MarketingCampaign>", () async {
      try {
        List<MarketingCampaign> _data = await client.listMarketingCampaigns();
        expect(_data is List<MarketingCampaign>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("listMarketingPartners() => List<MarketingPartner>", () async {
      try {
        List<MarketingPartner> _data = await client.listMarketingPartners();
        expect(_data is List<MarketingPartner>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getMarketingValidation() => MarketingValidation", () async {
      try {
        List<MarketingMaterial> _list = await client.listMarketingMaterial();
        MarketingValidation _data = await _list?.first?.validate();
        expect(_data is MarketingValidation, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

  group("Cart", () {
    test("listCartItems() => List<CartItem>", () async {
      try {
        CartOrder _data = await client.getCartOrder();
        List<CartItem> _list = await _data.listItems();
        expect(_list is List<CartItem>, true);
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));

    test("getCartOrder() => CartOrder", () async {
      try {
        CartOrder _data = await client.getCartOrder();
        expect(_data is CartOrder, equals(true));
      } catch (e) {
        fail("Error: $e");
      }
    }, timeout: Timeout(Duration(seconds: _timeout)));
  });

Libraries

unify
unify.tool