Esempio n. 1
0
def list_new_engagements(cache_file, cutoff, emails, meetings, notes, tasks, slack_webhook_url):
    api = get_api()
    cache = HubCache(api, filename=cache_file)
    cutoff_ts = time.time() - cutoff
    response = api.request('GET', '/engagements/v1/engagements/recent/modified', params={'count': 100})
    #with open('foo.json', 'r') as inf:
    #    response = json.load(inf)
    sess = requests.Session()
    for eng in filter_engagements(
        response,
        cutoff_ts=cutoff_ts,
        emails=emails, meetings=meetings, notes=notes, tasks=tasks
    ):
        formatted = format_engagement(cache, eng)
        print(formatted)
        if slack_webhook_url:
            sess.post(slack_webhook_url, json={
                'text': formatted,
            })
Esempio n. 2
0
def dump_engagements(output):
    api = get_api()
    write_dumpfile(output, dumpers.dump_engagements(api))
Esempio n. 3
0
def dump_owners(output):
    api = get_api()
    write_dumpfile(output, dumpers.dump_owners(api))
Esempio n. 4
0
def dump_deals(output, props_output):
    api = get_api()
    deal_props = dumpers.dump_deal_props(api)
    write_dumpfile(props_output, deal_props)
    write_dumpfile(output, dumpers.dump_deals(api, deal_props))
Esempio n. 5
0
def dump_companies(output, props_output):
    api = get_api()
    company_props = dumpers.dump_company_props(api)
    write_dumpfile(props_output, company_props)
    write_dumpfile(props_output, dumpers.dump_companies(api, company_props))
Esempio n. 6
0
def dump_contacts(output, props_output):
    api = get_api()
    contact_props = dumpers.dump_contact_props(api)
    write_dumpfile(props_output, contact_props)
    write_dumpfile(output, dumpers.dump_contacts(api, contact_props))
Esempio n. 7
0
def dump_contact_lists(output):
    api = get_api()
    write_dumpfile(output, dumpers.dump_contact_lists(api))
Esempio n. 8
0
def update_cache(cache_file):
    api = get_api()
    cache = HubCache(api, cache_file)
    cache.update()