Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
cjzamora committed Dec 19, 2016
1 parent 1d86d8a commit 432ef8a
Showing 1 changed file with 238 additions and 0 deletions.
238 changes: 238 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
# Globe Connect for Swift

## Introduction
Globe Connect for Swift platform provides an implementation of Globe APIs e.g Authentication, Amax,
Sms etc. that is easy to use and can be integrated in your existing Swift application. Below shows
some samples on how to use the API depending on the functionality that you need to integrate in your
application.

## Basic Usage

###### Figure 1. Authentication

```swift
import ConnectSwift

Authentication().getAccessToken(
appId: "5ozgSgeRyeHzacXo55TR65HnqoAESbAz",
appSecret: "3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e",
code: "M8s6gAarub9pebhgEAqKsxdByxHoM5kzf4Mp5js98Bzot8bqjrfaRdG4H4jknpFzr8gKtdx4jnUqbA8KsxqA48frR698IKLRb5S5LBxauo9EkxCMrzk6uorxGEu67Tay49aTxxzu8ozznukMEaXCBRB8GuKjR5MSpB65zIbkA8Bf5eA94se848KUb589RteGkdEFBEddEH6xqRyfjMBqatE4ppBsAe56Bfq4BkjHrXA9Rsqzp5RhMAA6Mu65MAds",
success: { json in
dump(json)
},
failure: { error in
print(error)
})

let url = Authentication().getDialogUrl(appId: "5ozgSgeRyeHzacXo55TR65HnqoAESbAz")
print(url)
```

###### Figure 2. Amax

```swift
import ConnectSwift

let amax = Amax(
appId: "5ozgSgeRyeHzacXo55TR65HnqoAESbAz",
appSecret: "3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e"
)

amax.sendRewardRequest(
address: "927XXXXXXX",
promo: "FREE10MB",
rewardsToken: "w7hYKxrE7ooHqXNBQkP9lg",
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 3. Binary SMS

```swift
import ConnectSwift

let sms = Sms(
accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA",
shortCode: "21584130"
)

sms.sendBinaryMessage(
address: "092XXXXXXXX",
message: "Lorem ipsum",
header: "06050423F423F4",
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 4. Location

```swift
import ConnectSwift

let locationQuery = LocationQuery(accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA")

locationQuery
.getLocation(
address: "092XXXXXXXX",
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 5. Payment (Send Payment Request)

```swift
import ConnectSwift

let payment = Payment(
appId: "5ozgSgeRyeHzacXo55TR65HnqoAESbAz",
appSecret: "3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e",
accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA"
)

payment.sendPaymentRequest(
amount: 0.00,
description: "My Application",
endUserId: "92XXXXXXXX",
referenceCode: "41301000111",
transactionOperationStatus: "Charged",
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 6. Payment (Get Last Reference ID)

```swift
import ConnectSwift

let payment = Payment(
appId: "5ozgSgeRyeHzacXo55TR65HnqoAESbAz",
appSecret: "3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e",
accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA"
)

payment.getLastReferenceCode(
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 7. Sms

```swift
import ConnectSwift

let sms = Sms(
accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA",
shortCode: "21584130"
)

sms.sendMessage(
address: "+6392XXXXXXXX",
message: "Lorem ipsum",
success: { json in
dump(json)
expectation.fulfill()
},
failure: { error in
expectation.fulfill()
})
```

###### Figure 8. Subscriber (Get Balance)

```swift
import ConnectSwift

let subscriber = Subscriber(accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA")

subscriber.getSubscriberBalance(
address: "6392XXXXXXXX",
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 9. Subscriber (Get Reload Amount)

```swift
import ConnectSwift

let subscriber = Subscriber(accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA")

subscriber
.getSubscriberReloadAmount(
address: "6392XXXXXXXX",
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 10. USSD (Send)

```swift
import ConnectSwift

let ussd = Ussd(
accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA",
shortCode: "21584130"
)

ussd.sendUssdRequest(
address: "6392XXXXXXXX",
message: "Simple USSD Message\nOption - 1\nOption - 2",
flash: false,
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

###### Figure 11. USSD (Reply)

```swift
import ConnectSwift

let ussd = Ussd(
accessToken: "kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA",
shortCode: "21584130"
)

ussd.replyUssdRequest(
address: "6392XXXXXXXX",
message: "Simple USSD Message\nOption - 1\nOption - 2",
sessionId: "012345678912",
flash: false,
success: { json in
dump(json)
},
failure: { error in
print(error)
})
```

0 comments on commit 432ef8a

Please sign in to comment.