Skip to content

Instantly share code, notes, and snippets.

@a-ast
Created January 2, 2017 14:15
Show Gist options
  • Save a-ast/13e084b764fb8b896ab9810ed0e8da71 to your computer and use it in GitHub Desktop.
Save a-ast/13e084b764fb8b896ab9810ed0e8da71 to your computer and use it in GitHub Desktop.
Github client with plugins services
services:
# Custom plugin
github_api.plugin.wait_and_retry:
class: AppBundle\Client\Github\WaitAndRetryPlugin
# Bundled plugin
github_api.plugin.authentication:
class: Github\HttpClient\Plugin\Authentication
arguments:
- '%env(GITHUB_CLIENT_ID)%'
- '%env(GITHUB_CLIENT_SECRET)%'
- 'url_client_id'
# HTTP client
github_api.http_client:
class: Http\Adapter\Guzzle6\Client
# HTTP client builder
github_api.http_client_builder:
class: Github\HttpClient\Builder
arguments:
- '@github_api.http_client'
# Configurator for Guthub API client
# to register plugins after the builder is created
github_api.client_configurator:
class: AppBundle\Client\Github\ClientConfigurator
arguments:
- '@github_api.http_client_builder'
- ['@github_api.plugin.wait_and_retry', '@github_api.plugin.authentication']
# Guthub API client
github_api.client:
class: Github\Client
arguments:
- '@github_api.http_client_builder'
configurator: ['@github_api.client_configurator', 'configure']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment