use of org.finos.symphony.toolkit.spring.api.factories.ApiInstance in project spring-bot by finos.
the class TestOboCall method doSomethingOBORSA.
@Test
public void doSomethingOBORSA() throws Exception {
ApiInstance ai = oboInstanceFactory.createApiInstance(1234l, "1000");
MessagesApi messagesApi = ai.getAgentApi(MessagesApi.class);
messagesApi.v4MessageBlastPost(STREAM_IDS, MESSAGE_CONTENT, null, null, null, null, null, null);
}
use of org.finos.symphony.toolkit.spring.api.factories.ApiInstance in project spring-bot by finos.
the class KoreAIBridgeFactoryImpl method buildBridge.
@Override
public SymphonyStreamHandler buildBridge(KoreAIInstanceProperties props) {
String email = "--no email--";
try {
// build KoreAI pipeline
ApiInstance apiInstance = symphonyAPIInstance(props);
email = apiInstance.getIdentity().getEmail();
KoreAIResponseBuilder koreAIResponseBuilder = koreAIResponseBuilder();
KoreAIResponseHandler koreAIResponseHandler = responseMessageAdapter(apiInstance, props);
KoreAIRequester requester = koreAIRequester(props, koreAIResponseHandler, koreAIResponseBuilder);
List<StreamEventConsumer> consumers = new ArrayList<StreamEventConsumer>();
consumers.add(koreAIEventHandler(requester, apiInstance, props));
if (props.isSendWelcomeMessage()) {
consumers.add(new RoomWelcomeEventConsumer(apiInstance.getAgentApi(MessagesApi.class), apiInstance.getPodApi(UsersApi.class), apiInstance.getIdentity(), props.getWelcomeMessageML()));
}
// wire this up to a shared stream
SymphonyStreamHandler out = sshf.createBean(apiInstance, consumers);
return out;
} catch (Exception e) {
LOG.error("Couldn't construct Kore/Symphony bridge bean for " + email, e);
return null;
}
}
use of org.finos.symphony.toolkit.spring.api.factories.ApiInstance in project spring-bot by finos.
the class SymphonyAdminController method getAPI.
protected <X> X getAPI(Class<X> x) throws IOException, Exception {
Config config = getConfig();
SymphonyIdentity identity = IdentityProperties.instantiateIdentityFromDetails(rl, config.getIdentityProperties(), getObjectMapper());
ApiBuilderFactory abf = new ApiBuilderFactory() {
@Override
public boolean isSingleton() {
return false;
}
@Override
public Class<?> getObjectType() {
return ApiBuilder.class;
}
@Override
public ConfigurableApiBuilder getObject() throws Exception {
return new CXFApiBuilder();
}
};
ApiInstanceFactory apiInstanceFactory = new TokenManagingApiInstanceFactory(abf);
ApiInstance instance = apiInstanceFactory.createApiInstance(identity, config.getPodProperties(), null);
X out = instance.getAgentApi(x);
return out;
}
use of org.finos.symphony.toolkit.spring.api.factories.ApiInstance in project spring-bot by finos.
the class KoreAIBridgeFactoryImpl method symphonyAPIInstance.
public ApiInstance symphonyAPIInstance(KoreAIInstanceProperties props) {
try {
SymphonyIdentity symphonyBotIdentity = IdentityProperties.instantiateIdentityFromDetails(rl, props.getSymphonyBot(), om);
TrustManager[] tms = tmf == null ? null : tmf.getTrustManagers();
ApiInstance apiInstance = apiInstanceFactory.createApiInstance(symphonyBotIdentity, podProperties, tms);
LOG.info("Constructed API Factory for {} ", props.getName());
return apiInstance;
} catch (Exception e) {
LOG.error("Couldn't create API instance for {} ", props.getName());
throw new UnsupportedOperationException("Couldn't get api instance: ", e);
}
}
use of org.finos.symphony.toolkit.spring.api.factories.ApiInstance in project spring-bot by finos.
the class TestOboCall method doSomethingOBOCert.
@Test
public void doSomethingOBOCert() throws Exception {
ApiInstance ai = oboInstanceFactory.createApiInstance(1234l, "1001");
MessagesApi messagesApi = ai.getAgentApi(MessagesApi.class);
messagesApi.v4MessageBlastPost(STREAM_IDS, MESSAGE_CONTENT, null, null, null, null, null, null);
}
Aggregations