Rename files to be consistent with Deno standards
This commit is contained in:
parent
6b218fec10
commit
1432cc6092
|
@ -1,16 +1,16 @@
|
|||
import Request from "./Request.ts";
|
||||
import Response from "./Response.ts";
|
||||
import { Request } from "./request.ts";
|
||||
import { Response } from "./response.ts";
|
||||
import { answerChallenge, parseResponses, serializeRequests } from "./utils.ts";
|
||||
import { throwError } from "./utils.ts";
|
||||
|
||||
interface Session {
|
||||
export interface Session {
|
||||
id: string;
|
||||
publicHash: string;
|
||||
privateHash: string;
|
||||
challenge: string;
|
||||
}
|
||||
|
||||
export default class BaseClient {
|
||||
export class BaseClient {
|
||||
protected _session?: Session;
|
||||
|
||||
constructor(
|
|
@ -9,10 +9,10 @@ import {
|
|||
Store,
|
||||
} from "./stores/mod.ts";
|
||||
import { Account, CDN, Cloud, Help, Network, Session } from "./methods/mod.ts";
|
||||
import BaseClient from "./BaseClient.ts";
|
||||
import { BaseClient } from "./base_client.ts";
|
||||
import { newHash } from "./utils.ts";
|
||||
|
||||
export default class Client extends BaseClient {
|
||||
export class Client extends BaseClient {
|
||||
help = new Help(this);
|
||||
cloud = new Cloud(this);
|
||||
network = new Network(this);
|
|
@ -1,5 +0,0 @@
|
|||
import BaseClient from "../BaseClient.ts";
|
||||
|
||||
export default class MethodBase {
|
||||
constructor(protected client: BaseClient) {}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
import Request from "../Request.ts";
|
||||
import { Request } from "../request.ts";
|
||||
import { Document } from "../types.ts";
|
||||
import MethodBase from "./MethodBase.ts";
|
||||
import { MethodBase } from "./method_base.ts";
|
||||
|
||||
export default class Account extends MethodBase {
|
||||
export class Account extends MethodBase {
|
||||
/**
|
||||
* Removes the profile picture of the currently logged in account.
|
||||
*/
|
|
@ -1,8 +1,8 @@
|
|||
import { Document } from "../types.ts";
|
||||
import { formFromObj } from "../utils.ts";
|
||||
import MethodBase from "./MethodBase.ts";
|
||||
import { MethodBase } from "./method_base.ts";
|
||||
|
||||
export default class CDN extends MethodBase {
|
||||
export class CDN extends MethodBase {
|
||||
async upload(document: any): Promise<Document> {
|
||||
const form = formFromObj({
|
||||
action: "upload",
|
|
@ -1,8 +1,8 @@
|
|||
import { Document } from "../types.ts";
|
||||
import MethodBase from "./MethodBase.ts";
|
||||
import Request from "../Request.ts";
|
||||
import { MethodBase } from "./method_base.ts";
|
||||
import { Request } from "../request.ts";
|
||||
|
||||
export default class Cloud extends MethodBase {
|
||||
export class Cloud extends MethodBase {
|
||||
/**
|
||||
* Gets a document using its ID or instance.
|
||||
*/
|
|
@ -1,8 +1,8 @@
|
|||
import Request from "../Request.ts";
|
||||
import { Request } from "../request.ts";
|
||||
import { HelpDocument, ServerInformation } from "../types.ts";
|
||||
import MethodBase from "./MethodBase.ts";
|
||||
import { MethodBase } from "./method_base.ts";
|
||||
|
||||
export default class Help extends MethodBase {
|
||||
export class Help extends MethodBase {
|
||||
private cachedServerInformation?: ServerInformation;
|
||||
|
||||
/**
|
|
@ -0,0 +1,5 @@
|
|||
import { BaseClient } from "../base_client.ts";
|
||||
|
||||
export class MethodBase {
|
||||
constructor(protected client: BaseClient) {}
|
||||
}
|
|
@ -1,8 +1,6 @@
|
|||
import Network from "./Network.ts";
|
||||
import Help from "./Help.ts";
|
||||
import Cloud from "./Cloud.ts";
|
||||
import Session from "./Session.ts";
|
||||
import Account from "./Account.ts";
|
||||
import CDN from "./CDN.ts";
|
||||
|
||||
export { Account, CDN, Cloud, Help, Network, Session };
|
||||
export * from "./network.ts";
|
||||
export * from "./help.ts";
|
||||
export * from "./cloud.ts";
|
||||
export * from "./session.ts";
|
||||
export * from "./account.ts";
|
||||
export * from "./cdn.ts";
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import Request from "../Request.ts";
|
||||
import { Request } from "../request.ts";
|
||||
import { Peer } from "../types.ts";
|
||||
import MethodBase from "./MethodBase.ts";
|
||||
import { MethodBase } from "./method_base.ts";
|
||||
|
||||
export default class Network extends MethodBase {
|
||||
export class Network extends MethodBase {
|
||||
/**
|
||||
* Gets the peer of the currently logged in account.
|
||||
*/
|
|
@ -1,9 +1,9 @@
|
|||
import Request from "../Request.ts";
|
||||
import { Request } from "../request.ts";
|
||||
import { Peer, Session as ISession } from "../types.ts";
|
||||
import MethodBase from "./MethodBase.ts";
|
||||
import { MethodBase } from "./method_base.ts";
|
||||
import { NAME, PLATFORM, VERSION } from "../constants.ts";
|
||||
|
||||
export default class Session extends MethodBase {
|
||||
export class Session extends MethodBase {
|
||||
/*
|
||||
* Creates a session.
|
||||
*
|
|
@ -1,6 +1,5 @@
|
|||
import Client from "./Client.ts";
|
||||
import Request from "./Request.ts";
|
||||
export { Client, Request };
|
||||
export * from "./client.ts";
|
||||
export * from "./request.ts";
|
||||
export * from "./types.ts";
|
||||
export * as errors from "./errors.ts";
|
||||
export * from "./stores/mod.ts";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default class Request {
|
||||
export class Request {
|
||||
id?: string;
|
||||
|
||||
constructor(
|
|
@ -1,6 +1,6 @@
|
|||
import { throwError } from "./utils.ts";
|
||||
|
||||
export default class Response {
|
||||
export class Response {
|
||||
id: number;
|
||||
success: boolean;
|
||||
error?: { code: number; message: string };
|
|
@ -1,8 +1,8 @@
|
|||
import { IS_BROWSER } from "../constants.ts";
|
||||
import Store from "./Store.ts";
|
||||
import { Store } from "./store.ts";
|
||||
import { readTextFileSync, writeTextFileSync } from "../deps.deno.ts";
|
||||
|
||||
export default class FileStore extends Store {
|
||||
export class FileStore extends Store {
|
||||
data: { [key: string]: any };
|
||||
|
||||
constructor(public readonly file: string) {
|
|
@ -1,5 +1,5 @@
|
|||
import { IS_BROWSER } from "../constants.ts";
|
||||
import Store from "./Store.ts";
|
||||
import { Store } from "./store.ts";
|
||||
|
||||
function resolveToBeSet(toBeSet: any) {
|
||||
return JSON.stringify(toBeSet);
|
||||
|
@ -9,7 +9,7 @@ function resolveGot(got: string | null) {
|
|||
return got == null ? got : JSON.parse(got);
|
||||
}
|
||||
|
||||
export default class LocalStorageStore extends Store {
|
||||
export class LocalStorageStore extends Store {
|
||||
constructor(private id = "main") {
|
||||
super();
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import Store from "./Store.ts";
|
||||
import { Store } from "./store.ts";
|
||||
|
||||
export default class MemoryStore extends Store {
|
||||
export class MemoryStore extends Store {
|
||||
private data: { [key: string]: any };
|
||||
|
||||
constructor() {
|
|
@ -1,10 +1,8 @@
|
|||
import Store from "./Store.ts";
|
||||
import FileStore from "./FileStore.ts";
|
||||
import MemoryStore from "./MemoryStore.ts";
|
||||
import LocalStorageStore from "./LocalStorageStore.ts";
|
||||
export * from "./store.ts";
|
||||
export * from "./file_store.ts";
|
||||
export * from "./memory_store.ts";
|
||||
export * from "./localstorage_store.ts";
|
||||
|
||||
export type Memory = ":memory:";
|
||||
export type FileName = string;
|
||||
export type LocalStorageKey = string;
|
||||
|
||||
export { FileStore, LocalStorageStore, MemoryStore, Store };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export default abstract class Store {
|
||||
export abstract class Store {
|
||||
abstract set(key: string, value: any): void;
|
||||
abstract get(key: string): any;
|
||||
abstract delete(key: string): void;
|
|
@ -1,6 +1,6 @@
|
|||
// import { crypto } from "https://deno.land/std@0.110.0/crypto/mod.ts";
|
||||
import Request from "./Request.ts";
|
||||
import Response from "./Response.ts";
|
||||
import { Request } from "./request.ts";
|
||||
import { Response } from "./response.ts";
|
||||
import { getRandomValues, jsSHA, OTPAuth } from "./deps.deno.ts";
|
||||
import map, { SocialvoidError } from "./errors.ts";
|
||||
|
||||
|
|
Loading…
Reference in New Issue