Skip to content

Commit

Permalink
makeing things public
Browse files Browse the repository at this point in the history
  • Loading branch information
underthestars-zhy committed Apr 29, 2023
1 parent 8724f82 commit bdd24a7
Show file tree
Hide file tree
Showing 21 changed files with 159 additions and 159 deletions.
16 changes: 8 additions & 8 deletions Sources/MobbinAPI/Collection/CollectionPlatformCount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@
import Foundation
import SwiftyJSON

struct PlatformCount: Equatable {
let mobileAppsCount: Int
let webAppsCount: Int
let mobileScreensCount: Int
let webScreensCount: Int
let mobileFlowsCount: Int
let webFlowsCount: Int
public struct PlatformCount: Equatable {
public let mobileAppsCount: Int
public let webAppsCount: Int
public let mobileScreensCount: Int
public let webScreensCount: Int
public let mobileFlowsCount: Int
public let webFlowsCount: Int
}

extension MobbinAPI {
func platformCount(of collection: Collection) async throws -> PlatformCount {
public func platformCount(of collection: Collection) async throws -> PlatformCount {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/collections_with_platform_counts") else { throw HTTPError.wrongUrlFormat }
Expand Down
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Collection/CreateCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

extension MobbinAPI {
func createCollection(in workspace: Workspace, name: String, description: String) async throws {
public func createCollection(in workspace: Workspace, name: String, description: String) async throws {
guard let token else { throw MobbinError.cannotFindToken }
guard let userInfo else { throw MobbinError.cannotFindToken }

Expand Down
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Collection/DeleteCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

extension MobbinAPI {
func delete(collection: Collection) async throws {
public func delete(collection: Collection) async throws {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/collections") else {return}
Expand Down
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Collection/EditCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
func edit(collection: Collection, name: String?, description: String?) async throws -> Collection {
public func edit(collection: Collection, name: String?, description: String?) async throws -> Collection {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/collections") else { throw HTTPError.wrongUrlFormat }
Expand Down
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Collection/QueryAppsInCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
func queryApps(in collection: Collection) async throws -> [Collection.App] {
public func queryApps(in collection: Collection) async throws -> [Collection.App] {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/rpc/get_apps_with_preview_screens_collection_filter") else { throw HTTPError.wrongUrlFormat }
Expand Down
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Collection/QueryFlowsInCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
func queryFlows(in collection: Collection) async throws -> [Collection.Flow] {
public func queryFlows(in collection: Collection) async throws -> [Collection.Flow] {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/rpc/get_app_sections_with_app_screens_collection_filter") else { throw HTTPError.wrongUrlFormat }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
func queryScreens(in collection: Collection) async throws -> [Collection.Screen] {
public func queryScreens(in collection: Collection) async throws -> [Collection.Screen] {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/rpc/get_app_screens_with_app_info_collection_filter") else { throw HTTPError.wrongUrlFormat }
Expand Down
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Collection/QureyCollections.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
func queryCollections() async throws -> [Collection] {
public func queryCollections() async throws -> [Collection] {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/workspaces") else { throw HTTPError.wrongUrlFormat }
Expand Down
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Error/HTTPError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

enum HTTPError: Error {
public enum HTTPError: Error {
case wrongUrlFormat
case badResponse
}
2 changes: 1 addition & 1 deletion Sources/MobbinAPI/Error/MobbinError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

enum MobbinError: Error {
public enum MobbinError: Error {
case emailProblem
case cannotFindToken
case cannotFindUserInfo
Expand Down
4 changes: 2 additions & 2 deletions Sources/MobbinAPI/IOS/GetIiOSApps.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
func getAlliOSApps() async throws -> [App] {
public func getAlliOSApps() async throws -> [App] {
guard let token else { throw MobbinError.cannotFindToken }

var lastAppPublishedDate: Date? = nil
Expand Down Expand Up @@ -115,7 +115,7 @@ extension MobbinAPI {
return res
}

func queryNextPage(_ app: App?) async throws -> [App] {
public func queryNextPage(_ app: App?) async throws -> [App] {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/rpc/get_apps_with_preview_screens_filter") else { throw HTTPError.wrongUrlFormat }
Expand Down
4 changes: 2 additions & 2 deletions Sources/MobbinAPI/IOS/GetiOSDetails.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
func getiOSScreens(of app: App) async throws -> [Screen] {
public func getiOSScreens(of app: App) async throws -> [Screen] {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/rpc/get_app_screens_filter") else { throw HTTPError.wrongUrlFormat }
Expand Down Expand Up @@ -83,7 +83,7 @@ extension MobbinAPI {
} ?? []
}

func getiOSFlows(of app: App) async throws -> [Flow] {
public func getiOSFlows(of app: App) async throws -> [Flow] {
guard let token else { throw MobbinError.cannotFindToken }

guard var URL = URL(string: "https://ujasntkfphywizsdaapi.supabase.co/rest/v1/rpc/get_app_sections_filter") else { throw HTTPError.wrongUrlFormat }
Expand Down
6 changes: 3 additions & 3 deletions Sources/MobbinAPI/IOS/iOSCount.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ import Foundation
import SwiftyJSON

extension MobbinAPI {
var iOSAppsCount: Int {
public var iOSAppsCount: Int {
get async throws {
try await getiOSMetaInfo().0
}
}

var iOSScreensCount: Int {
public var iOSScreensCount: Int {
get async throws {
try await getiOSMetaInfo().1
}
}

var iOSFlowCount: Int {
public var iOSFlowCount: Int {
get async throws {
try await getiOSMetaInfo().2
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/MobbinAPI/MobbinAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ public class MobbinAPI {
var token: Token? = nil
var userInfo: UserInfo? = nil

init(email: String, token: Token? = nil) {
public init(email: String, token: Token? = nil) {
self.email = email
self.token = token
}

init(userInfo: UserInfo, token: Token? = nil) {
public init(userInfo: UserInfo, token: Token? = nil) {
self.email = userInfo.email
self.userInfo = userInfo
self.token = token
Expand Down
32 changes: 16 additions & 16 deletions Sources/MobbinAPI/Model/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@

import Foundation

struct App {
let id: String
let appName: String
let appCategory: String
let appStyle: String?
let appLogoUrl: URL
let appTagline: String
let companyHqRegion: String
let companyStage: String
let platform: String
let createdAt: Date
let appVersionId: String
let appVersionCreatedAt: Date
let appVersionUpdatedAt: Date
let appVersionPublishedAt: Date
let previewScreenUrls: [URL]
public struct App {
public let id: String
public let appName: String
public let appCategory: String
public let appStyle: String?
public let appLogoUrl: URL
public let appTagline: String
public let companyHqRegion: String
public let companyStage: String
public let platform: String
public let createdAt: Date
public let appVersionId: String
public let appVersionCreatedAt: Date
public let appVersionUpdatedAt: Date
public let appVersionPublishedAt: Date
public let previewScreenUrls: [URL]
}
168 changes: 84 additions & 84 deletions Sources/MobbinAPI/Model/Collection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,96 +7,96 @@

import Foundation

struct Collection {
let name: String
let id: String
let description: String
let updatedAt: Date
let createdAt: Date
public struct Collection {
public let name: String
public let id: String
public let description: String
public let updatedAt: Date
public let createdAt: Date

struct App {
let id: String
let appName: String
let appCategory: String
let appStyle: String?
let appLogoURL: URL
let appTagline: String
let companyHqRegion: String
let companyStage: String
let platform: String
let createdAt: Date
let appVersionID: String
let appVersionCreatedAt: Date
let appVersionUpdatedAt: Date
let appVersionPublishedAt: Date
let collectionAppID: String
let collectionID: String
let collectionAppCreatedAt: Date
let collectionAppUpdatedAt: Date
let previewScreenUrls: [URL]
public struct App {
public let id: String
public let appName: String
public let appCategory: String
public let appStyle: String?
public let appLogoURL: URL
public let appTagline: String
public let companyHqRegion: String
public let companyStage: String
public let platform: String
public let createdAt: Date
public let appVersionID: String
public let appVersionCreatedAt: Date
public let appVersionUpdatedAt: Date
public let appVersionPublishedAt: Date
public let collectionAppID: String
public let collectionID: String
public let collectionAppCreatedAt: Date
public let collectionAppUpdatedAt: Date
public let previewScreenUrls: [URL]
}

struct Screen {
let id: String
let appID: String
let appName: String
let appCategory: String
let appStyle: String?
let appLogoURL: URL
let appTagline: String
let companyHqRegion: String
let companyStage: String
let platform: String
let appVersionID: String
let appVersionCreatedAt: Date
let appVersionUpdatedAt: Date
let appVersionPublishedAt: Date
let screenNumber: Int
let screenElements: [String]
let screenPatterns: [String]
let screenURL: URL
let createdAt: Date
let updatedAt: Date
let collectionID: String
let collectionAppScreenID: String
let collectionAppScreenUpdatedAt: Date
public struct Screen {
public let id: String
public let appID: String
public let appName: String
public let appCategory: String
public let appStyle: String?
public let appLogoURL: URL
public let appTagline: String
public let companyHqRegion: String
public let companyStage: String
public let platform: String
public let appVersionID: String
public let appVersionCreatedAt: Date
public let appVersionUpdatedAt: Date
public let appVersionPublishedAt: Date
public let screenNumber: Int
public let screenElements: [String]
public let screenPatterns: [String]
public let screenURL: URL
public let createdAt: Date
public let updatedAt: Date
public let collectionID: String
public let collectionAppScreenID: String
public let collectionAppScreenUpdatedAt: Date
}

struct Flow: Codable {
struct Screen: Codable {
let id: String
let order: Int
let hotspotType: String?
let hotspotX: Double?
let hotspotY: Double?
let hotspotWidth: Double?
let hotspotHeight: Double?
let screenID: String
let screenElements: [String]
let screenPatterns: [String]
let screenURL: URL
public struct Flow: Codable {
public struct Screen: Codable {
public let id: String
public let order: Int
public let hotspotType: String?
public let hotspotX: Double?
public let hotspotY: Double?
public let hotspotWidth: Double?
public let hotspotHeight: Double?
public let screenID: String
public let screenElements: [String]
public let screenPatterns: [String]
public let screenURL: URL
}

let id: String
let name: String
let actions: [String]
let order: Int
let appID: String
let appName: String
let appCategory: String
let appStyle: String?
let appLogoURL: URL
let appTagline: String
let companyHqRegion: String
let companyStage: String
let platform: String
let appVersionID: String
let appVersionCreatedAt: Date
let appVersionUpdatedAt: Date
let appVersionPublishedAt: Date
let collectionID: String
let collectionAppSectionID: String
let collectionAppSectionUpdatedAt: Date
let screens: [Screen]
public let id: String
public let name: String
public let actions: [String]
public let order: Int
public let appID: String
public let appName: String
public let appCategory: String
public let appStyle: String?
public let appLogoURL: URL
public let appTagline: String
public let companyHqRegion: String
public let companyStage: String
public let platform: String
public let appVersionID: String
public let appVersionCreatedAt: Date
public let appVersionUpdatedAt: Date
public let appVersionPublishedAt: Date
public let collectionID: String
public let collectionAppSectionID: String
public let collectionAppSectionUpdatedAt: Date
public let screens: [Screen]
}
}
Loading

0 comments on commit bdd24a7

Please sign in to comment.