-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(interfaces): split interfaces into multiple files and renaming
- Loading branch information
Showing
8 changed files
with
240 additions
and
230 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
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
export namespace Endpoint { | ||
export type Forecast = "forecast"; | ||
export type Weather = "weather"; | ||
|
||
export type Types = Forecast | Weather; | ||
|
||
export const Forecast: Forecast = "forecast"; | ||
export const Weather: Weather = "weather"; | ||
|
||
export const TypeMap: { [type: string]: string } = { | ||
[Forecast]: typeof Forecast, | ||
[Weather]: typeof Weather, | ||
}; | ||
|
||
export function typeOf(x: string) { | ||
return x in TypeMap ? TypeMap[x] : undefined; | ||
} | ||
} | ||
|
||
export type Endpoint = Endpoint.Types; |
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,4 @@ | ||
export * from "./endpoint"; | ||
export * from "./options"; | ||
export * from "./query"; | ||
export * from "./response"; |
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,50 @@ | ||
import { AxiosInstance } from "axios"; | ||
|
||
import { Endpoint } from "./endpoint"; | ||
|
||
export type Units = "imperial" | "metric" | "standard"; | ||
// export type Endpoint = "forecast" | "weather"; | ||
export type AccuracyType = "accurate" | "like"; | ||
export type Language = | ||
| "ar" | ||
| "bg" | ||
| "ca" | ||
| "cz" | ||
| "de" | ||
| "el" | ||
| "en" | ||
| "fa" | ||
| "fi" | ||
| "fr" | ||
| "gl" | ||
| "hr" | ||
| "hu" | ||
| "it" | ||
| "ja" | ||
| "kr" | ||
| "la" | ||
| "lt" | ||
| "mk" | ||
| "nl" | ||
| "pl" | ||
| "pt" | ||
| "ro" | ||
| "ru" | ||
| "se" | ||
| "sk" | ||
| "sl" | ||
| "es" | ||
| "tr" | ||
| "ua" | ||
| "vi" | ||
| "zh_cn" | ||
| "zh_tw"; | ||
|
||
export interface Options { | ||
apiKey: string; | ||
apiUrl?: string; | ||
axios?: AxiosInstance; | ||
endpoint?: Endpoint; | ||
lang?: Language; | ||
units?: Units; | ||
} |
Oops, something went wrong.