{"id":18310122,"url":"https://github.com/kazhuravlev/go-unsplash","last_synced_at":"2025-04-09T11:43:48.025Z","repository":{"id":78640914,"uuid":"160989446","full_name":"kazhuravlev/go-unsplash","owner":"kazhuravlev","description":"Go client for unsplash.com API","archived":false,"fork":false,"pushed_at":"2018-12-09T23:41:13.000Z","size":34,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T16:16:18.373Z","etag":null,"topics":["go","mit-license","unsplash-api"],"latest_commit_sha":null,"homepage":"","language":"Go","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/kazhuravlev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2018-12-09T00:01:27.000Z","updated_at":"2019-09-18T12:49:21.000Z","dependencies_parsed_at":"2023-04-09T04:32:23.230Z","dependency_job_id":null,"html_url":"https://github.com/kazhuravlev/go-unsplash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazhuravlev%2Fgo-unsplash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazhuravlev%2Fgo-unsplash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazhuravlev%2Fgo-unsplash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kazhuravlev%2Fgo-unsplash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kazhuravlev","download_url":"https://codeload.github.com/kazhuravlev/go-unsplash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248033366,"owners_count":21036778,"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":["go","mit-license","unsplash-api"],"created_at":"2024-11-05T16:13:19.003Z","updated_at":"2025-04-09T11:43:48.005Z","avatar_url":"https://github.com/kazhuravlev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go client for unsplash.com API\n\n## Installation\n\n```bash\ngo get github.com/kazhuravlev/go-unsplash \n```\n\n## Run tests\n\nTo run tests you must [register application](https://unsplash.com/oauth/applications/new).\n\nAfter register application copy `Access Key` and `Secret Key` and then:\n\n```bash\ngo run tools/main.go -accessKey=\u003cAccess Key\u003e -secretKey=\u003cSecret Key\u003e\n```\n\nGo to URL and authorize application to required permissions. After accept \nrequest you get `Authorization code` string. Copy it and:\n\n```bash\ngo run tools/main.go -accessKey=\u003cAccess Key\u003e -secretKey=\u003cSecret Key\u003e -code=\u003cAuthorization code\u003e \n```\n\nYou must see `Access Token` in terminal output. Copy it.\n\nTo run all tests with given credentials just type:\n\n```bash\nexport TEST_ACCESS_KEY=\u003cAccess Key\u003e; TEST_SECRET_KEY=\u003cSecret Key\u003e; TEST_ACCESS_TOKEN=\u003cAccess Token\u003e go test -v ./...\n```\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/kazhuravlev/go-unsplash/unsplash\"\n\t\"golang.org/x/oauth2\"\n\t\"log\"\n)\n\nfunc main() {\n\taccessToken := \"\u003cAccess Key\u003e\"\n\tsource := oauth2.StaticTokenSource(\n\t\t\u0026oauth2.Token{AccessToken: accessToken, TokenType: \"Client-ID\"},\n\t)\n\n\thttpClient := oauth2.NewClient(context.Background(), source)\n\n\tclient, err := unsplash.New(unsplash.WithHttpClient(httpClient))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tphotos, err := client.GetRandomPhotos(context.Background(), unsplash.GetRandomPhotosOptions{})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfmt.Println(photos[0].Urls.Full)\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazhuravlev%2Fgo-unsplash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkazhuravlev%2Fgo-unsplash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkazhuravlev%2Fgo-unsplash/lists"}