Skip to content

Conversation

pryrnjn
Copy link

@pryrnjn pryrnjn commented May 13, 2022

No description provided.

<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundant comment

@Getter
@Setter
@ToString
@AllArgsConstructor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data lombok's annotation can be used instead of a combination of Getter,Setter,ToString


private final HttpCommandExecutor httpCommandExecutor;

MarketoTriggerCampaignClient(HttpCommandExecutor httpCommandExecutor) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it isn't a public?
you can use @requiredargsconstructor lombok annotation

public TriggerCampaignResult requestTriggerCampaign(int campaignId,
TriggerCampaignRequest.LeadId[] leadIds)
throws MarketoApiException {
return this.requestTriggerCampaign(campaignId, leadIds,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omit redundant 'this'

new TriggerCampaignRequest.Token[]{});
}

public TriggerCampaignResult requestTriggerCampaign(int campaignId,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have only one method:
TriggerCampaignResult requestTriggerCampaign(int campaignId, TriggerCampaignRequest triggerCampaignRequest)
and construct TriggerCampaignRequest outside client.

in your case, your split constructing TriggerCampaignRequest into 2 places, outside client your construct leadIds and tokens, inside client ( in RequestTriggerCampaign ) - wrap them in TriggerCampaignRequest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, maybe it is just the bad model for TriggerCampaignRequest.
and you need something like:

public TriggerCampaignResult requestTriggerCampaign(
int campaignId, 
List<Integer> leadIds, 
List<TriggerCampaignToken> tokens)

throws MarketoApiException {
List<TriggerCampaignResult> triggerCampaignResults = httpCommandExecutor.execute(
new RequestTriggerCampaign(campaignId, leadIds, tokens));
return triggerCampaignResults.get(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the context, but it is an unsafe call. check size isn't empty at least. the same in next method

@Setter
@ToString
@AllArgsConstructor
public class TriggerCampaignRequest {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, it is confusing with RequestTriggerCampaign

Copy link
Contributor

@anastasiia-kryshtop anastasiia-kryshtop May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request data (leads and tokens) should be moved to the appropriate command (RequestTriggerCampaignCommand)


import java.util.List;

public class MarketoTriggerCampaignClient {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add some tests for the new client


MarketoTokenClient getMarketoTokenClient();

MarketoTriggerCampaignClient getMarketoTriggerCampaignClient();
Copy link
Contributor

@anastasiia-kryshtop anastasiia-kryshtop May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming convention of the Marketo and this sdk is not followed. I suggest to rename this client to SmartCampaignClient or CampaignClient. It will be able to be extended with other smart campaign endpoints.

@Setter
@ToString
@AllArgsConstructor
public static class LeadId {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Setter
@ToString
@AllArgsConstructor
public static class Token {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like in the previous comment it should be separate domain class Token

import lombok.ToString;

@Getter @Setter @ToString
public class TriggerCampaignResult {
Copy link
Contributor

@anastasiia-kryshtop anastasiia-kryshtop May 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Result of request trigger command should be Array of Campaign domain classes

Copy link
Contributor

@kdudina-smartling kdudina-smartling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like is deprecated request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants