use of org.talend.components.marketo.runtime.client.MarketoClientServiceExtended in project components by Talend.
the class MarketoSourceOrSink method getSchemaNames.
@Override
public List<NamedThing> getSchemaNames(RuntimeContainer container) throws IOException {
List<NamedThing> customObjects = new ArrayList<>();
MarketoClientServiceExtended client = (MarketoClientServiceExtended) getClientService(null);
TMarketoInputProperties ip = new TMarketoInputProperties("COSchemas");
ip.init();
ip.connection = properties.getConnectionProperties();
ip.inputOperation.setValue(InputOperation.CustomObject);
ip.customObjectAction.setValue(CustomObjectAction.list);
ip.customObjectNames.setValue("");
ip.schemaInput.schema.setValue(MarketoConstants.getCustomObjectDescribeSchema());
MarketoRecordResult r = client.listCustomObjects(ip);
for (IndexedRecord co : r.getRecords()) {
// name cannot be null
String name = co.get(0).toString();
Object displayName = co.get(1);
if (displayName == null) {
displayName = name;
}
customObjects.add(new SimpleNamedThing(name, displayName.toString()));
}
//
return customObjects;
}
Aggregations