-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: parametrise chunked uploads endpoint urls (box/box-openapi#444) (…
- Loading branch information
1 parent
2af60b9
commit ea18f9e
Showing
15 changed files
with
791 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "engineHash": "f42fdb0", "specHash": "e50af18", "version": "0.3.0" } | ||
{ "engineHash": "d1cb68d", "specHash": "9919482", "version": "0.3.0" } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'cocoapods' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
Sources/Managers/ChunkedUploads/CreateFileUploadSessionCommitByUrlHeaders.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import Foundation | ||
|
||
public class CreateFileUploadSessionCommitByUrlHeaders { | ||
/// The [RFC3230][1] message digest of the whole file. | ||
/// | ||
/// Only SHA1 is supported. The SHA1 digest must be Base64 | ||
/// encoded. The format of this header is as | ||
/// `sha=BASE64_ENCODED_DIGEST`. | ||
/// | ||
/// [1]: https://tools.ietf.org/html/rfc3230 | ||
public let digest: String | ||
|
||
/// Ensures this item hasn't recently changed before | ||
/// making changes. | ||
/// | ||
/// Pass in the item's last observed `etag` value | ||
/// into this header and the endpoint will fail | ||
/// with a `412 Precondition Failed` if it | ||
/// has changed since. | ||
public let ifMatch: String? | ||
|
||
/// Ensures an item is only returned if it has changed. | ||
/// | ||
/// Pass in the item's last observed `etag` value | ||
/// into this header and the endpoint will fail | ||
/// with a `304 Not Modified` if the item has not | ||
/// changed since. | ||
public let ifNoneMatch: String? | ||
|
||
/// Extra headers that will be included in the HTTP request. | ||
public let extraHeaders: [String: String?]? | ||
|
||
/// Initializer for a CreateFileUploadSessionCommitByUrlHeaders. | ||
/// | ||
/// - Parameters: | ||
/// - digest: The [RFC3230][1] message digest of the whole file. | ||
/// | ||
/// Only SHA1 is supported. The SHA1 digest must be Base64 | ||
/// encoded. The format of this header is as | ||
/// `sha=BASE64_ENCODED_DIGEST`. | ||
/// | ||
/// [1]: https://tools.ietf.org/html/rfc3230 | ||
/// - ifMatch: Ensures this item hasn't recently changed before | ||
/// making changes. | ||
/// | ||
/// Pass in the item's last observed `etag` value | ||
/// into this header and the endpoint will fail | ||
/// with a `412 Precondition Failed` if it | ||
/// has changed since. | ||
/// - ifNoneMatch: Ensures an item is only returned if it has changed. | ||
/// | ||
/// Pass in the item's last observed `etag` value | ||
/// into this header and the endpoint will fail | ||
/// with a `304 Not Modified` if the item has not | ||
/// changed since. | ||
/// - extraHeaders: Extra headers that will be included in the HTTP request. | ||
public init(digest: String, ifMatch: String? = nil, ifNoneMatch: String? = nil, extraHeaders: [String: String?]? = [:]) { | ||
self.digest = digest | ||
self.ifMatch = ifMatch | ||
self.ifNoneMatch = ifNoneMatch | ||
self.extraHeaders = extraHeaders | ||
} | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
Sources/Managers/ChunkedUploads/CreateFileUploadSessionCommitByUrlRequestBody.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Foundation | ||
|
||
public class CreateFileUploadSessionCommitByUrlRequestBody: Codable { | ||
private enum CodingKeys: String, CodingKey { | ||
case parts | ||
} | ||
|
||
/// The list details for the uploaded parts | ||
public let parts: [UploadPart] | ||
|
||
/// Initializer for a CreateFileUploadSessionCommitByUrlRequestBody. | ||
/// | ||
/// - Parameters: | ||
/// - parts: The list details for the uploaded parts | ||
public init(parts: [UploadPart]) { | ||
self.parts = parts | ||
} | ||
|
||
required public init(from decoder: Decoder) throws { | ||
let container = try decoder.container(keyedBy: CodingKeys.self) | ||
parts = try container.decode([UploadPart].self, forKey: .parts) | ||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
var container = encoder.container(keyedBy: CodingKeys.self) | ||
try container.encode(parts, forKey: .parts) | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
Sources/Managers/ChunkedUploads/DeleteFileUploadSessionByUrlHeaders.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Foundation | ||
|
||
public class DeleteFileUploadSessionByUrlHeaders { | ||
/// Extra headers that will be included in the HTTP request. | ||
public let extraHeaders: [String: String?]? | ||
|
||
/// Initializer for a DeleteFileUploadSessionByUrlHeaders. | ||
/// | ||
/// - Parameters: | ||
/// - extraHeaders: Extra headers that will be included in the HTTP request. | ||
public init(extraHeaders: [String: String?]? = [:]) { | ||
self.extraHeaders = extraHeaders | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
Sources/Managers/ChunkedUploads/GetFileUploadSessionByUrlHeaders.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Foundation | ||
|
||
public class GetFileUploadSessionByUrlHeaders { | ||
/// Extra headers that will be included in the HTTP request. | ||
public let extraHeaders: [String: String?]? | ||
|
||
/// Initializer for a GetFileUploadSessionByUrlHeaders. | ||
/// | ||
/// - Parameters: | ||
/// - extraHeaders: Extra headers that will be included in the HTTP request. | ||
public init(extraHeaders: [String: String?]? = [:]) { | ||
self.extraHeaders = extraHeaders | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
Sources/Managers/ChunkedUploads/GetFileUploadSessionPartsByUrlHeaders.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Foundation | ||
|
||
public class GetFileUploadSessionPartsByUrlHeaders { | ||
/// Extra headers that will be included in the HTTP request. | ||
public let extraHeaders: [String: String?]? | ||
|
||
/// Initializer for a GetFileUploadSessionPartsByUrlHeaders. | ||
/// | ||
/// - Parameters: | ||
/// - extraHeaders: Extra headers that will be included in the HTTP request. | ||
public init(extraHeaders: [String: String?]? = [:]) { | ||
self.extraHeaders = extraHeaders | ||
} | ||
|
||
} |
Oops, something went wrong.