<commit_before>// LICENSE : MIT
"use strict";
import assert from "assert";
import BrowserWindow from 'browser-window'
import {OAuth} from "oauth";
import {buildScope} from "./hatenaOauth";
// ref: https://github.com/kymmt90/blog/blob/76fe9265df6f55b13d6ecd2d33168464926259bd/hatena_oauth.md
const OAuthProvider = {
    requestTokenURL: "https://www.hatena.com/oauth/initiate",
    accessTokenURL: "https://www.hatena.com/oauth/token",
    authorizeURL: "https://www.hatena.ne.jp/oauth/authorize?oauth_token="
};
export default class AuthenticationWindow {
    constructor({ key , secret , scopes=[]}) {
        assert(key, "OAuth Consumer Key is needed!");
        assert(secret, "OAuth Consumer Secret is needed!");
        var scopeQuery = scopes.length > 0 ? `?scope=${buildScope(scopes)}` : "";
        this.consumerKey = key;
        this.consumerSecret = secret;
        this.OAuthProvider = {
            requestTokenURL: `${OAuthProvider.requestTokenURL}${scopeQuery}`,
            accessTokenURL: OAuthProvider.accessTokenURL
        };
        this.window = null;
        this.resolve = null;
        this.reject = null;
    }

    startRequest() {
        var oauth = new OAuth(
            this.OAuthProvider.requestTokenURL,
            this.OAuthProvider.accessTokenURL,
            this.consumerKey,
            this.consumerSecret,<commit_msg>docs: add link<commit_after>// LICENSE : MIT
"use strict";
import assert from "assert";
import BrowserWindow from 'browser-window'
import {OAuth} from "oauth";
import {buildScope} from "./hatenaOauth";
// ref: https://github.com/kymmt90/blog/blob/76fe9265df6f55b13d6ecd2d33168464926259bd/hatena_oauth.md
// http://qiita.com/n0bisuke/items/c12963e0bde614443adf
const OAuthProvider = {
    requestTokenURL: "https://www.hatena.com/oauth/initiate",
    accessTokenURL: "https://www.hatena.com/oauth/token",
    authorizeURL: "https://www.hatena.ne.jp/oauth/authorize?oauth_token="
};
export default class AuthenticationWindow {
    constructor({ key , secret , scopes=[]}) {
        assert(key, "OAuth Consumer Key is needed!");
        assert(secret, "OAuth Consumer Secret is needed!");
        var scopeQuery = scopes.length > 0 ? `?scope=${buildScope(scopes)}` : "";
        this.consumerKey = key;
        this.consumerSecret = secret;
        this.OAuthProvider = {
            requestTokenURL: `${OAuthProvider.requestTokenURL}${scopeQuery}`,
            accessTokenURL: OAuthProvider.accessTokenURL
        };
        this.window = null;
        this.resolve = null;
        this.reject = null;
    }

    startRequest() {
        var oauth = new OAuth(
            this.OAuthProvider.requestTokenURL,
            this.OAuthProvider.accessTokenURL,
            this.consumerKey,
            this.consumerSecret,
{'fraction_non_alphanumeric': 0.12612612612612611, 'fraction_numerical': 0.026306306306306305, 'mean_word_length': 3.0173661360347324, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3192135', 'n_tokens_mistral': 906, 'n_tokens_neox': 850, 'n_words': 162}