Repository navigation
Expand file tree
/
Copy pathQuickstart.java
More file actions
39 lines (33 loc) · 1.58 KB
/
Copy pathQuickstart.java
File metadata and controls
39 lines (33 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* Quickstart — the 60-second tour. Free (no credits spent).
*
* mvn -q exec:java -Dexec.mainClass="examples.Quickstart"
*/
package examples;
import ai.cleanlist.client.ApiException;
import ai.cleanlist.client.Cleanlist;
import ai.cleanlist.client.model.CreateListRequest;
import ai.cleanlist.client.model.ListDetailResponse;
import ai.cleanlist.client.model.ListSummary;
import ai.cleanlist.client.model.ListsPageResponse;
import ai.cleanlist.client.model.WhoamiResponse;
public class Quickstart {
public static void main(String[] args) throws ApiException {
String host = System.getenv().getOrDefault("CLEANLIST_HOST", Cleanlist.DEFAULT_BASE_PATH);
Cleanlist cl = new Cleanlist(null, host); // null -> reads CLEANLIST_API_KEY
// Who am I? — identity, org, plan tier, scopes.
WhoamiResponse me = cl.workspace.whoami();
System.out.printf("Authenticated as org '%s' (tier: %s)%n", me.getOrganizationName(), me.getTier());
// Credit balance.
System.out.println("Credit balance: " + cl.workspace.creditsBalance().getCredits());
// Create a lead list (idempotent on name).
ListDetailResponse list = cl.leadLists.createList(new CreateListRequest().name("SDK quickstart"));
System.out.println("List ready: " + list.getListId());
// Recent lists.
ListsPageResponse page = cl.leadLists.listLists(null, 5, null);
System.out.println("Recent lists:");
for (ListSummary s : page.getLists()) {
System.out.printf(" - %s (%d leads)%n", s.getName(), s.getLeadCount());
}
}
}