Skip to content

Commit

Permalink
#61: add retrieve/cache support for SendClassification
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Feb 7, 2023
1 parent 4a5dbc9 commit 3d4be2c
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/dist/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ Provides default functionality that can be overwritten by child metadata type cl
<dt><a href="#Script">Script</a> ⇐ <code><a href="#MetadataType">MetadataType</a></code></dt>
<dd><p>Script MetadataType</p>
</dd>
<dt><a href="#SendClassification">SendClassification</a> ⇐ <code><a href="#MetadataType">MetadataType</a></code></dt>
<dd><p>SendClassification MetadataType</p>
</dd>
<dt><a href="#SetDefinition">SetDefinition</a> ⇐ <code><a href="#MetadataType">MetadataType</a></code></dt>
<dd><p>SetDefinition MetadataType</p>
</dd>
Expand Down Expand Up @@ -4504,6 +4507,28 @@ additionally, the documentation for dataExtension and automation should be retur
| --- | --- | --- |
| keyArr | <code>Array.&lt;string&gt;</code> | customerkey of the metadata |

<a name="SendClassification"></a>

## SendClassification ⇐ [<code>MetadataType</code>](#MetadataType)
SendClassification MetadataType

**Kind**: global class
**Extends**: [<code>MetadataType</code>](#MetadataType)
<a name="SendClassification.retrieve"></a>

### SendClassification.retrieve(retrieveDir, [_], [__], [key]) ⇒ <code>Promise.&lt;TYPE.MetadataTypeMapObj&gt;</code>
Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata

**Kind**: static method of [<code>SendClassification</code>](#SendClassification)
**Returns**: <code>Promise.&lt;TYPE.MetadataTypeMapObj&gt;</code> - Promise of metadata

| Param | Type | Description |
| --- | --- | --- |
| retrieveDir | <code>string</code> | Directory where retrieved metadata directory will be saved |
| [_] | <code>void</code> | unused parameter |
| [__] | <code>void</code> | unused parameter |
| [key] | <code>string</code> | customer key of single item to retrieve |

<a name="SetDefinition"></a>

## SetDefinition ⇐ [<code>MetadataType</code>](#MetadataType)
Expand Down
1 change: 1 addition & 0 deletions lib/MetadataTypeDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const MetadataTypeDefinitions = {
query: require('./metadataTypes/definitions/Query.definition'),
role: require('./metadataTypes/definitions/Role.definition'),
script: require('./metadataTypes/definitions/Script.definition'),
sendClassification: require('./metadataTypes/definitions/SendClassification.definition'),
setDefinition: require('./metadataTypes/definitions/SetDefinition.definition'),
transactionalEmail: require('./metadataTypes/definitions/TransactionalEmail.definition'),
transactionalPush: require('./metadataTypes/definitions/TransactionalPush.definition'),
Expand Down
1 change: 1 addition & 0 deletions lib/MetadataTypeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const MetadataTypeInfo = {
query: require('./metadataTypes/Query'),
role: require('./metadataTypes/Role'),
script: require('./metadataTypes/Script'),
sendClassification: require('./metadataTypes/SendClassification'),
setDefinition: require('./metadataTypes/SetDefinition'),
transactionalEmail: require('./metadataTypes/TransactionalEmail'),
transactionalPush: require('./metadataTypes/TransactionalPush'),
Expand Down
40 changes: 40 additions & 0 deletions lib/metadataTypes/SendClassification.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict';

const TYPE = require('../../types/mcdev.d');
const MetadataType = require('./MetadataType');

/**
* SendClassification MetadataType
*
* @augments MetadataType
*/
class SendClassification extends MetadataType {
/**
* Retrieves SOAP based metadata of metadata type into local filesystem. executes callback with retrieved metadata
*
* @param {string} retrieveDir Directory where retrieved metadata directory will be saved
* @param {void} [_] unused parameter
* @param {void} [__] unused parameter
* @param {string} [key] customer key of single item to retrieve
* @returns {Promise.<TYPE.MetadataTypeMapObj>} Promise of metadata
*/
static retrieve(retrieveDir, _, __, key) {
/** @type {TYPE.SoapRequestParams} */
let requestParams = null;
if (key) {
requestParams = {
filter: {
leftOperand: 'CustomerKey',
operator: 'equals',
rightOperand: key,
},
};
}
return super.retrieveSOAP(retrieveDir, requestParams);
}
}

// Assign definition to static attributes
SendClassification.definition = require('../MetadataTypeDefinitions').sendClassification;

module.exports = SendClassification;
113 changes: 113 additions & 0 deletions lib/metadataTypes/definitions/SendClassification.definition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
// https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/sendclassification.html
module.exports = {
bodyIteratorField: 'Results',
dependencies: [],
filter: {},
hasExtended: false,
idField: 'ObjectID',
keyField: 'CustomerKey',
nameField: 'Name',
createdDateField: 'CreatedDate',
createdNameField: null,
lastmodDateField: 'ModifiedDate',
lastmodNameField: null,
restPagination: false,
type: 'sendClassification',
typeDescription:
'Lets admins define Delivery Profile, Sender Profile and CAN-SPAM for an email job in a central location.',
typeRetrieveByDefault: false,
typeName: 'SendClassification',
fields: {
'Client.ID': {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
CreatedDate: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
ModifiedDate: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
CustomerKey: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: false,
},
ObjectID: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: false,
},
Name: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: false,
},
Description: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: false,
},
PartnerKey: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
PartnerProperties: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},

ArchiveEmail: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: true,
},
DeliveryProfile: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
HonorPublicationListOptOutsForTransactionalSends: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
SendClassificationType: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: true,
},
SenderProfile: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
SendPriority: {
isCreateable: false,
isUpdateable: false,
retrieving: false,
template: false,
},
},
};

0 comments on commit 3d4be2c

Please sign in to comment.