-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #359 from cobbler/feature/remove-xmlrpc-types
XMLRPC-Client: Remove the need for custom list and map type
- Loading branch information
Showing
7 changed files
with
103 additions
and
26 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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
MethodFault, | ||
MethodResponse, | ||
XmlRpcArray, | ||
XmlRpcStruct, | ||
XmlRpcTypes, | ||
} from './xmlrpc-types'; | ||
|
||
export class Utils { | ||
static instanceOfMethodResponse(object: object): object is MethodResponse { | ||
return 'value' in object; | ||
} | ||
|
||
static instanceOfMethodFault(object: object): object is MethodFault { | ||
return 'faultCode' in object && 'faultString' in object; | ||
} | ||
|
||
static instanceOfXmlRpcStruct(object: XmlRpcTypes): object is XmlRpcStruct { | ||
return ( | ||
object !== null && | ||
typeof object === 'object' && | ||
Object.keys(object).length === 1 && | ||
'members' in object | ||
); | ||
} | ||
|
||
static instanceOfXmlRpcArray(object: XmlRpcTypes): object is XmlRpcArray { | ||
return ( | ||
object !== null && | ||
typeof object === 'object' && | ||
Object.keys(object).length === 1 && | ||
'data' in object | ||
); | ||
} | ||
} |
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