Skip to content

Commit

Permalink
Change protection from internal to public
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamad Fuad committed Apr 14, 2022
1 parent bc55e20 commit aa37742
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 72 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ You can use The Swift Package Manager to install SwiftEmailValidator by adding i
### Usage

```swift
import AppStoreReviewsAPI

let appStore = AppStoreReviewsAPI(appID: "310633997") // This app id belongs to WhatsApp
let reviews = try await appStore.reviews()

Expand Down
10 changes: 1 addition & 9 deletions Sources/AppStoreReviewsAPI/AppStoreReviewsAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,14 @@ public struct AppStoreReviewsAPI {
case mostRecent = "mostrecent"
}

var appID = String()
var page: String = "1"
var sortBy: Sortby = .mostHelpful

private var url: String?

public init(appID: String, page: String = "1", sortBy: Sortby = .mostHelpful) {

self.appID = appID
self.page = page
self.sortBy = sortBy

url = "https://itunes.apple.com/rss/customerreviews/page=" + page + "/id=" + appID + "/sortby=" + sortBy.rawValue + "/json?l=en&cc=gb"
}

func reviews() async throws -> ReviewsFeed {
public func reviews() async throws -> ReviewsFeed {

guard let urlString = url,
let url = URL(string: urlString)
Expand Down
8 changes: 4 additions & 4 deletions Sources/AppStoreReviewsAPI/Models/Author/Author.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

import Foundation

struct Author: Decodable {
public struct Author: Decodable {

let name, uri: URI
public let name, uri: URI
}

struct URI: Decodable {
public struct URI: Decodable {

let label: String
public let label: String
}
64 changes: 32 additions & 32 deletions Sources/AppStoreReviewsAPI/Models/Entry/Entry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

import Foundation

struct Entry: Decodable {

let author: EntryAuthor
let updated: Updated
let imRating, imVersion, id: ID
let title: Title
let content: Content
let link: EntryLink
let imVoteSum: Vote
let imContentType: IMContentType
let imVoteCount: Vote
public struct Entry: Decodable {

public let author: EntryAuthor
public let updated: Updated
public let imRating, imVersion, id: ID
public let title: Title
public let content: Content
public let link: EntryLink
public let imVoteSum: Vote
public let imContentType: IMContentType
public let imVoteCount: Vote

enum CodingKeys: String, CodingKey {

Expand All @@ -32,64 +32,64 @@ struct Entry: Decodable {
}

// MARK: - Author
struct EntryAuthor: Decodable {
public struct EntryAuthor: Decodable {

let uri, name: ID
let label: String
public let uri, name: ID
public let label: String
}

// MARK: - Content
struct Content: Decodable {
public struct Content: Decodable {

let label: String
let attributes: ContentAttributes
public let label: String
public let attributes: ContentAttributes
}

// MARK: - ContentAttributes
struct ContentAttributes: Decodable {
public struct ContentAttributes: Decodable {

let type: TypeEnum
public let type: TypeEnum
}

enum TypeEnum: String, Decodable {
public enum TypeEnum: String, Decodable {

case text = "text"
}

// MARK: - Vote
struct Vote: Decodable {
public struct Vote: Decodable {

let label: String
public let label: String
}

// MARK: - IMContentType
struct IMContentType: Decodable {
public struct IMContentType: Decodable {

let attributes: IMContentTypeAttributes
public let attributes: IMContentTypeAttributes
}

// MARK: - IMContentTypeAttributes
struct IMContentTypeAttributes: Decodable {
public struct IMContentTypeAttributes: Decodable {

let term, label: Label
public let term, label: Label
}

enum Label: String, Decodable {
public enum Label: String, Decodable {

case application = "Application"
}

// MARK: - EntryLink
struct EntryLink: Decodable {
public struct EntryLink: Decodable {

let attributes: LinkAttributes
public let attributes: LinkAttributes
}

// MARK: - LinkAttributes
struct LinkAttributes: Decodable {
public struct LinkAttributes: Decodable {

let rel: String
let href: String
public let rel: String
public let href: String
}


Expand Down
4 changes: 2 additions & 2 deletions Sources/AppStoreReviewsAPI/Models/ID/ID.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct ID: Decodable {
public struct ID: Decodable {

let label: String
public let label: String
}
4 changes: 2 additions & 2 deletions Sources/AppStoreReviewsAPI/Models/Icon/Icon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct Icon: Decodable {
public struct Icon: Decodable {

let label: String
public let label: String
}
12 changes: 6 additions & 6 deletions Sources/AppStoreReviewsAPI/Models/Link/Link.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

import Foundation

struct Link: Decodable {
public struct Link: Decodable {

let attributes: Attributes
public let attributes: Attributes
}

struct Attributes: Decodable {
public struct Attributes: Decodable {

let rel: String
let type: String?
let href: String
public let rel: String
public let type: String?
public let href: String
}
22 changes: 11 additions & 11 deletions Sources/AppStoreReviewsAPI/Models/ReviewsFeed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@

import Foundation

struct ReviewsFeed: Decodable {
public struct ReviewsFeed: Decodable {

let feed: Feed
public let feed: Feed
}

struct Feed: Decodable {
public struct Feed: Decodable {

let id: ID
let author: Author
let entry: [Entry]
let updated: Updated
let rights: Rights
let title: Title
let icon: Icon
let link: [Link]
public let id: ID
public let author: Author
public let entry: [Entry]
public let updated: Updated
public let rights: Rights
public let title: Title
public let icon: Icon
public let link: [Link]
}
4 changes: 2 additions & 2 deletions Sources/AppStoreReviewsAPI/Models/Rights/Rights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct Rights: Decodable {
public struct Rights: Decodable {

let label: String
public let label: String
}
4 changes: 2 additions & 2 deletions Sources/AppStoreReviewsAPI/Models/Title/Title.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct Title: Decodable {
public struct Title: Decodable {

let label: String
public let label: String
}
4 changes: 2 additions & 2 deletions Sources/AppStoreReviewsAPI/Models/Updated/Updated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

struct Updated: Decodable {
public struct Updated: Decodable {

let label: Date
public let label: Date
}

0 comments on commit aa37742

Please sign in to comment.