so 1.0.0
so: ^1.0.0 copied to clipboard
A client library to communicate and exchange data with SO Platform.
import 'package:so/so.dart';
Future<void> main() async {
Client client = Client("emqim12.engravsystems.com", "emqimtest");
String status = await client.login("username", "password");
if (status == "") {
print("Logged in successfully");
Data d = await client.file("ENGRAV Air - Operation Manual");
if (d.error == '') {
print("Mime type of the file retrieved is: ${d.contentType}");
} else {
print("Error retrieving file: ${d.error}");
}
Map<String, dynamic> attributes;
print("List of persons whose first name starts with the letter N");
attributes = {
"className": "core.Person",
"attributes": ["TitleValue AS Title", "FirstName", "DateOfBirth"],
"where": "FirstName LIKE 'N%'",
};
printResult(await client.command("list", attributes));
print("List of usernames whose first name starts with the letter N");
attributes = {
"className": "core.SystemUser",
"attributes": [
"Id",
"Login",
"Person.Name AS FN",
"Person.DateOfBirth AS DoB",
"Person.MaritalStatusValue AS MaritalStatus"
],
"where": "Person.FirstName LIKE 'N%'",
"order": "Person.FirstName"
};
printResult(await client.command("list", attributes));
print(
"A person whose name starts with N (Note: The fist person found is returned)");
attributes = {
"className": "core.Person",
"where": "FirstName LIKE 'N%'",
};
printResult(await client.command("get", attributes));
} else {
print("Not logged in. Error: $status");
}
await client.logout();
}
void printResult(Map<String, dynamic> result) {
if (result['status'] == "OK") {
print(result['data']);
} else {
print("Error: ${result['message]']}");
}
}