BTC:BC1Q9N0V6L3CH2PJFHLD4RJ9Y2EPH3M9WL9XPMZNLX
现在可以在HTTPS或TCP流(默认)之间进行选择,以与BroadWorks API进行交互。基本基准测试建议TCP流的15/请求/第二个带有SOAP和150/请求/第二个。 UsergetRequest17sp4用于基准。
可以将会话导出到客户端中,并添加该会话以允许通过诸如Cronjob之类的方法触发的广泛工作OCI-P脚本使用外部会话数据执行。移植会话是执行命令的安全方法,因为请求它的用户未存储密码,cookie/sessionID用于身份验证。
框架的所有元素都考虑到IDE自动完成构建,因此无需记住数据类型的详细信息,以下是为组中所有用户禁用CallForwardingAlways的示例。
相互作用的CLI建立在需要零的编程知识中。用户以与Linux文件系统上的目录和文件相同的方式导航架构。命令可以在CLI中执行,并将结果打印到屏幕上。 TAB自动完成作品 - (最新版本中断)
对象支持序列化,以允许以普通文本格式保存消息,这些消息可以不被重新审理到框架可以理解的数据类型中,然后重播回到宽阔的工作中
$ composer require lukebeer/broadworks-ocip
$ composer require lukebeer/broadworks-ocip:development
<?php
require_once ' vendor/autoload.php ' ;
// Use the ComplexType required for this example.
use Broadworks_OCIP api Rel_17_sp4_1_197_OCISchemaAS OCISchemaUser UserServiceGetAssignmentListRequest ;
// Create a Client and login. CoreFactory also has getSOAPClient()
$ client = BroadworksOCIP Factory:: getTCPClient ( ' ocip.example.com ' );
$ client -> login ( ' user ' , ' pass ' );
// Generate a request, send and assign the response to $response
$ request = new UserServiceGetAssignmentListRequest ( ' [email protected] ' );
$ response = $ request -> get ( $ client );
// This response type returns a TableType object, getValue() renders a table.
echo $ response -> getServicePacksAssignmentTable ()-> getValue ();
?>
/* Spits out:
+--------------------------------------------------+----------+
| Service Name | Assigned |
+--------------------------------------------------+----------+
| Anonymous Call Rejection | true |
| Authentication | true |
| Call Forwarding Always | true |
| Call Forwarding Busy | true |
| Call Forwarding No Answer | true |
| Call Notify | false |
| Calling Line ID Delivery Blocking | true |
| CommPilot Express | true |
| CommPilot Call Manager | true |
| Do Not Disturb | true |
| Intercept User | true |
| Last Number Redial | true |
| Sequential Ring | true |
+--------------------------------------------------+----------+
*/诸如UserGetRequest17sp4之类的复杂类型是可能包含元素类型(包括复杂型)的混合物的类型。将它们视为XML的嵌套孩子。
如果要设置的元素之一是复杂型,则复杂类型需要在父对象中设置之前创建。例如,StreetDress是一个复杂的型:
<?php
$ address = new StreetAddress ();
$ address -> setAddressLine1 ( ' 1337 Street ' );
$ address -> setCountry ( ' England ' );
$ request = new UserAddRequest17sp4 ();
$ request -> setStreetAddress ( $ address ); Broadworks_OCIPapiRel_17_sp4_1_197_OCISchemaASOCISchemaDataTypesStreetAddress Object
(
[elementName] => StreetAddress
[addressLine1:protected] => Broadworks_OCIPcoreBuilderTypesSimpleContent Object
(
[annontation:protected] =>
[attributes:protected] =>
[restrictions:protected] => Array
(
[0] => Broadworks_OCIPcoreBuilderRestrictionsMinLength Object
(
[value:protected] => 1
[detail:protected] =>
)
[1] => Broadworks_OCIPcoreBuilderRestrictionsMaxLength Object
(
[value:protected] => 80
[detail:protected] =>
)
)
[errors:protected] =>
[elementValue:protected] => 1337 Street
[elementName:protected] => addressLine1
)
[addressLine2:protected] => Broadworks_OCIPcoreBuilderTypesSimpleContent Object
(
[annontation:protected] =>
[attributes:protected] =>
[restrictions:protected] => Array
(
[0] => Broadworks_OCIPcoreBuilderRestrictionsMinLength Object
(
[value:protected] => 1
[detail:protected] =>
)
[1] => Broadworks_OCIPcoreBuilderRestrictionsMaxLength Object
(
[value:protected] => 80
[detail:protected] =>
)
)
[errors:protected] =>
[elementValue:protected] =>
[elementName:protected] => addressLine2
)
[city:protected] => Broadworks_OCIPcoreBuilderTypesSimpleContent Object
(
[annontation:protected] =>
[attributes:protected] =>
[restrictions:protected] => Array
(
[0] => Broadworks_OCIPcoreBuilderRestrictionsMinLength Object
(
[value:protected] => 1
[detail:protected] =>
)
[1] => Broadworks_OCIPcoreBuilderRestrictionsMaxLength Object
(
[value:protected] => 50
[detail:protected] =>
)
)
[errors:protected] =>
[elementValue:protected] =>
[elementName:protected] => city
)
[stateOrProvince:protected] => Broadworks_OCIPcoreBuilderTypesSimpleContent Object
(
[annontation:protected] =>
[attributes:protected] =>
[restrictions:protected] => Array
(
[0] => Broadworks_OCIPcoreBuilderRestrictionsMinLength Object
(
[value:protected] => 1
[detail:protected] =>
)
[1] => Broadworks_OCIPcoreBuilderRestrictionsMaxLength Object
(
[value:protected] => 50
[detail:protected] =>
)
)
[errors:protected] =>
[elementValue:protected] =>
[elementName:protected] => stateOrProvince
)
[stateOrProvinceDisplayName:protected] => Broadworks_OCIPcoreBuilderTypesSimpleContent Object
(
[annontation:protected] =>
[attributes:protected] =>
[restrictions:protected] => Array
(
[0] => Broadworks_OCIPcoreBuilderRestrictionsMinLength Object
(
[value:protected] => 1
[detail:protected] =>
)
[1] => Broadworks_OCIPcoreBuilderRestrictionsMaxLength Object
(
[value:protected] => 50
[detail:protected] =>
)
)
[errors:protected] =>
[elementValue:protected] =>
[elementName:protected] => stateOrProvinceDisplayName
)
[zipOrPostalCode:protected] => Broadworks_OCIPcoreBuilderTypesSimpleContent Object
(
[annontation:protected] =>
[attributes:protected] =>
[restrictions:protected] => Array
(
[0] => Broadworks_OCIPcoreBuilderRestrictionsMinLength Object
(
[value:protected] => 1
[detail:protected] =>
)
[1] => Broadworks_OCIPcoreBuilderRestrictionsMaxLength Object
(
[value:protected] => 50
[detail:protected] =>
)
)
[errors:protected] =>
[elementValue:protected] =>
[elementName:protected] => zipOrPostalCode
)
[country:protected] => Broadworks_OCIPcoreBuilderTypesSimpleContent Object
(
[annontation:protected] =>
[attributes:protected] =>
[restrictions:protected] => Array
(
[0] => Broadworks_OCIPcoreBuilderRestrictionsMinLength Object
(
[value:protected] => 1
[detail:protected] =>
)
[1] => Broadworks_OCIPcoreBuilderRestrictionsMaxLength Object
(
[value:protected] => 50
[detail:protected] =>
)
)
[errors:protected] =>
[elementValue:protected] => Enngland
[elementName:protected] => country
)
[elements:protected] => Array
(
)
[responseType:protected] =>
[errors:protected] =>
[params:protected] => Array
(
)
[args:protected] =>
[elementValue:protected] =>
)
TableTypes用于处理可观的数据。通过使用单个或多维数组的addrow或Addrows设置了单个维数组,并将数据设置为列标题。
可以用数据呈现一个漂亮的ASCII表,并使用$ echo $table->getValue() $table->findRow('something')搜索
如果仅需要一个列,方法$table->getColumn($id)将返回数据集中所有行的特定数据列。一个值可以用于键,另一个值用于值。
<?php
$ data = $ table -> getColummn ( 0 , 3 );
$ newTable = new TableType ([ ' User Id ' , ' Phone Number ' );
$ newTable -> addRows ( $ data );
echo $ newTable -> getValue ();返回:
+------------------------+---------------+
| User Id | Phone Number |
+------------------------+---------------+
| [email protected] | 01234123456 |
| [email protected] | 01234123456 |
| [email protected] | 01234123456 |
| [email protected] | 01234123456 |
| [email protected] | 01234123456 |
| [email protected] | 01234123456 |
+------------------------+---------------+
请使用问题跟踪器报告任何错误或文件功能请求。
欢迎PR。要开始开发,请这样做:
$ curl -X POST -u " GITHUB_USERNAME:GITHUB_PASSWORD " https://api.github.com/repos/lukebeer/broadworks-ocip/forks && history -c
$ git clone github:GITHUB_USERNAME/broadworks-ocip &&
$ cd broadworks-ocip Builder
Builder.php # Takes a ComplexType and converts to XML or XML string then wraps it in an envelope ready for shipping.
Restrictions
Enumeration.php # Defines a list of acceptable values.
Length.php # Specifies the exact number of characters or list items allowed. Must be equal to or greater than zero.
MaxExclusive.php # Specifies the upper bounds for numeric values (the value must be less than this value).
MaxInclusive.php # Specifies the upper bounds for numeric values (the value must be less than or equal to this value).
MaxLength.php # Specifies the maximum number of characters or list items allowed. Must be equal to or greater than zero.
MinExclusive.php # Specifies the lower bounds for numeric values (the value must be greater than this value).
MinInclusive.php # Specifies the lower bounds for numeric values (the value must be greater than or equal to this value).
MinLength.php # Specifies the minimum number of characters or list items allowed. Must be equal to or greater than zero.
Pattern.php # Defines the exact sequence of characters that are acceptable.
Restriction.php # Abstract base class all restrictions must extend.
RestrictionInterface.php # Interface all Restrictins must implement.
Types
ComplexInterface.php # Interface all ComplexTypes must implement.
ComplexType.php # Defines a complex type element.
PrimitiveType.php # Primitive type such as bool/int/string.
SimpleContent.php # Contains extensions or restrictions on a text-only complex type or on a simple type as content and contains no elements.
SimpleInterface.php # Interface all SimpleTypes must implement.
SimpleType.php # Defines a simple type and specifies the constraints and information about the values of attributes or text-only elements.
TableType.php # Used for OCITable responses only, never in requests.
TypeCheck.php # Not implemented yet.
TypeMap.php # Converts xs types to PHP types.
TypeTrait.php # Common trait all types have.
Client
Client.php # Main controller for the whole framework exposing methods for requests and responses.
Transport
SOAPTransport.php # Communicates with Broadworks via http(s), this is the slowest but most robust transport type.
TCPTransport.php # Communicates with Broadworks via a TCPStream on port 2208, this is the fastest transport type.
TransportInterface.php # Interface all Transport types must implement.
Console
Console.php # Generates an array of commands for the interactive console.
Logging
ErrorControl.php # Crappy logging object, needs nuking and starting again.
Output
ConsoleOutput.php # Output type for the interactive console.
JSONOutput.php # Generates and echos JSON.
OutputInterface.php # Output interface all Outputs must implement.
Response
Response.php # Takes XML input and returns response object specified or false if error.
ResponseOutput.php # Convenience class for selecting response output format.
Serializer
SerializerInterface.php # Interface all Serializers must implement.
XMLSerializer.php # Converts XML into the requested object type automatically, very much the brain of this.
Session
Session.php # Portable Session object used to store details of the current authenticated session.