diff --git a/ballerina/Ballerina.toml b/ballerina/Ballerina.toml index 5a6977c..fcba158 100644 --- a/ballerina/Ballerina.toml +++ b/ballerina/Ballerina.toml @@ -1,8 +1,8 @@ [package] -distribution = "2201.10.0" +distribution = "2201.12.0" org = "ballerinax" name = "hubspot.marketing.campaigns" -version = "1.0.0" +version = "2.0.0" license = ["Apache-2.0"] authors = ["Ballerina"] keywords = ["hubspot", "crm", "marketing", "campaigns"] @@ -11,6 +11,3 @@ repository = "https://github.com/ballerina-platform/module-ballerinax-hubspot.ma [build-options] observabilityIncluded = true - -[platform.java17] -graalvmCompatible = true diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 36a5195..08c8e60 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -5,12 +5,12 @@ [ballerina] dependencies-toml-version = "2" -distribution-version = "2201.10.0" +distribution-version = "2201.12.2" [[package]] org = "ballerina" name = "auth" -version = "2.12.0" +version = "2.14.0" dependencies = [ {org = "ballerina", name = "crypto"}, {org = "ballerina", name = "jballerina.java"}, @@ -22,7 +22,7 @@ dependencies = [ [[package]] org = "ballerina" name = "cache" -version = "3.8.0" +version = "3.10.0" dependencies = [ {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "jballerina.java"}, @@ -33,7 +33,7 @@ dependencies = [ [[package]] org = "ballerina" name = "constraint" -version = "1.5.0" +version = "1.7.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -41,16 +41,28 @@ dependencies = [ [[package]] org = "ballerina" name = "crypto" -version = "2.7.2" +version = "2.9.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} ] +[[package]] +org = "ballerina" +name = "data.jsondata" +version = "1.1.0" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.object"} +] +modules = [ + {org = "ballerina", packageName = "data.jsondata", moduleName = "data.jsondata"} +] + [[package]] org = "ballerina" name = "file" -version = "1.10.0" +version = "1.12.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -61,12 +73,13 @@ dependencies = [ [[package]] org = "ballerina" name = "http" -version = "2.12.4" +version = "2.14.0" dependencies = [ {org = "ballerina", name = "auth"}, {org = "ballerina", name = "cache"}, {org = "ballerina", name = "constraint"}, {org = "ballerina", name = "crypto"}, + {org = "ballerina", name = "data.jsondata"}, {org = "ballerina", name = "file"}, {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -93,7 +106,7 @@ modules = [ [[package]] org = "ballerina" name = "io" -version = "1.6.3" +version = "1.8.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "lang.value"} @@ -107,7 +120,7 @@ version = "0.0.0" [[package]] org = "ballerina" name = "jwt" -version = "2.13.0" +version = "2.15.0" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, @@ -205,7 +218,7 @@ dependencies = [ [[package]] org = "ballerina" name = "log" -version = "2.10.0" +version = "2.12.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -219,7 +232,7 @@ modules = [ [[package]] org = "ballerina" name = "mime" -version = "2.10.1" +version = "2.12.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"}, @@ -230,7 +243,7 @@ dependencies = [ [[package]] org = "ballerina" name = "oauth2" -version = "2.12.0" +version = "2.14.0" dependencies = [ {org = "ballerina", name = "cache"}, {org = "ballerina", name = "crypto"}, @@ -246,7 +259,7 @@ modules = [ [[package]] org = "ballerina" name = "observe" -version = "1.3.0" +version = "1.5.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -254,7 +267,7 @@ dependencies = [ [[package]] org = "ballerina" name = "os" -version = "1.8.0" +version = "1.10.0" dependencies = [ {org = "ballerina", name = "io"}, {org = "ballerina", name = "jballerina.java"} @@ -266,7 +279,7 @@ modules = [ [[package]] org = "ballerina" name = "task" -version = "2.5.0" +version = "2.7.0" dependencies = [ {org = "ballerina", name = "jballerina.java"}, {org = "ballerina", name = "time"} @@ -289,7 +302,7 @@ modules = [ [[package]] org = "ballerina" name = "time" -version = "2.5.0" +version = "2.7.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -300,7 +313,7 @@ modules = [ [[package]] org = "ballerina" name = "url" -version = "2.4.0" +version = "2.6.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] @@ -323,8 +336,9 @@ modules = [ [[package]] org = "ballerinax" name = "hubspot.marketing.campaigns" -version = "1.0.0" +version = "2.0.0" dependencies = [ + {org = "ballerina", name = "data.jsondata"}, {org = "ballerina", name = "http"}, {org = "ballerina", name = "log"}, {org = "ballerina", name = "oauth2"}, diff --git a/ballerina/client.bal b/ballerina/client.bal index 7086fa6..83f218b 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -1,3 +1,6 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + // Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). // // WSO2 LLC. licenses this file to you under the Apache License, @@ -14,6 +17,7 @@ // specific language governing permissions and limitations // under the License. +import ballerina/data.jsondata; import ballerina/http; public isolated client class Client { @@ -25,70 +29,14 @@ public isolated client class Client { # + serviceUrl - URL of the target service # + return - An error if connector initialization failed public isolated function init(ConnectionConfig config, string serviceUrl = "https://api.hubapi.com/marketing/v3/campaigns") returns error? { - http:ClientConfiguration httpClientConfig = {httpVersion: config.httpVersion, timeout: config.timeout, forwarded: config.forwarded, poolConfig: config.poolConfig, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, validation: config.validation}; - do { - if config.http1Settings is ClientHttp1Settings { - ClientHttp1Settings settings = check config.http1Settings.ensureType(ClientHttp1Settings); - httpClientConfig.http1Settings = {...settings}; - } - if config.http2Settings is http:ClientHttp2Settings { - httpClientConfig.http2Settings = check config.http2Settings.ensureType(http:ClientHttp2Settings); - } - if config.cache is http:CacheConfig { - httpClientConfig.cache = check config.cache.ensureType(http:CacheConfig); - } - if config.responseLimits is http:ResponseLimitConfigs { - httpClientConfig.responseLimits = check config.responseLimits.ensureType(http:ResponseLimitConfigs); - } - if config.secureSocket is http:ClientSecureSocket { - httpClientConfig.secureSocket = check config.secureSocket.ensureType(http:ClientSecureSocket); - } - if config.proxy is http:ProxyConfig { - httpClientConfig.proxy = check config.proxy.ensureType(http:ProxyConfig); - } - } + http:ClientConfiguration httpClientConfig = {httpVersion: config.httpVersion, http1Settings: config.http1Settings, http2Settings: config.http2Settings, timeout: config.timeout, forwarded: config.forwarded, followRedirects: config.followRedirects, poolConfig: config.poolConfig, cache: config.cache, compression: config.compression, circuitBreaker: config.circuitBreaker, retryConfig: config.retryConfig, cookieConfig: config.cookieConfig, responseLimits: config.responseLimits, secureSocket: config.secureSocket, proxy: config.proxy, socketConfig: config.socketConfig, validation: config.validation, laxDataBinding: config.laxDataBinding}; if config.auth is ApiKeysConfig { self.apiKeyConfig = (config.auth).cloneReadOnly(); } else { httpClientConfig.auth = config.auth; self.apiKeyConfig = (); } - http:Client httpEp = check new (serviceUrl, httpClientConfig); - self.clientEp = httpEp; - return; - } - - # Delete campaign - # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. - # + headers - Headers to be sent with the request - # + return - No content - resource isolated function delete [string campaignGuid](map headers = {}) returns http:Response|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}`; - map headerValues = {...headers}; - if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; - } - map httpHeaders = getMapForHeaders(headerValues); - return self.clientEp->delete(resourcePath, headers = httpHeaders); - } - - # Remove asset association - # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. - # + assetType - The type of asset - # Important: Currently, only the following asset types are available for disassociation via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL - # + assetId - Id of the asset - # + headers - Headers to be sent with the request - # + return - No content - resource isolated function delete [string campaignGuid]/assets/[string assetType]/[string assetId](map headers = {}) returns http:Response|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}/${getEncodedUri(assetId)}`; - map headerValues = {...headers}; - if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; - } - map httpHeaders = getMapForHeaders(headerValues); - return self.clientEp->delete(resourcePath, headers = httpHeaders); + self.clientEp = check new (serviceUrl, httpClientConfig); } # Campaign search @@ -100,167 +48,172 @@ public isolated client class Client { string resourcePath = string `/`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } map queryParamEncoding = {"properties": {style: FORM, explode: true}}; resourcePath = resourcePath + check getPathForQueryParam(queries, queryParamEncoding); - map httpHeaders = getMapForHeaders(headerValues); + map httpHeaders = http:getHeaderMap(headerValues); return self.clientEp->get(resourcePath, httpHeaders); } - # Read a campaign + # Create a campaign # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get [string campaignGuid](map headers = {}, *GetMarketingV3CampaignsCampaignguidQueries queries) returns PublicCampaignWithAssets|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}`; + resource isolated function post .(PublicCampaignInput payload, map headers = {}) returns PublicCampaign|error { + string resourcePath = string `/`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map queryParamEncoding = {"properties": {style: FORM, explode: true}}; - resourcePath = resourcePath + check getPathForQueryParam(queries, queryParamEncoding); - map httpHeaders = getMapForHeaders(headerValues); - return self.clientEp->get(resourcePath, httpHeaders); + map httpHeaders = http:getHeaderMap(headerValues); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); } - # List assets + # Read a batch of campaigns # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. - # + assetType - The type of asset to fetch. # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get [string campaignGuid]/assets/[string assetType](map headers = {}, *GetMarketingV3CampaignsCampaignguidAssetsAssettypeQueries queries) returns CollectionResponsePublicCampaignAssetForwardPaging|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}`; + resource isolated function post batch/read(BatchInputPublicCampaignReadInput payload, map headers = {}, *PostMarketingV3CampaignsBatchReadQueries queries) returns BatchResponsePublicCampaignWithAssets|BatchResponsePublicCampaignWithAssetsWithErrors|error { + string resourcePath = string `/batch/read`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - resourcePath = resourcePath + check getPathForQueryParam(queries); - map httpHeaders = getMapForHeaders(headerValues); - return self.clientEp->get(resourcePath, httpHeaders); + map queryParamEncoding = {"properties": {style: FORM, explode: true}}; + resourcePath = resourcePath + check getPathForQueryParam(queries, queryParamEncoding); + map httpHeaders = http:getHeaderMap(headerValues); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); } - # Read budget + # Update a batch of campaigns # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. # + headers - Headers to be sent with the request # + return - successful operation - resource isolated function get [string campaignGuid]/budget/totals(map headers = {}) returns PublicBudgetTotals|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}/budget/totals`; + resource isolated function post batch/update(BatchInputPublicCampaignBatchUpdateItem payload, map headers = {}) returns BatchResponsePublicCampaign|BatchResponsePublicCampaignWithErrors|error { + string resourcePath = string `/batch/update`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map httpHeaders = getMapForHeaders(headerValues); - return self.clientEp->get(resourcePath, httpHeaders); + map httpHeaders = http:getHeaderMap(headerValues); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); } - # Fetch contact IDs + # Get Campaign Metrics # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. - # + contactType - The type of metric to filter the influenced contacts. Allowed values: contactFirstTouch, contactLastTouch, influencedContacts + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get [string campaignGuid]/reports/contacts/[string contactType](map headers = {}, *GetMarketingV3CampaignsCampaignguidReportsContactsContacttypeQueries queries) returns CollectionResponseContactReferenceForwardPaging|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}/reports/contacts/${getEncodedUri(contactType)}`; + resource isolated function get [string campaignGuid]/reports/metrics(map headers = {}, *GetMarketingV3CampaignsCampaignGuidReportsMetricsQueries queries) returns MetricsCounters|error { + string resourcePath = string `/${getEncodedUri(campaignGuid)}/reports/metrics`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } resourcePath = resourcePath + check getPathForQueryParam(queries); - map httpHeaders = getMapForHeaders(headerValues); + map httpHeaders = http:getHeaderMap(headerValues); return self.clientEp->get(resourcePath, httpHeaders); } - # Get Campaign Metrics + # List assets # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID + # + assetType - The type of asset to fetch # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get [string campaignGuid]/reports/metrics(map headers = {}, *GetMarketingV3CampaignsCampaignguidReportsMetricsQueries queries) returns MetricsCounters|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}/reports/metrics`; + resource isolated function get [string campaignGuid]/assets/[string assetType](map headers = {}, *GetMarketingV3CampaignsCampaignGuidAssetsAssetTypeQueries queries) returns CollectionResponsePublicCampaignAssetForwardPaging|error { + string resourcePath = string `/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } resourcePath = resourcePath + check getPathForQueryParam(queries); - map httpHeaders = getMapForHeaders(headerValues); + map httpHeaders = http:getHeaderMap(headerValues); return self.clientEp->get(resourcePath, httpHeaders); } - # Fetch revenue + # Delete a batch of campaigns # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. # + headers - Headers to be sent with the request - # + queries - Queries to be sent with the request - # + return - successful operation - resource isolated function get [string campaignGuid]/reports/revenue(map headers = {}, *GetMarketingV3CampaignsCampaignguidReportsRevenueQueries queries) returns RevenueAttributionAggregate|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}/reports/revenue`; + # + return - No content + resource isolated function post batch/archive(BatchInputPublicCampaignDeleteInput payload, map headers = {}) returns error? { + string resourcePath = string `/batch/archive`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - resourcePath = resourcePath + check getPathForQueryParam(queries); - map httpHeaders = getMapForHeaders(headerValues); - return self.clientEp->get(resourcePath, httpHeaders); + map httpHeaders = http:getHeaderMap(headerValues); + http:Request request = new; + json jsonBody = jsondata:toJson(payload); + request.setPayload(jsonBody, "application/json"); + return self.clientEp->post(resourcePath, request, httpHeaders); } - # Update campaign + # Add asset association # - # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID + # + assetType - The type of asset + # Important: Currently, only the following asset types are available for association via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL + # + assetId - Id of the asset # + headers - Headers to be sent with the request - # + return - successful operation - resource isolated function patch [string campaignGuid](PublicCampaignInput payload, map headers = {}) returns PublicCampaign|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}`; + # + return - No content + resource isolated function put [string campaignGuid]/assets/[string assetType]/[string assetId](map headers = {}) returns error? { + string resourcePath = string `/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}/${getEncodedUri(assetId)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map httpHeaders = getMapForHeaders(headerValues); + map httpHeaders = http:getHeaderMap(headerValues); http:Request request = new; - json jsonBody = payload.toJson(); - request.setPayload(jsonBody, "application/json"); - return self.clientEp->patch(resourcePath, request, httpHeaders); + return self.clientEp->put(resourcePath, request, httpHeaders); } - # Create a campaign + # Remove asset association # + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID + # + assetType - The type of asset + # Important: Currently, only the following asset types are available for disassociation via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL + # + assetId - Id of the asset # + headers - Headers to be sent with the request - # + return - successful operation - resource isolated function post .(PublicCampaignInput payload, map headers = {}) returns PublicCampaign|error { - string resourcePath = string `/`; + # + return - No content + resource isolated function delete [string campaignGuid]/assets/[string assetType]/[string assetId](map headers = {}) returns error? { + string resourcePath = string `/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}/${getEncodedUri(assetId)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map httpHeaders = getMapForHeaders(headerValues); - http:Request request = new; - json jsonBody = payload.toJson(); - request.setPayload(jsonBody, "application/json"); - return self.clientEp->post(resourcePath, request, httpHeaders); + map httpHeaders = http:getHeaderMap(headerValues); + return self.clientEp->delete(resourcePath, headers = httpHeaders); } - # Delete a batch of campaigns + # Fetch revenue # + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID # + headers - Headers to be sent with the request - # + return - No content - resource isolated function post batch/archive(BatchInputPublicCampaignDeleteInput payload, map headers = {}) returns http:Response|error { - string resourcePath = string `/batch/archive`; + # + queries - Queries to be sent with the request + # + return - successful operation + resource isolated function get [string campaignGuid]/reports/revenue(map headers = {}, *GetMarketingV3CampaignsCampaignGuidReportsRevenueQueries queries) returns RevenueAttributionAggregate|error { + string resourcePath = string `/${getEncodedUri(campaignGuid)}/reports/revenue`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map httpHeaders = getMapForHeaders(headerValues); - http:Request request = new; - json jsonBody = payload.toJson(); - request.setPayload(jsonBody, "application/json"); - return self.clientEp->post(resourcePath, request, httpHeaders); + resourcePath = resourcePath + check getPathForQueryParam(queries); + map httpHeaders = http:getHeaderMap(headerValues); + return self.clientEp->get(resourcePath, httpHeaders); } # Create a batch of campaigns @@ -271,68 +224,96 @@ public isolated client class Client { string resourcePath = string `/batch/create`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map httpHeaders = getMapForHeaders(headerValues); + 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); } - # Read a batch of campaigns + # Read budget + # + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID + # + headers - Headers to be sent with the request + # + return - successful operation + resource isolated function get [string campaignGuid]/budget/totals(map headers = {}) returns PublicBudgetTotals|error { + string resourcePath = string `/${getEncodedUri(campaignGuid)}/budget/totals`; + map headerValues = {...headers}; + if self.apiKeyConfig is ApiKeysConfig { + headerValues["private-app"] = self.apiKeyConfig?.privateApp; + } + map httpHeaders = http:getHeaderMap(headerValues); + return self.clientEp->get(resourcePath, httpHeaders); + } + + # Read a campaign # + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function post batch/read(BatchInputPublicCampaignReadInput payload, map headers = {}, *PostMarketingV3CampaignsBatchReadQueries queries) returns BatchResponsePublicCampaignWithAssets|BatchResponsePublicCampaignWithAssetsWithErrors|error { - string resourcePath = string `/batch/read`; + resource isolated function get [string campaignGuid](map headers = {}, *GetMarketingV3CampaignsCampaignGuidQueries queries) returns PublicCampaignWithAssets|error { + string resourcePath = string `/${getEncodedUri(campaignGuid)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } map queryParamEncoding = {"properties": {style: FORM, explode: true}}; resourcePath = resourcePath + check getPathForQueryParam(queries, queryParamEncoding); - map httpHeaders = getMapForHeaders(headerValues); - http:Request request = new; - json jsonBody = payload.toJson(); - request.setPayload(jsonBody, "application/json"); - return self.clientEp->post(resourcePath, request, httpHeaders); + map httpHeaders = http:getHeaderMap(headerValues); + return self.clientEp->get(resourcePath, httpHeaders); } - # Update a batch of campaigns + # Delete campaign + # + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID + # + headers - Headers to be sent with the request + # + return - No content + resource isolated function delete [string campaignGuid](map headers = {}) returns error? { + string resourcePath = string `/${getEncodedUri(campaignGuid)}`; + map headerValues = {...headers}; + if self.apiKeyConfig is ApiKeysConfig { + headerValues["private-app"] = self.apiKeyConfig?.privateApp; + } + map httpHeaders = http:getHeaderMap(headerValues); + return self.clientEp->delete(resourcePath, headers = httpHeaders); + } + + # Update campaign # + # + campaignGuid - Unique identifier for the campaign, formatted as a UUID # + headers - Headers to be sent with the request # + return - successful operation - resource isolated function post batch/update(BatchInputPublicCampaignBatchUpdateItem payload, map headers = {}) returns BatchResponsePublicCampaign|BatchResponsePublicCampaignWithErrors|error { - string resourcePath = string `/batch/update`; + resource isolated function patch [string campaignGuid](PublicCampaignInput payload, map headers = {}) returns PublicCampaign|error { + string resourcePath = string `/${getEncodedUri(campaignGuid)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map httpHeaders = getMapForHeaders(headerValues); + 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); + return self.clientEp->patch(resourcePath, request, httpHeaders); } - # Add asset association + # Fetch contact IDs # # + campaignGuid - Unique identifier for the campaign, formatted as a UUID - # + assetType - The type of asset - # Important: Currently, only the following asset types are available for association via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL - # + assetId - Id of the asset + # + contactType - The type of metric to filter the influenced contacts. Allowed values: contactFirstTouch, contactLastTouch, influencedContacts # + headers - Headers to be sent with the request - # + return - No content - resource isolated function put [string campaignGuid]/assets/[string assetType]/[string assetId](map headers = {}) returns http:Response|error { - string resourcePath = string `/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}/${getEncodedUri(assetId)}`; + # + queries - Queries to be sent with the request + # + return - successful operation + resource isolated function get [string campaignGuid]/reports/contacts/[string contactType](map headers = {}, *GetMarketingV3CampaignsCampaignGuidReportsContactsContactTypeQueries queries) returns CollectionResponseContactReferenceForwardPaging|error { + string resourcePath = string `/${getEncodedUri(campaignGuid)}/reports/contacts/${getEncodedUri(contactType)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { - headerValues["private-app"] = self.apiKeyConfig?.private\-app; + headerValues["private-app"] = self.apiKeyConfig?.privateApp; } - map httpHeaders = getMapForHeaders(headerValues); - http:Request request = new; - return self.clientEp->put(resourcePath, request, httpHeaders); + resourcePath = resourcePath + check getPathForQueryParam(queries); + map httpHeaders = http:getHeaderMap(headerValues); + return self.clientEp->get(resourcePath, httpHeaders); } } diff --git a/ballerina/tests/test.bal b/ballerina/tests/test.bal index d9ee81d..ec021f1 100644 --- a/ballerina/tests/test.bal +++ b/ballerina/tests/test.bal @@ -187,8 +187,7 @@ isolated function testGetListAssets() returns error? { enable: enableClient0auth2 } isolated function testPutAddAssetAssociation() returns error? { - var response = check hsmCampaignsClient->/[campaignGuid]/assets/[assetType]/[assetID].put(); - test:assertEquals(response.statusCode, 204); + _ = check hsmCampaignsClient->/[campaignGuid]/assets/[assetType]/[assetID].put(); } @test:Config { @@ -197,8 +196,7 @@ isolated function testPutAddAssetAssociation() returns error? { enable: enableClient0auth2 } isolated function testDeleteRemoveAssetAssociation() returns error? { - var response = check hsmCampaignsClient->/[campaignGuid]/assets/[assetType]/[assetID].delete(); - test:assertEquals(response.statusCode, 204); + _ = check hsmCampaignsClient->/[campaignGuid]/assets/[assetType]/[assetID].delete(); } @test:Config { @@ -207,8 +205,7 @@ isolated function testDeleteRemoveAssetAssociation() returns error? { enable: enableClient0auth2 } function testDeleteCampaign() returns error? { - var response = check hsmCampaignsClient->/[campaignGuid2].delete(); - test:assertEquals(response.statusCode, 204); + _ = check hsmCampaignsClient->/[campaignGuid2].delete(); } @test:Config { @@ -216,7 +213,7 @@ function testDeleteCampaign() returns error? { enable: enableClient0auth2 } isolated function testPostDeleteABatchOfCampaigns() returns error? { - var response = check hsmCampaignsClient->/batch/archive.post( + _ = check hsmCampaignsClient->/batch/archive.post( payload = { "inputs": [ { @@ -228,5 +225,4 @@ isolated function testPostDeleteABatchOfCampaigns() returns error? { ] } ); - test:assertEquals(response.statusCode, 204); } diff --git a/ballerina/types.bal b/ballerina/types.bal index b8f4a60..88ffaf0 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -1,3 +1,6 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + // Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). // // WSO2 LLC. licenses this file to you under the Apache License, @@ -37,10 +40,33 @@ public type CollectionResponsePublicCampaignAssetForwardPaging record { PublicCampaignAsset[] results; }; +# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid}/reports/revenue +public type GetMarketingV3CampaignsCampaignGuidReportsRevenueQueries record { + # Allowed values: LINEAR, FIRST_INTERACTION, LAST_INTERACTION, FULL_PATH, U_SHAPED, W_SHAPED, TIME_DECAY, J_SHAPED, INVERSE_J_SHAPED + # Default value: LINEAR + string attributionModel?; + # End date for the report data, formatted as YYYY-MM-DD. + # Default value: Current date + string endDate?; + # The start date for the report data, formatted as YYYY-MM-DD. + # Default value: 2006-01-01 + string startDate?; +}; + public type PublicCampaignReadInput record { string id; }; +# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid}/reports/metrics +public type GetMarketingV3CampaignsCampaignGuidReportsMetricsQueries record { + # End date for the report data, formatted as YYYY-MM-DD. + # Default value: Current date + string endDate?; + # The start date for the report data, formatted as YYYY-MM-DD. + # Default value: 2006-01-01 + string startDate?; +}; + public type BatchResponsePublicCampaignWithAssetsWithErrors record { string completedAt; int:Signed32 numErrors?; @@ -70,7 +96,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?; @@ -93,26 +119,13 @@ public type ForwardPaging record { NextPage next?; }; -# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid}/reports/revenue -public type GetMarketingV3CampaignsCampaignguidReportsRevenueQueries record { - # Allowed values: LINEAR, FIRST_INTERACTION, LAST_INTERACTION, FULL_PATH, U_SHAPED, W_SHAPED, TIME_DECAY, J_SHAPED, INVERSE_J_SHAPED - # Default value: LINEAR - string attributionModel?; - # End date for the report data, formatted as YYYY-MM-DD. - # Default value: Current date - string endDate?; - # The start date for the report data, formatted as YYYY-MM-DD. - # Default value: 2006-01-01 - string startDate?; -}; - # Represents the Queries record for the operation: post-/marketing/v3/campaigns/batch/read public type PostMarketingV3CampaignsBatchReadQueries record { - # End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched. + # End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched string endDate?; - # Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched. + # Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched string startDate?; - # A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object(s), they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map. + # A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object(s), they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map string[] properties?; }; @@ -158,31 +171,40 @@ 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 PublicBudgetTotals record { @@ -228,20 +250,20 @@ public type PublicBudgetItem record { int:Signed32 updatedAt; }; -# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid} -public type GetMarketingV3CampaignsCampaignguidQueries record { - # End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. - # If not provided, no asset metrics will be fetched. +# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid}/reports/contacts/{contactType} +public type GetMarketingV3CampaignsCampaignGuidReportsContactsContactTypeQueries record { + # End date for the report data, formatted as YYYY-MM-DD. + # Default value: Current date string endDate?; - # Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. - # If not provided, no asset metrics will be fetched. + # Limit for the number of contacts to fetch + # Default: 100 + int:Signed32 'limit?; + # A cursor for pagination. If provided, the results will start after the given cursor. + # Example: NTI1Cg%3D%3D + string after?; + # The start date for the report data, formatted as YYYY-MM-DD. + # Default value: 2006-01-01 string startDate?; - # A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object, they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map. - string[] properties?; -}; - -public type BatchInputPublicCampaignInput record { - PublicCampaignInput[] inputs; }; public type CollectionResponseWithTotalPublicCampaignForwardPaging record { @@ -250,43 +272,31 @@ public type CollectionResponseWithTotalPublicCampaignForwardPaging record { PublicCampaign[] results; }; +public type BatchInputPublicCampaignInput record { + PublicCampaignInput[] inputs; +}; + public type Paging record { NextPage next?; PreviousPage prev?; }; -# 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 = ""; -|}; - -# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid}/reports/metrics -public type GetMarketingV3CampaignsCampaignguidReportsMetricsQueries record { - # End date for the report data, formatted as YYYY-MM-DD. - # Default value: Current date +# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid} +public type GetMarketingV3CampaignsCampaignGuidQueries record { + # End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. + # If not provided, no asset metrics will be fetched string endDate?; - # The start date for the report data, formatted as YYYY-MM-DD. - # Default value: 2006-01-01 + # Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. + # If not provided, no asset metrics will be fetched string startDate?; -}; - -public type CollectionResponseContactReferenceForwardPaging record { - ForwardPaging paging?; - ContactReference[] results; + # A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object, they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map + string[] properties?; }; # Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid}/assets/{assetType} -public type GetMarketingV3CampaignsCampaignguidAssetsAssettypeQueries record { +public type GetMarketingV3CampaignsCampaignGuidAssetsAssetTypeQueries record { # End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. - # If not provided, no asset metrics will be fetched. + # If not provided, no asset metrics will be fetched string endDate?; # The maximum number of results to return. # Default: 10 @@ -295,10 +305,15 @@ public type GetMarketingV3CampaignsCampaignguidAssetsAssettypeQueries record { # Example: NTI1Cg%3D%3D string after?; # Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. - # If not provided, no asset metrics will be fetched. + # If not provided, no asset metrics will be fetched string startDate?; }; +public type CollectionResponseContactReferenceForwardPaging record { + ForwardPaging paging?; + ContactReference[] results; +}; + public type PublicCampaignAsset record { string name?; string id; @@ -313,36 +328,10 @@ public type RevenueAttributionAggregate record { "AED"|"AFN"|"ALL"|"AMD"|"ANG"|"AOA"|"ARS"|"AUD"|"AWG"|"AZN"|"BAM"|"BBD"|"BDT"|"BGN"|"BHD"|"BIF"|"BMD"|"BND"|"BOB"|"BOV"|"BRL"|"BSD"|"BTN"|"BWP"|"BYN"|"BZD"|"CAD"|"CDF"|"CHE"|"CHF"|"CHW"|"CLF"|"CLP"|"CNY"|"COP"|"COU"|"CRC"|"CUC"|"CUP"|"CVE"|"CZK"|"DJF"|"DKK"|"DOP"|"DZD"|"EGP"|"ERN"|"ETB"|"EUR"|"FJD"|"FKP"|"GBP"|"GEL"|"GHS"|"GIP"|"GMD"|"GNF"|"GTQ"|"GYD"|"HKD"|"HNL"|"HRK"|"HTG"|"HUF"|"IDR"|"ILS"|"INR"|"IQD"|"IRR"|"ISK"|"JMD"|"JOD"|"JPY"|"KES"|"KGS"|"KHR"|"KMF"|"KPW"|"KRW"|"KWD"|"KYD"|"KZT"|"LAK"|"LBP"|"LKR"|"LRD"|"LSL"|"LYD"|"MAD"|"MDL"|"MGA"|"MKD"|"MMK"|"MNT"|"MOP"|"MRU"|"MUR"|"MVR"|"MWK"|"MXN"|"MXV"|"MYR"|"MZN"|"NAD"|"NGN"|"NIO"|"NOK"|"NPR"|"NZD"|"OMR"|"PAB"|"PEN"|"PGK"|"PHP"|"PKR"|"PLN"|"PYG"|"QAR"|"RON"|"RSD"|"RUB"|"RWF"|"SAR"|"SBD"|"SCR"|"SDG"|"SEK"|"SGD"|"SHP"|"SLL"|"SOS"|"SRD"|"SSP"|"STN"|"SVC"|"SYP"|"SZL"|"THB"|"TJS"|"TMT"|"TND"|"TOP"|"TRY"|"TTD"|"TWD"|"TZS"|"UAH"|"UGX"|"USD"|"USN"|"UYI"|"UYU"|"UZS"|"VEF"|"VND"|"VUV"|"WST"|"XAF"|"XAG"|"XAU"|"XBA"|"XBB"|"XBC"|"XBD"|"XCD"|"XDR"|"XOF"|"XPD"|"XPF"|"XPT"|"XSU"|"XUA"|"YER"|"ZAR"|"ZMW"|"ZWL" currencyCode?; }; -# Represents the Queries record for the operation: get-/marketing/v3/campaigns/{campaignGuid}/reports/contacts/{contactType} -public type GetMarketingV3CampaignsCampaignguidReportsContactsContacttypeQueries record { - # End date for the report data, formatted as YYYY-MM-DD. - # Default value: Current date - string endDate?; - # Limit for the number of contacts to fetch - # Default: 100 - int:Signed32 'limit?; - # A cursor for pagination. If provided, the results will start after the given cursor. - # Example: NTI1Cg%3D%3D - string after?; - # The start date for the report data, formatted as YYYY-MM-DD. - # Default value: 2006-01-01 - string startDate?; -}; - public type BatchInputPublicCampaignBatchUpdateItem record { PublicCampaignBatchUpdateItem[] inputs; }; -# 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?; @@ -375,10 +364,8 @@ public type NextPage record { }; # Provides API key configurations needed when communicating with a remote HTTP endpoint. -# -# + private\-app - field description public type ApiKeysConfig record {| - string private\-app; + string privateApp; |}; public type PublicCampaign record { diff --git a/ballerina/utils.bal b/ballerina/utils.bal index b2aff1f..8269f00 100644 --- a/ballerina/utils.bal +++ b/ballerina/utils.bal @@ -1,3 +1,6 @@ +// AUTO-GENERATED FILE. DO NOT MODIFY. +// This file is auto-generated by the Ballerina OpenAPI tool. + // Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). // // WSO2 LLC. licenses this file to you under the Apache License, @@ -14,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; @@ -183,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 queryParam, map encodingMap = {}) returns string|error { + map 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; @@ -212,20 +217,3 @@ isolated function getPathForQueryParam(map queryParam, map 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 headerParam) returns map { - map 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; -} diff --git a/build-config/resources/Ballerina.toml b/build-config/resources/Ballerina.toml index 3ad8554..2ceb127 100644 --- a/build-config/resources/Ballerina.toml +++ b/build-config/resources/Ballerina.toml @@ -1,5 +1,5 @@ [package] -distribution = "2201.10.0" +distribution = "2201.12.0" org = "ballerinax" name = "hubspot.marketing.campaigns" version = "@toml.version@" @@ -11,6 +11,3 @@ repository = "https://github.com/ballerina-platform/module-ballerinax-hubspot.ma [build-options] observabilityIncluded = true - -[platform.java17] -graalvmCompatible = true diff --git a/docs/license.txt b/docs/license.txt index 921a7a1..adfc413 100644 --- a/docs/license.txt +++ b/docs/license.txt @@ -1,7 +1,7 @@ // AUTO-GENERATED FILE. DO NOT MODIFY. // This file is auto-generated by the Ballerina OpenAPI tool. -// Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). +// Copyright (c) 2025, WSO2 LLC. (http://www.wso2.com). // // WSO2 LLC. licenses this file to you under the Apache License, // Version 2.0 (the "License"); you may not use this file except diff --git a/docs/spec/openapi.json b/docs/spec/openapi.json index 284f824..b36bb6e 100644 --- a/docs/spec/openapi.json +++ b/docs/spec/openapi.json @@ -159,7 +159,7 @@ "parameters" : [ { "name" : "startDate", "in" : "query", - "description" : "Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched.\n", + "description" : "Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched\n", "required" : false, "style" : "form", "explode" : true, @@ -169,7 +169,7 @@ }, { "name" : "endDate", "in" : "query", - "description" : "End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched.", + "description" : "End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period. If not provided, no asset metrics will be fetched", "required" : false, "style" : "form", "explode" : true, @@ -179,7 +179,7 @@ }, { "name" : "properties", "in" : "query", - "description" : "A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object(s), they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map.", + "description" : "A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object(s), they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map", "required" : false, "style" : "form", "explode" : true, @@ -290,7 +290,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -349,7 +349,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -359,7 +359,7 @@ }, { "name" : "assetType", "in" : "path", - "description" : "The type of asset to fetch.", + "description" : "The type of asset to fetch", "required" : true, "style" : "simple", "explode" : false, @@ -389,7 +389,7 @@ }, { "name" : "startDate", "in" : "query", - "description" : "Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched.\n", + "description" : "Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched\n", "required" : false, "style" : "form", "explode" : true, @@ -399,7 +399,7 @@ }, { "name" : "endDate", "in" : "query", - "description" : "End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched.", + "description" : "End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched", "required" : false, "style" : "form", "explode" : true, @@ -522,7 +522,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -575,7 +575,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -693,7 +693,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -732,7 +732,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -742,7 +742,7 @@ }, { "name" : "startDate", "in" : "query", - "description" : "Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched.", + "description" : "Start date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched", "required" : false, "style" : "form", "explode" : true, @@ -752,7 +752,7 @@ }, { "name" : "endDate", "in" : "query", - "description" : " End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched.", + "description" : " End date to fetch asset metrics, formatted as YYYY-MM-DD. This date is used to fetch the metrics associated with the assets for a specified period.\nIf not provided, no asset metrics will be fetched", "required" : false, "style" : "form", "explode" : true, @@ -762,7 +762,7 @@ }, { "name" : "properties", "in" : "query", - "description" : "A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object, they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map.", + "description" : "A comma-separated list of the properties to be returned in the response. If any of the specified properties has empty value on the requested object, they will be ignored and not returned in response. If this parameter is empty, the response will include an empty properties map", "required" : false, "style" : "form", "explode" : true, @@ -802,7 +802,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -833,7 +833,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.\n", + "description" : "Unique identifier for the campaign, formatted as a UUID\n", "required" : true, "style" : "simple", "explode" : false, @@ -882,7 +882,7 @@ "parameters" : [ { "name" : "campaignGuid", "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", + "description" : "Unique identifier for the campaign, formatted as a UUID", "required" : true, "style" : "simple", "explode" : false, @@ -1196,7 +1196,7 @@ }, "in" : { "type" : "string", - "description" : "The name of the field or parameter in which the error was found." + "description" : "The name of the field or parameter in which the error was found" }, "context" : { "type" : "object", @@ -1568,7 +1568,7 @@ } }, "PublicCampaignAsset" : { - "required" : [ "id"], + "required" : [ "id" ], "type" : "object", "properties" : { "name" : { @@ -1706,7 +1706,8 @@ "private_apps" : { "type" : "apiKey", "name" : "private-app", - "in" : "header" + "in" : "header", + "x-ballerina-name" : "privateApp" } } } diff --git a/examples/batch_of_campaigns/Ballerina.toml b/examples/batch_of_campaigns/Ballerina.toml index 434c1c1..9f52218 100644 --- a/examples/batch_of_campaigns/Ballerina.toml +++ b/examples/batch_of_campaigns/Ballerina.toml @@ -5,4 +5,4 @@ version = "0.1.0" distribution = "2201.10.3" [build-options] -observabilityIncluded = true \ No newline at end of file +observabilityIncluded = true diff --git a/examples/batch_of_campaigns/main.bal b/examples/batch_of_campaigns/main.bal index e7c2abf..780c604 100644 --- a/examples/batch_of_campaigns/main.bal +++ b/examples/batch_of_campaigns/main.bal @@ -14,7 +14,6 @@ // specific language governing permissions and limitations // under the License. -import ballerina/http; import ballerina/io; import ballerina/oauth2; import ballerina/time; @@ -79,7 +78,7 @@ public function main() returns error? { io:println("Batch read is not successful"); } - http:Response batchDeleteResponse = check hubspotMarketingCampaign->/batch/archive.post( + _ = check hubspotMarketingCampaign->/batch/archive.post( payload = { "inputs": [ { @@ -91,12 +90,5 @@ public function main() returns error? { ] } ); - - int deleteResponse = batchDeleteResponse.statusCode; - - if deleteResponse == 204 { - io:println("Batch deletion is successful"); - } else { - io:println("Batch deletion is not successful"); - } + io:println("Batch deletion is successful"); }; diff --git a/examples/campaign_lifecycle_with_assets/main.bal b/examples/campaign_lifecycle_with_assets/main.bal index 45aa12f..e6f7c2e 100644 --- a/examples/campaign_lifecycle_with_assets/main.bal +++ b/examples/campaign_lifecycle_with_assets/main.bal @@ -14,7 +14,6 @@ // specific language governing permissions and limitations // under the License. -import ballerina/http; import ballerina/io; import ballerina/oauth2; import ballerina/time; @@ -58,13 +57,8 @@ public function main() returns error? { io:println(string `Campaign with id "${campaignId}" created successfully`); } - var addAssetResponse = check hubspotMarketingCampaigns->/[campaignId]/assets/[assetType]/[assetID].put(); - - if addAssetResponse.statusCode == 204 { - io:println("Asset association is successful"); - } else { - io:println("Asset association is not successful"); - } + _ = check hubspotMarketingCampaigns->/[campaignId]/assets/[assetType]/[assetID].put(); + io:println("Asset association is successful"); campaigns:CollectionResponsePublicCampaignAssetForwardPaging assetListResponse = check hubspotMarketingCampaigns->/[campaignId]/assets/[assetType]; @@ -76,20 +70,10 @@ public function main() returns error? { io:println("Asset list retrieval is not successful"); } - http:Response assetRemoveResponse = check hubspotMarketingCampaigns->/[campaignId]/assets/[assetType]/[assetID].delete(); + _ = check hubspotMarketingCampaigns->/[campaignId]/assets/[assetType]/[assetID].delete(); + io:println("Asset disassociation is successful"); - if assetRemoveResponse.statusCode == 204 { - io:println("Asset removal is successful"); - } else { - io:println("Asset removal is not successful"); - } - - http:Response deleteCampaignResponse = check hubspotMarketingCampaigns->/[campaignId].delete(); - - if deleteCampaignResponse.statusCode == 204 { - io:println("Deletion is successful"); - } else { - io:println("Deletion is not successful"); - } + _ = check hubspotMarketingCampaigns->/[campaignId].delete(); + io:println("Campaign deletion is successful"); }; diff --git a/gradle.properties b/gradle.properties index 985fff3..6fa8439 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ org.gradle.caching=true group=io.ballerina.lib -version=1.0.1-SNAPSHOT +version=2.0.0-SNAPSHOT releasePluginVersion=2.8.0 -ballerinaGradlePluginVersion=2.2.4 -ballerinaLangVersion=2201.10.0 +ballerinaGradlePluginVersion=2.3.0 +ballerinaLangVersion=2201.12.2