urbit/pkg/npm/api/hood/lib.ts

128 lines
1.8 KiB
TypeScript
Raw Normal View History

2021-08-17 03:15:14 +03:00
import { Poke, Scry } from '../lib';
2022-11-04 10:19:38 +03:00
import { Pike } from './types';
2021-08-17 03:15:14 +03:00
2022-11-04 08:18:58 +03:00
export const getPikes: Scry = {
app: 'hood',
path: '/kiln/pikes'
};
2021-08-17 03:15:14 +03:00
/**
* Install a foreign desk
*/
export function kilnInstall(
ship: string,
desk: string,
local?: string
): Poke<any> {
return {
app: 'hood',
mark: 'kiln-install',
json: {
ship,
desk,
local: local || desk
}
};
}
2022-11-08 10:23:08 +03:00
/**
* Sync with a foreign desk
*/
export function kilnSync(
ship: string,
desk: string,
local?: string
): Poke<any> {
return {
app: 'hood',
mark: 'kiln-sync',
json: {
ship,
desk,
local: local || desk
}
};
}
/**
* Unsync with a foreign desk
*/
export function kilnUnsync(
ship: string,
desk: string,
local?: string
): Poke<any> {
return {
app: 'hood',
mark: 'kiln-unsync',
json: {
ship,
desk,
local: local || desk
}
};
}
2021-08-17 03:15:14 +03:00
/**
* Uninstall a desk
*/
export function kilnUninstall(
desk: string
): Poke<any> {
return {
app: 'hood',
mark: 'kiln-uninstall',
json: desk
};
}
export function kilnSuspend(
desk: string
): Poke<any> {
return {
app: 'hood',
mark: 'kiln-suspend',
json: desk
};
}
export function kilnRevive(
desk: string
): Poke<any> {
return {
app: 'hood',
mark: 'kiln-revive',
json: desk
};
}
2021-08-25 02:17:12 +03:00
2022-11-08 14:32:32 +03:00
export function kilnBump(): Poke<any> {
2021-09-07 07:46:44 +03:00
return {
app: 'hood',
mark: 'kiln-bump',
2022-11-08 14:32:32 +03:00
json: null,
2021-09-07 07:46:44 +03:00
};
}
2021-09-14 02:47:51 +03:00
export function kilnPause(desk: string) {
return {
app: 'hood',
mark: 'kiln-pause',
json: desk
};
}
export function kilnResume(desk: string) {
return {
app: 'hood',
mark: 'kiln-resume',
json: desk
};
}
2021-08-25 02:17:12 +03:00
export const scryLag: Scry = ({ app: 'hood', path: '/kiln/lag' });
export function getPikePublisher(pike: Pike) {
return pike.sync?.ship;
}