Skip to content

Commit

Permalink
#60: basic retrieve-support for deliveryProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed Apr 15, 2024
1 parent 23db15a commit ebffd18
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/MetadataTypeDefinitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import dataExtensionField from './metadataTypes/definitions/DataExtensionField.d
import dataExtensionTemplate from './metadataTypes/definitions/DataExtensionTemplate.definition.js';
import dataExtract from './metadataTypes/definitions/DataExtract.definition.js';
import dataExtractType from './metadataTypes/definitions/DataExtractType.definition.js';
import deliveryProfile from './metadataTypes/definitions/DeliveryProfile.definition.js';
import discovery from './metadataTypes/definitions/Discovery.definition.js';
import email from './metadataTypes/definitions/Email.definition.js';
import emailSend from './metadataTypes/definitions/EmailSend.definition.js';
Expand Down Expand Up @@ -53,6 +54,7 @@ export default {
dataExtensionTemplate,
dataExtract,
dataExtractType,
deliveryProfile,
discovery,
email,
emailSend,
Expand Down
2 changes: 2 additions & 0 deletions lib/MetadataTypeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import dataExtensionField from './metadataTypes/DataExtensionField.js';
import dataExtensionTemplate from './metadataTypes/DataExtensionTemplate.js';
import dataExtract from './metadataTypes/DataExtract.js';
import dataExtractType from './metadataTypes/DataExtractType.js';
import deliveryProfile from './metadataTypes/DeliveryProfile.js';
import discovery from './metadataTypes/Discovery.js';
import email from './metadataTypes/Email.js';
import emailSend from './metadataTypes/EmailSend.js';
Expand Down Expand Up @@ -52,6 +53,7 @@ export default {
dataExtensionTemplate,
dataExtract,
dataExtractType,
deliveryProfile,
discovery,
email,
emailSend,
Expand Down
47 changes: 47 additions & 0 deletions lib/metadataTypes/DeliveryProfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
'use strict';

import MetadataType from './MetadataType.js';

/**
* @typedef {import('../../types/mcdev.d.js').BuObject} BuObject
* @typedef {import('../../types/mcdev.d.js').CodeExtract} CodeExtract
* @typedef {import('../../types/mcdev.d.js').CodeExtractItem} CodeExtractItem
* @typedef {import('../../types/mcdev.d.js').MetadataTypeItem} MetadataTypeItem
* @typedef {import('../../types/mcdev.d.js').MetadataTypeItemDiff} MetadataTypeItemDiff
* @typedef {import('../../types/mcdev.d.js').MetadataTypeItemObj} MetadataTypeItemObj
* @typedef {import('../../types/mcdev.d.js').MetadataTypeMap} MetadataTypeMap
* @typedef {import('../../types/mcdev.d.js').MetadataTypeMapObj} MetadataTypeMapObj
* @typedef {import('../../types/mcdev.d.js').SoapRequestParams} SoapRequestParams
* @typedef {import('../../types/mcdev.d.js').TemplateMap} TemplateMap
*/

/**
* DeliveryProfile MetadataType
*
* @augments MetadataType
*/
class DeliveryProfile 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 | string[]} [_] not used
* @param {void | string[]} [__] unused parameter
* @param {string} [key] customer key of single item to retrieve
* @returns {Promise.<MetadataTypeMapObj>} Promise of metadata
*/
static retrieve(retrieveDir, _, __, key) {
return super.retrieveREST(
retrieveDir,
'/legacy/v1/beta/messaging/deliverypolicy/',
null,
key
);
}
}

// Assign definition to static attributes
import MetadataTypeDefinitions from '../MetadataTypeDefinitions.js';
DeliveryProfile.definition = MetadataTypeDefinitions.deliveryProfile;

export default DeliveryProfile;
57 changes: 57 additions & 0 deletions lib/metadataTypes/definitions/DeliveryProfile.definition.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
export default {
bodyIteratorField: 'entry',
dependencies: [],
filter: {},
hasExtended: false,
idField: 'id',
keyField: 'key',
nameField: 'name',
createdDateField: 'createdDate',
createdNameField: null,
lastmodDateField: 'lastUpdated',
lastmodNameField: null,
restPagination: false,
type: 'deliveryProfile',
typeDescription:
'Delivery profiles specify details such as IP address, domain, header inclusion, and footer; Via API we can only check for their existence but not see any details.',
typeRetrieveByDefault: false,
typeName: 'Delivery Profile',
fields: {
id: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: false,
},
key: {
isCreateable: true,
isUpdateable: true,
retrieving: true,
template: true,
},
name: {
isCreateable: true,
isUpdateable: true,
retrieving: true,
template: true,
},
description: {
isCreateable: true,
isUpdateable: true,
retrieving: true,
template: true,
},
createdDate: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: false,
},
lastUpdated: {
isCreateable: false,
isUpdateable: false,
retrieving: true,
template: false,
},
},
};

0 comments on commit ebffd18

Please sign in to comment.