This repository was archived by the owner on Sep 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Sources/WordPressKit/Services Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ let package = Package(
1212 . binaryTarget(
1313 name: " WordPressKit " ,
1414 url: " https://github.com/user-attachments/files/20127687/WordPressKit.zip " ,
15- checksum: " bbc81f893eb080a176d018f53d85e6747e529799309c0245c9e204053e75e138 "
15+ checksum: " 13aa0e5952616a2f01a0f0db370ee7925d58253c2aab6e216671e8a013ab471b "
1616 ) ,
1717 ]
1818)
Original file line number Diff line number Diff line change @@ -244,6 +244,35 @@ public class SubscribersServiceRemote: ServiceRemoteWordPressComREST {
244244 type: GetSubscriberStatsResponse . self
245245 ) . get ( ) . body
246246 }
247+
248+ // MARK: POST Import Subscribers
249+
250+ /// Example: URL: https://public-api.wordpress.com/wpcom/v2/sites/216878809/subscribers/import?_envelope=1
251+ @discardableResult
252+ public func importSubscribers(
253+ siteID: Int ,
254+ emails: [ String ]
255+ ) async throws -> ImportSubscribersResponse {
256+ let url = self . path ( forEndpoint: " sites/ \( siteID) /subscribers/import " , withVersion: . _2_0)
257+ let parameters : [ String : Any ] = [
258+ " emails " : emails,
259+ " parse_only " : false
260+ ]
261+ return try await wordPressComRestApi. perform (
262+ . post,
263+ URLString: url,
264+ parameters: parameters,
265+ type: ImportSubscribersResponse . self
266+ ) . get ( ) . body
267+ }
268+
269+ public struct ImportSubscribersResponse : Decodable {
270+ public let uploadID : Int
271+
272+ enum CodingKeys : String , CodingKey {
273+ case uploadID = " upload_id "
274+ }
275+ }
247276}
248277
249278extension SubscribersServiceRemote . SubsciberBasicInfoResponse {
You can’t perform that action at this time.
0 commit comments