-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(urbex): added core urbex class for creating http clients
- Loading branch information
Michael
committed
Oct 16, 2022
1 parent
40288e0
commit ac5216e
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import type { RequestUrlPath } from "../types"; | ||
import type { UrbexClientConfig } from "./config/request-config"; | ||
|
||
import { RequestApi } from "./api/request-api"; | ||
import { RequestConfig } from "./config/request-config"; | ||
|
||
export class UrbexClient extends RequestApi { | ||
private $config: RequestConfig; | ||
private $interceptors = {}; | ||
private $subscriptions = {}; | ||
|
||
constructor(config?: UrbexClientConfig) { | ||
super(); | ||
|
||
this.$config = new RequestConfig(config); | ||
} | ||
|
||
/** | ||
* | ||
* Creates a new instance of the UrbexClient. | ||
*/ | ||
static create(): UrbexClient { | ||
return new UrbexClient(); | ||
} | ||
|
||
get config(): UrbexClientConfig { | ||
return this.$config.get(); | ||
} | ||
|
||
/** | ||
* Configures the UrbexClient. | ||
* | ||
* @param config The configuration to use. | ||
*/ | ||
public configure(config: UrbexClientConfig): void { | ||
this.$config.set(config); | ||
} | ||
|
||
public get() {} | ||
|
||
public post() {} | ||
|
||
public put() {} | ||
|
||
public patch() {} | ||
|
||
public delete() {} | ||
|
||
public head() {} | ||
|
||
public options() {} | ||
} | ||
|
||
export function isUrbexClient(client: unknown): client is UrbexClient { | ||
return client instanceof UrbexClient; | ||
} |