Skip to content

Commit

Permalink
Merge pull request #12 from lexisother/master
Browse files Browse the repository at this point in the history
#ACT-2382 Add TS declarations
  • Loading branch information
tim-hanssen authored Jan 21, 2024
2 parents c8336bb + 0147e47 commit 9aa1289
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
declare module '@preprio/nodejs-sdk' {
interface ClientOptions {
token?: string;
baseUrl?: string;
timeout?: number;
userId?: string;
}

class PreprClient {
public constructor({
token: string = null,
baseUrl: string = 'https://cdn.prepr.io',
timeout: number = 4000,
userId: string = null,
}: ClientOptions);

public userId(userId: string): this;
public timeout(milliseconds: number): this;
public query(query: Record<string, any>): this;
public sort(field: string): this;
public limit(limit: number): this;
public skip(skip: number): this;
public path(path: string): this;
public graphqlQuery(graphQLQuery: string): this;
public graphqlVariables(graphQLVariables: Record<string, any>): this;
public async fetch(options = {}): Promise<Record<string, any>>;
}
export function createPreprClient(options: ClientOptions): PreprClient;
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.1",
"description": "The official Prepr SDK for Node.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"directories": {
"lib": "lib"
},
Expand Down

0 comments on commit 9aa1289

Please sign in to comment.