Last active
April 10, 2024 19:55
-
-
Save RinniSwift/fadb04ef6b339dba676711bc2a1cf9bc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
enum Router { | |
case getSources | |
case getProductIds | |
case getProductInfo | |
var scheme: String { | |
switch self { | |
case .getSources, .getProductIds, .getProductInfo: | |
return "https" | |
} | |
} | |
var host: String { | |
switch self { | |
case .getSources, .getProductIds, .getProductInfo: | |
return "shopicruit.myshopify.com" | |
} | |
} | |
var path: String { | |
switch self { | |
case .getSources: | |
return "/admin/custom_collections.json" | |
case .getProductIds: | |
return "/admin/collects.json" | |
case .getProductInfo: | |
return "/admin/products.json" | |
} | |
} | |
var parameters: [URLQueryItem] { | |
let accessToken = "c32313df0d0ef512ca64d5b336a0d7c6" | |
switch self { | |
case .getSources: | |
return [URLQueryItem(name: "page", value: "1"), | |
URLQueryItem(name: "access_token", value: accessToken)] | |
case .getProductIds: | |
return [URLQueryItem(name: "page", value: "1"), | |
URLQueryItem(name: "collection_id", value: "68424466488"), | |
URLQueryItem(name: "access_token", value: accessToken)] | |
case .getProductInfo: | |
return [URLQueryItem(name: "ids", value: "2759162243,2759143811"), | |
URLQueryItem(name: "page", value: "1"), | |
URLQueryItem(name: "access_token", value: accessToken)] | |
} | |
} | |
var method: String { | |
switch self { | |
case .getSources, .getProductIds, .getProductInfo: | |
return "GET" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment