package org.thinkinghub.gateway.api;

import com.github.scribejava.core.builder.api.DefaultApi20;
import com.github.scribejava.core.extractors.TokenExtractor;
import com.github.scribejava.core.model.OAuth2AccessToken;
import com.github.scribejava.core.model.OAuthConfig;
import com.github.scribejava.core.oauth.OAuth20Service;
import org.thinkinghub.gateway.core.extractors.GitHubOAuth2AccessTokenExtractor;
import org.thinkinghub.gateway.core.extractors.LinkedInOAuth2AccessTokenExtractor;
import org.thinkinghub.gateway.core.service.LinkedInOAuthService;

public class LinkedInApi extends DefaultApi20{
    protected LinkedInApi() {
    }

    private static class InstanceHolder {
        private static final LinkedInApi INSTANCE = new LinkedInApi();
    }

    public static LinkedInApi instance() {
        return InstanceHolder.INSTANCE;
    }

    @Override
    public String getAccessTokenEndpoint() {
        return "https://www.linkedin.com/oauth/v2/accessToken";
    }

    @Override
    protected String getAuthorizationBaseUrl() {
        return "https://www.linkedin.com/oauth/v2/authorization";
    }

    @Override
    public TokenExtractor<OAuth2AccessToken> getAccessTokenExtractor() {
        return LinkedInOAuth2AccessTokenExtractor.instance();
    }

    @Override
    public OAuth20Service createService(OAuthConfig config) {
        return new LinkedInOAuthService(this, config);
    }
}

@@ -31,16 +31,166 @@
 y.api;%0A%0A
+import org.thinkinghub.gateway.core.extractors.LinkedInOAuth2AccessTokenExtractor;%0Aimport org.thinkinghub.gateway.core.service.LinkedInOAuthService;%0A%0A
 import c
@@ -473,238 +473,8 @@
 ice;
-%0Aimport org.thinkinghub.gateway.core.extractors.GitHubOAuth2AccessTokenExtractor;%0Aimport org.thinkinghub.gateway.core.extractors.LinkedInOAuth2AccessTokenExtractor;%0Aimport org.thinkinghub.gateway.core.service.LinkedInOAuthService;
 %0A%0Apu

remove unused import