{"id":21980899,"url":"https://github.com/rryam/quotekit","last_synced_at":"2025-04-30T05:04:35.523Z","repository":{"id":38466242,"uuid":"401192456","full_name":"rryam/QuoteKit","owner":"rryam","description":"A framework to use the free APIs provided by https://quotable.io ","archived":false,"fork":false,"pushed_at":"2023-04-15T22:42:21.000Z","size":184,"stargazers_count":21,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T05:04:25.893Z","etag":null,"topics":["framework","ios","macos","package","quotable-api","quotes","quotes-api","swift","swift5","swiftui","tvos","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rryam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"rryam"}},"created_at":"2021-08-30T02:26:51.000Z","updated_at":"2025-04-04T12:50:34.000Z","dependencies_parsed_at":"2023-02-08T07:45:53.839Z","dependency_job_id":null,"html_url":"https://github.com/rryam/QuoteKit","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rryam%2FQuoteKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rryam%2FQuoteKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rryam%2FQuoteKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rryam%2FQuoteKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rryam","download_url":"https://codeload.github.com/rryam/QuoteKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644841,"owners_count":21620632,"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":["framework","ios","macos","package","quotable-api","quotes","quotes-api","swift","swift5","swiftui","tvos","watchos"],"created_at":"2024-11-29T17:14:08.431Z","updated_at":"2025-04-30T05:04:35.488Z","avatar_url":"https://github.com/rryam.png","language":"Swift","funding_links":["https://github.com/sponsors/rryam"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src= \"https://github.com/rudrankriyam/QuoteKit/blob/main/QuoteKit_Logo.png\" alt=\"QuoteKit Logo\" width=\"256\"/\u003e\n\u003c/p\u003e\n\n# QuoteKit\n\n![Twitter Follow](https://img.shields.io/twitter/follow/rudrankriyam?style=social)\n\nThe QuoteKit is a Swift framework to use the free APIs provided by [Quotable](https://github.com/lukePeavey/quotable) created by [Luke Peavey](https://github.com/lukePeavey). It uses the latest async/await syntax for easy access and contains all the APIs like fetching a random quote, all quotes, authors, tags, and searching quotes and authors.\n\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Random Quote](#random-quote)\n  - [List Quotes](#list-quotes)\n  - [Quote By ID](#quote-by-id)\n  - [List Authors](#list-authors)\n  - [Author By ID](#author-by-id)\n  - [Author Profile Image URL](#author-profile-image-url)\n  - [List Tags](#list-tags)\n  - [Search Quotes](#search-quotes)\n  - [Search Authors](#search-authors)\n- [Data Models](#data-models)\n\n## Requirements\n\nAs it uses the async/await feature of Swift 5.5, the platforms supported are OS 13.0+, macOS 11.0+, watchOS 6.0+, and tvOS 13.0+.\n\n## Installation\n\nThe best way to add QuoteKit to your project is via the Swift Package Manager. \n\n```\ndependencies: [\n    .package(url: \"https://github.com/rudrankriyam/QuoteKit.git\")\n]\n```\n\n## Usage \n\nThe `struct QuoteKit` contains static methods to fetch the relevant data. For example, to get the list of quotes - \n\n```swift \ndo {\n    var quotes: Quotes?\n    quotes = try await QuoteKit.quotes()\n} catch {\n    print(error)\n}\n```\n\nThe examples given below are similar to Quotable's [README.](https://github.com/lukePeavey/quotable/blob/master/README.md)\n\n## Random Quote\n\nReturns a single random `Quote` object from the `/random` API. \n\n```swift \nvar randomQuote: Quote?\nrandomQuote = try await QuoteKit.randomQuote()\n```\n\nYou can customize the request by adding query parameters like the minimum and maximum length of the quote or its tag. You can also get a random quote from a specific author(s).\n\nFew examples:\n\nRandom Quote with tags \"technology\" AND \"famous-quotes\" - \n\n```swift\ntry await QuoteKit.randomQuote(tags: [.technology, .famousQuotes], type: .all)\n```\n\nRandom Quote with tags \"History\" OR \"Civil Rights\" -\n\n```swift\ntry await QuoteKit.randomQuote(tags: [.history, .civilRights], type: .either)\n```\n\nRandom Quote with a maximum length of 50 characters -\n\n```swift\ntry await QuoteKit.randomQuote(maxLength: 150)\n```\n\nRandom Quote with a length between 100 and 140 characters -\n\n```swift\ntry await QuoteKit.randomQuote(minLength: 100, maxLength: 140)\n```\n\nRandom Quote by the author \"Aesop\" and \"Stephen Hawking\" -\n\n```swift\ntry await QuoteKit.randomQuote(authors: [\"aesop\", \"stephen-hawking\"])\n```\n\n## List Quotes \n\nReturns the `Quotes` object based on the given queries from the `/quotes` API. By default, the list contains 20 `Quote` on one page.\n\n```swift \nvar quotes: Quotes?\nquotes = try await QuoteKit.quotes()\n```\n\nFew examples:\n\nGet all quotes with a maximum length of 50 characters -\n\n```swift\ntry await QuoteKit.quotes(maxLength: 150)\n```\n\nGet all quotes with a length between 100 and 140 characters -\n\n```swift\ntry await QuoteKit.quotes(minLength: 100, maxLength: 140)\n```\n\nGet the first page of quotes, with 20 results per page -\n\n```swift \ntry await QuoteKit.quotes(page: 1)\n```\n\nGet the second page of quotes, with 20 results per page, with a limit of 10 quotes -\n\n```swift \ntry await QuoteKit.quotes(limit: 10, page: 2)\n```\n\nGet all quotes with the tags love OR happiness -\n\n```swift \ntry await QuoteKit.quotes(tags: [.love, .happiness], type: .either)\n```\n\nGet all quotes with the tags technology AND famous-quotes -\n\n```swift \ntry await QuoteKit.quotes(tags: [.technology, .famousQuotes], type: .all)\n```\n\nGet all quotes by author, using the author's slug -\n\n```swift \ntry await QuoteKit.quotes(authors: [\"albert-einstein\"])\n```\n\nGet all quotes sorted by the author -\n\n```swift \ntry await QuoteKit.quotes(sortBy: .author)\n```\n\nGet all quotes sorted by content, in descending order -\n\n```swift \ntry await QuoteKit.quotes(sortBy: .content, order: .descending)\n```\n\n## Quote By ID \n\nIf there is one, return a single `Quote` object for the given id from the `/quotes/:id` API.\n\n```swift \nvar quote: Quote?\nquote = try await QuoteKit.quote(id: \"2xpHvSOQMD\")\n```\n\n## List Authors\n \n Returns the `Authors` object matching the given queries from the `/authors` API. By default, the list contains 20 `Author` on one page. You can filter multiple authors by providing their slugs in the query parameter.\n \n ```swift \nvar authors: Authors?\nauthors = try await QuoteKit.authors()\n```\n\nFew examples:\n\nGet the first page of authors, with 20 results per page -\n\n```swift \ntry await QuoteKit.authors(page: 1)\n```\n\nGet the second page of authors, with 20 results per page, with a limit of 10 authors -\n\n```swift \ntry await QuoteKit.authors(limit: 10, page: 2)\n```\n\nGet all authors, sorted alphabetically by name -\n\n```swift \ntry await QuoteKit.authors(sortBy: .name)\n```\n\nGet all authors sorted by number of quotes in descending order -\n\n```swift \ntry await QuoteKit.authors(sortBy: .quoteCount, order: .descending)\n```\n\nGet a single author by slug -\n\n```swift \ntry await QuoteKit.authors(slugs: [\"albert-einstein\"])\n```\n\nGet multiple authors by slug -\n\n```swift \ntry await QuoteKit.authors(slugs: [\"albert-einstein\", \"abraham-lincoln\"])\n```\n\n## Author By ID \n\nIf there is one, return a single `Author` object for the given id from the `/authors/:id` API.\n\n```swift \nvar author: Author?\nauthor = try await QuoteKit.author(id: \"XYxYtSeixS-o\")\n```\n\n## Author Profile Image URL\n\nReturns the image URL for the given author slug. You can specify the image size as well. The default image size is 700x700. \n\n```swift \nvar authorImageURL: URL?\nauthorImageURL = QuoteKit.authorProfile(size: 1000, slug: \"aesop\")\n```\n\n## List Tags \n\nReturns the `Tags` object containing the list of all tags from the `/tags` API. You can sort it and order the sorted results.\n\n```swift \nvar tags: Tags?\ntags = try await QuoteKit.tags()\n```\n\nGet all tags, sorted alphabetically by name -\n\n```swift \ntry await QuoteKit.tags(sortBy: .name)\n```\n\nGet all tags, sorted by number of quotes in descending order -\n\n```swift \ntry await QuoteKit.tags(sortBy: .quoteCount, order: .descending)\n```\n\n## Search Quotes \n\nReturns the `Quotes` object based on the search query from the `/search/quotes` API. By default, the list contains 20 `Quote` on one page.\n\n```swift \nvar quotes: Quotes?\nquotes = try await QuoteKit.searchQuotes(for: \"love\")\n```\n\nGet the first page of searched quotes, with 20 results per page -\n\n```swift \ntry await QuoteKit.searchQuotes(for: \"love\", page: 1)\n```\n\nGet the second page of searched quotes, with 20 results per page, with a limit of 10 quotes -\n\n```swift \ntry await QuoteKit.searchQuotes(for: \"love\", limit: 10, page: 2)\n```\n\n## Search Authors \n\nReturns the `Authors` object based on the search query from the `/search/authors` API. By default, the list contains 20 `Author` on one page.\n\n```swift \nvar quotes: Quotes?\nquotes = try await QuoteKit.searchAuthors(for: \"kalam\")\n```\n\nGet the first page of searched authors, with 20 results per page -\n\n```swift \ntry await QuoteKit.searchAuthors(for: \"kalam\", page: 1)\n```\n\nGet the second page of searched authors, with 20 results per page, with a limit of 10 authors -\n\n```swift \ntry await QuoteKit.searchAuthors(for: \"kalam\", limit: 10, page: 2)\n```\n\n## Data Models \n\nThere are many different data models for using this framework. \n\n- `Quote`\n\nThe object represents a single quote. You can get the content of the quote using the `content` variable. The `tags` is an array of the relevant tag associated with the quote. To get the number of characters in the quote, use `length.`\n\n```swift \nstruct Quote: Decodable, Identifiable {\n    var id: String\n    var tags: [String]\n    var content: String\n    var author: String\n    var authorSlug: String\n    var length: Int\n    var dateAdded: String\n    var dateModified: String\n    \n    enum CodingKeys: String, CodingKey {\n        case id = \"_id\"\n        case tags, content, author, authorSlug, length, dateAdded, dateModified\n    }\n}\n```\n\n- `Author`\n\nThe object represents a single author. You can get the link to their Wikipedia page or their official website using `link.` `bio` contains a brief, one paragraph about the author. Use `description` instead to get a shorter description of the person's occupation or what they're known for. `quotes` contains an array of the author's quote.\n\n```swift\nstruct Author: Decodable, Identifiable {\n    var id: String\n    var link: String\n    var bio: String\n    var description: String\n    var name: String\n    var quoteCount: Int\n    var slug: String\n    var dateAdded: String\n    var dateModified: String\n    var quotes: [Quote]?\n    \n    enum CodingKeys: String, CodingKey {\n        case link, bio, description\n        case id = \"_id\"\n        case name, quoteCount, slug\n        case dateAdded, dateModified\n        case quotes\n    }\n}\n\nextension Author: Equatable {\n    static func ==(lhs: Author, rhs: Author) -\u003e Bool {\n        lhs.id == rhs.id\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frryam%2Fquotekit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frryam%2Fquotekit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frryam%2Fquotekit/lists"}