{"id":26119424,"url":"https://github.com/berrycloud/ngx-unsplash","last_synced_at":"2025-08-03T03:09:21.661Z","repository":{"id":36960003,"uuid":"390310707","full_name":"BerryCloud/ngx-unsplash","owner":"BerryCloud","description":"Angular service for proxied Unsplash API","archived":false,"fork":false,"pushed_at":"2024-11-04T08:23:13.000Z","size":1849,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-16T18:51:23.455Z","etag":null,"topics":["angular","typescript","unsplash"],"latest_commit_sha":null,"homepage":"https://berrycloud.co.uk","language":"TypeScript","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/BerryCloud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-28T10:30:27.000Z","updated_at":"2024-10-23T09:36:03.000Z","dependencies_parsed_at":"2024-04-10T10:29:13.628Z","dependency_job_id":"cf34faed-bd78-4d7b-87e0-90aac6803a04","html_url":"https://github.com/BerryCloud/ngx-unsplash","commit_stats":{"total_commits":96,"total_committers":4,"mean_commits":24.0,"dds":"0.42708333333333337","last_synced_commit":"912dbbbe319e01254c77902690b2af1962a5ae96"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/BerryCloud/ngx-unsplash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerryCloud%2Fngx-unsplash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerryCloud%2Fngx-unsplash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerryCloud%2Fngx-unsplash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerryCloud%2Fngx-unsplash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BerryCloud","download_url":"https://codeload.github.com/BerryCloud/ngx-unsplash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BerryCloud%2Fngx-unsplash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268488509,"owners_count":24258280,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["angular","typescript","unsplash"],"created_at":"2025-03-10T12:54:50.407Z","updated_at":"2025-08-03T03:09:21.595Z","avatar_url":"https://github.com/BerryCloud.png","language":"TypeScript","readme":"# ngx-unsplash\n\nLightweight Angular wrapper for the\n[Unsplash API](https://unsplash.com/developers).\n\nIt can be used to connect to the Unsplash API in a development environment or a\nUnsplash Proxy API in a production environment.\n\nIt uses the Angular Http Client.\n\nThis library is not provided or supported by [Unsplash](https://unsplash.com).\n\n## Installation\n\n```bash\nnpm i @berry-cloud/ngx-unsplash\n```\n\n## Configuration injection\n\nYou must provide an UnsplashConfig to be injected into the UnsplashService. The\nHttpClientModule must also be imported.\n\nFor example:\n\n```TypeScript\nimport { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { UnsplashConfig, UNSPLASH_CONFIG } from 'ngx-unsplash';\nimport { AppRoutingModule } from './app-routing.module';\nimport { AppComponent } from './app.component';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [\n    BrowserModule,\n    // import HttpClientModule after BrowserModule.\n    HttpClientModule,\n    AppRoutingModule,\n  ],\n  providers: [\n    {\n      provide: UNSPLASH_CONFIG,\n      useValue: {\n        url: 'https://example.com/',\n        authorization: 'Client-ID YOUR_ID_HERE',\n      } as UnsplashConfig,\n    },\n  ],\n  bootstrap: [AppComponent],\n})\nexport class AppModule {}\n```\n\nRemember to change the url and authorization values for your environment.\n\nThe value for the authorization is sent as an authorization header when making\nAPI requests.\n\nNOTE: In a production environment the value of the url should be set to your Unsplash\nproxy server.\n\nNOTE: In a production environment the authorization header should not be hardcoded\ninto the application.\n\nAlternatively you can provide an Observable of an UnsplashConfig which will be\ninjected into the UnsplashService.\n\nFor example:\n\n```TypeScript\nimport { NgModule } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { UNSPLASH_CONFIG } from 'ngx-unsplash';\nimport { map } from 'rxjs/operators';\nimport { AppRoutingModule } from './app-routing.module';\nimport { AppComponent } from './app.component';\nimport { UserService } from './user.service';\n\nfunction unsplashConfigFactory(userService: UserService) {\n  return userService.user$.pipe(\n      map((user) =\u003e ({\n        url: 'https://example.com/',\n        authorization: `Bearer ${user.authorization}`,\n      }))\n    );\n}\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [\n    BrowserModule,\n    // import HttpClientModule after BrowserModule.\n    HttpClientModule,\n    AppRoutingModule,\n  ],\n  providers: [\n    {\n      provide: UNSPLASH_CONFIG,\n      useFactory: unsplashConfigFactory,\n      deps: [UserService],\n    },\n  ],\n  bootstrap: [AppComponent],\n})\nexport class AppModule {}\n```\n\n### List Photos\n\nInject the UnsplashService into the constructor of a component.\n\nOptions:\n\n- page\n- perPage\n- orderBy\n\nExample:\n\n```TypeScript\nexport class ListComponent {\n  photos: Photo[] | undefined;\n\n  constructor(private unsplash: UnsplashService) {}\n\n  photos() {\n    this.unsplash.photos({ perPage: 40 }).subscribe((response) =\u003e {\n      this.photos = response;\n    });\n  }\n}\n```\n\n### Get a Photo\n\nInject the UnsplashService into the constructor of a component.\n\nExample:\n\n```TypeScript\nexport class GetComponent {\n  photo: Photo | undefined;\n\n  constructor(private unsplash: UnsplashService) {}\n\n  photo(id: string) {\n    this.unsplash.photo(id).subscribe((response) =\u003e {\n      this.photo = response;\n    });\n  }\n}\n```\n\n### Random\n\nInject the UnsplashService into the constructor of a component.\n\nOptions:\n\n- collections\n- topics\n- username\n- query\n- orientation\n- contentFilter\n- count\n\nExample:\n\n```TypeScript\nexport class RandomComponent {\n  photos: Photo[] | undefined;\n\n  constructor(private unsplash: UnsplashService) {}\n\n  randomPhoto() {\n    this.unsplash.randomPhoto({ count: 10 }).subscribe((response) =\u003e {\n      this.photos = response;\n    });\n  }\n}\n```\n\n### Search\n\nInject the UnsplashService into the constructor of a component.\n\nOptions:\n\n- page\n- perPage\n- orderBy\n- collections\n- contentFilter\n- color\n- orientation\n\nExample:\n\n```TypeScript\nexport class SearchComponent {\n  photos: Photo[] | undefined;\n\n  constructor(private unsplash: UnsplashService) {}\n\n  searchPhotos(query: string) {\n    this.unsplash.searchPhotos(query, { perPage: 10 }).subscribe((response) =\u003e {\n      this.photos = response.results;\n    });\n  }\n}\n```\n\n### Triggering a download\n\nInject the UnsplashService into the constructor of a component.\n\nExample:\n\n```TypeScript\nexport class DownloadComponent {\n\nconstructor(private unsplash: UnsplashService) {}\n\n  downloadPhoto(photo: Photo) {\n    this.unsplash.download(photo).subscribe();\n  }\n}\n```\n\n### BlurHash Pipe\n\nReturns a URL of the BlurHash preview and then the URL of photo once the photo\nbeen downloaded by the browser.\n\nParameters:\n\n- size\n\nExample:\n\n```HTML\n\u003cdiv *ngFor=\"let photo of photos\"\u003e\n  \u003cimg [src]=\"photo | blurhash | async\" alt=\"{{ photo.alt_description }}\" /\u003e\n\u003c/div\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrycloud%2Fngx-unsplash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberrycloud%2Fngx-unsplash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberrycloud%2Fngx-unsplash/lists"}