-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b8f89ea
commit 818df54
Showing
16 changed files
with
269 additions
and
121 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
Binary file modified
BIN
+5.88 KB
(110%)
...eproj/project.xcworkspace/xcuserdata/belalsamy.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
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
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,13 @@ | ||
// | ||
// Encoding.swift | ||
// SimpleAPI | ||
// | ||
// Created by Belal Samy on 23/03/2022. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum Encoding { | ||
case json | ||
case url | ||
} |
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,37 @@ | ||
// | ||
// EndPoint.swift | ||
// SimpleAPI | ||
// | ||
// Created by Belal Samy on 23/03/2022. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum EndPoint { | ||
case url(String) | ||
case customize(paramsArr: [String]?, queryDict: [String: String]?) | ||
|
||
var url: String? { | ||
switch self { | ||
case .url(let url): | ||
return "\(url)" | ||
|
||
case .customize(let paramsArr, let queryDict): | ||
var endpoint = "" | ||
|
||
if let paramsArr = paramsArr { | ||
for param in paramsArr { | ||
endpoint += "/\(param)" | ||
} | ||
} | ||
|
||
if let queryDict = queryDict { | ||
for (key, value) in queryDict { | ||
endpoint += "?\(key)=\(value)" | ||
} | ||
} | ||
|
||
return endpoint | ||
} | ||
} | ||
} |
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,42 @@ | ||
// | ||
// HTTPMethod.swift | ||
// SimpleAPI | ||
// | ||
// Created by Belal Samy on 23/03/2022. | ||
// | ||
|
||
import Foundation | ||
|
||
public enum HTTPMethod { | ||
case get(_ path: String = "") | ||
case post(_ path: String = "") | ||
case put(_ path: String = "") | ||
case delete(_ path: String = "") | ||
|
||
var name: String { | ||
switch self { | ||
case .get: | ||
return "GET" | ||
case .post: | ||
return "POST" | ||
case .put: | ||
return "PUT" | ||
case .delete: | ||
return "DELETE" | ||
} | ||
} | ||
|
||
var id: String { | ||
switch self { | ||
case .get(let path): | ||
return path == "" ? "" : "with path \"\(path)\"" | ||
case .post(let path): | ||
return path == "" ? "" : "with path \"\(path)\"" | ||
case .put(let path): | ||
return path == "" ? "" : "with path \"\(path)\"" | ||
case .delete(let path): | ||
return path == "" ? "" : "with path \"\(path)\"" | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.