libcast/highrise

Highrise API客户端

v1.0.6 2014-08-27 13:25 UTC

This package is not auto-updated.

Last update: 2024-09-14 13:40:32 UTC


README

这个库是对Highrise-PHP-Api的全面重写,旨在提高可用性并遵循现代PHP实践。

新功能包括

  • PHP 5.3命名空间
  • Composer支持
  • 能够列出全局主题字段
  • 能够向个人添加自定义字段
  • 能够删除个人的电子邮件地址

原始库中的现有功能

  • 人员
  • 任务
  • 笔记
  • 电子邮件
  • 标签
  • 用户

安装

推荐使用Composer安装libcast/highrise

$ composer require libcast/highrise

用法

人员

创建一个新的人员并设置其地址

use Highrise\Resources\HighrisePerson;

$person = new HighrisePerson($highrise);
$person->setFirstName("John");
$person->setLastName("Doe");
$person->addEmailAddress("johndoe@gmail.com");

$address = new HighriseAddress();
$address->setAddress("165 Test St.");
$address->setCity("Glasgow");
$address->setCountry("Scotland");
$address->setZip("GL1");
$person->addAddress($address);

$person->save();

通过搜索词查找人员

$people = $highrise->findPeopleBySearchTerm("John");
foreach($people as $p) {
    print $person->getFirstName() . "\n";
}

笔记

打印所有笔记

foreach($highrise->findAllPeople() as $person) {
    print_r($person->getNotes());
}

创建一个新的笔记

$note = new HighriseNote($highrise);
$note->setSubjectType("Party");
$note->setSubjectId($person->getId());
$note->setBody("Test");
$note->save();

标签

添加标签

$people = $highrise->findPeopleByTitle("CEO");
foreach($people as $person) {
    $person->addTag("CEO");
    $person->save();
}
```php

Remove Tags:

```php
$people = $highrise->findPeopleByTitle("Ex-CEO");
foreach($people as $person) {
    unset($person->tags['CEO']);
    $person->save();
}

查找所有标签

$all_tags = $highrise->findAllTags();
print_r($all_tags);

任务

创建任务

$task = new HighriseTask($highrise);
$task->setBody("Task Body");
$task->setPublic(false);
$task->setFrame("Tomorrow");
$task->save();

分配所有即将到来的任务

$users = $highrise->findAllUsers();
$user = $users[0]; // just select the first user

foreach($highrise->findUpcomingTasks() as $task) {
    $task->assignToUser($user);
    $task->save();
}
```php

Find all assigned tasks:

```php
$assigned_tasks = $highrise->findAssignedTasks();
print_r($assigned_tasks);

用户

查找所有用户

$users = $highrise->findAllUsers();
print_r($users);

查找当前用户

$me = $highrise->findMe();