32 lines
		
	
	
		
			636 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			636 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Srgssr;
 | 
						|
 | 
						|
use App\Srgssr\Auth;
 | 
						|
 | 
						|
class Api
 | 
						|
{
 | 
						|
 | 
						|
    public $endpoint;
 | 
						|
    public $token;
 | 
						|
    public $headers;
 | 
						|
 | 
						|
    /**
 | 
						|
     * Initialize Bearer Token for SRGSSR API calls.
 | 
						|
     * https://developer.srgssr.ch/getting-started/how-update-srg-ssr-oauth-security
 | 
						|
     */
 | 
						|
    public function __construct()
 | 
						|
    {
 | 
						|
        $this->token = Auth::token($this->endpoint);
 | 
						|
        $this->headers = [
 | 
						|
            'accept' => 'application/json',
 | 
						|
            'Authorization' => 'Bearer '.$this->token,
 | 
						|
            'Cache-Control' => 'no-cache',
 | 
						|
            'Postman-Token' => '561XX353-805e-4974-66XX-5efXX86e2d80'
 | 
						|
        ];
 | 
						|
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
}
 |