mirror of
https://github.com/apple/swift-nio-imap
synced 2026-11-26 04:57:51 +00:00
`writeAuthIMAPURLRump`, `writeAuthIMAPURLFull`, `writeRelativeIMAPURL`, `writeURLFetchType`, `writeInternetMessageDate` and `writeListSelectBaseOptionQuoted` had no callers outside their own encode tests, nor did the writers only they reached (`writeAuthenticatedURL(NetworkMessagePath)`, `writeNetworkPath`, `writeAbsoluteMessagePath`, `writeIUIDOnly`, `writeURLMessageSectionOnly`, `writeMessagePathByteRangeOnly`). Delete them and those tests; parse tests stay.
42 lines
1.5 KiB
Swift
42 lines
1.5 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2020 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
extension MessagePath {
|
|
/// A byte range suffix for partial IMAP URL fetches.
|
|
///
|
|
/// Wraps a ``/NIOIMAPCore/ByteRange`` for use in IMAP URLs with the `/;PARTIAL=` encoding
|
|
/// (RFC 5092). It enables clients to request only a portion of a message via URL without
|
|
/// downloading the entire body.
|
|
///
|
|
/// - SeeAlso: [RFC 5092 IMAP URL Scheme](https://datatracker.ietf.org/doc/html/rfc5092)
|
|
public struct ByteRange: Hashable, Sendable {
|
|
/// The underlying ``/NIOIMAPCore/ByteRange``.
|
|
public var range: NIOIMAPCore.ByteRange
|
|
|
|
/// Creates a new `MessagePath.ByteRange`.
|
|
/// - parameter range: The ``/NIOIMAPCore/ByteRange`` to be wrapped.
|
|
public init(range: NIOIMAPCore.ByteRange) {
|
|
self.range = range
|
|
}
|
|
}
|
|
}
|
|
|
|
// MARK: - Encoding
|
|
|
|
extension EncodeBuffer {
|
|
@discardableResult mutating func writeMessagePathByteRange(_ data: MessagePath.ByteRange) -> Int {
|
|
self.writeString("/;PARTIAL=") + self.writeByteRange(data.range)
|
|
}
|
|
}
|