0.1.26 • Published 5 years ago
aicevote v0.1.26
aicevote - AICEVOTE API Client Library -
This project ends May 18, 2020
Installing
Using npm:
$ npm install aicevoteUsing yarn:
$ yarn add aicevoteUsing jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/aicevote/dist/aicevote.min.js"></script>Using unpkg CDN:
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://unpkg.com/aicevote/dist/aicevote.min.js"></script>note: aicevote uses axios for http requests. Don't forget to load axios.
Example
aicevote.getAllThemes().then(themes => {
    console.log(themes);
});
// Want to use async/await? Add the "async" keyword to your outer function/method.
async function getAllThemes() {
    const themes = await aicevote.getAllThemes();
    console.log(themes);
}note:
async/awaitis part of ECMAScript 2017 and is not supported in Internet Explorer and older browsers, so use with caution.
CommonJS usage
while using CommonJS imports with require(), use the following approach:
const aicevote = require("aicevote");
// aicevote.<method> will now provide autocomplete and parameter typingsTypeScript usage
aicevote includes TypeScript definitions.
import aicevote from "aicevote";aicevote API
Functions
// Auth
function getSessionToken(sessionID: string): Promise<string>;
// Index
function getArticles(): Promise<{
    latest: Article[];
    related: {
        themeID: number;
        articles: Article[];
    }[];
}>;
function postFeedback(feedback: string): Promise<void>;
function postApplication(application: string): Promise<void>;
// Theme
function getAllThemes(): Promise<Theme[]>;
function getTheme(themeID: number): Promise<Theme>;
function queryThemes(regex: string): Promise<Theme[]>;
function putTheme(themeID: number, sessionToken: string, isEnabled: boolean, 
    title: string, description: string, imageURI: string, genre: number, 
    choices: string, DRClass: number, isPersonalMatters: boolean): Promise<void>;
// User
function getMyProfile(sessionToken: string): Promise<Profile>;
function getProfiles(users: {
    userProvider: userProvider;
    userID: string;
}[]): Promise<Profile[]>;
function getInfluencers(): Promise<string[]>;
// Vote
function getResult(themeID: number): Promise<Result>;
function getVotes(themeID: number, sessionToken: string): Promise<Vote[]>;
function vote(themeID: number, sessionToken: string, answer: number): Promise<void>;
function getTransition(themeID: number): Promise<Transition>;
function getComments(themeID: number): Promise<Comment[]>;
function comment(themeID: number, sessionToken: string, message: string): Promise<void>;Types
// Index
interface Article {
    source: string;
    author: string;
    title: string;
    description: string;
    uri: string;
    uriToImage: string;
    publishedAt: number;
}
// Theme
interface Theme {
    themeID: number;
    userProvider: string;
    userID: string;
    title: string;
    description: string;
    imageURI: string;
    genre: number;
    choices: string[];
    isPersonalMatters: boolean;
    topicality: number;
}
// User
type userProvider = "twitter" | "legacy";
interface Profile {
    userProvider: userProvider;
    userID: string;
    name: string;
    imageURI: string;
    friends: string[];
    isInfluencer: boolean;
    votes: Vote[];
    comments: Comment[];
    themes: Theme[];
}
// Vote
interface Result {
    themeID: number;
    percentage: number[];
}
interface Vote {    
    themeID: number;
    answer: number;
    userProvider: userProvider;
    userID: string;
    createdAt: number;
}
interface Transition {
    shortTransition: {
        timestamp: number;
        percentage: number[];
    }[];
    longTransition: {
        timestamp: number;
        percentage: number[];
    }[];
}
interface Comment {
    themeID: number;
    message: string;
    userProvider: userProvider;
    userID: string;
    createdAt: number;
}(C) 2020 YUJI mail@yuji.ne.jp
0.1.26
5 years ago
0.1.25
5 years ago
0.1.24
5 years ago
0.1.20
5 years ago
0.1.21
5 years ago
0.1.22
5 years ago
0.1.23
5 years ago
0.1.19
5 years ago
0.1.17
5 years ago
0.1.18
5 years ago
0.1.16
6 years ago
0.1.15
6 years ago
0.1.14
6 years ago
0.1.13
6 years ago
0.1.12
6 years ago
0.1.10
6 years ago
0.1.11
6 years ago
0.1.9
6 years ago
0.1.8
6 years ago
0.1.7
6 years ago
0.1.6
6 years ago
0.1.2
6 years ago
0.1.4
6 years ago
0.1.3
6 years ago
0.1.5
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago