{"id":16685523,"url":"https://github.com/imryan/approveapi","last_synced_at":"2025-10-09T05:10:31.681Z","repository":{"id":56902354,"uuid":"173221887","full_name":"imryan/ApproveAPI","owner":"imryan","description":"✅ ApproveAPI in Swift.","archived":false,"fork":false,"pushed_at":"2019-07-05T16:51:15.000Z","size":322,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T05:05:06.011Z","etag":null,"topics":["approveapi","rest-api"],"latest_commit_sha":null,"homepage":"https://approveapi.com","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imryan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-01T02:34:45.000Z","updated_at":"2019-07-05T16:51:17.000Z","dependencies_parsed_at":"2022-08-21T01:50:39.654Z","dependency_job_id":null,"html_url":"https://github.com/imryan/ApproveAPI","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FApproveAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FApproveAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FApproveAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imryan%2FApproveAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imryan","download_url":"https://codeload.github.com/imryan/ApproveAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243428434,"owners_count":20289317,"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":["approveapi","rest-api"],"created_at":"2024-10-12T14:47:30.490Z","updated_at":"2025-10-09T05:10:26.652Z","avatar_url":"https://github.com/imryan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✅ ApproveAPI\n\n[![CI Status](https://img.shields.io/travis/imryan/ApproveAPI.svg?style=flat)](https://travis-ci.org/imryan/ApproveAPI)\n[![Version](https://img.shields.io/cocoapods/v/ApproveAPI.svg?style=flat)](https://cocoapods.org/pods/ApproveAPI)\n[![License](https://img.shields.io/cocoapods/l/ApproveAPI.svg?style=flat)](https://cocoapods.org/pods/ApproveAPI)\n[![Platform](https://img.shields.io/cocoapods/p/ApproveAPI.svg?style=flat)](https://cocoapods.org/pods/ApproveAPI)\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## Requirements\n\n- Alamofire\n\n## Installation\n\nApproveAPI is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'ApproveAPI'\n```\n\n## Usage\n\n#### Create ApproveAPI client with API key\n```swift\nlet approveClient = ApproveAPI(apiKey: \"your-api-key\", isTestKey: true, delegate: nil)\n```\n\n#### Send a Prompt\n```swift\n// Create metadata\nlet metadata = AnswerMetadataPost(location: \"New York, NY\", timestamp: \"9:41 AM\")\nmetadata.browser = UIDevice.current.model\n\n// Create Prompt request object\nvar request = PromptRequest(userType: .email(\"someone@email.com\"), body: \"Demo body message.\")\nrequest.title = \"Optional prompt title\"\nrequest.metadata = metadata\n\n// Send prompt to provided user address\napproveClient.sendPrompt(withRequest: request) { (prompt, error) in\n    guard let promptId = prompt?.id, error == nil else {\n        debugPrint(\"Error:\", error ?? \"N/A\")\n        return\n    }\n\n    debugPrint(\"Prompt Send:\", prompt ?? \"None\")\n}\n```\n\n#### Retrieve a Prompt\n```swift\napproveClient.retreivePrompt(withId: \"prompt_id\") { (prompt, error) in\n    guard let promptId = prompt?.id, error == nil else {\n        debugPrint(\"Error:\", error ?? \"N/A\")\n        return\n    }\n\n    debugPrint(\"Prompt Retrieval:\", prompt ?? \"None\")\n}\n```\n\n#### Get Prompt status\n```swift\napproveClient.checkPromptStatus(withId: \"prompt_id\") { (status, error) in\n    guard let status = status, error == nil else {\n        debugPrint(\"Error:\", error ?? \"N/A\")\n        return\n    }\n\n    debugPrint(\"Prompt Status:\", status)\n}\n```\n\n#### Send prompt (with delegate response)\n```swift\n// Create Prompt request object\nvar request = PromptRequest(userType: .email(\"someone@email.com\"), body: \"Demo body message.\")\nrequest.longPoll = true // Wait for user response\n\n// Will notify via delegate\napproveClient.delegate = self // Can also set on init()\napproveClient.sendPrompt(withRequest: request, completion: nil)\n```\n```swift\nextension ViewController: ApproveAPIProtocol {\n\n    func approveClient(_ client: ApproveAPI, promptChanged prompt: Prompt) {\n        debugPrint(\"Prompt changed:\", prompt)\n    }\n\n    func approveClient(_ client: ApproveAPI, promptStatusChanged status: PromptStatus) {\n        debugPrint(\"Status changed:\", status)\n    }\n}\n```\n\n## Author\n\nRyan Cohen, notryancohen@gmail.com\n\n## License\n\nApproveAPI is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimryan%2Fapproveapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimryan%2Fapproveapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimryan%2Fapproveapi/lists"}