Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for creating Blaze campaigns with custom cta_text field #3108

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,8 @@ class BlazeCampaignsStoreTest {
val suggestions = List(10) {
BlazeAdSuggestion(
tagLine = it.toString(),
description = "Ad $it"
description = "Ad $it",
ctaText = "CTA $it"
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package org.wordpress.android.fluxc.model.blaze

data class BlazeAdSuggestion(
val tagLine: String,
val description: String
val description: String,
val ctaText: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ data class BlazeCampaignCreationRequest(
val paymentMethodId: String,
val tagLine: String,
val description: String,
val ctaText: String,
val startDate: Date,
val endDate: Date,
val budget: BlazeCampaignCreationRequestBudget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ class BlazeCreationRestClient @Inject constructor(
),
"site_name" to request.tagLine,
"text_snippet" to request.description,
"cta_text" to request.ctaText,
"target_url" to request.targetUrl,
"url_params" to request.urlParams.entries.joinToString(separator = "&") { "${it.key}=${it.value}" },
"main_image" to JsonObject().apply {
Expand Down Expand Up @@ -366,11 +367,14 @@ private class BlazeAdSuggestionListResponse(
val siteName: String,
@SerializedName("text_snippet")
val textSnippet: String,
@SerializedName("cta_text")
val ctaText: String,
) {
fun toDomainModel(): BlazeAdSuggestion {
return BlazeAdSuggestion(
tagLine = siteName,
description = textSnippet
description = textSnippet,
ctaText = ctaText
)
}
}
Expand Down
Loading