diff --git a/ballerina/client.bal b/ballerina/client.bal index bca4816..1780302 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -17,6 +17,7 @@ // specific language governing permissions and limitations // under the License. +import ballerina/data.jsondata; import ballerina/http; public isolated client class Client { @@ -38,13 +39,7 @@ public isolated client class Client { self.clientEp = check new (serviceUrl, httpClientConfig); } - # Update List Name - # - # + listId - The **ILS ID** of the list to update - # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - successful operation - remote isolated function putListIdUpdateListNameUpdateName(string listId, map headers = {}, *PutListIdUpdateListNameUpdateNameQueries queries) returns ListUpdateResponse|error { + resource isolated function put [string listId]/update\-list\-name(map headers = {}, *PutListIdUpdateListNameUpdateNameQueries queries) returns ListUpdateResponse|error { string resourcePath = string `/${getEncodedUri(listId)}/update-list-name`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -56,12 +51,7 @@ public isolated client class Client { return self.clientEp->put(resourcePath, request, httpHeaders); } - # Add and/or Remove Records from a List - # - # + listId - The **ILS ID** of the `MANUAL` or `SNAPSHOT` list - # + headers - Headers to be sent with the request - # + return - successful operation - remote isolated function putListIdMembershipsAddAndRemoveAddAndRemove(string listId, MembershipChangeRequest payload, map headers = {}) returns MembershipsUpdateResponse|error { + resource isolated function put [string listId]/memberships/add\-and\-remove(MembershipChangeRequest payload, map headers = {}) returns MembershipsUpdateResponse|error { string resourcePath = string `/${getEncodedUri(listId)}/memberships/add-and-remove`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -69,7 +59,7 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->put(resourcePath, request, httpHeaders); } @@ -80,7 +70,7 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - remote isolated function getListIdGetById(string listId, map headers = {}, *GetListIdGetByIdQueries queries) returns ListFetchResponse|error { + resource isolated function get [string listId](map headers = {}, *GetListIdGetByIdQueries queries) returns ListFetchResponse|error { string resourcePath = string `/${getEncodedUri(listId)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -96,7 +86,7 @@ public isolated client class Client { # + listId - The **ILS ID** of the list to delete # + headers - Headers to be sent with the request # + return - No content - remote isolated function deleteListIdRemove(string listId, map headers = {}) returns error? { + resource isolated function delete [string listId](map headers = {}) returns error? { string resourcePath = string `/${getEncodedUri(listId)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -106,13 +96,7 @@ public isolated client class Client { return self.clientEp->delete(resourcePath, headers = httpHeaders); } - # Update List Filter Definition - # - # + listId - The **ILS ID** of the list to update - # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - successful operation - remote isolated function putListIdUpdateListFiltersUpdateListFilters(string listId, ListFilterUpdateRequest payload, map headers = {}, *PutListIdUpdateListFiltersUpdateListFiltersQueries queries) returns ListUpdateResponse|error { + resource isolated function put [string listId]/update\-list\-filters(ListFilterUpdateRequest payload, map headers = {}, *PutListIdUpdateListFiltersUpdateListFiltersQueries queries) returns ListUpdateResponse|error { string resourcePath = string `/${getEncodedUri(listId)}/update-list-filters`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -121,7 +105,7 @@ public isolated client class Client { resourcePath = resourcePath + check getPathForQueryParam(queries); map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->put(resourcePath, request, httpHeaders); } @@ -130,7 +114,7 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function postSearchDoSearch(ListSearchRequest payload, map headers = {}) returns ListSearchResponse|error { + resource isolated function post search(ListSearchRequest payload, map headers = {}) returns ListSearchResponse|error { string resourcePath = string `/search`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -138,16 +122,12 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->post(resourcePath, request, httpHeaders); } - # Moves a list to a given folder - # - # + headers - Headers to be sent with the request - # + return - No content - remote isolated function putFoldersMoveListMoveList(ListMoveRequest payload, map headers = {}) returns error? { + resource isolated function put folders/move\-list(ListMoveRequest payload, map headers = {}) returns error? { string resourcePath = string `/folders/move-list`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -155,7 +135,7 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->put(resourcePath, request, httpHeaders); } @@ -165,7 +145,7 @@ public isolated client class Client { # + listId - The **ILS ID** of the `MANUAL` or `SNAPSHOT` list # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function putListIdMembershipsAddAdd(string listId, string[] payload, map headers = {}) returns MembershipsUpdateResponse|error { + resource isolated function put [string listId]/memberships/add(string[] payload, map headers = {}) returns MembershipsUpdateResponse|error { string resourcePath = string `/${getEncodedUri(listId)}/memberships/add`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -173,19 +153,12 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->put(resourcePath, request, httpHeaders); } - # Fetch List by Name - # - # + listName - The name of the list to fetch. This is **not** case sensitive - # + objectTypeId - The object type ID of the object types stored by the list to fetch. For example, `0-1` for a `CONTACT` list - # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - successful operation - remote isolated function getObjectTypeIdObjectTypeIdNameListNameGetByName(string listName, string objectTypeId, map headers = {}, *GetObjectTypeIdObjectTypeIdNameListNameGetByNameQueries queries) returns ListFetchResponse|error { + resource isolated function get object\-type\-id/[string objectTypeId]/name/[string listName](map headers = {}, *GetObjectTypeIdObjectTypeIdNameListNameGetByNameQueries queries) returns ListFetchResponse|error { string resourcePath = string `/object-type-id/${getEncodedUri(objectTypeId)}/name/${getEncodedUri(listName)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -202,7 +175,7 @@ public isolated client class Client { # + newParentFolderId - # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function putFoldersFolderIdMoveNewParentFolderIdMove(string folderId, string newParentFolderId, map headers = {}) returns ListFolderFetchResponse|error { + resource isolated function put folders/[string folderId]/move/[string newParentFolderId](map headers = {}) returns ListFolderFetchResponse|error { string resourcePath = string `/folders/${getEncodedUri(folderId)}/move/${getEncodedUri(newParentFolderId)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -218,7 +191,7 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - remote isolated function getIdmappingTranslateLegacyListIdToListId(map headers = {}, *GetIdmappingTranslateLegacyListIdToListIdQueries queries) returns PublicMigrationMapping|error { + resource isolated function get idmapping(map headers = {}, *GetIdmappingTranslateLegacyListIdToListIdQueries queries) returns PublicMigrationMapping|error { string resourcePath = string `/idmapping`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -233,7 +206,7 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function postIdmappingTranslateLegacyListIdToListIdBatch(string[] payload, map headers = {}) returns PublicBatchMigrationMapping|error { + resource isolated function post idmapping(string[] payload, map headers = {}) returns PublicBatchMigrationMapping|error { string resourcePath = string `/idmapping`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -241,7 +214,7 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->post(resourcePath, request, httpHeaders); } @@ -251,7 +224,7 @@ public isolated client class Client { # + listId - The **ILS ID** of the list to restore # + headers - Headers to be sent with the request # + return - No content - remote isolated function putListIdRestoreRestore(string listId, map headers = {}) returns error? { + resource isolated function put [string listId]/restore(map headers = {}) returns error? { string resourcePath = string `/${getEncodedUri(listId)}/restore`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -268,7 +241,7 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - remote isolated function putFoldersFolderIdRenameRename(string folderId, map headers = {}, *PutFoldersFolderIdRenameRenameQueries queries) returns ListFolderFetchResponse|error { + resource isolated function put folders/[string folderId]/rename(map headers = {}, *PutFoldersFolderIdRenameRenameQueries queries) returns ListFolderFetchResponse|error { string resourcePath = string `/folders/${getEncodedUri(folderId)}/rename`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -280,13 +253,7 @@ public isolated client class Client { return self.clientEp->put(resourcePath, request, httpHeaders); } - # Fetch List Memberships Ordered by Added to List Date - # - # + listId - The **ILS ID** of the list - # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - successful operation - remote isolated function getListIdMembershipsJoinOrderGetPageOrderedByAddedToListDate(string listId, map headers = {}, *GetListIdMembershipsJoinOrderGetPageOrderedByAddedToListDateQueries queries) returns ApiCollectionResponseJoinTimeAndRecordId|error { + resource isolated function get [string listId]/memberships/join\-order(map headers = {}, *GetListIdMembershipsJoinOrderGetPageOrderedByAddedToListDateQueries queries) returns ApiCollectionResponseJoinTimeAndRecordId|error { string resourcePath = string `/${getEncodedUri(listId)}/memberships/join-order`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -303,7 +270,7 @@ public isolated client class Client { # + sourceListId - The **ILS ID** of the *source list* to grab the records from, which are then added to the *destination list* # + headers - Headers to be sent with the request # + return - No content - remote isolated function putListIdMembershipsAddFromSourceListIdAddAllFromList(string listId, string sourceListId, map headers = {}) returns error? { + resource isolated function put [string listId]/memberships/add\-from/[string sourceListId](map headers = {}) returns error? { string resourcePath = string `/${getEncodedUri(listId)}/memberships/add-from/${getEncodedUri(sourceListId)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -320,7 +287,7 @@ public isolated client class Client { # + recordId - Id of the record # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function getRecordsObjectTypeIdRecordIdMembershipsGetLists(string objectTypeId, string recordId, map headers = {}) returns ApiCollectionResponseRecordListMembershipNoPaging|error { + resource isolated function get records/[string objectTypeId]/[string recordId]/memberships(map headers = {}) returns ApiCollectionResponseRecordListMembershipNoPaging|error { string resourcePath = string `/records/${getEncodedUri(objectTypeId)}/${getEncodedUri(recordId)}/memberships`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -335,7 +302,7 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - remote isolated function getGetAll(map headers = {}, *GetGetAllQueries queries) returns ListsByIdResponse|error { + resource isolated function get .(map headers = {}, *GetGetAllQueries queries) returns ListsByIdResponse|error { string resourcePath = string `/`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -351,7 +318,7 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function postCreate(ListCreateRequest payload, map headers = {}) returns ListCreateResponse|error { + resource isolated function post .(ListCreateRequest payload, map headers = {}) returns ListCreateResponse|error { string resourcePath = string `/`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -359,7 +326,7 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->post(resourcePath, request, httpHeaders); } @@ -369,7 +336,7 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - remote isolated function getFoldersGetAll(map headers = {}, *GetFoldersGetAllQueries queries) returns ListFolderFetchResponse|error { + resource isolated function get folders(map headers = {}, *GetFoldersGetAllQueries queries) returns ListFolderFetchResponse|error { string resourcePath = string `/folders`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -384,7 +351,7 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function postFoldersCreate(ListFolderCreateRequest payload, map headers = {}) returns ListFolderCreateResponse|error { + resource isolated function post folders(ListFolderCreateRequest payload, map headers = {}) returns ListFolderCreateResponse|error { string resourcePath = string `/folders`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -392,7 +359,7 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->post(resourcePath, request, httpHeaders); } @@ -402,7 +369,7 @@ public isolated client class Client { # + folderId - # + headers - Headers to be sent with the request # + return - No content - remote isolated function deleteFoldersFolderIdRemove(string folderId, map headers = {}) returns error? { + resource isolated function delete folders/[string folderId](map headers = {}) returns error? { string resourcePath = string `/folders/${getEncodedUri(folderId)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -418,7 +385,7 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - remote isolated function getListIdMembershipsGetPage(string listId, map headers = {}, *GetListIdMembershipsGetPageQueries queries) returns ApiCollectionResponseJoinTimeAndRecordId|error { + resource isolated function get [string listId]/memberships(map headers = {}, *GetListIdMembershipsGetPageQueries queries) returns ApiCollectionResponseJoinTimeAndRecordId|error { string resourcePath = string `/${getEncodedUri(listId)}/memberships`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -434,7 +401,7 @@ public isolated client class Client { # + listId - The **ILS ID** of the `MANUAL` or `SNAPSHOT` list # + headers - Headers to be sent with the request # + return - No content - remote isolated function deleteListIdMembershipsRemoveAll(string listId, map headers = {}) returns error? { + resource isolated function delete [string listId]/memberships(map headers = {}) returns error? { string resourcePath = string `/${getEncodedUri(listId)}/memberships`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -449,7 +416,7 @@ public isolated client class Client { # + listId - The **ILS ID** of the `MANUAL` or `SNAPSHOT` list # + headers - Headers to be sent with the request # + return - successful operation - remote isolated function putListIdMembershipsRemoveRemove(string listId, string[] payload, map headers = {}) returns MembershipsUpdateResponse|error { + resource isolated function put [string listId]/memberships/remove(string[] payload, map headers = {}) returns MembershipsUpdateResponse|error { string resourcePath = string `/${getEncodedUri(listId)}/memberships/remove`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { @@ -457,7 +424,7 @@ public isolated client class Client { } map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); + json jsonBody = jsondata:toJson(payload); request.setPayload(jsonBody, "application/json"); return self.clientEp->put(resourcePath, request, httpHeaders); } diff --git a/ballerina/types.bal b/ballerina/types.bal index 844585a..627e059 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -142,7 +142,7 @@ public type ListsByIdResponse record { public type PublicNotAllFilterBranchFilters PublicPropertyFilter|PublicAssociationInListFilter|PublicPageViewAnalyticsFilter|PublicCtaAnalyticsFilter|PublicEventAnalyticsFilter|PublicFormSubmissionFilter|PublicFormSubmissionOnPageFilter|PublicIntegrationEventFilter|PublicEmailSubscriptionFilter|PublicCommunicationSubscriptionFilter|PublicCampaignInfluencedFilter|PublicSurveyMonkeyFilter|PublicSurveyMonkeyValueFilter|PublicWebinarFilter|PublicEmailEventFilter|PublicPrivacyAnalyticsFilter|PublicAdsSearchFilter|PublicAdsTimeFilter|PublicInListFilter|PublicNumAssociationsFilter|PublicUnifiedEventsFilter|PublicPropertyAssociationInListFilter|PublicConstantFilter; -# Represents the Queries record for the operation: getIdmappingTranslateLegacyListIdToListId +# Represents the Queries record for the operation: get-/idmapping_translateLegacyListIdToListId public type GetIdmappingTranslateLegacyListIdToListIdQueries record { # The legacy list id from lists v1 API string legacyListId?; @@ -177,7 +177,7 @@ public type PublicObjectListSearchResult record { string updatedAt?; }; -# Represents the Queries record for the operation: getObjectTypeIdObjectTypeIdNameListNameGetByName +# Represents the Queries record for the operation: get-/object-type-id/{objectTypeId}/name/{listName}_getByName public type GetObjectTypeIdObjectTypeIdNameListNameGetByNameQueries record { # A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response boolean includeFilters = false; @@ -253,7 +253,7 @@ public type PublicNotAllFilterBranch record { PublicNotAllFilterBranchFilters[] filters; }; -# Represents the Queries record for the operation: putListIdUpdateListFiltersUpdateListFilters +# Represents the Queries record for the operation: put-/{listId}/update-list-filters_updateListFilters public type PutListIdUpdateListFiltersUpdateListFiltersQueries record { # A flag indicating whether or not the memberships added to the list as a result of the filter change should be enrolled in workflows that are relevant to this list boolean enrollObjectsInWorkflows = false; @@ -370,7 +370,7 @@ public type PublicOrFilterBranchFilterBranches PublicOrFilterBranch|PublicAndFil public type PublicRestrictedFilterBranchFilters PublicPropertyFilter|PublicAssociationInListFilter|PublicPageViewAnalyticsFilter|PublicCtaAnalyticsFilter|PublicEventAnalyticsFilter|PublicFormSubmissionFilter|PublicFormSubmissionOnPageFilter|PublicIntegrationEventFilter|PublicEmailSubscriptionFilter|PublicCommunicationSubscriptionFilter|PublicCampaignInfluencedFilter|PublicSurveyMonkeyFilter|PublicSurveyMonkeyValueFilter|PublicWebinarFilter|PublicEmailEventFilter|PublicPrivacyAnalyticsFilter|PublicAdsSearchFilter|PublicAdsTimeFilter|PublicInListFilter|PublicNumAssociationsFilter|PublicUnifiedEventsFilter|PublicPropertyAssociationInListFilter|PublicConstantFilter; -# Represents the Queries record for the operation: getListIdMembershipsJoinOrderGetPageOrderedByAddedToListDate +# Represents the Queries record for the operation: get-/{listId}/memberships/join-order_getPageOrderedByAddedToListDate public type GetListIdMembershipsJoinOrderGetPageOrderedByAddedToListDateQueries record { # The paging offset token for the page that comes `before` the previously requested records. # @@ -474,7 +474,7 @@ public type PublicCtaAnalyticsFilter record { string operator; }; -# Represents the Queries record for the operation: getListIdMembershipsGetPage +# Represents the Queries record for the operation: get-/{listId}/memberships_getPage public type GetListIdMembershipsGetPageQueries record { # The paging offset token for the page that comes `before` the previously requested records. # @@ -686,7 +686,7 @@ public type PublicAssociationInListFilter record { public type PublicRestrictedFilterBranchFilterBranches PublicOrFilterBranch|PublicAndFilterBranch|PublicNotAllFilterBranch|PublicNotAnyFilterBranch|PublicRestrictedFilterBranch|PublicUnifiedEventsFilterBranch|PublicPropertyAssociationFilterBranch|PublicAssociationFilterBranch; -# Represents the Queries record for the operation: putListIdUpdateListNameUpdateName +# Represents the Queries record for the operation: put-/{listId}/update-list-name_updateName public type PutListIdUpdateListNameUpdateNameQueries record { # The name to update the list to string listName?; @@ -725,13 +725,13 @@ public type PublicAdsTimeFilter record { "ADS_TIME" filterType = "ADS_TIME"; }; -# Represents the Queries record for the operation: getFoldersGetAll +# Represents the Queries record for the operation: get-/folders_getAll public type GetFoldersGetAllQueries record { # The Id of the folder to retrieve string folderId = "0"; }; -# Represents the Queries record for the operation: getListIdGetById +# Represents the Queries record for the operation: get-/{listId}_getById public type GetListIdGetByIdQueries record { # A flag indicating whether or not the response object list definition should include a filter branch definition. By default, object list definitions will not have their filter branch definitions included in the response boolean includeFilters = false; @@ -811,13 +811,13 @@ public type PublicAdsSearchFilter record { string operator; }; -# Represents the Queries record for the operation: putFoldersFolderIdRenameRename +# Represents the Queries record for the operation: put-/folders/{folderId}/rename_rename public type PutFoldersFolderIdRenameRenameQueries record { # string newFolderName?; }; -# Represents the Queries record for the operation: getGetAll +# Represents the Queries record for the operation: get-/_getAll public type GetGetAllQueries record { # The **ILS IDs** of the lists to fetch string[] listIds?;