{"id":26856888,"url":"https://github.com/leodeveloper/pagedapi","last_synced_at":"2025-03-31T00:29:55.518Z","repository":{"id":211418016,"uuid":"154312885","full_name":"leodeveloper/PagedApi","owner":"leodeveloper","description":"how to implement fake api testing with IEnumerableDisposable\u003cout T\u003e : IEnumerable\u003cT\u003e, IDisposable, Generics","archived":false,"fork":false,"pushed_at":"2018-10-23T11:05:43.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-12-08T11:41:03.775Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","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/leodeveloper.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-23T11:01:51.000Z","updated_at":"2023-12-08T11:41:08.713Z","dependencies_parsed_at":"2023-12-08T11:51:10.905Z","dependency_job_id":null,"html_url":"https://github.com/leodeveloper/PagedApi","commit_stats":null,"previous_names":["leodeveloper/pagedapi"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leodeveloper%2FPagedApi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leodeveloper%2FPagedApi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leodeveloper%2FPagedApi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leodeveloper%2FPagedApi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leodeveloper","download_url":"https://codeload.github.com/leodeveloper/PagedApi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246399822,"owners_count":20770907,"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":[],"created_at":"2025-03-31T00:29:54.907Z","updated_at":"2025-03-31T00:29:55.503Z","avatar_url":"https://github.com/leodeveloper.png","language":"C#","readme":"# PagedApi Test\n\n## Scenario\n\nYou are working on a project which must integrate heavily with a 3rd party API.\nThe 3rd party have provided you with a client library to access this API, contained within the `PagedApi` project.\n\nThe API currently exposes the ability to retreive `Foo` and `Bar` items, which are represented by the `ItemTypeId.Foo` and `ItemTypeId.Bar` enum respectively.\n\nFetching items works using a statefull 'request' model. The caller must first establish a request for a particular type of item by calling `int \nBeginPagesRequest(ItemTypeId itemTypeId)`, which returns a unique RequestId for the given `ItemTypeId`.\n\nItems are then fetched one page at a time, by passing the RequestId to `Page GetNextPage(int requestId)`. The size of each page is determined by the API.\nThe returned `Page` object will contain the collection of items for this page, and a boolean indicating if there are more pages to follow.\n\nOnce all desired items have been retrieved, the caller should call `void EndPagesRequest(int requestId)`, \nsignalling to the API that it may now clean up any resources associated with the request.\n\n## Task\n\nThe `IPagedApiCollection` interface has been proposed by your team as a way of simplifing access to `IPagedApi` throughout the project.\nDesigned to wrap `IPagedApi`, it contains only a single method: `GetItems\u003c\u003e()`.\n\nComplete the implementation of `MyPagedApiCollection`.\n\n## Considerations\n\nConsider the following points when designing your implementation.\nYou should attempt to address at least 2 of them.\n\n* The API call `IPagedApi.GetNextPage()` may take a long time to complete. If the consumer only enumerates the first few items of the `IPagedApiCollection.GetItems()` response, \nensure `IPagedApi.GetNextPage()` is called as few times as possible.\n* If the consumer never enumerates the response from `IPagedApiCollection.GetItems()`, ensure `IPagedApi.BeginPagesRequest()` is not unnecessarily called.\n* Once the consumer is finished with the request, ensure `IPagedApi.EndPagesRequest()` is called.\n* You discover a quirk concerning `IPagedApi.GetNextPage()`, where sometimes the returned `Page.Items` collection can be empty. Ensure this is gracefully handled within your implementation.\n* What happens when the response from `IPagedApiCollection.GetItems()` is enumeratad by the consumer multiple times?\n* What happens when the response from `IPagedApiCollection.GetItems()` is enumerated after it has been disposed?","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleodeveloper%2Fpagedapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleodeveloper%2Fpagedapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleodeveloper%2Fpagedapi/lists"}