-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added videos endpoints, documentation, refactoring
- Loading branch information
1 parent
ef6180e
commit 6f9a700
Showing
10 changed files
with
407 additions
and
63 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
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
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,109 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Lukas Pistrol on 13.05.22. | ||
// | ||
|
||
import Foundation | ||
|
||
/// A structure representing a Video and its metadata. | ||
public struct PSVideo: Identifiable, Codable, Equatable { | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case id, width, height, url, image, duration, user | ||
case videoFiles = "video_files" | ||
case videoPictures = "video_pictures" | ||
} | ||
|
||
/// The ID of the video. | ||
public var id: Int | ||
|
||
/// The real width of the video in pixels. | ||
public var width: Int | ||
|
||
/// The real height of the video in pixels. | ||
public var height: Int | ||
|
||
/// The Pexels URL where the video is located. | ||
public var url: String | ||
|
||
/// URL to a screenshot of the video. | ||
public var image: String | ||
|
||
/// The duration of the video in seconds. | ||
public var duration: Int | ||
|
||
/// The videographer who shot the video. | ||
public var user: Videographer | ||
|
||
/// An array of different sized versions of the video. | ||
public var videoFiles: Array<File> | ||
|
||
/// An array of preview pictures of the video. | ||
public var videoPictures: Array<Preview> | ||
|
||
/// A structure representing a videographer | ||
public struct Videographer: Identifiable, Codable, Equatable { | ||
|
||
/// The ID of the videographer. | ||
public var id: Int | ||
|
||
/// The name of the videographer. | ||
public var name: String | ||
|
||
/// The URL of the videographer's Pexels profile. | ||
public var url: String | ||
} | ||
|
||
/// A structure representing a video file and its metadata. | ||
public struct File: Identifiable, Codable, Equatable { | ||
enum CodingKeys: String, CodingKey { | ||
case id, width, height, link, quality | ||
case fileType = "file_type" | ||
} | ||
|
||
/// The ID of the ``PSVideo/File``. | ||
public var id: Int | ||
|
||
/// The quality of the ``PSVideo/File``. | ||
public var quality: Quality | ||
|
||
/// The video format. | ||
public var fileType: String | ||
|
||
/// The width in pixels. | ||
public var width: Int? | ||
|
||
/// The height in pixels | ||
public var height: Int? | ||
|
||
/// A link to where the ``PSVideo/File`` is hosted. | ||
public var link: String | ||
|
||
/// A collection of possible video qualities `[hd, sd, hls]`. | ||
public enum Quality: String, Codable { | ||
case hd, sd, hls | ||
} | ||
} | ||
|
||
/// A structure representing a preview picture of a video. | ||
public struct Preview: Identifiable, Codable, Equatable { | ||
enum CodingKeys: String, CodingKey { | ||
case id | ||
case link = "picture" | ||
case index = "nr" | ||
} | ||
|
||
/// The ID of the ``PSVideo/Preview``. | ||
public var id: Int | ||
|
||
/// A link to the preview image. | ||
public var link: String | ||
|
||
/// The index in the array. | ||
public var index: Int | ||
} | ||
|
||
|
||
} |
15 changes: 15 additions & 0 deletions
15
Sources/PexelsSwift/PexelsSwift+Extensions/PexelsSwift+Color.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 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Lukas Pistrol on 13.05.22. | ||
// | ||
|
||
import Foundation | ||
|
||
public extension PexelsSwift { | ||
/// Colors for ``PSPhoto`` search queries | ||
enum PSColor: String { | ||
case red, orange, yellow, green, turquoise, blue, violet, pink, brown, black, gray, white | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
Sources/PexelsSwift/PexelsSwift+Extensions/PexelsSwift+Orientation+Size.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,20 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Lukas Pistrol on 13.05.22. | ||
// | ||
|
||
import Foundation | ||
|
||
public extension PexelsSwift { | ||
/// Supported orientations for search queries. | ||
enum PSOrientation: String { | ||
case landscape, portrait, square | ||
} | ||
|
||
/// Supported sizes for search queries. | ||
enum PSSize: String { | ||
case large, medium, small | ||
} | ||
} |
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
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
18 changes: 0 additions & 18 deletions
18
Sources/PexelsSwift/PexelsSwift+Extensions/PexelsSwift+URL.swift
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.