ScheduleHandle
in package
uses
ClientContextTrait
Table of Contents
Properties
- $clientOptions : ClientOptions
- $converter : DataConverterInterface
- $id : string
- $marshaller : MarshallerInterface
- $namespace : string
- $protoConverter : ProtoToArrayConverter
Methods
- __construct() : mixed
- backfill() : void
- Backfill the schedule by going though the specified time periods and taking Actions as if that time passed by right now, all at once.
- delete() : void
- Delete the Schedule.
- describe() : ScheduleDescription
- Describe fetches the Schedule's description from the Server
- getID() : string
- GetID returns the schedule ID associated with this handle.
- listScheduleMatchingTimes() : Countable|Traversable<int, DateTimeImmutable>
- Lists matching times within a range.
- pause() : void
- Pause the Schedule will also overwrite the Schedules current note with the new note.
- trigger() : void
- Trigger an Action to be taken immediately. Will override the schedules default policy with the one specified here. If overlap is {@see ScheduleOverlapPolicy::Unspecified} the Schedule policy will be used.
- unpause() : void
- Unpause the Schedule will also overwrite the Schedules current note with the new note.
- update() : void
- Update the Schedule.
- patch() : PatchScheduleRequest
Properties
$clientOptions read-only
private
ClientOptions
$clientOptions
$converter read-only
private
DataConverterInterface
$converter
$id read-only
private
string
$id
$marshaller read-only
private
MarshallerInterface
$marshaller
$namespace read-only
private
string
$namespace
$protoConverter read-only
private
ProtoToArrayConverter
$protoConverter
Methods
__construct()
public
__construct(ServiceClientInterface $client, ClientOptions $clientOptions, DataConverterInterface $converter, MarshallerInterface $marshaller, ProtoToArrayConverter $protoConverter, string $namespace, string $id) : mixed
Parameters
- $client : ServiceClientInterface
- $clientOptions : ClientOptions
- $converter : DataConverterInterface
- $marshaller : MarshallerInterface
- $protoConverter : ProtoToArrayConverter
- $namespace : string
- $id : string
backfill()
Backfill the schedule by going though the specified time periods and taking Actions as if that time passed by right now, all at once.
public
backfill(iterable<string|int, BackfillPeriod> $periods) : void
Parameters
- $periods : iterable<string|int, BackfillPeriod>
-
Time periods to backfill the schedule.
delete()
Delete the Schedule.
public
delete() : void
describe()
Describe fetches the Schedule's description from the Server
public
describe() : ScheduleDescription
Return values
ScheduleDescriptiongetID()
GetID returns the schedule ID associated with this handle.
public
getID() : string
Return values
stringlistScheduleMatchingTimes()
Lists matching times within a range.
public
listScheduleMatchingTimes(DateTimeInterface $startTime, DateTimeInterface $endTime) : Countable|Traversable<int, DateTimeImmutable>
Parameters
- $startTime : DateTimeInterface
- $endTime : DateTimeInterface
Return values
Countable|Traversable<int, DateTimeImmutable>pause()
Pause the Schedule will also overwrite the Schedules current note with the new note.
public
pause([string $note = 'Paused via PHP SDK' ]) : void
Parameters
- $note : string = 'Paused via PHP SDK'
-
Informative human-readable message with contextual notes.
Tags
trigger()
Trigger an Action to be taken immediately. Will override the schedules default policy with the one specified here. If overlap is {@see ScheduleOverlapPolicy::Unspecified} the Schedule policy will be used.
public
trigger([ScheduleOverlapPolicy $overlapPolicy = ScheduleOverlapPolicy::Unspecified ]) : void
Parameters
- $overlapPolicy : ScheduleOverlapPolicy = ScheduleOverlapPolicy::Unspecified
-
If specified, policy to override the Schedules default overlap policy.
unpause()
Unpause the Schedule will also overwrite the Schedules current note with the new note.
public
unpause([string $note = 'Unpaused via PHP SDK' ]) : void
Parameters
- $note : string = 'Unpaused via PHP SDK'
-
Informative human-readable message with contextual notes.
Tags
update()
Update the Schedule.
public
update(Schedule|callable(ScheduleUpdateInput): ScheduleUpdate $schedule[, string|null $conflictToken = null ]) : void
Examples:
Add a search attribute to the schedule:
$handle->update(function (ScheduleUpdateInput $input): ScheduleUpdate {
return ScheduleUpdate::new($input->description->schedule)
->withSearchAttributes($input->description->searchAttributes
->withValue('foo', 'bar'),
->withValue('bar', 42),
);
});
Pause a described schedule:
$description = $handle->describe();
$schedule = $description->schedule;
$handle->update(
$schedule
->withState($schedule->state->withPaused(true)),
$description->conflictToken,
);
NOTE: If two Update calls are made in parallel to the same Schedule there is the potential for a race condition. Use $conflictToken to avoid this.
Parameters
- $schedule : Schedule|callable(ScheduleUpdateInput): ScheduleUpdate
-
The new Schedule to update to or a closure that will be passed the current ScheduleDescription and should return a ScheduleUpdate.
- $conflictToken : string|null = null
-
Can be the value of ScheduleDescription::$conflictToken, which will cause this request to fail if the schedule has been modified between the self::describe() and this Update. If missing, the schedule will be updated unconditionally.
patch()
private
patch(SchedulePatch $patch) : PatchScheduleRequest
Parameters
- $patch : SchedulePatch