-
-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: add metadata to models (#496)
- Loading branch information
1 parent
69a0aef
commit 11cb0e9
Showing
32 changed files
with
513 additions
and
273 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 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 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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { BaseModel } from "./base"; | ||
import { BindingsMixinInterface, DescriptionMixinInterface } from './mixins'; | ||
import type { BaseModel } from "./base"; | ||
import type { BindingsMixinInterface, DescriptionMixinInterface, ExtensionsMixinInterface } from './mixins'; | ||
|
||
export interface ServerInterface extends BaseModel, DescriptionMixinInterface, BindingsMixinInterface { | ||
id(): string | ||
protocol(): string | undefined; | ||
protocolVersion(): string; | ||
hasProtocolVersion(): boolean; | ||
url(): string; | ||
export interface ServerInterface extends BaseModel, DescriptionMixinInterface, BindingsMixinInterface, ExtensionsMixinInterface { | ||
id(): string | ||
url(): string; | ||
protocol(): string | undefined; | ||
protocolVersion(): string; | ||
hasProtocolVersion(): boolean; | ||
} |
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 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 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 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 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 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 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 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 |
---|---|---|
@@ -1,34 +1,39 @@ | ||
import { Mixin } from '../utils'; | ||
import { BaseModel } from '../base'; | ||
import { ServerInterface } from '../server'; | ||
import { DescriptionMixin } from './mixins/description'; | ||
|
||
import { Mixin } from '../utils'; | ||
import { BindingsMixin } from './mixins/bindings'; | ||
import { DescriptionMixin } from './mixins/description'; | ||
import { ExtensionsMixin } from './mixins/extensions'; | ||
|
||
import type { ModelMetadata } from "../base"; | ||
import type { ServerInterface } from '../server'; | ||
|
||
export class Server extends Mixin(BaseModel, BindingsMixin, DescriptionMixin, ExtensionsMixin) implements ServerInterface { | ||
constructor( | ||
private readonly _id: string, | ||
_json: Record<string, any>, | ||
_meta: ModelMetadata = {} as any, | ||
) { | ||
super(_json, _meta); | ||
} | ||
|
||
id(): string { | ||
return this._id; | ||
} | ||
|
||
url(): string { | ||
return this._json.url; | ||
} | ||
|
||
protocol(): string | undefined { | ||
return this._json.protocol; | ||
} | ||
|
||
hasProtocolVersion(): boolean { | ||
return !!this._json.protocolVersion; | ||
} | ||
|
||
export class Server extends Mixin(BaseModel, DescriptionMixin, BindingsMixin) implements ServerInterface { | ||
constructor( | ||
private readonly _id: string, | ||
_json: Record<string, any> | ||
){ | ||
super(_json); | ||
} | ||
|
||
id(): string { | ||
return this._id; | ||
} | ||
|
||
protocol(): string | undefined { | ||
return this.json('protocol'); | ||
} | ||
|
||
hasProtocolVersion(): boolean { | ||
return !!this.json('protocolVersion'); | ||
} | ||
|
||
protocolVersion(): string { | ||
return this.json('protocolVersion'); | ||
} | ||
|
||
url(): string { | ||
return this.json('url'); | ||
} | ||
protocolVersion(): string { | ||
return this._json.protocolVersion; | ||
} | ||
} |
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
Oops, something went wrong.