Skip to content

Commit

Permalink
Add getRecentCampaigns to blaze service
Browse files Browse the repository at this point in the history
  • Loading branch information
kean committed Jun 8, 2023
1 parent 328640e commit 21afec0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def wordpress_ui
end

def wordpress_kit
pod 'WordPressKit', '~> 8.2-beta'
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: ''
# pod 'WordPressKit', '~> 8.2-beta'
pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: 'feature/add-blaze-campaigns-endpoints'
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: ''
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: ''
# pod 'WordPressKit', path: '../WordPressKit-iOS'
Expand Down
15 changes: 10 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ PODS:
- WordPressKit (~> 8.0-beta)
- WordPressShared (~> 2.1-beta)
- WordPressUI (~> 1.7-beta)
- WordPressKit (8.2.0):
- WordPressKit (8.3.0-beta.1):
- Alamofire (~> 4.8.0)
- NSObject-SafeExpectations (~> 0.0.4)
- UIDeviceIdentifier (~> 2.0)
Expand Down Expand Up @@ -612,7 +612,7 @@ DEPENDENCIES:
- SwiftLint (~> 0.50)
- WordPress-Editor-iOS (~> 1.19.8)
- WordPressAuthenticator (~> 6.1-beta)
- WordPressKit (~> 8.2-beta)
- WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, branch `feature/add-blaze-campaigns-endpoints`)
- WordPressShared (from `https://github.com/wordpress-mobile/WordPress-iOS-Shared.git`, branch `trunk`)
- WordPressUI (~> 1.12.5)
- WPMediaPicker (~> 1.8-beta)
Expand Down Expand Up @@ -661,7 +661,6 @@ SPEC REPOS:
- UIDeviceIdentifier
- WordPress-Aztec-iOS
- WordPress-Editor-iOS
- WordPressKit
- WordPressUI
- WPMediaPicker
- wpxmlrpc
Expand Down Expand Up @@ -776,6 +775,9 @@ EXTERNAL SOURCES:
:git: https://github.com/wordpress-mobile/gutenberg-mobile.git
:submodules: true
:tag: v1.97.0-alpha1
WordPressKit:
:branch: feature/add-blaze-campaigns-endpoints
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git
WordPressShared:
:branch: trunk
:git: https://github.com/wordpress-mobile/WordPress-iOS-Shared.git
Expand All @@ -794,6 +796,9 @@ CHECKOUT OPTIONS:
:git: https://github.com/wordpress-mobile/gutenberg-mobile.git
:submodules: true
:tag: v1.97.0-alpha1
WordPressKit:
:commit: efdf32d8ba5ecf18c4e49f08209cf1ef8756387d
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git
WordPressShared:
:commit: 9a010fdab8d31f9e1fa0511f231e7068ef0170b1
:git: https://github.com/wordpress-mobile/WordPress-iOS-Shared.git
Expand Down Expand Up @@ -885,7 +890,7 @@ SPEC CHECKSUMS:
WordPress-Aztec-iOS: 7d11d598f14c82c727c08b56bd35fbeb7dafb504
WordPress-Editor-iOS: 9eb9f12f21a5209cb837908d81ffe1e31cb27345
WordPressAuthenticator: b0b900696de5129a215adcd1e9ae6eb89da36ac8
WordPressKit: d9015b097a58096033775dd8fc026d7d42005ae2
WordPressKit: eab8f16472a869721b3c5ecce0089f467cf6602d
WordPressShared: 87f3ee89b0a3e83106106f13a8b71605fb8eb6d2
WordPressUI: c5be816f6c7b3392224ac21de9e521e89fa108ac
WPMediaPicker: 0d40b8d66b6dfdaa2d6a41e3be51249ff5898775
Expand All @@ -900,6 +905,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
ZIPFoundation: ae5b4b813d216d3bf0a148773267fff14bd51d37

PODFILE CHECKSUM: c4bdcbac21a417ad5d771fc6fe99602db67b4fa8
PODFILE CHECKSUM: d2bc1efbb0c1760c24438c6dd6c89be1150c617f

COCOAPODS: 1.12.1
14 changes: 14 additions & 0 deletions WordPress/Classes/Services/BlazeService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,18 @@ import WordPressKit
completion?()
}, on: .main)
}

func getRecentCampaigns(for blog: Blog,
completion: @escaping (Result<BlazeCampaignsSearchResponse, Error>) -> Void) {
guard let siteId = blog.dotComID?.intValue else {
DDLogError("Invalid site ID for Blaze")
completion(.failure(BlazeServiceError.missingBlogId))
return
}
remote.searchCampaigns(forSiteId: siteId, callback: completion)
}
}

enum BlazeServiceError: Error {
case missingBlogId
}

0 comments on commit 21afec0

Please sign in to comment.