SevenShores\Hubspot\Resources\Timeline::updateEventType PHP Method

updateEventType() public method

Update Timeline Event Type
See also: http://developers.hubspot.com/docs/methods/timeline/update-event-type
public updateEventType ( integer $appId, integer $eventTypeId, string | null $name = null, string | null $headerTemplate = null, string | null $detailTemplate = null, string | null $objectType = null ) : mixed
$appId integer
$eventTypeId integer
$name string | null
$headerTemplate string | null
$detailTemplate string | null
$objectType string | null
return mixed
    public function updateEventType($appId, $eventTypeId, $name = null, $headerTemplate = null, $detailTemplate = null, $objectType = null)
    {
        $endpoint = "https://api.hubapi.com/integrations/v1/{$appId}/timeline/event-types/{$eventTypeId}";
        $data['json'] = ['applicationId' => $appId, 'name' => $name, 'headerTemplate' => $headerTemplate, 'detailTemplate' => $detailTemplate, 'objectType' => $objectType];
        return $this->client->request('put', $endpoint, $data);
    }

Usage Example

Example #1
0
 /**
  * @test
  */
 public function updateEventType()
 {
     $name = 'New Event Name';
     $headerTemplate = 'New event header template';
     $detailTemplate = 'New event detail template';
     $response = $this->timeline->updateEventType(self::APP_ID, $this->eventTypeId, $name, $headerTemplate, $detailTemplate);
     $eventType = json_decode((string) $response->getBody());
     $this->assertEquals($name, $eventType->name);
     $this->assertEquals($headerTemplate, $eventType->headerTemplate);
     $this->assertEquals($detailTemplate, $eventType->detailTemplate);
     $this->assertEquals(200, $response->getStatusCode());
     return $response;
 }