{"id":13608214,"url":"https://github.com/alexstyl/contactstore","last_synced_at":"2025-04-08T20:00:04.344Z","repository":{"id":37036222,"uuid":"408189357","full_name":"alexstyl/contactstore","owner":"alexstyl","description":"A modern, strongly-typed contacts API for Android.","archived":false,"fork":false,"pushed_at":"2023-02-27T08:46:13.000Z","size":1089,"stargazers_count":440,"open_issues_count":3,"forks_count":15,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-11-07T13:40:06.052Z","etag":null,"topics":["android","android-library","contacts","contacts-api","contacts-app","kotlin","kotlin-android","kotlin-coroutine-flow","kotlin-coroutines","kotlin-dsl","kotlin-library","rxjava"],"latest_commit_sha":null,"homepage":"https://alexstyl.github.io/contactstore","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexstyl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["buymeacoffee.com/alexstyl"]}},"created_at":"2021-09-19T17:16:10.000Z","updated_at":"2024-10-13T17:36:17.000Z","dependencies_parsed_at":"2024-01-16T23:30:51.677Z","dependency_job_id":"9a985f9b-0a0c-4270-a015-224963515591","html_url":"https://github.com/alexstyl/contactstore","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexstyl%2Fcontactstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexstyl%2Fcontactstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexstyl%2Fcontactstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexstyl%2Fcontactstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexstyl","download_url":"https://codeload.github.com/alexstyl/contactstore/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247918900,"owners_count":21018044,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-library","contacts","contacts-api","contacts-app","kotlin","kotlin-android","kotlin-coroutine-flow","kotlin-coroutines","kotlin-dsl","kotlin-library","rxjava"],"created_at":"2024-08-01T19:01:25.230Z","updated_at":"2025-04-08T20:00:04.314Z","avatar_url":"https://github.com/alexstyl.png","language":"Kotlin","funding_links":["buymeacoffee.com/alexstyl"],"categories":["Kotlin"],"sub_categories":[],"readme":"# Introduction\n\n![Contact Store - a modern contacts Android API](./docs/assets/banner.png)\n\nContact Store is a modern API that makes access to contacts on Android devices simple to use.\n\n[The default way of accessing contacts on Android](https://developer.android.com/guide/topics/providers/contacts-provider)\nis based off ContentProviders. Despite powerful, ContentProviders can be error-prone and frustrating to use.\n\nContact Store is a refreshed take on the Contacts API. It provides solutions to contacts' most\nfrequent use cases and uses modern developer practices for an enjoyable developer experience.\n\n## Quick Start\n\nInstall the API using Gradle:\n\n```gradle\nrepositories {\n  ...\n  mavenCentral()\n}\n\ndependencies {\n    implementation 'com.alexstyl:contactstore:1.7.0'\n    \n    // extension functions for kotlin coroutines\n    implementation 'com.alexstyl:contactstore-coroutines:1.7.0'\n    \n    // extension functions for rxJava 3\n    implementation 'com.alexstyl:contactstore-reactive:1.7.0'\n    \n    // optional dependency for tests\n    testImplementation 'com.alexstyl:contactstore-test:1.7.0'\n}\n```\n\n### Fetch all contacts\n\n```kotlin\nval store = ContactStore.newInstance(application)\n\nstore.fetchContacts()\n    .collect { contacts -\u003e\n        println(\"Contacts emitted: $contacts\")\n    }\n```\n\n### Get details of a specific contact\n\n```kotlin\nval store = ContactStore.newInstance(application)\n\nstore.fetchContacts(\n    predicate = ContactLookup(contactId),\n    columnsToFetch = allContactColumns()\n)\n    .collect { contacts -\u003e\n        val contact = contacts.firstOrNull()\n        if (contact == null) {\n            println(\"Contact not found\")\n        } else {\n            println(\"Contact found: $contact\")\n\n            // Use contact.phones, contact.mails, contact.customDataItems etc\n        }\n    }\n```\n\n### Insert a new contact into a Gmail account\n\n```kotlin\nval store = ContactStore.newInstance(application)\n\nstore.execute {\n    insert(InternetAcount(\"paolo@gmail.com\", \"gmail.com\")) {\n        firstName = \"Paolo\"\n        lastName = \"Melendez\"\n        phone(\n            value = PhoneNumber(\"555\"),\n            label = Label.PhoneNumberMobile\n        )\n        mail(\n            address = \"paolo@paolo.com\",\n            label = Label.LocationWork\n        )\n        event(\n            dayOfMonth = 23,\n            month = 11,\n            year = 2021,\n            label = Label.DateBirthday\n        )\n        postalAddress(\n            street = \"85 Somewhere Str\",\n            label = Label.LocationHome\n        )\n        webAddress(\n            address = \"paolo@paolo.com\",\n            label = Label.LocationWork\n        )\n        groupMembership(groupId = 123)\n    }\n}\n```\n\n### Update an existing Contact\n\n```kotlin\nval foundContacts = store.fetchContacts(\n    predicate = ContactLookup(contactId = 5L),\n    columnsToFetch = listOf(ContactColumn.Note)\n).blockingGet()\n\nif (foundContacts.isEmpty()) return // the contact was not found\n\nval contact = foundContacts.first()\n\nstore.execute {\n    update(contact.mutableCopy {\n        note = Note(\"To infinity and beyond!\")\n    })\n}\n```\n\n### Delete a contact\n\n```kotlin\nstore.execute {\n    delete(contactId = 5L)\n}\n```\n\n## Does Contact Store support all features the default Contacts API does?\n\nProbably not and this is not the aim of the project. The existing Contacts API has been out there\nfor 10 years or so without much update. It is powerful given that you have access to an SQL-like\nsyntax. I am assuming that a lot of the features it provides were introduced because the platform\ndevelopers were coding against the ContactProvider interface instead of supporting the features app\ndevelopers would eventually end up using.\n\nKeeping the API lean allows for faster iterations/releases too as there is less things to maintain.\nI am not saying that the features of the default API are not important or that they will\nnever make it to Contact Store. Instead, I would rather have the features and capabilities of the\nAPI to be driven by dev requirements.\n\nIf you believe you are missing a specific feature, [open a new feature request on Github][1].\n\n## Can I use this API from Java?\n\nYou should be able to use Contact Store through Java as you can call Kotlin code from Java, but it\nwon't be ideal. [Check this Github issue](https://github.com/alexstyl/contactstore/issues/58) and\nwrite your experience.\n\n## Getting Help\n\nCheckout [the project documentation](https://alexstyl.github.io/contactstore) to learn about about\nContact Store features in detail. To report a specific problem or feature\nrequest, [open a new issue on Github][1].\n\n## License\n\nApache 2.0. See the [LICENSE](https://github.com/alexstyl/contactstore/blob/main/LICENSE) file for details.\n\n## Author\n\nMade by Alex Styl. [Follow @alexstyl](https://www.twitter.com/alexstyl) on Twitter for future\nupdates.\n\n[1]: https://github.com/alexstyl/contactstore/issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexstyl%2Fcontactstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexstyl%2Fcontactstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexstyl%2Fcontactstore/lists"}