Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 62 additions & 86 deletions ballerina/client.bal

Large diffs are not rendered by default.

140 changes: 63 additions & 77 deletions ballerina/types.bal
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@

import ballerina/http;

# Represents the Queries record for the operation: post-/crm/v3/objects/leads/batch/read_read
public type PostCrmV3ObjectsLeadsBatchReadReadQueries record {
# Whether to return only results that have been archived
boolean archived = false;
};

public type StandardError record {
record {} subCategory?;
record {|string[]...;|} context;
Expand All @@ -35,6 +41,22 @@ public type CollectionResponseAssociatedId record {
AssociatedId[] results;
};

# Represents the Queries record for the operation: get-/crm/v3/objects/leads_getPage
public type GetCrmV3ObjectsLeadsGetPageQueries record {
# A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored
string[] associations?;
# Whether to return only results that have been archived
boolean archived = false;
# A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request
string[] propertiesWithHistory?;
# The maximum number of results to display per page
int:Signed32 'limit = 10;
# The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results
string after?;
# A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored
string[] properties?;
};

public type PublicAssociationsForObject record {
AssociationSpec[] types;
PublicObjectId to;
Expand All @@ -58,7 +80,7 @@ public type ErrorDetail record {
string subCategory?;
# The status code associated with the error detail
string code?;
# The name of the field or parameter in which the error was found.
# The name of the field or parameter in which the error was found
string 'in?;
# Context about the error condition
record {|string[]...;|} context?;
Expand Down Expand Up @@ -149,49 +171,50 @@ public type ConnectionConfig record {|
# The HTTP version understood by the client
http:HttpVersion httpVersion = http:HTTP_2_0;
# Configurations related to HTTP/1.x protocol
ClientHttp1Settings http1Settings?;
http:ClientHttp1Settings http1Settings = {};
# Configurations related to HTTP/2 protocol
http:ClientHttp2Settings http2Settings?;
http:ClientHttp2Settings http2Settings = {};
# The maximum time to wait (in seconds) for a response before closing the connection
decimal timeout = 60;
decimal timeout = 30;
# The choice of setting `forwarded`/`x-forwarded` header
string forwarded = "disable";
# Configurations associated with Redirection
http:FollowRedirects followRedirects?;
# Configurations associated with request pooling
http:PoolConfiguration poolConfig?;
# HTTP caching related configurations
http:CacheConfig cache?;
http:CacheConfig cache = {};
# Specifies the way of handling compression (`accept-encoding`) header
http:Compression compression = http:COMPRESSION_AUTO;
# Configurations associated with the behaviour of the Circuit Breaker
http:CircuitBreakerConfig circuitBreaker?;
# Configurations associated with retrying
http:RetryConfig retryConfig?;
# Configurations associated with cookies
http:CookieConfig cookieConfig?;
# Configurations associated with inbound response size limits
http:ResponseLimitConfigs responseLimits?;
http:ResponseLimitConfigs responseLimits = {};
# SSL/TLS-related options
http:ClientSecureSocket secureSocket?;
# Proxy server related options
http:ProxyConfig proxy?;
# Provides settings related to client socket configuration
http:ClientSocketConfig socketConfig = {};
# Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
boolean validation = true;
# Enables relaxed data binding on the client side. When enabled, `nil` values are treated as optional,
# and absent fields are handled as `nilable` types. Enabled by default.
boolean laxDataBinding = true;
|};

public type PublicObjectId record {
string id;
};

# Represents the Queries record for the operation: get-/crm/v3/objects/leads/{leadsId}_getById
public type GetCrmV3ObjectsLeadsLeadsid_getbyidQueries record {
# A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.
string[] associations?;
# Whether to return only results that have been archived.
boolean archived = false;
# A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored.
string[] propertiesWithHistory?;
# Represents the Queries record for the operation: patch-/crm/v3/objects/leads/{leadsId}_update
public type PatchCrmV3ObjectsLeadsLeadsIdUpdateQueries record {
# The name of a property whose values are unique for this object
string idProperty?;
# A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.
string[] properties?;
};

public type PublicObjectId record {
string id;
};

public type Paging record {
Expand Down Expand Up @@ -226,30 +249,11 @@ public type BatchResponseSimplePublicObjectWithErrors record {
"PENDING"|"PROCESSING"|"CANCELED"|"COMPLETE" status;
};

# Proxy server configurations to be used with the HTTP client endpoint.
public type ProxyConfig record {|
# Host name of the proxy server
string host = "";
# Proxy server port
int port = 0;
# Proxy server username
string userName = "";
# Proxy server password
@display {label: "", kind: "password"}
string password = "";
|};

public type SimplePublicObjectInput record {
string objectWriteTraceId?;
record {|string...;|} properties;
};

# Represents the Queries record for the operation: patch-/crm/v3/objects/leads/{leadsId}_update
public type PatchCrmV3ObjectsLeadsLeadsid_updateQueries record {
# The name of a property whose values are unique for this object
string idProperty?;
};

public type CollectionResponseSimplePublicObjectWithAssociationsForwardPaging record {
ForwardPaging paging?;
SimplePublicObjectWithAssociations[] results;
Expand All @@ -271,22 +275,6 @@ public type SimplePublicObjectWithAssociations record {
string updatedAt;
};

# Represents the Queries record for the operation: get-/crm/v3/objects/leads_getPage
public type GetCrmV3ObjectsLeads_getpageQueries record {
# A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored.
string[] associations?;
# Whether to return only results that have been archived.
boolean archived = false;
# A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored. Usage of this parameter will reduce the maximum number of objects that can be read by a single request.
string[] propertiesWithHistory?;
# The maximum number of results to display per page.
int:Signed32 'limit = 10;
# The paging cursor token of the last successfully read resource will be returned as the `paging.next.after` JSON property of a paged response containing more results.
string after?;
# A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored.
string[] properties?;
};

public type Filter record {
string highValue?;
string propertyName;
Expand All @@ -296,29 +284,19 @@ public type Filter record {
"EQ"|"NEQ"|"LT"|"LTE"|"GT"|"GTE"|"BETWEEN"|"IN"|"NOT_IN"|"HAS_PROPERTY"|"NOT_HAS_PROPERTY"|"CONTAINS_TOKEN"|"NOT_CONTAINS_TOKEN" operator;
};

# Provides settings related to HTTP/1.x protocol.
public type ClientHttp1Settings record {|
# Specifies whether to reuse a connection for multiple requests
http:KeepAlive keepAlive = http:KEEPALIVE_AUTO;
# The chunking behaviour of the request
http:Chunking chunking = http:CHUNKING_AUTO;
# Proxy server related options
ProxyConfig proxy?;
|};

public type PreviousPage record {
string before;
string link?;
};

public type BatchInputSimplePublicObjectBatchInput record {
SimplePublicObjectBatchInput[] inputs;
};

public type BatchInputSimplePublicObjectInputForCreate record {
SimplePublicObjectInputForCreate[] inputs;
};

public type BatchInputSimplePublicObjectBatchInput record {
SimplePublicObjectBatchInput[] inputs;
};

public type SimplePublicUpsertObject record {
string createdAt;
boolean archived?;
Expand All @@ -330,6 +308,20 @@ public type SimplePublicUpsertObject record {
string updatedAt;
};

# Represents the Queries record for the operation: get-/crm/v3/objects/leads/{leadsId}_getById
public type GetCrmV3ObjectsLeadsLeadsIdGetByIdQueries record {
# A comma separated list of object types to retrieve associated IDs for. If any of the specified associations do not exist, they will be ignored
string[] associations?;
# Whether to return only results that have been archived
boolean archived = false;
# A comma separated list of the properties to be returned along with their history of previous values. If any of the specified properties are not present on the requested object(s), they will be ignored
string[] propertiesWithHistory?;
# The name of a property whose values are unique for this object
string idProperty?;
# A comma separated list of the properties to be returned in the response. If any of the specified properties are not present on the requested object(s), they will be ignored
string[] properties?;
};

public type SimplePublicObjectBatchInput record {
string idProperty?;
string objectWriteTraceId?;
Expand All @@ -349,16 +341,10 @@ public type AssociatedId record {

# Provides API key configurations needed when communicating with a remote HTTP endpoint.
public type ApiKeysConfig record {|
string private\-app\-legacy;
string private\-app;
string privateAppLegacy;
string privateApp;
|};

# Represents the Queries record for the operation: post-/crm/v3/objects/leads/batch/read_read
public type PostCrmV3ObjectsLeadsBatchRead_readQueries record {
# Whether to return only results that have been archived.
boolean archived = false;
};

public type SimplePublicObjectInputForCreate record {
PublicAssociationsForObject[] associations;
string objectWriteTraceId?;
Expand Down
25 changes: 5 additions & 20 deletions ballerina/utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// specific language governing permissions and limitations
// under the License.

import ballerina/http;
import ballerina/url;

type SimpleBasicType string|boolean|int|float|decimal;
Expand Down Expand Up @@ -186,12 +187,13 @@ isolated function getEncodedUri(anydata value) returns string {
# + encodingMap - Details on serialization mechanism
# + return - Returns generated Path or error at failure of client initialization
isolated function getPathForQueryParam(map<anydata> queryParam, map<Encoding> encodingMap = {}) returns string|error {
map<anydata> queriesMap = http:getQueryMap(queryParam);
string[] param = [];
if queryParam.length() > 0 {
if queriesMap.length() > 0 {
param.push("?");
foreach var [key, value] in queryParam.entries() {
foreach var [key, value] in queriesMap.entries() {
if value is () {
_ = queryParam.remove(key);
_ = queriesMap.remove(key);
continue;
}
Encoding encodingData = encodingMap.hasKey(key) ? encodingMap.get(key) : defaultEncoding;
Expand All @@ -215,20 +217,3 @@ isolated function getPathForQueryParam(map<anydata> queryParam, map<Encoding> en
string restOfPath = string:'join("", ...param);
return restOfPath;
}

# Generate header map for given header values.
#
# + headerParam - Headers map
# + return - Returns generated map or error at failure of client initialization
isolated function getMapForHeaders(map<anydata> headerParam) returns map<string|string[]> {
map<string|string[]> headerMap = {};
foreach var [key, value] in headerParam.entries() {
if value is SimpleBasicType[] {
headerMap[key] = from SimpleBasicType data in value
select data.toString();
} else {
headerMap[key] = value.toString();
}
}
return headerMap;
}
Loading
Loading