{"id":20287468,"url":"https://github.com/developerzelentsov/smshubapi","last_synced_at":"2025-09-22T16:31:43.777Z","repository":{"id":147117142,"uuid":"616685900","full_name":"DeveloperZelentsov/SMSHubAPI","owner":"DeveloperZelentsov","description":"SmsHubAPI Swift Library","archived":false,"fork":false,"pushed_at":"2023-04-06T11:05:13.000Z","size":62,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-14T14:44:35.192Z","etag":null,"topics":["ios","sms-api","sms-client","sms-hub","sms-messages","smshub","smshub-api","swift"],"latest_commit_sha":null,"homepage":"","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/DeveloperZelentsov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-20T21:54:28.000Z","updated_at":"2023-05-26T11:45:30.000Z","dependencies_parsed_at":"2023-05-12T21:15:50.122Z","dependency_job_id":null,"html_url":"https://github.com/DeveloperZelentsov/SMSHubAPI","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperZelentsov%2FSMSHubAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperZelentsov%2FSMSHubAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperZelentsov%2FSMSHubAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DeveloperZelentsov%2FSMSHubAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DeveloperZelentsov","download_url":"https://codeload.github.com/DeveloperZelentsov/SMSHubAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233863674,"owners_count":18742182,"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":["ios","sms-api","sms-client","sms-hub","sms-messages","smshub","smshub-api","swift"],"created_at":"2024-11-14T14:40:05.441Z","updated_at":"2025-09-22T16:31:43.477Z","avatar_url":"https://github.com/DeveloperZelentsov.png","language":"Swift","funding_links":["https://www.buymeacoffee.com/zelentsov"],"categories":[],"sub_categories":[],"readme":"# SmsHubAPI Swift Library #\n\nSmsHubAPI is a Swift library that provides an easy-to-use interface for interacting with the SmsHub API. With this library, you can access various [SmsHub services](https://smshub.org/en/main), such as getting your account balance, purchasing a phone number, setting and retrieving the status of an activation, and more.\n\n[![Buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/zelentsov)\n\n## Features ##\n\n* Swift concurrency support with async/await\n* Simple, protocol-based API\n* Lightweight and modular\n\n## Requirements ##\n\n* iOS 15.0+\n* Swift 5.6+\n\n## Installation ##\n\nAdd the library to your project using Swift Package Manager:\n\n1. Open your project in Xcode.\n2. Go to File \u003e Swift Packages \u003e Add Package Dependency.\n3. Enter the repository URL `https://github.com/DeveloperZelentsov/SMSHubAPI` for the SmsHubAPI library and click Next.\n4. Choose the latest available version and click Next.\n5. Select the target where you want to use SmsHubAPI and click Finish.\n\n## Usage ##\n\nFirst, import the **_SmsHubAPI_** library in your Swift file:\n\n```swift\nimport SmsHubAPI\n```\n\nTo start using the library, create an instance of **_SmsHubAPI_** with your API key:\n\n```swift\nlet smsHubAPI = SmsHubAPI(apiKey: \"your_api_key_here\")\n```\nNow, you can call the methods provided by the **_SmsHubAPI_** protocol:\n\n### Get Account Balance ###\n\n```swift\ndo {\n    let balance = try await smsHubAPI.getBalance()\n    print(\"Account balance: \\(balance)\")\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n### Purchase Phone Number ###\n\n```swift\nlet getNumber = GetNumberRequest(service: .nextdoor, country: .usa)\n\ndo {\n    let (id, phone) = try await smsHubAPI.purchasePhoneNumber(by: getNumber)\n    print(\"Purchased phone number: \\(phone) with ID: \\(id)\")\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n### Wait for Code ###\n\nThe `waitForCode` method can be used to conveniently retrieve the SMS verification code for an activation. This method will repeatedly check the activation status until the code is received or the specified number of attempts is exhausted.\n\n```swift\ndo {\n    let activationId = 12345\n    let code = try await smsHubAPI.waitForCode(id: activationId, attempts: 20, setStatusAfterCompletion: true)\n    print(\"Received code: \\(code)\")\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n### Set Activation Status ###\n\n```swift\ndo {\n    let response = try await smsHubAPI.setStatus(id: activationId, status: .smsSent)\n    print(\"Status set response: \\(response)\")\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\n### Get Activation Status ###\n\n```swift\ndo {\n    let (status, code) = try await smsHubAPI.getStatus(id: activationId)\n    print(\"Activation status: \\(status)\")\n\n    if let code = code {\n        print(\"Activation code: \\(code)\")\n    }\n} catch {\n    print(\"Error: \\(error)\")\n}\n```\n\nFor more information on the available methods and their parameters, refer to the **_ISmsHubAPI_** protocol and the library's source code.\n\n## License ##\n\nThis project is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperzelentsov%2Fsmshubapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeveloperzelentsov%2Fsmshubapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeveloperzelentsov%2Fsmshubapi/lists"}