DeleteBlocks

public class DeleteBlocks : SuppressionListDeleter<Block>

The DeleteBlocks class represents the API call to delete from the block list. You can use it to delete the entire list, or specific entries in the list.

Delete All Blocks

To delete all blocks, use the request returned from DeleteBlocks.all. This request will delete all blocks on your block list.

do {
    let request = DeleteBlocks.all
    try Session.shared.send(request: request) { result in
        switch result {
        case .success(let response):
            print(response.statusCode)
        case .failure(let err):
            print(err)
        }
    }
} catch {
    print(error)
}

Delete Specific Blocks

To delete specific entries from your block list, use the DeleteBlocks class. You can either specify email addresses (as strings), or you can use Block instances (useful for if you just retrieved some from the RetrieveBlocks class).

do {
    let request = DeleteBlocks(emails: "foo@example.none", "bar@example.none")
    try Session.shared.send(request: request) { result in
        switch result {
        case .success(let response):
            print(response.statusCode)
        case .failure(let err):
            print(err)
        }
    }
} catch {
    print(error)
}
  • all

    Returns a request that will delete all the entries on your block list.

    Declaration

    Swift

    public static var all: DeleteBlocks { get }