99
1010class DeleteRestoreEnvelopeService
1111{
12+ const DELETE_FOLDER_ID = "recyclebin " ;
13+
1214 /**
1315 * Moves envelope to a different folder
1416 *
1517 * @param SignatureClientService $clientService The client service for eSignature
1618 * @param string $accountId The DocuSign Account ID (GUID or short version)
1719 * @param string $envelopeId Envelope ID
1820 * @param string $folderId Destination Folder ID
19- * @param string|null $fromFolderId From Folder ID (optional)
21+ * @param string $fromFolderId From Folder ID
2022 *
2123 * @return \DocuSign\eSign\Model\FoldersResponse
2224 */
@@ -25,7 +27,7 @@ public static function moveEnvelopeToFolder(
2527 string $ accountId ,
2628 string $ envelopeId ,
2729 string $ folderId ,
28- string | null $ fromFolderId
30+ string $ fromFolderId
2931 ): FoldersResponse {
3032 $ foldersApi = $ clientService ->getFoldersApi ();
3133
@@ -37,6 +39,29 @@ public static function moveEnvelopeToFolder(
3739 return $ foldersApi ->moveEnvelopes ($ accountId , $ folderId , $ foldersRequest );
3840 }
3941
42+ /**
43+ * Deletes envelope
44+ *
45+ * @param SignatureClientService $clientService The client service for eSignature
46+ * @param string $accountId The DocuSign Account ID (GUID or short version)
47+ * @param string $envelopeId Envelope ID
48+ *
49+ * @return \DocuSign\eSign\Model\FoldersResponse
50+ */
51+ public static function deleteEnvelope (
52+ SignatureClientService $ clientService ,
53+ string $ accountId ,
54+ string $ envelopeId ,
55+ ): FoldersResponse {
56+ $ foldersApi = $ clientService ->getFoldersApi ();
57+
58+ $ foldersRequest = new FoldersRequest ([
59+ 'envelope_ids ' => [$ envelopeId ],
60+ ]);
61+
62+ return $ foldersApi ->moveEnvelopes ($ accountId , self ::DELETE_FOLDER_ID , $ foldersRequest );
63+ }
64+
4065 /**
4166 * Gets all folders in the account
4267 *
0 commit comments