如何从 docusign 结果中删除具有 null 的参数

How to remove parameters that has null from the docusign result

我已经使用 DocuSign Java SDK 实现了端点,它工作正常,但与从 Postman 获得的结果相比,结果有点不同。以下是调用 {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes?folder_ids=out_for_signature&include=recipients&exclude=folders,powerforms 时 Postman 的结果 结果

{
"resultSetSize": "1",
"startPosition": "0",
"endPosition": "0",
"totalSetSize": "1",
"nextUri": "",
"previousUri": "",
"envelopes": [
    {
        "status": "sent",
        "documentsUri": "/envelopes/xxxx-9777-7153b02d44e3/documents",
        "recipientsUri": "/envelopes/axxxxfaf-9777-7153b02d44e3/recipients",
        "attachmentsUri": "/envelopes/xxxxaf-9777-7153b02d44e3/attachments",
        "envelopeUri": "/envelopes/xxxxx4faf-9777-7153b02d44e3",
        "emailSubject": "Please sign this document set",
        "envelopeId": "a826d1da-8cf6-4faf-9777-7153b02d44e3",
        "customFieldsUri": "/envelopes/xxf-9777-7153b02d44e3/custom_fields",
        "notificationUri": "/envelopes/x6-4faf-9777xxxx-7153b02d44e3/notification",
        "createdDateTime": "2021-12-06T21:27:02.8300000Z",
        "lastModifiedDateTime": "2021-12-14T19:45:07.3300000Z",
        "initialSentDateTime": "2021-12-06T21:27:04.0800000Z",
        "sentDateTime": "2021-12-13T20:19:00.8570000Z",
        "statusChangedDateTime": "2021-12-14T19:45:07.3900000Z",
        "documentsCombinedUri": "/envelopes/a826d1da-8cf6-4faf-9777-7153b02d44e3/documents/combined",
        "certificateUri": "/envelopes/xxxx-4faf-9777-7153b02d44e3/documents/certificate",
        "templatesUri": "/envelopes/xxxx4faf-9777-7153b02d44e3/templates",
        "expireEnabled": "true",
        "expireDateTime": "2022-04-05T21:27:04.0800000Z",
        "expireAfter": "111",
        "sender": {
            "userName": "rizauddin Mohammad",
            "userId": "xxxxxx11-987f-0c9253822c79",
            "accountId": "xxxxx-46d2-9f5e-d39f7ffaeec3"
        },
       
            "certifiedDeliveries": [],
            "inPersonSigners": [],
            "seals": [],
            "witnesses": [],
            "notaries": [],
            "recipientCount": "2",
            "currentRoutingOrder": "1"
        },
        "purgeState": "unpurged",
        "isSignatureProviderEnvelope": "false",
        "anySigner": null,
        "envelopeLocation": "current_site"
    }
]

}

以及有这段代码时SDK的结果

final EnvelopesApi envelopesApi = new EnvelopesApi(apiClient);
val options = envelopesApi.new ListStatusChangesOptions();
options.setFolderIds("out_for_signature");
options.setInclude("recipients");
options.setExclude("folders,powerForms");
EnvelopesInformation envelopesInformation = envelopesApi.listStatusChanges(accountId, options);

[
{
    "accessControlListBase64": null,
    "allowComments": null,
    "allowMarkup": null,
    "allowReassign": null,
    "allowViewHistory": null,
    "anySigner": null,
    "asynchronous": null,
    "attachmentsUri": "/envelopes/xxxxx9777-7153b02d44e3/attachments",
    "authoritativeCopy": null,
    "authoritativeCopyDefault": null,
    "autoNavigation": null,
    "brandId": null,
    "brandLock": null,
    "certificateUri": "/envelopes/a826d1da-8cf6-4faf-9777-7153b02d44e3/documents/certificate",
    "completedDateTime": null,
    "copyRecipientData": null,
    "createdDateTime": "2021-12-06T21:27:02.8300000Z",
    "customFields": null,
    "customFieldsUri": "/envelopes/xxxx6-4faf-9777-7153b02d44e3/custom_fields",
    "declinedDateTime": null,
    "deletedDateTime": null,
    "deliveredDateTime": null,
    "disableResponsiveDocument": null,
    "documentBase64": null,
    "documentsCombinedUri": "/envelopes/a826d1da-8cf6-4faf-9777-7153b02d44e3/documents/combined",
    "documentsUri": "/envelopes/xxxxx4faf-9777-7153b02d44e3/documents",
    "emailBlurb": null,
    "emailSettings": null,
    "emailSubject": "Please sign this document set",
    "enableWetSign": null,
    "enforceSignerVisibility": null,
    "envelopeAttachments": null,
    "envelopeDocuments": null,
    "envelopeId": "xxxx-9777-7153b02d44e3",
    "envelopeIdStamping": null,
    "envelopeLocation": "current_site",
    "envelopeMetadata": null,
    "envelopeUri": "/envelopes/xxxxx4faf-9777-7153b02d44e3",
    "expireAfter": "111",
    "expireDateTime": "2022-04-05T21:27:04.0800000Z",
    "expireEnabled": "true",
    "externalEnvelopeId": null,
    
        "certifiedDeliveries": [],
        "currentRoutingOrder": "1",
        "editors": [],
        "errorDetails": null,
        "inPersonSigners": [],
        "intermediaries": [],
        "notaries": [],
        "recipientCount": "2",
        "seals": [],
        "signers": [
            {
                "accessCode": null,
                "accessCodeMetadata": null,
                "addAccessCodeToEmail": null,
                "additionalNotifications": null,
                "agentCanEditEmail": null,
                "agentCanEditName": null,
                "allowSystemOverrideForLockedRecipient": null,
                "autoNavigation": null,
                "autoRespondedReason": null,
                "bulkRecipientsUri": null,
                "canSignOffline": null,
                "clientUserId": null,
                "completedCount": "0",
                "creationReason": "sender",
                "customFields": null,
                "declinedDateTime": null,
                "declinedReason": null,
                "defaultRecipient": null,
                "deliveredDateTime": null,
                "deliveryMethod": "email",
                "deliveryMethodMetadata": null,
                "designatorId": null,
                "designatorIdGuid": null,
                "documentVisibility": null,
                "email": "rizauddin446@gmail.com",
                "emailMetadata": null,
                "emailNotification": null,
                "embeddedRecipientStartURL": null,
                "errorDetails": null,
                "excludedDocuments": null,
                "faxNumber": null,
                "faxNumberMetadata": null,
                "firstName": "",
                "firstNameMetadata": null,
                "fullName": null,
                "fullNameMetadata": null,
                "idCheckConfigurationName": null,
                "idCheckConfigurationNameMetadata": null,
                "idCheckInformationInput": null,
                "identityVerification": null,
                "inheritEmailNotificationConfiguration": null,
                "isBulkRecipient": null,
                "isBulkRecipientMetadata": null,
                "lastName": "",
                "lastNameMetadata": null,
                "lockedRecipientPhoneAuthEditable": null,
                "lockedRecipientSmsEditable": null,
                "name": "rizauddin mohammad",
                "nameMetadata": null,
                "notaryId": null,
                "note": null,
                "noteMetadata": null,
                "offlineAttributes": null,
                "phoneAuthentication": null,
                "phoneNumber": null,
                "proofFile": null,
                "recipientAttachments": null,
                "recipientAuthenticationStatus": null,
                "recipientFeatureMetadata": null,
                "recipientId": "1",
                "recipientIdGuid": "xdcd3-4fxxxxc2-aec2-ef83d86cadaa",
                "recipientSignatureProviders": null,
                "recipientSuppliesTabs": null,
                "recipientType": "signer",
                "recipientTypeMetadata": null,
                "requireIdLookup": "false",
                "requireIdLookupMetadata": null,
                "requireSignerCertificate": null,
                "requireSignOnPaper": null,
                "requireUploadSignature": "false",
                "roleName": null,
                "routingOrder": "1",
                "routingOrderMetadata": null,
                "sentDateTime": null,
                "signatureInfo": null,
                "signedDateTime": null,
                "signInEachLocation": null,
                "signInEachLocationMetadata": null,
                "signingGroupId": null,
                "signingGroupIdMetadata": null,
                "signingGroupName": null,
                "signingGroupUsers": null,
                "smsAuthentication": null,
                "socialAuthentications": null,
                "status": "sent",
                "statusCode": null,
                "suppressEmails": null,
                "tabs": null,
                "templateLocked": null,
                "templateRequired": null,
                "totalTabCount": null,
                "userId": "xxxxx-4e74-aab8-bd1f98e63fb6"
            }
        ],
        "witnesses": []
    },
    
}

]

我必须得到与 Postman 相同的结果。我需要在编码中添加或删除任何选项吗?

在 C# 和 Java 中,DocuSign SDK 不是,但使用 dynamic typing 和现代技术来构建对象。对象必须(从 C# 和 Java 的经典 OOP 设计的本质)具有可以返回的所有各种属性,否则您将需要为返回数据的每种组合使用不同的对象。

I have to get the same result as I get from Postman. Is there any options I need to add or remove in coding?

好吧,您在 SDK 在幕后发送的 JSON 中得到了相同的结果,但该对象具有额外的 null 属性。我不清楚为什么这对您来说是个问题。可以使用简单的空检查来确定其中哪些具有值。您甚至可以通过即时创建动态对象并在确实需要时消除空值来构建自己的动态对象类型。