Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods for collections, topics and users #174

Merged
merged 18 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ jobs:
- run: npm ci
- run: npx ng build
# TODO add linting
- run: npx ng test --no-watch --no-progress --browsers=ChromeHeadless
- run: npx ng test --no-watch --no-progress --code-coverage --browsers=ChromeHeadless
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function unsplashConfigFactory(userService: UserService) {
export class AppModule {}
```

### List
### List Photos

Inject the UnsplashService into the constructor of a component.

Expand All @@ -124,15 +124,15 @@ export class ListComponent {

constructor(private unsplash: UnsplashService) {}

list() {
this.unsplash.list({ perPage: 40 }).subscribe((response) => {
photos() {
this.unsplash.photos({ perPage: 40 }).subscribe((response) => {
this.photos = response;
});
}
}
```

### Get
### Get a Photo

Inject the UnsplashService into the constructor of a component.

Expand All @@ -144,8 +144,8 @@ export class GetComponent {

constructor(private unsplash: UnsplashService) {}

get(id: string) {
this.unsplash.get(id).subscribe((response) => {
photo(id: string) {
this.unsplash.photo(id).subscribe((response) => {
this.photo = response;
});
}
Expand Down Expand Up @@ -174,8 +174,8 @@ export class RandomComponent {

constructor(private unsplash: UnsplashService) {}

random() {
this.unsplash.random({ count: 10 }).subscribe((response) => {
randomPhoto() {
this.unsplash.randomPhoto({ count: 10 }).subscribe((response) => {
this.photos = response;
});
}
Expand Down Expand Up @@ -204,8 +204,8 @@ export class SearchComponent {

constructor(private unsplash: UnsplashService) {}

search(query: string) {
this.unsplash.search(query, { perPage: 10 }).subscribe((response) => {
searchPhotos(query: string) {
this.unsplash.searchPhotos(query, { perPage: 10 }).subscribe((response) => {
this.photos = response.results;
});
}
Expand All @@ -214,14 +214,16 @@ export class SearchComponent {

### Triggering a download

Inject the UnsplashService into the constructor of a component.

Example:

```TypeScript
export class DownloadComponent {

constructor(private unsplash: UnsplashService) {}

download(photo: Photo) {
downloadPhoto(photo: Photo) {
this.unsplash.download(photo).subscribe();
}
}
Expand Down
3 changes: 2 additions & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"polyfills": [
"zone.js",
"zone.js/testing"
]
],
"karmaConfig": "projects/ngx-unsplash/karma.conf.js"
}
}
}
Expand Down
Loading