Skip to content

Latest commit

 

History

History
553 lines (499 loc) · 14.5 KB

PublicAPI.md

File metadata and controls

553 lines (499 loc) · 14.5 KB

Public API

Auto generated by BSl LS

ObjectModule

Server

// Initializes the client to communicate with the MockServer on the specified host and port.
//
// Parameters:
// 	URL - String - URL;
// 	Port - String - port;
// 	Reset - Boolean - True - reset MockServer, otherwise - False (default);
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object;
//
// Example:
//  Mock = DataProcessors.MockServerClient.Create().Server("http://server");
//  Mock = DataProcessors.MockServerClient.Create().Server("http://server", "1090");
//  Mock = DataProcessors.MockServerClient.Create().Server("http://server", "1090", True);
//
Функция Server(Знач URL, Знач Port = Undefined, Знач Reset = False) Экспорт

When

// Presets any conditions or accepts fully prepared JSON for subsequent sending data to MockServer.
// 
// Parameters:
// 	What - DataProcessorObject.MockServerClient - instance of mock-object with a predefined conditions;
//       - String - JSON to send to MockServer;   
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object;
// 	
// Example:
//  Mock.When( Mock.WithPath("/фуу/foo") ).Respond();
// 	Mock.When("{""sample"": ""any""}").Respond();
//
Функция When(Знач What) Экспорт

Request

// Prepares a set of request properties in "httpRequest" node.
//
// Parameters:
// 	Request - String - a request properties in JSON-format;
//          - Undefined - an empty collection will be added to the conditions collection for the 'httpRequest' node;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with a new collection of properties;
//
// Example:
//	Mock.When( Mock.Request().WithPath("/фуу/foo") ).Respond( Mock.Response().WithBody("some_response_body") );
//	Mock.When( Mock.Request("""method"": ""GET""") ).Respond( Mock.Response().WithBody("some_response_body") );
//
Функция Request(Знач Request = Undefined) Экспорт

Response

// Prepares a set of response properties in "httpResponse" node.
//
// Parameters:
// 	Response - String - a response properties in JSON-format;
//           - Undefined - an empty collection will be added to the conditions collection for the 'httpResponse' node;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with a new collection of properties;
//
// Example:
//	Mock.When( Mock.Request().WithPath("/фуу/foo") ).Respond( Mock.Response().WithBody("some_response_body") );
//	Mock.When( Mock.Request().WithPath("/фуу/foo") ).Respond( Mock.Response("""statusCode"": 200 ") );
//
Функция Response(Знач Response = Undefined) Экспорт

OpenAPI

// Prepares a set of OpenAPI properties in "httpResponse" node.
//
// Parameters:
// 	OpenAPI - String - OpenAPI properties in JSON-format;
//           - Undefined - an empty collection will be added to the conditions collection for the 'httpResponse' node;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with a new collection of properties;
//
// Example:
//	Mock.When(
//			Mock.OpenAPI()
//				.WithSource("http://example.com/openapi_petstore_example.json")
//				.WithOperationId("some_id")
//		).Verify(
//			Mock.Times()
//				.Once()
//		);
//
Функция OpenAPI(Знач OpenAPI = Undefined) Экспорт

Times

// Sets conditions that a requests has been received by MockServer a specific number of time.
//
// Parameters:
// 	Condition - String - a conditions in JSON-format string;
//            - Undefined - an empty collection will be added to the conditions collection for the 'times' node;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with a new collection of properties;
//
// Example:
//	Mock.When( Mock.Request().WithMethod("GET") ).Verify( Mock.Times().AtMost(3) );
//  Result = Mock.Times().AtMost(3).AtLeast(3);
//  Result = Mock.Times("""atLeast"": 3, ""atMost"": 3");
//
Функция Times(Знач Condition = Undefined) Экспорт

AtLeast

// Adds  condition that a request has been received by MockServer at least n-times.
//
// Parameters:
// 	Count - Number - n-times;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object;
//
Функция AtLeast(Знач Count) Экспорт

AtMost

// Adds condition that a request has been received by MockServer at most n-times.
//
// Parameters:
// 	Count - Number - number of times;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object;
//
Функция AtMost(Знач Count) Экспорт

Exactly

// Adds condition that a request has been received by MockServer exactly n-times.
//
// Parameters:
// 	Count - Number - number of times;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object;
//
Функция Exactly(Знач Count) Экспорт

Once

// Adds condition that a request has been received by MockServer only once.
// 
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object;
//
Функция Once() Экспорт

Between

// Adds condition that a request has been received by MockServer between n and m times.
//
// Parameters:
// 	AtLeast - Number - at least n-times;
// 	AtMost - Number - at most m-times;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object;
//
Функция Between(Знач AtLeast, Знач AtMost) Экспорт

Reset

// Resets the MockServer completely (terminal operation).
// 
Процедура Reset() Экспорт

Respond

// Sets requests expectation (terminal operation).
// 
// Parameters:
// 	Self - DataProcessorObject.MockServerClient - a reference to object with preparing conditions; 
//
// Example:
//	Mock.When( Mock.Request().WithMethod("GET") ).Respond( Mock.Response().WithBody("some_response_body") );
//	Mock.Respond( Mock.Response().WithBody("some_response_body") );
//	Mock.Respond( Mock.Response("""statusCode"": 404") );
//
Процедура Respond(Знач Self = Undefined) Экспорт

Verify

// Verifies a request has been sent (terminal operation).
// 
// Parameters:
// 	Self - DataProcessorObject.MockServerClient - a reference to object with preparing conditions; 
//
// Example:
//	Mock.When( Mock.Request().WithMethod("GET") ).Verify( Mock.Times().AtMost(3) );
//	Mock.Verify( Mock.Times().AtMost(3) );
//	Mock.Verify( Mock.Times("""atMost"": 3") );
//
Процедура Verify(Знач Self = Undefined) Экспорт

OpenAPIExpectation

// Sets the expectations according to the OpenAPI specification (terminal operation).
// 
// Parameters:
// 	Source - String - the path to the OpenAPI document or the data itself in accordance with the OpenAPI specification;
// 	Operations - String - operation id and response status code for the selected operation as a JSON-format string;
//
// Example:
//  Mock.OpenAPIExpectation( "file:/Users/me/openapi.json" );
//  Mock.OpenAPIExpectation( "http://example.com/mock/openapi.json", """some_operation_id"": ""200""" );
//  Mock.OpenAPIExpectation( "---\n""
//        + """openapi: 3.0.0\n"""
//        + """info:\n"""
//		...
//        + """...OpenAPI specification here""" " );	
//
Процедура OpenAPIExpectation(Знач Source, Знач Operations = "") Экспорт

IsOk

// Returns the result of executing the PUT method for the last action.
// 
// Returns:
// 	Boolean - true - operation was successful, otherwise - false;
//
Функция IsOk() Экспорт

WithMethod

// Adds the "method" property.
// See also: https://www.mock-server.com/mock_server/creating_expectations.html#request_property_matchers
// 
// Parameters:
// 	Method - String - property matcher;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
//	Mock.When(
//		Mock.Request()
//			.WithMethod("!GET")
//	).Respond(
//		Mock.Response()
//			.WithBody("some_response_body")
//	);
//
Функция WithMethod(Знач Method) Экспорт

WithPath

// Adds the "path" property.
// See also: https://www.mock-server.com/mock_server/creating_expectations.html#request_property_matchers
// 
// Parameters:
// 	Path - String - property matcher;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
//	Mock.When(
//		Mock.Request()
//			.WithMethod("!GET")
//	).Respond(
//		Mock.Response()
//			.WithBody("some_response_body")
//	);
//
Функция WithPath(Знач Path) Экспорт

WithQueryStringParameter

// Adds the "queryStringParameters" property.
// See also: https://www.mock-server.com/mock_server/getting_started.html#request_key_to_multivalue_matchers
// 
// Parameters:
// 	Key - String - key of query parameter;
// 	Value - String - value of query parameter;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
//  Mock.When(
//      Mock.Request()
//        .WithPath("/some/path")
//        .WithQueryStringParameter("cartId", "[A-Z0-9\\-]+")
//        .WithQueryStringParameter("anotherId", "[A-Z0-9\\-]+")
//    ).Respond(
//      Mock.Response()
//        .WithBody("some_response_body")
//    );
//
Функция WithQueryStringParameter(Знач Key, Знач Value) Экспорт

Headers

// Prepares a set of headers properties in "headers" node.
//
// Parameters:
// 	Headers - Map - a headers (key = header, value = array of strings);
//          - Undefined - an empty collection will be added to the 'header' node;
//
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
// 
// 	1:
// 	
//  Mock.When(
//      Mock.Request()
//        .WithMethod("GET")
//        .WithPath("/some/path")
//        .Headers()
//          .WithHeader("Accept", "application/json")
//          .WithHeader("Accept-Encoding", "gzip, deflate, br")
//    ).Respond(
//      Mock.Response()
//        .WithBody("some_response_body")
//    );
//
//	2:
//	
//	Header_1 = New Array();
//	Header_1.Add("11");
//	Header_1.Add("12");
//	Header_2 = New Array();
//	Header_2.Add("21");
//	Header_2.Add("22");
//	Headers = New Map();
//	Headers.Insert("Header_1", Header_1);
//	Headers.Insert("Header_2", Header_2);
//	
//	Mock.When( Mock.Request().Headers(Headers) ).Respond();
//
Функция Headers(Знач Headers = Undefined) Экспорт

WithHeader

// Adds the "header" property to the "headers" node.
// See also: https://www.mock-server.com/mock_server/getting_started.html#request_key_to_multivalue_matchers
// 
// Parameters:
// 	Key - String - key of header;
// 	Value - String - value of header;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
// 
//  Mock.When(
//      Mock.Request()
//        .WithMethod("GET")
//        .WithPath("/some/path")
//        .Headers()
//          .WithHeader("Accept", "application/json")
//          .WithHeader("Accept-Encoding", "gzip, deflate, br")
//    ).Respond(
//      Mock.Response()
//        .WithBody("some_response_body")
//    );
//
Функция WithHeader(Знач Key, Знач Value) Экспорт

WithBody

// Adds the "body" property.
// See also: https://www.mock-server.com/mock_server/creating_expectations.html#request_property_matchers
// 
// Parameters:
// 	Body - String - property matcher;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
//	Mock.When(
//		Mock.Request()
//			.WithMethod("!GET")
//	).Respond(
//		Mock.Response()
//			.WithBody("some_response_body")
//	);
//
Функция WithBody(Знач Body) Экспорт

WithStatusCode

// Adds the "statusCode" property.
// See also: https://www.mock-server.com/mock_server/creating_expectations.html#request_property_matchers
// 
// Parameters:
// 	StatusCode - Numeric - numeric status code;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
//  Mock.When(
//      Mock.Request()
//        .WithMethod("GET")
//        .WithPath("/some/path")
//    ).Respond(
//      Mock.Response()
//        .WithStatusCode(418)
//        .WithReasonPhrase("I'm a teapot")
//    );
//
Функция WithStatusCode(Знач StatusCode) Экспорт

WithReasonPhrase

// Adds the "reasonPhrase" property.
// See also: https://www.mock-server.com/mock_server/creating_expectations.html#request_property_matchers
// 
// Parameters:
// 	ReasonPhrase - String - reason phrase;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
//  Mock.When(
//      Mock.Request()
//        .WithMethod("GET")
//        .WithPath("/some/path")
//    ).Respond(
//      Mock.Response()
//        .WithStatusCode(418)
//        .WithReasonPhrase("I'm a teapot")
//    );
//
Функция WithReasonPhrase(Знач ReasonPhrase) Экспорт

WithSource

// Adds the "specUrlOrPayload" property describing the data source or the data itself in OpenAPI format.
// 
// Parameters:
// 	Source - String - the path to the OpenAPI document or the data itself in accordance with the OpenAPI specification;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
// 	Mock.When(
//		Mock.OpenAPI()
//			.WithSource("https://example.com/openapi.json")
//	).Verify(
//		Mock.Times()
//			.AtLeast(2)
//	);
//
//  Result = Mock.OpenAPI().WithSource( "file:/Users/me/openapi.json" );
//
Функция WithSource(Знач Source) Экспорт

WithOperationId

// Adds the "operationId" property that specifies which operations of OpenAPI are included.
// 
// Parameters:
// 	OperationId - String - the operation in the OpenAPI specification;
// 	
// Returns:
// 	DataProcessorObject.MockServerClient - instance of mock-object with added property;
//
// Example:
//  
// 	Mock.When(
//		Mock.OpenAPI()
//			.WithSource("https://example.com/openapi.json")
//			.WithOperationId("listPets")
//	).Verify(
//		Mock.Times()
//			.AtLeast(2)
//	);
//
//  Result = Mock.OpenAPI().WithSource( "file:/Users/me/openapi.json" ).WithOperationId("listPets");
//
Функция WithOperationId(Знач OperationId) Экспорт