-
Notifications
You must be signed in to change notification settings - Fork 7
SDK V2 #28
SDK V2 #28
Changes from 34 commits
0f988f5
e9e0962
cc036f8
ceb75a1
3fc76ac
d1fa5b4
43dd510
8a6c7f6
89114dc
dff5da6
4ab199d
74ec086
71de593
6e60e48
b6cd198
80685a3
5f58d89
bd1ee13
ace8f54
ea3891c
edd9589
c80090a
cd7d26f
80268e1
b5dedd6
60708a3
93cbe6e
a4cd3ab
99e4e29
462612c
87ffcee
bb6cb18
7a5b6d9
cac6a3c
2cd125e
2991301
d9f00d7
ea3c2d4
17eb34c
7915a10
9857d7f
a58d99a
6bbce38
eac1015
5230efd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "WeTransfer-Swift-SDK" | ||
s.version = "1.0" | ||
s.version = "2.0" | ||
s.summary = "A Swift SDK for WeTransfer’s public API" | ||
s.homepage = "https://github.com/WeTransfer/WeTransfer-Swift-SDK" | ||
s.license = "MIT" | ||
s.author = { "Pim Coumans" => "[email protected]" } | ||
s.source = { :git => "https://github.com/WeTransfer/WeTransfer-Swift-SDK.git", :tag => "v#{s.version}" } | ||
|
||
s.swift_version = "4.1" | ||
s.swift_version = "4.2" | ||
s.ios.deployment_target = "9.0" | ||
s.osx.deployment_target = "10.10" | ||
|
||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// Transfer.swift | ||
// WeTransfer Swift SDK | ||
// | ||
// Created by Pim Coumans on 01/10/2018. | ||
// Copyright © 2018 WeTransfer. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Describes a single board to be created, adding files to and uploading files from. Used as an identifier between each request to be made and a local representation of the server-side board. | ||
/// Files should be added through the appropriate addFiles method | ||
public final class Board: Transferable { | ||
public private(set) var identifier: String? | ||
|
||
/// The name of the board. This name will be shown when viewing the transfer on wetransfer.com | ||
public let name: String | ||
/// Optional description of the board. This will be shown when viewing the transfer on wetransfer.com | ||
public let description: String? | ||
|
||
/// References to all the files added to the board. Files can be added with the public method on the WeTransfer struct | ||
public private(set) var files: [File] = [] | ||
|
||
/// Available when the board is created on the server | ||
public private(set) var shortURL: URL? | ||
|
||
/// Internal initializer with required properties | ||
init(name: String, description: String?) { | ||
self.name = name | ||
self.description = description | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Weird indent There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's just tabs, just like in the rest of the project. Will be addressed in future PR |
||
} | ||
} | ||
|
||
// MARK: - Private updating methods | ||
extension Board { | ||
|
||
/// Updates the board with server-side information | ||
/// | ||
/// - Parameters: | ||
/// - identifier: Identifier to point to global board | ||
/// - shortURL: URL of where the board can be found online | ||
func update(with identifier: String, shortURL: URL) { | ||
self.identifier = identifier | ||
self.shortURL = shortURL | ||
} | ||
|
||
/// Adds provided files to the board locally | ||
/// | ||
/// - Parameter files: Files to be added to the board | ||
func add(_ files: [File]) { | ||
for file in files where !self.files.contains(file) { | ||
self.files.append(file) | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Transferable.swift | ||
// WeTransfer | ||
// | ||
// Created by Pim Coumans on 04/10/2018. | ||
// Copyright © 2018 WeTransfer. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// Shared properties for both transfers and boards | ||
public protocol Transferable { | ||
var identifier: String? { get } | ||
var files: [File] { get } | ||
var shortURL: URL? { get } | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boards can contain links as well, which are not files. Rather call this
Content
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Links wil be added when addressing #8, for now boards and transfer only support files.