Skip to content

Commit

Permalink
added doc link
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpcarter committed Oct 14, 2020
1 parent 59d098d commit bb582df
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,54 @@ import Combine
import Cumulocity_Client_Library
```

## Connectivity and basic usage ##

You first need to create a Connection object and then one of the API Service classes to interact with you Cumulocity tenant, e.g.

```
let conn: C8yCumulocityConnection = C8yCumulocityConnection(tenant: "<mytenant>", server: "cumulocity.com")
conn.connect(user: "john", password: "appleseed").sink(receiveCompletion: { (completion) in
switch completion {
case .failure(let error):
print("Connection refused! - \(error.localizedDescription)")
default:
print("Connection Success")
// Now that we have tested the connections, lets fetch some managed objects
C8yManagedObjectsService(conn).get(pageNum: 0).sink(receiveCompletion: { (completion) in
switch completion {
case .failure(let error):
print("Get Failed \(error.localizedDescription)")
default:
print("Get Completed")
}
}, receiveValue: { results in
if (results.status == .SUCCESS) {
print("page \(results.content!.statistics.currentPage) of \(results.content!.statistics.totalPages!), size \(results.content!.statistics.pageSize)")
for object in results.content!.objects {
print("\(String(describing: object.id))")
}
}
}).store(in: &self._cancellableSet)
}
}, receiveValue: ({ userInfo in
print("User name is \(userInfo)")
})).store(in: &self._cancellableSet)
```

The above first verifies the connection and uses the `C8yManagedObjectsService` class to fetch a page of `C8yManagedObject` objects. The connection object does not carry state and
the connect method is only useful to verify the credentials and also gather information about the user `C8yUserProfile`. Each call via the Service classes reconnects via the connection
credentials and stateless.

## SDK Documentation ##

Full documentation can be viewed [here](https://raw.githack.com/johnpcarter/c8y-ios-lib/master/docs/out/index.html)

0 comments on commit bb582df

Please sign in to comment.