Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ import PackageDescription
// MARK: Definitions

let package = Package(
name: "Swiftagram",
name: "SocialGraphKit",
// Supported versions.
platforms: [.iOS("13.0"),
.macOS("10.15"),
.tvOS("13.0"),
.watchOS("6.0")],
// Exposed libraries.
products: [.library(name: "Swiftagram",
targets: ["Swiftagram"]),
.library(name: "SwiftagramCrypto",
targets: ["SwiftagramCrypto"])],
products: [.library(name: "SocialGraphKit",
targets: ["SocialGraphKit"]),
.library(name: "SocialGraphCrypto",
targets: ["SocialGraphCrypto"])],
// Package dependencies.
dependencies: [.package(url: "https://github.com/sbertix/ComposableRequest", .upToNextMinor(from: "5.3.1")),
.package(url: "https://github.com/sbertix/SwCrypt.git", .upToNextMinor(from: "5.1.0"))],
// All targets.
targets: [.target(name: "Swiftagram",
targets: [.target(name: "SocialGraphKit",
dependencies: [.product(name: "Requests", package: "ComposableRequest"),
.product(name: "Storage", package: "ComposableRequest")]),
.target(name: "SwiftagramCrypto",
dependencies: ["Swiftagram",
.target(name: "SocialGraphCrypto",
dependencies: ["SocialGraphKit",
.product(name: "StorageCrypto", package: "ComposableRequest"),
.product(name: "SwCrypt", package: "SwCrypt")]),
.testTarget(name: "SwiftagramTests",
dependencies: ["Swiftagram", "SwiftagramCrypto"])]
.testTarget(name: "SocialGraphKitTests",
dependencies: ["SocialGraphKit", "SocialGraphCrypto"])]
)

if ProcessInfo.processInfo.environment["TARGETING_WATCHOS"] == "true" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Authenticator+Keychain.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 09/04/21.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Authenticator+Basic.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 10/04/21.
//
Expand Down Expand Up @@ -41,7 +41,7 @@
///
/// - parameter client: A valid `Client`.
/// - returns: A valid `Publisher`.
public func authenticate(in client: Client) -> AnyPublisher<Secret, Swift.Error> {

Check failure on line 44 in Sources/SocialGraphCrypto/Authentication/Basic/Authenticator+Basic.swift

View workflow job for this annotation

GitHub Actions / Lint

Type Contents Order Violation: An 'other_method' should not be placed amongst the type content(s) 'type_method' (type_contents_order)
// Fetch unauthenticated header fields.
Self.unauthenticatedHeader(for: client)
.flatMap { cookies -> AnyPublisher<Secret, Swift.Error> in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Authenticator+TwoFactor.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 10/04/21.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+Comment.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 07/04/21.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+ManyComments.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 07/04/21.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+Media.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 07/04/21.
//
Expand Down Expand Up @@ -36,7 +36,7 @@ public extension Endpoint.Group.Media {
/// - returns: A valid `Endpoint.Single`.
func comment(with text: String,
under parentCommentIdentifier: String? = nil)
-> Endpoint.Single<Swiftagram.Comment.Unit, Swift.Error> {
-> Endpoint.Single<SocialGraphKit.Comment.Unit, Swift.Error> {
.init { secret, session in
Deferred {
Request.media(self.identifier)
Expand All @@ -51,7 +51,7 @@ public extension Endpoint.Group.Media {
.publish(with: session)
.map(\.data)
.wrap()
.map(Swiftagram.Comment.Unit.init)
.map(SocialGraphKit.Comment.Unit.init)
}
.eraseToAnyPublisher()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+Posts.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 08/04/21.
//
Expand All @@ -27,7 +27,7 @@ public extension Endpoint.Group.Posts {
/// - caption: An optional `String`.
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload<U: Collection>(image: Agnostic.Image,
captioned caption: String?,
tagging users: U,
Expand All @@ -43,7 +43,7 @@ public extension Endpoint.Group.Posts {
/// - image: An `Agnostic.Image` (either `UIImage` or `NSImage`).
/// - caption: An optional `String`.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload(image: Agnostic.Image,
captioned caption: String?,
at location: Location? = nil) -> Endpoint.Single<Media.Unit, Error> {
Expand All @@ -59,7 +59,7 @@ public extension Endpoint.Group.Posts {
/// - caption: An optional `String`.
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
internal func upload<U: Collection>(image data: Data,
size: CGSize,
captioned caption: String?,
Expand Down Expand Up @@ -143,7 +143,7 @@ public extension Endpoint.Group.Posts {
/// - caption: An optional `String`.
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload<U: Collection>(image data: Data,
captioned caption: String?,
tagging users: U,
Expand All @@ -159,7 +159,7 @@ public extension Endpoint.Group.Posts {
/// - data: Some `Data` holding reference to an image.
/// - caption: An optional `String`.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload(image data: Data,
captioned caption: String?,
at location: Location? = nil) -> Endpoint.Single<Media.Unit, Error> {
Expand All @@ -176,7 +176,7 @@ public extension Endpoint.Group.Posts {
/// - caption: An optional `String`.
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload<U: Collection>(video url: URL,
preview image: Agnostic.Image,
Expand All @@ -200,7 +200,7 @@ public extension Endpoint.Group.Posts {
/// - image: An `Agnostic.Image` (either `UIImage` or `NSImage`) used as preview image.
/// - caption: An optional `String`.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload(video url: URL,
preview image: Agnostic.Image,
Expand All @@ -219,7 +219,7 @@ public extension Endpoint.Group.Posts {
/// - caption: An optional `String`.
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
internal func upload<U: Collection>(video url: URL,
preview data: Data,
Expand Down Expand Up @@ -328,7 +328,7 @@ public extension Endpoint.Group.Posts {
/// - caption: An optional `String`.
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload<U: Collection>(video url: URL,
preview data: Data,
Expand All @@ -349,7 +349,7 @@ public extension Endpoint.Group.Posts {
/// - data: Some `Data` holding reference to an image to be used as preview image.
/// - caption: An optional `String`.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload(video url: URL,
preview data: Data,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+Stories.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 08/04/21.
//
Expand All @@ -26,7 +26,7 @@ public extension Endpoint.Group.Stories {
/// - image: An `Agnostic.Image` (either `UIImage` or `NSImage`).
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload<S: Sequence>(image: Agnostic.Image,
stickers: S,
isCloseFriendsOnly: Bool = false) -> Endpoint.Single<Media.Unit, Error>
Expand All @@ -40,7 +40,7 @@ public extension Endpoint.Group.Stories {
/// - parameters:
/// - image: An `Agnostic.Image` (either `UIImage` or `NSImage`).
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload(image: Agnostic.Image, isCloseFriendsOnly: Bool = false) -> Endpoint.Single<Media.Unit, Error> {
upload(image: image, stickers: [], isCloseFriendsOnly: isCloseFriendsOnly)
}
Expand All @@ -52,7 +52,7 @@ public extension Endpoint.Group.Stories {
/// - size: A valid `CGSize`.
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
internal func upload<S: Sequence>(image data: Data,
size: CGSize,
stickers: S,
Expand Down Expand Up @@ -116,7 +116,7 @@ public extension Endpoint.Group.Stories {
/// - data: Some `Data` holding reference to an image.
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload<S: Collection>(image data: Data,
stickers: S,
isCloseFriendsOnly: Bool = false) -> Endpoint.Single<Media.Unit, Error>
Expand All @@ -130,7 +130,7 @@ public extension Endpoint.Group.Stories {
/// - parameters:
/// - data: Some `Data` holding reference to an image.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func upload(image data: Data, isCloseFriendsOnly: Bool = false) -> Endpoint.Single<Media.Unit, Error> {
upload(image: data, stickers: [], isCloseFriendsOnly: isCloseFriendsOnly)
}
Expand All @@ -144,7 +144,7 @@ public extension Endpoint.Group.Stories {
/// - image: An optional `Agnostic.Image` to be used as preview. Defaults to `nil`, meaning a full black preview will be used.
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload<S: Sequence>(video url: URL,
preview image: Agnostic.Image? = nil,
Expand All @@ -164,7 +164,7 @@ public extension Endpoint.Group.Stories {
/// - url: A local or remote `URL` to a valid `.mp4` `h264` encoded video.
/// - image: An `Agnostic.Image` to be used as preview. Defaults to `nil`, meaning a full black preview will be used.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload(video url: URL,
preview image: Agnostic.Image? = nil,
Expand All @@ -181,7 +181,7 @@ public extension Endpoint.Group.Stories {
/// - size: A valid `CGSize`.
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
internal func upload<S: Sequence>(video url: URL,
preview data: Data?,
Expand Down Expand Up @@ -263,7 +263,7 @@ public extension Endpoint.Group.Stories {
/// - data: Some `Data` holding reference to an image to be used as preview.
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload<S: Collection>(video url: URL,
preview data: Data,
Expand All @@ -282,7 +282,7 @@ public extension Endpoint.Group.Stories {
/// - url: A local or remote `URL` to a valid `.mp4` `h264` encoded video.
/// - data: Some `Data` holding reference to an image to be used as preview.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
@available(watchOS 6, *)
func upload(video url: URL, preview data: Data, isCloseFriendsOnly: Bool = false) -> Endpoint.Single<Media.Unit, Error> {
upload(video: url, preview: data, stickers: [], isCloseFriendsOnly: isCloseFriendsOnly)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+Tag.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 20/04/21.
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+Uploader.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 29/08/20.
//
Expand Down Expand Up @@ -92,7 +92,7 @@
/// - isForAlbum: A `Bool`.
/// - returns: A `Media.Unit` `Disposable`, `identifier`, `name` and `date`.
/// - warning: Remember to set `Secret` specific headers in the request.
func upload(video url: URL,

Check failure on line 95 in Sources/SocialGraphCrypto/Endpoints/Endpoint+Uploader.swift

View workflow job for this annotation

GitHub Actions / Lint

Attributes Violation: Attributes should be on their own lines in functions and types, but on the same line as variables and imports (attributes)
preview data: Data?,
previewSize: CGSize,
sourceType: String,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Endpoint+User.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 27/03/21.
//
Expand Down Expand Up @@ -50,7 +50,7 @@ public extension Endpoint.Group.User {
func mute(_ action: Muting) -> Endpoint.Single<Friendship.Unit, Error> {
.init { secret, session in
Deferred {
Swiftagram.Request.version1
SocialGraphKit.Request.version1
.friendships
.path(appending: "mute_posts_or_story_from_follow/")
.appendingDefaultHeader()
Expand All @@ -74,7 +74,7 @@ public extension Endpoint.Group.User {
/// Remove the given user from your followers.
///
/// - returns: A valid `Endpoint.Single`.
/// - warning: This is not tested in `SwiftagramTests`, so it might not work in the future. Open an `issue` if that happens.
/// - warning: This is not tested in `SocialGraphKitTests`, so it might not work in the future. Open an `issue` if that happens.
func remove() -> Endpoint.Single<Friendship.Unit, Error> {
edit("remove_follower")
}
Expand All @@ -100,7 +100,7 @@ public extension Endpoint.Group.User {
func unmute(_ action: Muting) -> Endpoint.Single<Friendship.Unit, Error> {
.init { secret, session in
Deferred {
Swiftagram.Request.version1
SocialGraphKit.Request.version1
.friendships
.path(appending: "unmute_posts_or_story_from_follow/")
.appendingDefaultHeader()
Expand All @@ -126,15 +126,15 @@ public extension Endpoint.Group.User.Request {
/// Accept the follow request.
///
/// - returns: A valid `Endpoint.Single`.
/// - warning: This is not tested in `SwiftagramTests`, so it might not work in the future. Open an `issue` if that happens.
/// - warning: This is not tested in `SocialGraphKitTests`, so it might not work in the future. Open an `issue` if that happens.
func approve() -> Endpoint.Single<Friendship.Unit, Error> {
user.edit("approve")
}

/// Decline the follow request.
///
/// - returns: A valid `Endpoint.Single`.
/// - warning: This is not tested in `SwiftagramTests`, so it might not work in the future. Open an `issue` if that happens.
/// - warning: This is not tested in `SocialGraphKitTests`, so it might not work in the future. Open an `issue` if that happens.
func decline() -> Endpoint.Single<Friendship.Unit, Error> {
user.edit("decline")
}
Expand All @@ -144,11 +144,11 @@ fileprivate extension Endpoint.Group.User {
/// Perform an action involving the user matching `identifier`.
///
/// - parameter endpoint: A valid `String`.
/// - note: **SwiftagramCrypto** only.
/// - note: **SocialGraphKitCrypto** only.
func edit(_ endpoint: String) -> Endpoint.Single<Friendship.Unit, Error> {
.init { secret, session in
Deferred {
Swiftagram.Request.version1
SocialGraphKit.Request.version1
.friendships
.path(appending: endpoint)
.path(appending: self.identifier)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//
// @_exported.swift
// SwiftagramCrypto
// SocialGraphKitCrypto
//
// Created by Stefano Bertagno on 23/02/21.
//

@_exported import Swiftagram
@_exported import SocialGraphKit
Loading
Loading