sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function get($fileId, $parentId, $optParams = array()) { $params = array('fileId' => $fileId, 'parentId' => $parentId); $params = array_merge($params, $optParams); $data = $this->__call('get', array($params)); if ($this->useObjects()) { return new Google_ParentReference($data); } else { return $data; } }
Gets a specific parent reference. (parents.get) @param string $fileId The ID of the file. @param string $parentId The ID of the parent. @param array $optParams Optional parameters. @return Google_ParentReference
entailment
public function get($fileId, $propertyKey, $optParams = array()) { $params = array('fileId' => $fileId, 'propertyKey' => $propertyKey); $params = array_merge($params, $optParams); $data = $this->__call('get', array($params)); if ($this->useObjects()) { return new Google_Property($data); } else { return $data; } }
Gets a property by its key. (properties.get) @param string $fileId The ID of the file. @param string $propertyKey The key of the property. @param array $optParams Optional parameters. @opt_param string visibility The visibility of the property. @return Google_Property
entailment
public function get($fileId, $commentId, $replyId, $optParams = array()) { $params = array('fileId' => $fileId, 'commentId' => $commentId, 'replyId' => $replyId); $params = array_merge($params, $optParams); $data = $this->__call('get', array($params)); if ($this->useObjects()) { return new Google_CommentReply($data); } else { return $data; } }
Gets a reply. (replies.get) @param string $fileId The ID of the file. @param string $commentId The ID of the comment. @param string $replyId The ID of the reply. @param array $optParams Optional parameters. @opt_param bool includeDeleted If set, this will succeed when retrieving a deleted reply. @return Google_CommentReply
entailment
public function insert($fileId, $commentId, Google_CommentReply $postBody, $optParams = array()) { $params = array('fileId' => $fileId, 'commentId' => $commentId, 'postBody' => $postBody); $params = array_merge($params, $optParams); $data = $this->__call('insert', array($params)); if ($this->useObjects()) { return new Google_CommentReply($data); } else { return $data; } }
Creates a new reply to the given comment. (replies.insert) @param string $fileId The ID of the file. @param string $commentId The ID of the comment. @param Google_CommentReply $postBody @param array $optParams Optional parameters. @return Google_CommentReply
entailment
public function listReplies($fileId, $commentId, $optParams = array()) { $params = array('fileId' => $fileId, 'commentId' => $commentId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_CommentReplyList($data); } else { return $data; } }
Lists all of the replies to a comment. (replies.list) @param string $fileId The ID of the file. @param string $commentId The ID of the comment. @param array $optParams Optional parameters. @opt_param bool includeDeleted If set, all replies, including deleted replies (with content stripped) will be returned. @opt_param int maxResults The maximum number of replies to include in the response, used for paging. @opt_param string pageToken The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of "nextPageToken" from the previous response. @return Google_CommentReplyList
entailment
public function patch($fileId, $revisionId, Google_Revision $postBody, $optParams = array()) { $params = array('fileId' => $fileId, 'revisionId' => $revisionId, 'postBody' => $postBody); $params = array_merge($params, $optParams); $data = $this->__call('patch', array($params)); if ($this->useObjects()) { return new Google_Revision($data); } else { return $data; } }
Updates a revision. This method supports patch semantics. (revisions.patch) @param string $fileId The ID for the file. @param string $revisionId The ID for the revision. @param Google_Revision $postBody @param array $optParams Optional parameters. @return Google_Revision
entailment
public function listSubscriptions($optParams = array()) { $params = array(); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_SubscriptionsListResponse($data); } else { return $data; } }
Retrieves a list of subscriptions for the authenticated user and service. (subscriptions.list) @param array $optParams Optional parameters. @return Google_SubscriptionsListResponse
entailment
public function delete($itemId, $attachmentId, $optParams = array()) { $params = array('itemId' => $itemId, 'attachmentId' => $attachmentId); $params = array_merge($params, $optParams); $data = $this->__call('delete', array($params)); return $data; }
Deletes an attachment from a timeline item. (attachments.delete) @param string $itemId The ID of the timeline item the attachment belongs to. @param string $attachmentId The ID of the attachment. @param array $optParams Optional parameters.
entailment
public function get($itemId, $attachmentId, $optParams = array()) { $params = array('itemId' => $itemId, 'attachmentId' => $attachmentId); $params = array_merge($params, $optParams); $data = $this->__call('get', array($params)); if ($this->useObjects()) { return new Google_Attachment($data); } else { return $data; } }
Retrieves an attachment on a timeline item by item ID and attachment ID. (attachments.get) @param string $itemId The ID of the timeline item the attachment belongs to. @param string $attachmentId The ID of the attachment. @param array $optParams Optional parameters. @return Google_Attachment
entailment
public function insert($itemId, $optParams = array()) { $params = array('itemId' => $itemId); $params = array_merge($params, $optParams); $data = $this->__call('insert', array($params)); if ($this->useObjects()) { return new Google_Attachment($data); } else { return $data; } }
Adds a new attachment to a timeline item. (attachments.insert) @param string $itemId The ID of the timeline item the attachment belongs to. @param array $optParams Optional parameters. @return Google_Attachment
entailment
public function listTimelineAttachments($itemId, $optParams = array()) { $params = array('itemId' => $itemId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_AttachmentsListResponse($data); } else { return $data; } }
Returns a list of attachments for a timeline item. (attachments.list) @param string $itemId The ID of the timeline item whose attachments should be listed. @param array $optParams Optional parameters. @return Google_AttachmentsListResponse
entailment
public function get($seriesId, $submissionId, $optParams = array()) { $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId); $params = array_merge($params, $optParams); $data = $this->__call('get', array($params)); if ($this->useObjects()) { return new Google_Vote($data); } else { return $data; } }
Returns the votes by the authenticated user for the specified submission within the specified series. (votes.get) @param string $seriesId The decimal ID of the Series. @param string $submissionId The decimal ID of the Submission within the Series. @param array $optParams Optional parameters. @opt_param string userId @opt_param string unauthToken User identifier for unauthenticated usage mode @return Google_Vote
entailment
public function insert($seriesId, $topicId, $parentSubmissionId, Google_Submission $postBody, $optParams = array()) { $params = array('seriesId' => $seriesId, 'topicId' => $topicId, 'parentSubmissionId' => $parentSubmissionId, 'postBody' => $postBody); $params = array_merge($params, $optParams); $data = $this->__call('insert', array($params)); if ($this->useObjects()) { return new Google_Submission($data); } else { return $data; } }
Inserts a response for the specified submission in the specified topic within the specified series. (responses.insert) @param string $seriesId The decimal ID of the Series. @param string $topicId The decimal ID of the Topic within the Series. @param string $parentSubmissionId The decimal ID of the parent Submission within the Series. @param Google_Submission $postBody @param array $optParams Optional parameters. @opt_param string unauthToken User identifier for unauthenticated usage mode @opt_param bool anonymous Set to true to mark the new submission as anonymous. @return Google_Submission
entailment
public function listResponses($seriesId, $submissionId, $optParams = array()) { $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_SubmissionList($data); } else { return $data; } }
Lists or searches the responses for the specified submission within the specified series and returns the search results. (responses.list) @param string $seriesId The decimal ID of the Series. @param string $submissionId The decimal ID of the Submission within the Series. @param array $optParams Optional parameters. @opt_param string max-results Maximum number of results to return. @opt_param string sort Sort order. @opt_param string author Restricts the results to submissions by a specific author. @opt_param string start-index Index of the first result to be retrieved. @opt_param string q Search query. @opt_param bool hasAttachedVideo Specifies whether to restrict to submissions that have videos attached. @return Google_SubmissionList
entailment
public function delete($seriesId, $submissionId, $tagId, $optParams = array()) { $params = array('seriesId' => $seriesId, 'submissionId' => $submissionId, 'tagId' => $tagId); $params = array_merge($params, $optParams); $data = $this->__call('delete', array($params)); return $data; }
Deletes the specified tag from the specified submission within the specified series. (tags.delete) @param string $seriesId The decimal ID of the Series. @param string $submissionId The decimal ID of the Submission within the Series. @param string $tagId @param array $optParams Optional parameters.
entailment
public function listSeries($optParams = array()) { $params = array(); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_SeriesList($data); } else { return $data; } }
Searches the series and returns the search results. (series.list) @param array $optParams Optional parameters. @opt_param string max-results Maximum number of results to return. @opt_param string q Search query. @opt_param string start-index Index of the first result to be retrieved. @return Google_SeriesList
entailment
public function update($seriesId, Google_Series $postBody, $optParams = array()) { $params = array('seriesId' => $seriesId, 'postBody' => $postBody); $params = array_merge($params, $optParams); $data = $this->__call('update', array($params)); if ($this->useObjects()) { return new Google_Series($data); } else { return $data; } }
Updates the specified series. (series.update) @param string $seriesId The decimal ID of the Series. @param Google_Series $postBody @param array $optParams Optional parameters. @return Google_Series
entailment
public function get($seriesId, $optParams = array()) { $params = array('seriesId' => $seriesId); $params = array_merge($params, $optParams); $data = $this->__call('get', array($params)); if ($this->useObjects()) { return new Google_Series($data); } else { return $data; } }
Returns the specified series. (series.get) @param string $seriesId The decimal ID of the Series. @param array $optParams Optional parameters. @return Google_Series
entailment
public function listSeriesSubmissions($seriesId, $optParams = array()) { $params = array('seriesId' => $seriesId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_SubmissionList($data); } else { return $data; } }
Searches the submissions for the specified series and returns the search results. (submissions.list) @param string $seriesId The decimal ID of the Series. @param array $optParams Optional parameters. @opt_param string lang The language code for the language the client prefers results in. @opt_param string max-results Maximum number of results to return. @opt_param bool includeVotes Specifies whether to include the current user's vote @opt_param string start-index Index of the first result to be retrieved. @opt_param string author Restricts the results to submissions by a specific author. @opt_param string sort Sort order. @opt_param string q Search query. @opt_param bool hasAttachedVideo Specifies whether to restrict to submissions that have videos attached. @return Google_SubmissionList
entailment
public function get($seriesId, $topicId, $optParams = array()) { $params = array('seriesId' => $seriesId, 'topicId' => $topicId); $params = array_merge($params, $optParams); $data = $this->__call('get', array($params)); if ($this->useObjects()) { return new Google_Topic($data); } else { return $data; } }
Returns the specified topic from the specified series. (topics.get) @param string $seriesId The decimal ID of the Series. @param string $topicId The decimal ID of the Topic within the Series. @param array $optParams Optional parameters. @return Google_Topic
entailment
public function listTopicsSubmissions($seriesId, $topicId, $optParams = array()) { $params = array('seriesId' => $seriesId, 'topicId' => $topicId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_SubmissionList($data); } else { return $data; } }
Searches the submissions for the specified topic within the specified series and returns the search results. (submissions.list) @param string $seriesId The decimal ID of the Series. @param string $topicId The decimal ID of the Topic within the Series. @param array $optParams Optional parameters. @opt_param string max-results Maximum number of results to return. @opt_param bool includeVotes Specifies whether to include the current user's vote @opt_param string start-index Index of the first result to be retrieved. @opt_param string author Restricts the results to submissions by a specific author. @opt_param string sort Sort order. @opt_param string q Search query. @opt_param bool hasAttachedVideo Specifies whether to restrict to submissions that have videos attached. @return Google_SubmissionList
entailment
public function listActivities($userId, $collection, $optParams = array()) { $params = array('userId' => $userId, 'collection' => $collection); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_ActivityList($data); } else { return $data; } }
Retrieves a list of activities. (activities.list) @param string $userId The ID of the user whose activities will be listed. Can be me to refer to the viewer (i.e. the authenticated user). @param string $collection The collection of activities to list. @param array $optParams Optional parameters. @opt_param string hl Specifies the interface language (host language) of your user interface. @opt_param string maxResults The maximum number of activities to include in the response. @opt_param string pageToken A continuation token that allows pagination. @return Google_ActivityList
entailment
public function insert($activityId, Google_Comment $postBody, $optParams = array()) { $params = array('activityId' => $activityId, 'postBody' => $postBody); $params = array_merge($params, $optParams); $data = $this->__call('insert', array($params)); if ($this->useObjects()) { return new Google_Comment($data); } else { return $data; } }
Inserts a new comment to an activity. (comments.insert) @param string $activityId The ID of the activity to contain the new comment. @param Google_Comment $postBody @param array $optParams Optional parameters. @return Google_Comment
entailment
public function listCommunityMembers($communityId, $optParams = array()) { $params = array('communityId' => $communityId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_CommunityMembersList($data); } else { return $data; } }
Lists members of a community. Use the pagination tokens to retrieve the full list; do not rely on the member count available in the community profile information to know when to stop iterating, as that count may be approximate. (communityMembers.list) @param int $communityId The ID of the community whose members will be listed. @param array $optParams Optional parameters. @opt_param bool friendsOnly Whether to list only community members who are friends of the user. @opt_param string hl Specifies the interface language (host language) of your user interface. @opt_param string maxResults The maximum number of members to include in the response. @opt_param string pageToken A continuation token that allows pagination. @return Google_CommunityMembersList
entailment
public function insert($communityId, $topicId, Google_CommunityMessage $postBody, $optParams = array()) { $params = array('communityId' => $communityId, 'topicId' => $topicId, 'postBody' => $postBody); $params = array_merge($params, $optParams); $data = $this->__call('insert', array($params)); if ($this->useObjects()) { return new Google_CommunityMessage($data); } else { return $data; } }
Adds a message to a given community topic. (communityMessages.insert) @param int $communityId The ID of the community the message should be added to. @param string $topicId The ID of the topic the message should be added to. @param Google_CommunityMessage $postBody @param array $optParams Optional parameters. @return Google_CommunityMessage
entailment
public function listCommunityMessages($communityId, $topicId, $optParams = array()) { $params = array('communityId' => $communityId, 'topicId' => $topicId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_CommunityMessageList($data); } else { return $data; } }
Retrieves the messages of a topic of a community. (communityMessages.list) @param int $communityId The ID of the community which messages will be listed. @param string $topicId The ID of the topic which messages will be listed. @param array $optParams Optional parameters. @opt_param string hl Specifies the interface language (host language) of your user interface. @opt_param string maxResults The maximum number of messages to include in the response. @opt_param string pageToken A continuation token that allows pagination. @return Google_CommunityMessageList
entailment
public function listCommunityPolls($communityId, $optParams = array()) { $params = array('communityId' => $communityId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_CommunityPollList($data); } else { return $data; } }
Retrieves the polls of a community. (communityPolls.list) @param int $communityId The ID of the community which polls will be listed. @param array $optParams Optional parameters. @opt_param string hl Specifies the interface language (host language) of your user interface. @opt_param string maxResults The maximum number of polls to include in the response. @opt_param string pageToken A continuation token that allows pagination. @return Google_CommunityPollList
entailment
public function listCommunityRelated($communityId, $optParams = array()) { $params = array('communityId' => $communityId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_CommunityList($data); } else { return $data; } }
Retrieves the communities related to another one. (communityRelated.list) @param int $communityId The ID of the community whose related communities will be listed. @param array $optParams Optional parameters. @opt_param string hl Specifies the interface language (host language) of your user interface. @return Google_CommunityList
entailment
public function insert($communityId, Google_CommunityTopic $postBody, $optParams = array()) { $params = array('communityId' => $communityId, 'postBody' => $postBody); $params = array_merge($params, $optParams); $data = $this->__call('insert', array($params)); if ($this->useObjects()) { return new Google_CommunityTopic($data); } else { return $data; } }
Adds a topic to a given community. (communityTopics.insert) @param int $communityId The ID of the community the topic should be added to. @param Google_CommunityTopic $postBody @param array $optParams Optional parameters. @opt_param bool isShout Whether this topic is a shout. @return Google_CommunityTopic
entailment
public function listCounters($userId, $optParams = array()) { $params = array('userId' => $userId); $params = array_merge($params, $optParams); $data = $this->__call('list', array($params)); if ($this->useObjects()) { return new Google_Counters($data); } else { return $data; } }
Retrieves the counters of a user. (counters.list) @param string $userId The ID of the user whose counters will be listed. Can be me to refer to caller. @param array $optParams Optional parameters. @return Google_Counters
entailment
protected function checkMustRevaliadateCachedRequest($cached, $request) { if (Google_CacheParser::mustRevalidate($cached)) { $addHeaders = array(); if ($cached->getResponseHeader('etag')) { // [13.3.4] If an entity tag has been provided by the origin server, // we must use that entity tag in any cache-conditional request. $addHeaders['If-None-Match'] = $cached->getResponseHeader('etag'); } elseif ($cached->getResponseHeader('date')) { $addHeaders['If-Modified-Since'] = $cached->getResponseHeader('date'); } $request->setRequestHeaders($addHeaders); return true; } else { return false; } }
Check if an already cached request must be revalidated, and if so update the request with the correct ETag headers. @param Google_HttpRequest $cached A previously cached response. @param Google_HttpRequest $request The outbound request. return bool If the cached object needs to be revalidated, false if it is still current and can be re-used.
entailment
protected function updateCachedRequest($cached, $responseHeaders) { if (isset($responseHeaders['connection'])) { $hopByHop = array_merge( self::$HOP_BY_HOP, explode(',', $responseHeaders['connection']) ); $endToEnd = array(); foreach($hopByHop as $key) { if (isset($responseHeaders[$key])) { $endToEnd[$key] = $responseHeaders[$key]; } } $cached->setResponseHeaders($endToEnd); } }
Update a cached request, using the headers from the last response. @param Google_HttpRequest $cached A previously cached response. @param mixed Associative array of response headers from the last request.
entailment
protected function loadInternal(array $configs, ContainerBuilder $container) { $factoryReference = new Reference(Redis\FactoryInterface::class); $container->setDefinition($factoryReference, new Definition(Redis\Factory::class)); foreach ($configs['clients'] as $name => $arguments) { $definition = new Definition(Redis\Client::class); $definition->setFactory([$factoryReference, 'create']); $definition->setArguments([$arguments['$parameters'], $arguments['$options']]); $definition->setPublic(true); $container->setDefinition(sprintf('%s.%s', $this->getAlias(), $name), $definition); if (false === $container->hasDefinition(Redis\ClientInterface::class)) { $container->setDefinition(Redis\ClientInterface::class, $definition); } } }
{@inheritdoc}
entailment
public function getConfigTreeBuilder() { $builder = new TreeBuilder(); $builder ->root('sb_redis') ->children() ->arrayNode('clients') ->addDefaultChildrenIfNoneSet('default') ->useAttributeAsKey('default') ->prototype('array') ->children() ->arrayNode('$parameters')->prototype('variable')->end()->end() ->arrayNode('$options')->prototype('variable')->end()->end() ->end() ->end() ->end() ->end(); return $builder; }
{@inheritdoc}
entailment
public function push(string $key, ...$values): int { return $this->call('rpush', array_merge([$key], $values)); }
{@inheritdoc}
entailment
public function setCustomFieldValue($field_name, $value, $editor = null, $required = null) { $custom_fields = isset($this->custom_fields) ? json_decode($this->custom_fields) : array(); $custom_fields[] = array( 'name' => $field_name, 'value' => $value, 'editor' => $editor, 'required' => $required ); $this->custom_fields = json_encode($custom_fields); return $this; }
Set the value for a custom field with the given field name and optionally define a Role allowed to edit it and if the field is required to be filled @param string $field_name field name to be filled in @param string $value @param string $editor @param string $required @return SignatureRequest
entailment
public function addAttachment($name, $signer_index, $instructions = null, $required = null) { $attachment = new Attachment(array( 'name' => $name, 'instructions' => $instructions, 'signer_index' => $signer_index, 'required' => $required )); $this->attachments[] = $attachment; return $this; }
Adds an Attachment to the SignatureRequest @param string $name Name of the Attachment. @param integer $signer_index Index of the signer to upload this Attachment. @param string $instructions Instructions for uploading the Attachment. (optional) @param boolean $required Whether or not the signer is required to upload this Attachment. (optional) @return SignatureRequest
entailment
public function getMetadata($key) { if (!is_array($this->metadata)) { $this->metadata = json_decode(json_encode($this->metadata), true); } return (isset($this->metadata[$key])) ? $this->metadata[$key] : null; }
Get the current metadata value for the provided key. @param string $key @return string|NULL
entailment
public function toArray($options = array()) { $array = get_object_vars($this); // default value if (!isset($options['include_null'])) { $options['include_null'] = false; } if (!isset($options['except'])) { $options['except'] = array(); } $options['except'][] = 'resource_type'; if (isset($options['only'])) { foreach ($array as $key => $value) { if (!in_array($key, $options['only'])) { unset($array[$key]); } } } else { foreach ($options['except'] as $value) { unset($array[$value]); } } // nested call & remove null foreach ($array as $key => $value) { if (!$options['include_null'] && $value === null) { unset($array[$key]); } elseif ($value instanceof AbstractObject || $value instanceof AbstractList) { $array[$key] = $value->toArray(); } } return $array; }
Export to array @param array $options Accepted keys: except, only, include_null @return array
entailment
public function fromArray($array, $options = array()) { // default options if (!isset($options['except'])) { $options['except'] = array(); } foreach ($options['except'] as $value) { unset($array[$value]); } foreach ($array as $key => $value) { $this->{$key} = $value; } return $this; }
Populate from array @param array $array @param array $options Accepted keys: except @return static
entailment
public function setCollection($array) { foreach ($array as $key => $object) { $class_name = "HelloSign\\{$this->resource_class}"; $resource = new $class_name; $resource->fromObject($object); $this->collection[$key] = $resource; } return $this; }
Populate collection from array @param array $array @return static
entailment
public function toArray($options = array()) { $array = array(); foreach ($this->collection as $key => $obj) { $array[$key] = $obj->toArray($options); } return $array; }
Export to array @param array $options Accepted keys: except, only, include_null @return array @see AbstractObject::toArray()
entailment
public function addSigner($email_or_signer, $name = null, $index = null) { $signer = ($email_or_signer instanceof Signer) ? $email_or_signer : new Signer(array( 'name' => $name, 'email_address' => $email_or_signer )); if (isset($index)) { $this->signers[$index] = $signer; } else { $this->signers[] = $signer; } return $this; }
Adds a signer to the signature request @param mixed $email_or_signer @param string $name @param string $index @return AbstractSignatureRequest
entailment
public function addGroup($name, $group_index_or_role = 0) { $group = new SignerGroup(array( 'name' => $name )); $this->signers[$group_index_or_role] = $group; return $this; }
Adds a Signer Group to the Signature Request @param string $name Signer Group name @param mixed $group_index_or_role Group Index or Signer Role. Defaults to 0. @return AbstractSignatureRequest
entailment
public function addGroupSigner($name, $email, $signer_index, $group_index_or_role = 0) { $signer = new Signer(array( 'name' => $name, 'email_address' => $email ) ); $this->signers[$group_index_or_role]->$signer_index = $signer; return $this; }
Adds Signers to a Signer Group in the Signature Request @param string $name Name of the Signer @param string $email Email address of the Signer @param integer $signer_index Signer Index of the Signer @param mixed $group_index_or_role Group Index or Signer Role. Defaults to 0. @return AbstractSignatureRequest
entailment
public function isValid($api_key) { if (!$api_key) { return false; } return ($this->event_hash == $this->calculateHash($api_key)) ? true : false; }
Check the event is valid or not @param string $api_key @return boolean @see Event::calculateHash()
entailment
public function setTemplateId($id, $order = null) { if ($order === null) { // If no order is provided, append the template ID to the end of the list $this->template_ids[] = $id; } else { $this->template_ids[$order] = $id; } return $this; }
Set the template ID, along with an optional order @param string $id @param int null $index @return \HelloSign\TemplateSignatureRequest
entailment
public function setSigner($role, $email_or_signer, $name = null) { return parent::addSigner($email_or_signer, $name, $role); }
Set the signer to the list of signers for this request @param string $role @param mixed $email_or_signer @param string $name @return TemplateSignatureRequest @see AbstractSignatureRequest::addSigner()
entailment
public function setCC($role, $email) { $obj = new stdClass; $obj->email_address = $email; $this->ccs[$role] = $obj; return $this; }
Sets the CC email address for the provided role @param string $role @param string $email @return TemplateSignatureRequest
entailment
public function fromResponse($response) { $this->page = $response->list_info->page; $this->num_pages = $response->list_info->num_pages; $this->num_results = $response->list_info->num_results; $this->page_size = $response->list_info->page_size; property_exists($response, $this->list_type) && $this->setCollection($response->{$this->list_type}); return $this; }
Populate from response @param stdClass $response @return static @see static::setCollection()
entailment
public function addSignerfile($file) { if (!file_exists($file)) { throw new Error('file not found', 'File does not exist. Please use an absolute file path.'); } $this->signer_file = fopen($file, 'rb'); return $this; }
Adds a list of signers in a CSV file. Required unless signer_list is used. @param string $file path for signer_file @return BulkSendJob @ignore
entailment
public function sendSignatureRequest(SignatureRequest $request) { $params = $request->toParams(); $response = $this->rest->post( static::SIGNATURE_REQUEST_SEND_PATH, $params ); $this->checkResponse($response); return $request->fromResponse($response); }
Send a new SignatureRequest with the submitted documents @param SignatureRequest $request @return SignatureRequest @throws BaseException
entailment
public function cancelSignatureRequest($id) { $response = $this->rest->post( static::SIGNATURE_REQUEST_CANCEL_PATH . '/' . $id ); $this->checkResponse($response, false); return true; }
Cancels an existing signature request If it has been completed, it will delete the signature request from your account. @param string $id @return boolean @throws BaseException
entailment
public function requestEmailReminder($request_id, $email, $name = null) { $response = $this->rest->post( static::SIGNATURE_REQUEST_REMIND_PATH . '/' . $request_id, array('email_address' => $email, 'name' => $name) ); $this->checkResponse($response); return new SignatureRequest($response); }
Instructs HelloSign to email the given address with a reminder to sign the SignatureRequest referenced by the given request ID. Note: You cannot send a reminder within 1 hour of the last reminder that was sent, manually or automatically. @param string $request_id Signature Request ID @param string $email Email address of the signer @param string $name Name of signer to send reminder to (optional) @return SignatureRequest @throws BaseException
entailment
public function updateSignatureRequest($request_id, $signature_id, $email) { $response = $this->rest->post( static::SIGNATURE_REQUEST_UPDATE_PATH . '/' . $request_id, array('signature_id' => $signature_id, 'email_address' => $email) ); $this->checkResponse($response); return new SignatureRequest($response); }
Updates the email address for a given signer on a SignatureRequest @param string $request_id Signature Request ID to update @param string $signature_id The Signature ID for the recipient @param string $email The new email address for the recipient @return SignatureRequest @throws BaseException
entailment
public function removeSignatureRequestAccess($request_id) { $response = $this->rest->post( static::SIGNATURE_REQUEST_REMOVE_PATH . '/' . $request_id ); $this->checkResponse($response, false); return true; }
Removes your access to a completed SignatureRequest. Note that this action is NOT reversible. @param string $request_id Signature Request ID to remove access @return boolean @throws BaseException
entailment
public function getFiles($request_id, $dest_path = null, $type = null) { if ($dest_path) { // file stream $response = $this->rest->get( static::SIGNATURE_REQUEST_FILES_PATH . '/' . $request_id, $type ? array('file_type' => $type) : null ); $this->checkResponse($response, false); file_put_contents($dest_path, $response); } else { // link $response = $this->rest->get( static::SIGNATURE_REQUEST_FILES_PATH . '/' . $request_id, array('get_url' => true) ); return new FileResponse($response); } return $response; }
Retrieves a link or copy of the files associated with a signature request @param string $request_id @param string $dest_path (optional) where should the file be saved. Will retrieve link if empty. @param string $type (optional) get the files as a single pdf or a zip of many. Links will always be pdfs. @return string @throws BaseException
entailment
public function getTemplate($id) { $response = $this->rest->get( static::TEMPLATE_PATH . '/' . $id ); $this->checkResponse($response); return new Template($response); }
Retrieves the specified Template @param string $id Template ID to retrieve @return stdClass @throws BaseException
entailment
public function getTemplates($page = 1, $page_size = null, $account_id = null) { $response = $this->rest->get(static::TEMPLATE_LIST_PATH, array('account_id' => $account_id, 'page' => $page, 'page_size' => $page_size) ); $this->checkResponse($response); $list = new TemplateList($response); if ($page > $list->getNumPages()) { throw new Error('page_not_found', 'Page not found'); } return $list; }
Retrieves a list of Templates that are accessible by this account @param integer $page Specified page number to return. Defaults to 1. (optional) @param integer $page_size Number of objects to return per page between 1 and 100. Defaults to 20. (optional) @param string $account_id Account ID to return Templates for. Defaults to your account. (optional) @return TemplateList @throws BaseException
entailment
public function addTemplateUser($template_id, $id_or_email) { $key = strpos($id_or_email, '@') ? 'email_address' : 'account_id'; $response = $this->rest->post( static::TEMPLATE_ADD_USER_PATH . '/' . $template_id, array($key => $id_or_email) ); $this->checkResponse($response); return new Template($response); }
Gives the specified Account access to the specified Template. The user can be designated using their account ID or email address. @param string $template_id Template ID to give the Account access to. @param string $id_or_email Account ID or email address to give access to the Template. @return Template @throws BaseException
entailment
public function removeTemplateUser($template_id, $id_or_email) { $key = strpos($id_or_email, '@') ? 'email_address' : 'account_id'; $response = $this->rest->post( static::TEMPLATE_REMOVE_USER_PATH . '/' . $template_id, array($key => $id_or_email) ); $this->checkResponse($response); return new Template($response); }
Removes the specified Account access to the specified Template. The user can be designated using their account ID or email. @param string $template_id Template ID to remove the Account access to. @param string $id_or_email Account ID or email address to remove access to the Template. @return Template @throws BaseException
entailment
public function createEmbeddedDraft(Template $request) { $response = $this->rest->post( static::TEMPLATE_CREATE_EMBEDDED_DRAFT, $request->toEmbeddedDraftParams() ); $this->checkResponse($response); return new Template($response); }
The first step in an EmbeddedTemplate workflow. Creates a draft template that can then be further set up in the template 'edit' stage. @param Template $request @return Template @throws BaseException
entailment
public function deleteTemplate($template_id) { $response = $this->rest->post( static::TEMPLATE_DELETE_PATH . '/' . $template_id ); $this->checkResponse($response, false); return true; }
Deletes the specified Template from the Account. @param string $template_id Template ID to delete @return boolean @throws BaseException
entailment
public function getTemplateFiles($template_id, $dest_path = null, $type = 'pdf') { if ($dest_path) { // file stream $response = $this->rest->get( static::TEMPLATE_FILES_PATH . '/' . $template_id, $type ? array('file_type' => $type) : null ); $this->checkResponse($response, false); file_put_contents($dest_path, $response); } else { // link $response = $this->rest->get( static::TEMPLATE_FILES_PATH . '/' . $template_id, array('get_url' => true) ); } return $response; }
Retrieves a link or copy of the files associated with a template @param string $template_id Template ID to retrieve files @param string $dest_path Where should the file be saved. Will retrieve link if empty. (optional) @param string $type Return the files as a single PDF or a zip of each document. Links will always be PDFs. (optional) @return string @throws BaseException
entailment
public function updateTemplateFiles($template_id, Template $request) { $params = $request->toUpdateParams(); $response = $this->rest->post( static::TEMPLATE_UPDATE_FILES_PATH . '/' . $template_id, $params ); return new Template($response); }
Creates a new Template using the overlay of specified Template @param string $template_id Template ID to update @param Template $request Template Object settings to apply to the new Template @return string
entailment
public function sendTemplateSignatureRequest(TemplateSignatureRequest $request) { $params = $request->toParams(); $response = $this->rest->post( static::TEMPLATE_SIGNATURE_REQUEST_PATH, $params ); $this->checkResponse($response); return new SignatureRequest($response); }
Creates a new Signature Request based on the Template provided @param TemplateSignatureRequest $request @return SignatureRequest @throws BaseException
entailment
public function getSignatureRequest($id) { $response = $this->rest->get( static::SIGNATURE_REQUEST_PATH . '/' . $id ); $this->checkResponse($response); return new SignatureRequest($response); }
Retrieves a SignatureRequest with the given ID @param String $id Signature Request ID @return SignatureRequest @throws BaseException
entailment
public function getSignatureRequests($page = 1) { $params = array( 'page' => $page ); $response = $this->rest->get( static::SIGNATURE_REQUEST_LIST_PATH, $params ); $this->checkResponse($response); $list = new SignatureRequestList($response); if ($page > $list->getNumPages()) { throw new Error('page_not_found', 'Page not found'); } return $list; }
Retrieves the current user's signature requests. The resulting object represents a paged query result. @param Integer $page @return SignatureRequestList @throws BaseException
entailment
public function createEmbeddedSignatureRequest(EmbeddedSignatureRequest $request) { $params = $request->toParams(); // choose url $url = $request->isUsingTemplate() ? static::SIGNATURE_REQUEST_EMBEDDED_TEMPLATE_PATH : static::SIGNATURE_REQUEST_EMBEDDED_PATH; $response = $this->rest->post($url, $params); $this->checkResponse($response); return new SignatureRequest($response); }
Creates a SignatureRequest that can be embedded within your website @param EmbeddedSignatureRequest $request @return SignatureRequest @throws BaseException
entailment
public function getEmbeddedSignUrl($id) { $response = $this->rest->get( static::EMBEDDED_SIGN_URL_PATH . '/' . $id ); $this->checkResponse($response); return new EmbeddedResponse($response); }
Retrieves an embedded object containing a signature URL that can be opened in an iFrame. @param string $id The signature_id of the SignatureRequest to embed @return EmbeddedResponse @throws BaseException
entailment
public function getEmbeddedEditUrl($id, Template $request = null) { if ($request !== null) { $params = $request->toParams(); $response = $this->rest->post( static::EMBEDDED_EDIT_URL_PATH . '/' . $id, $params ); } else { $response = $this->rest->get( static::EMBEDDED_EDIT_URL_PATH . '/' . $id ); } $this->checkResponse($response); return new EmbeddedResponse($response); }
Retrieves an embedded object containing an edit URL that can be opened in an iFrame to edit an EmbeddedTemplate. @param string $id The ID of the EmbeddedTemplate to edit or create. @param Template $request Template object with settings for the Embedded Template @return EmbeddedResponse @throws BaseException
entailment
public function createUnclaimedDraft(UnclaimedDraft $draft) { // choose url $url = $draft->getClientId() ? static::UNCLAIMED_DRAFT_CREATE_EMBEDDED_PATH : static::UNCLAIMED_DRAFT_CREATE_PATH; $response = $this->rest->post($url, $draft->toParams()); $this->checkResponse($response); return $draft->fromResponse($response); }
Creates an UnclaimedDraft using the provided request draft object @param UnclaimedDraft $draft @return UnclaimedDraft The created draft @throws BaseException
entailment
public function createUnclaimedDraftEmbeddedWithTemplate(EmbeddedSignatureRequest $request) { $url = static::UNCLAIMED_DRAFT_CREATE_EMBEDDED_WITH_TEMPLATE_PATH; $response = $this->rest->post($url, $request->toParams()); $this->checkResponse($response); $draft = new UnclaimedDraft(); return $draft->fromResponse($response); }
Creates an UnclaimedDraft using the provided request draft object @param EmbeddedSignatureRequest $request @return UnclaimedDraft The created draft @throws BaseException
entailment
public function unclaimedDraftEditAndResend($id, UnclaimedDraft $draft) { $response = $this->rest->post( static::UNCLAIMED_DRAFT_EDIT_AND_RESEND_PATH . '/' . $id, $draft->toEditParams() ); $this->checkResponse($response); return $draft->fromResponse($response); }
Creates a new SignatureRequest from another request that can be edited prior to being sent to the recipients. @param string $id The Signature Request ID to copy @param UnclaimedDraft $draft @return UnclaimedDraft The newly created draft @throws BaseException
entailment
public function requestOAuthToken(OAuthTokenRequest $request, $auto_set_request_token = false) { $rest = new REST(array( 'server' => $this->oauth_token_url, 'debug_mode' => $this->debug_mode )); if ($this->oauth_token_url != self::OAUTH_TOKEN_URL) { $this->disableCertificateCheck($rest); } $response = $rest->post('', $request->toParams()); $this->checkResponse($response); $this->checkOAuthTokenResponse($response); // populate object from response $token = new OAuthToken($response); if ($auto_set_request_token) { $this->rest = $this->createREST($token); } return $token; }
Performs an OAuth request and returns the OAuthToken object for authorizing an API App, and will automatically set the access token for making authenticated requests with this client. @param OAuthTokenRequest $request @param boolean $auto_set_request_token true if the token should be immediately applied to this client @return OAuthToken object containing OAuth token details @throws BaseException
entailment
public function refreshOAuthToken(OAuthToken $token, $auto_set_request_token = false) { $rest = new REST(array( 'server' => $this->oauth_token_url, 'debug_mode' => $this->debug_mode )); if ($this->oauth_token_url != self::OAUTH_TOKEN_URL) { $this->disableCertificateCheck($rest); } $response = $rest->post('', $token->toParams()); $this->checkResponse($response); $this->checkOAuthTokenResponse($response); // populate object from response $token->fromObject($response); if ($auto_set_request_token) { $this->rest = $this->createREST($token); } return $token; }
Refresh OAuth token, and will automatically set the access token for making authenticated requests with this client. @param OAuthToken $token @param boolean $auto_set_request_token true if the token should be immediately applied to this client @return OAuthToken object containing OAuth token details @throws BaseException
entailment
public function getAccount() { $response = $this->rest->get( static::ACCOUNT_PATH ); $this->checkResponse($response); return new Account($response); }
Returns the current user's HelloSign account information @return Account @throws BaseException
entailment
public function isAccountValid($email) { $response = $this->rest->post( static::ACCOUNT_VALIDATE_PATH, array( 'email_address' => $email ) ); $this->checkResponse($response); return property_exists($response, 'account'); }
Returns true if an Account exists with the provided email address. Note this is limited to the visibility of the currently authenticated user. @param string $email Email address to validate. @return boolean @throws BaseException
entailment
public function createAccount(Account $account, $client_id = null, $client_secret = null) { $post = $account->toCreateParams(); if ($client_id) { $post += array( 'client_id' => $client_id, 'client_secret' => $client_secret ); } $response = $this->rest->post( static::ACCOUNT_CREATE_PATH, $post ); $this->checkResponse($response); return $account->fromResponse($response); }
Creates a new HelloSign account If client_id & client_secret null: The user will still need to validate their email address to complete the creation process. Else: Creates a new HelloSign account and provides OAuth app credentials to generate an OAuth token automatically with the user Account response. @param Account $account @param string $client_id (optional) @param string $client_secret (optional) @return Account @throws BaseException
entailment
public function updateAccount(Account $account) { $response = $this->rest->post( static::ACCOUNT_PATH, $account->toUpdateParams() ); $this->checkResponse($response); return $account->fromResponse($response); }
Updates your Account's settings @param Account $account @return Account @throws BaseException
entailment
public function getTeam() { $response = $this->rest->get( static::TEAM_PATH ); $this->checkResponse($response); return new Team($response); }
Retrieves the Team for the current Account @return Team @throws BaseException
entailment
public function createTeam(Team $team) { $response = $this->rest->post( static::TEAM_CREATE_PATH, $team->toCreateParams() ); $this->checkResponse($response); return $team->fromResponse($response); }
Creates a new Team for the current Account @param Team $team @return Team @throws BaseException
entailment
public function updateTeamName($name) { $response = $this->rest->post( static::TEAM_PATH, array( 'name' => $name ) ); $this->checkResponse($response); return new Team($response); }
Updates the current Account's Team name @param string $name New Team name @return Team @throws BaseException
entailment
public function destroyTeam() { $response = $this->rest->post( static::TEAM_DESTROY_PATH ); $this->checkResponse($response, false); return true; }
Deletes the current Account's Team @return boolean @throws BaseException
entailment
public function inviteTeamMember($id_or_email) { $key = strpos($id_or_email, '@') ? 'email_address' : 'account_id'; $response = $this->rest->post( static::TEAM_ADD_MEMBER_PATH, array($key => $id_or_email) ); $this->checkResponse($response); return new Team($response); }
Adds the specified Account to the current Team @param string $id_or_email Account ID or email address of the Account to invite @return Team @throws BaseException
entailment
public function removeTeamMember($id_or_email) { $key = strpos($id_or_email, '@') ? 'email_address' : 'account_id'; $response = $this->rest->post( static::TEAM_REMOVE_MEMBER_PATH, array($key => $id_or_email) ); $this->checkResponse($response); return new Team($response); }
Removes the specified Account from the current Team @param string $id_or_email Account ID or email address of the Account to remove @return Team @throws BaseException
entailment
public function removeAllTeamMembers() { $team = $this->getTeam(); $last_team = $team; foreach ($team->getAccounts() as $account) { if (!$account->isTeamAdmin()) { $last_team = $this->removeTeamMember($account->getId()); } } return $last_team; }
Removes all team members from current Team @return Team @throws BaseException
entailment
protected function checkResponse($response, $strict = true) { $status = $this->rest->getStatus(); if ($response === false) { throw new Error('unknown', 'Unknown error', $status); } elseif ($strict && is_string($response)) { throw new Error('invalid_format', 'Response should be returned in JSON format', $status); } elseif ($status >= 400) { if (property_exists($response, 'error')) { throw new Error($response->error->error_name, $response->error->error_msg, $status); } else { throw new Error(null, null, $status); } } }
Checks response and throws Exception if response is not proper @param mixed $response @param boolean $strict @throws BaseException @ignore
entailment
protected function checkOAuthTokenResponse($response) { if (property_exists($response, 'error') && property_exists($response, 'error_description')) { throw new Error($response->error, $response->error_description); } }
Checks response and throws Exception if response is not proper @param stdClass $response @throws Error @ignore
entailment
protected function createREST($first, $last = null, $api_url = self::API_URL) { if ($first instanceof OAuthToken) { $rest = new REST(array( 'server' => $api_url, 'debug_mode' => $this->debug_mode )); $auth = $first->getTokenType() . ' ' . $first->getAccessToken(); $rest->setHeader('Authorization', $auth); return $rest; } return new REST(array( 'server' => $api_url, 'user' => $first, 'pass' => $last, 'debug_mode' => $this->debug_mode )); }
Creates REST object @param mixed $first email address or apikey or OAuthToken @param string $last Null if using apikey or OAuthToken @return REST @ignore
entailment
public function createApiApp(ApiApp $apiApp) { $post = $apiApp->toCreateParams(); $response = $this->rest->post( static::APIAPP_PATH, $post ); $this->checkResponse($response); return $apiApp->fromResponse($response); }
Creates a new API App @param ApiApp $apiApp @return ApiApp @throws BaseException
entailment
public function updateApiApp($client_id, ApiApp $app) { $response = $this->rest->post( static::APIAPP_PATH . '/' . $client_id, $app->toUpdateParams() ); $this->checkResponse($response); return $app->fromResponse($response); }
Updates your API App's settings @param ApiApp $apiApp @return ApiApp @throws BaseException
entailment
public function getApiApp($id) { $params = array(); $response = $this->rest->get( static::APIAPP_PATH . '/' . $id, $params ); $this->checkResponse($response); return new ApiApp($response); }
Retrieves an API App with the given Client ID @param String $id Client ID @return ApiApp @throws BaseException
entailment
public function deleteApiApp($client_id) { $response = $this->rest->delete( static::APIAPP_PATH . '/' . $client_id ); $this->checkResponse($response, false); return true; }
Completely deletes the API app specified from the account. @param string $client_id client ID @return boolean @throws BaseException
entailment
public function getApiApps($page = 1, $page_size = 20) { $response = $this->rest->get(static::APIAPP_LIST_PATH, array('page' => $page, 'page_size' => $page_size)); $this->checkResponse($response); $list = new ApiAppList($response); if ($page > $list->getNumPages()) { throw new Error('page_not_found', 'Page not found'); } return $list; }
Retrieves a list of API Apps for account @param integer $page @param integer $page_size @return ApiAppList @throws BaseException
entailment
public function sendBulkSendJobWithTemplate(BulkSendJob $request) { $params = $request->toParams(); $response = $this->rest->post( static::SIGNATURE_REQUEST_BULK_SEND_PATH, $params ); $this->checkResponse($response); return new BulkSendJob($response); }
Creates a new Bulk Send Job using the specified Template @param BulkSendJob $request @return BulkSendJob @throws BaseException
entailment
public function sendEmbeddedBulkSendJobWithTemplate(EmbeddedBulkSendJob $request) { $params = $request->toParams(); $response = $this->rest->post( static::SIGNATURE_REQUEST_EMBEDDED_BULK_SEND_PATH, $params ); $this->checkResponse($response); return new BulkSendJob($response); }
Creates a new embedded Bulk Send Job using the specified Template @param EmbeddedBulkSendJob $request @return BulkSendJob @throws BaseException
entailment
public function getBulkSendJob($id) { $params = array(); $response = $this->rest->get( static::BULK_SEND_JOB_PATH . '/' . $id, $params ); $this->checkResponse($response); return new BulkSendJob($response); }
Retrieves a Bulk Send Job with the given Bulk Send Job ID @param String $id Bulk Send Job ID @return BulkSendJob @throws BaseException
entailment
public function getBulkSendJobs($page = 1, $page_size = 20) { $response = $this->rest->get(static::BULK_SEND_JOB_LIST_PATH, array('page' => $page, 'page_size' => $page_size)); $this->checkResponse($response); $list = new BulkSendJobList($response); if ($page > $list->getNumPages()) { throw new Error('page_not_found', 'Page not found'); } return $list; }
Retrieves a list of Bulk Send Jobs for account @param integer $page @param integer $page_size @return BulkSendJobList @throws BaseException
entailment
public function getParsedBody() { $parsedBody = $this->serverRequest->getParsedBody(); if ($parsedBody !== null) { return $parsedBody; } $mediaType = $this->getMediaType(); if ($mediaType === null) { return null; } // Check if this specific media type has a parser registered first if (!isset($this->bodyParsers[$mediaType])) { // If not, look for a media type with a structured syntax suffix (RFC 6839) $parts = explode('+', $mediaType); if (count($parts) >= 2) { $mediaType = 'application/' . $parts[count($parts) - 1]; } } if (isset($this->bodyParsers[$mediaType])) { $body = (string)$this->getBody(); $parsed = $this->bodyParsers[$mediaType]($body); if (!is_null($parsed) && !is_object($parsed) && !is_array($parsed)) { throw new RuntimeException( 'Request body media type parser return value must be an array, an object, or null' ); } return $parsed; } return null; }
Retrieve any parameters provided in the request body. If the request Content-Type is either application/x-www-form-urlencoded or multipart/form-data, and the request method is POST, this method MUST return the contents of $_POST. Otherwise, this method may return any results of deserializing the request body content; as parsing returns structured content, the potential types MUST be arrays or objects only. A null value indicates the absence of body content. @return null|array|object The deserialized body parameters, if any. These will typically be an array or object.
entailment