Skip to content

Commit da00459

Browse files
author
Vlad Balin
authored
Merge pull request #37 from begemotx2/develop
Http endpoint
2 parents 49e234b + c84c8e1 commit da00459

File tree

14 files changed

+25764
-451
lines changed

14 files changed

+25764
-451
lines changed

endpoints/restful/dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

endpoints/restful/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

endpoints/restful/lib/index.d.ts

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,35 @@
1-
import { IOEndpoint, IOOptions, IOPromise } from 'type-r';
2-
export declare type Index = number[];
3-
export declare function create(key: string): LocalStorageEndpoint;
4-
export { create as localStorageIO };
5-
export declare class LocalStorageEndpoint implements IOEndpoint {
6-
key: string;
7-
constructor(key: string);
8-
resolve(value: any): IOPromise<any>;
9-
reject(value: any): IOPromise<any>;
10-
create(json: any, options: IOOptions): IOPromise<any>;
11-
set(json: any): void;
12-
get(id: any): any;
13-
update(id: any, json: any, options: IOOptions): IOPromise<any>;
14-
read(id: any, options: IOOptions): IOPromise<any>;
15-
destroy(id: any, options: IOOptions): IOPromise<any>;
16-
index: (string | number)[];
17-
list(options?: IOOptions): IOPromise<any>;
1+
import { IOEndpoint, IOOptions } from 'type-r';
2+
export declare function create(url: string, fetchOptions?: Partial<RestfulFetchOptions>): RestfulEndpoint;
3+
export { create as restfulIO };
4+
export interface RestfulIOOptions extends IOOptions {
5+
params?: object;
6+
options?: RequestInit;
7+
}
8+
export declare type RestfulFetchOptions = {
9+
cache?: RequestCache;
10+
credentials?: RequestCredentials;
11+
mode?: RequestMode;
12+
redirect?: RequestRedirect;
13+
referrerPolicy?: ReferrerPolicy;
14+
};
15+
export declare class RestfulEndpoint implements IOEndpoint {
16+
url: string;
17+
fetchOptions: Partial<RestfulFetchOptions>;
18+
constructor(url: string, fetchOptions?: Partial<RestfulFetchOptions>);
19+
static defaultFetchOptions: RestfulFetchOptions;
20+
create(json: any, options: RestfulIOOptions, record: any): Promise<any>;
21+
update(id: any, json: any, options: RestfulIOOptions, record: any): Promise<any>;
22+
read(id: any, options: IOOptions, record: any): Promise<any>;
23+
destroy(id: any, options: RestfulIOOptions, record: any): Promise<any>;
24+
list(options: RestfulIOOptions, collection: any): Promise<any>;
1825
subscribe(events: any): any;
1926
unsubscribe(events: any): any;
27+
protected isRelativeUrl(url: any): boolean;
28+
protected removeTrailingSlash(url: string): string;
29+
protected getRootUrl(recordOrCollection: any): string;
30+
protected getUrl(record: any): string;
31+
protected objectUrl(record: any, id: any, options: any): any;
32+
protected collectionUrl(collection: any, options: any): any;
33+
protected buildRequestOptions(method: string, options?: RequestInit, body?: any): RequestInit;
34+
protected request(method: string, url: string, {options}: RestfulIOOptions, body?: any): Promise<any>;
2035
}

endpoints/restful/lib/index.js

Lines changed: 78 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)