File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
swift-polaris-playground.playground/Sources Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,6 @@ class API {
10
10
init ( apiURI: String ) {
11
11
URI = apiURI // Set URI
12
12
13
- Accounts = AccountsAPI ( apiURI) // Initialize accounts API
13
+ Accounts = AccountsAPI ( apiURI: apiURI ) // Initialize accounts API
14
14
}
15
15
}
Original file line number Diff line number Diff line change @@ -6,6 +6,15 @@ class AccountsAPI {
6
6
7
7
// init initializes a new AccountsAPI instance.
8
8
init ( apiURI: String ) {
9
- URI = apiURI // Set API URI
9
+ URI = String ( format: " %@/twirp/accounts.Accounts " , apiURI) // Set API URI
10
+ }
11
+
12
+ // NewAccount initializes a new account via the provieded API lookup URI.
13
+ func NewAccount( ) -> ( String , Error ) {
14
+ let requestContents : [ String : Any ] = [ : ] // Empty JSON request
15
+
16
+ let jsonData = try ? JSONSerialization . data ( withJSONObject: requestContents) // Get JSON representation
17
+
18
+ var request = URLRequest ( url: URL ( string: String ( format: " %@/NewAccount " , URI) ) !) // Craft request
10
19
}
11
20
}
You can’t perform that action at this time.
0 commit comments