mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* add types for kap plugins * add support for new oauth functionality * fixup! pr comments * fixup! pr comments * Update types/kap-plugin/index.d.ts Co-Authored-By: Sindre Sorhus <sindresorhus@gmail.com> * rebuild Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
36 lines
814 B
TypeScript
36 lines
814 B
TypeScript
import { KapShareService } from 'kap-plugin';
|
|
|
|
interface Config {
|
|
name: string;
|
|
greeting: string;
|
|
accessToken?: string;
|
|
}
|
|
|
|
const service: KapShareService<Config> = {
|
|
title: 'My Plugin',
|
|
formats: ['apng', 'gif'],
|
|
config: {
|
|
name: {
|
|
type: 'string',
|
|
minLength: 1,
|
|
required: true,
|
|
default: 'Bilbo',
|
|
},
|
|
// $ExpectError
|
|
greeting: { type: 'string', default: true },
|
|
},
|
|
action: async context => {
|
|
// $ExpectType string
|
|
const name = context.config.get('name');
|
|
|
|
context.config.get('accessToken');
|
|
|
|
// $ExpectError
|
|
context.config.get('unknown');
|
|
|
|
await context.request(`https://example.com/greet/${name}`);
|
|
|
|
context.notify('Greeted example.com');
|
|
},
|
|
};
|