diff --git a/ballerina/Dependencies.toml b/ballerina/Dependencies.toml index 8d193ad..b385d49 100644 --- a/ballerina/Dependencies.toml +++ b/ballerina/Dependencies.toml @@ -145,6 +145,15 @@ dependencies = [ {org = "ballerina", name = "jballerina.java"} ] +[[package]] +org = "ballerina" +name = "lang.error" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"} +] + [[package]] org = "ballerina" name = "lang.int" @@ -227,6 +236,9 @@ dependencies = [ {org = "ballerina", name = "time"}, {org = "ballerina", name = "url"} ] +modules = [ + {org = "ballerina", packageName = "oauth2", moduleName = "oauth2"} +] [[package]] org = "ballerina" @@ -254,6 +266,20 @@ dependencies = [ {org = "ballerina", name = "time"} ] +[[package]] +org = "ballerina" +name = "test" +version = "0.0.0" +scope = "testOnly" +dependencies = [ + {org = "ballerina", name = "jballerina.java"}, + {org = "ballerina", name = "lang.array"}, + {org = "ballerina", name = "lang.error"} +] +modules = [ + {org = "ballerina", packageName = "test", moduleName = "test"} +] + [[package]] org = "ballerina" name = "time" @@ -261,6 +287,9 @@ version = "2.5.0" dependencies = [ {org = "ballerina", name = "jballerina.java"} ] +modules = [ + {org = "ballerina", packageName = "time", moduleName = "time"} +] [[package]] org = "ballerina" @@ -288,9 +317,12 @@ modules = [ [[package]] org = "ballerinax" name = "hubspot.marketing.campaigns" -version = "0.1.0" +version = "1.0.0" dependencies = [ {org = "ballerina", name = "http"}, + {org = "ballerina", name = "oauth2"}, + {org = "ballerina", name = "test"}, + {org = "ballerina", name = "time"}, {org = "ballerina", name = "url"}, {org = "ballerinai", name = "observe"} ] diff --git a/ballerina/client.bal b/ballerina/client.bal index a07f252..7086fa6 100644 --- a/ballerina/client.bal +++ b/ballerina/client.bal @@ -1,4 +1,4 @@ -// 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 @@ -14,9 +14,6 @@ // specific language governing permissions and limitations // under the License. -// AUTO-GENERATED FILE. DO NOT MODIFY. -// This file is auto-generated by the Ballerina OpenAPI tool. - import ballerina/http; public isolated client class Client { @@ -27,7 +24,7 @@ public isolated client class Client { # + config - The configurations to be used when initializing the `connector` # + 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") returns error? { + 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 { @@ -66,8 +63,8 @@ public isolated client class Client { # + 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 marketing/v3/campaigns/[string campaignGuid](map headers = {}) returns http:Response|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}`; + 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; @@ -84,8 +81,8 @@ public isolated client class Client { # + assetId - Id of the asset # + headers - Headers to be sent with the request # + return - No content - resource isolated function delete marketing/v3/campaigns/[string campaignGuid]/assets/[string assetType]/[string assetId](map headers = {}) returns http:Response|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}/${getEncodedUri(assetId)}`; + 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; @@ -94,8 +91,13 @@ public isolated client class Client { return self.clientEp->delete(resourcePath, headers = httpHeaders); } - resource isolated function get marketing/v3/campaigns(map headers = {}, *GetMarketingV3CampaignsQueries queries) returns CollectionResponseWithTotalPublicCampaignForwardPaging|error { - string resourcePath = string `/marketing/v3/campaigns/`; + # Campaign search + # + # + headers - Headers to be sent with the request + # + queries - Queries to be sent with the request + # + return - successful operation + resource isolated function get .(map headers = {}, *GetMarketingV3CampaignsQueries queries) returns CollectionResponseWithTotalPublicCampaignForwardPaging|error { + string resourcePath = string `/`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { headerValues["private-app"] = self.apiKeyConfig?.private\-app; @@ -112,8 +114,8 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get marketing/v3/campaigns/[string campaignGuid](map headers = {}, *GetMarketingV3CampaignsCampaignguidQueries queries) returns PublicCampaignWithAssets|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}`; + 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; @@ -131,8 +133,8 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get marketing/v3/campaigns/[string campaignGuid]/assets/[string assetType](map headers = {}, *GetMarketingV3CampaignsCampaignguidAssetsAssettypeQueries queries) returns CollectionResponsePublicCampaignAssetForwardPaging|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}`; + 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; @@ -147,8 +149,8 @@ public isolated client class Client { # + 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 marketing/v3/campaigns/[string campaignGuid]/budget/totals(map headers = {}) returns PublicBudgetTotals|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}/budget/totals`; + 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?.private\-app; @@ -164,8 +166,8 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get marketing/v3/campaigns/[string campaignGuid]/reports/contacts/[string contactType](map headers = {}, *GetMarketingV3CampaignsCampaignguidReportsContactsContacttypeQueries queries) returns CollectionResponseContactReferenceForwardPaging|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}/reports/contacts/${getEncodedUri(contactType)}`; + 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; @@ -181,8 +183,8 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get marketing/v3/campaigns/[string campaignGuid]/reports/metrics(map headers = {}, *GetMarketingV3CampaignsCampaignguidReportsMetricsQueries queries) returns MetricsCounters|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}/reports/metrics`; + 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; @@ -198,8 +200,8 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function get marketing/v3/campaigns/[string campaignGuid]/reports/revenue(map headers = {}, *GetMarketingV3CampaignsCampaignguidReportsRevenueQueries queries) returns RevenueAttributionAggregate|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}/reports/revenue`; + 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; @@ -214,8 +216,8 @@ public isolated client class Client { # + campaignGuid - Unique identifier for the campaign, formatted as a UUID. # + headers - Headers to be sent with the request # + return - successful operation - resource isolated function patch marketing/v3/campaigns/[string campaignGuid](PublicCampaignInput payload, map headers = {}) returns PublicCampaign|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}`; + 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; @@ -227,8 +229,12 @@ public isolated client class Client { return self.clientEp->patch(resourcePath, request, httpHeaders); } - resource isolated function post marketing/v3/campaigns(PublicCampaignInput payload, map headers = {}) returns PublicCampaign|error { - string resourcePath = string `/marketing/v3/campaigns/`; + # Create a campaign + # + # + 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 `/`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { headerValues["private-app"] = self.apiKeyConfig?.private\-app; @@ -244,8 +250,8 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + return - No content - resource isolated function post marketing/v3/campaigns/batch/archive(BatchInputPublicCampaignDeleteInput payload, map headers = {}) returns http:Response|error { - string resourcePath = string `/marketing/v3/campaigns/batch/archive`; + resource isolated function post batch/archive(BatchInputPublicCampaignDeleteInput payload, map headers = {}) returns http:Response|error { + string resourcePath = string `/batch/archive`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { headerValues["private-app"] = self.apiKeyConfig?.private\-app; @@ -261,8 +267,8 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + return - successful operation - resource isolated function post marketing/v3/campaigns/batch/create(BatchInputPublicCampaignInput payload, map headers = {}) returns BatchResponsePublicCampaign|BatchResponsePublicCampaignWithErrors|error { - string resourcePath = string `/marketing/v3/campaigns/batch/create`; + resource isolated function post batch/create(BatchInputPublicCampaignInput payload, map headers = {}) returns BatchResponsePublicCampaign|BatchResponsePublicCampaignWithErrors|error { + string resourcePath = string `/batch/create`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { headerValues["private-app"] = self.apiKeyConfig?.private\-app; @@ -279,8 +285,8 @@ public isolated client class Client { # + headers - Headers to be sent with the request # + queries - Queries to be sent with the request # + return - successful operation - resource isolated function post marketing/v3/campaigns/batch/read(BatchInputPublicCampaignReadInput payload, map headers = {}, *PostMarketingV3CampaignsBatchReadQueries queries) returns BatchResponsePublicCampaignWithAssets|BatchResponsePublicCampaignWithAssetsWithErrors|error { - string resourcePath = string `/marketing/v3/campaigns/batch/read`; + 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; @@ -298,8 +304,8 @@ public isolated client class Client { # # + headers - Headers to be sent with the request # + return - successful operation - resource isolated function post marketing/v3/campaigns/batch/update(BatchInputPublicCampaignBatchUpdateItem payload, map headers = {}) returns BatchResponsePublicCampaign|BatchResponsePublicCampaignWithErrors|error { - string resourcePath = string `/marketing/v3/campaigns/batch/update`; + 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; @@ -319,8 +325,8 @@ public isolated client class Client { # + assetId - Id of the asset # + headers - Headers to be sent with the request # + return - No content - resource isolated function put marketing/v3/campaigns/[string campaignGuid]/assets/[string assetType]/[string assetId](map headers = {}) returns http:Response|error { - string resourcePath = string `/marketing/v3/campaigns/${getEncodedUri(campaignGuid)}/assets/${getEncodedUri(assetType)}/${getEncodedUri(assetId)}`; + 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)}`; map headerValues = {...headers}; if self.apiKeyConfig is ApiKeysConfig { headerValues["private-app"] = self.apiKeyConfig?.private\-app; diff --git a/ballerina/tests/README.md b/ballerina/tests/README.md new file mode 100644 index 0000000..e69de29 diff --git a/ballerina/tests/test.bal b/ballerina/tests/test.bal new file mode 100644 index 0000000..5869f04 --- /dev/null +++ b/ballerina/tests/test.bal @@ -0,0 +1,167 @@ +// 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 +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +import ballerina/oauth2; +import ballerina/test; +import ballerina/time; + +configurable string clientId = ?; +configurable string clientSecret = ?; +configurable string refreshToken = ?; + +configurable string serviceUrl = "https://api.hubapi.com/marketing/v3/campaigns"; + +OAuth2RefreshTokenGrantConfig authConfig = { + clientId, + clientSecret, + refreshToken, + credentialBearer: oauth2:POST_BODY_BEARER +}; + +ConnectionConfig config = {auth: authConfig}; + +final Client baseClient = check new Client(config, serviceUrl = serviceUrl); + +//Variables +string campaignGuid2 = "" ; +configurable string campaignGuid = ?; +configurable string assetType = ?; +configurable string assetID = ?; + +@test:Config {} +isolated function testGetSearchMarketingCampaigns() returns error? { + CollectionResponseWithTotalPublicCampaignForwardPaging response = check baseClient->/.get(); + test:assertTrue(response?.results.length() > 0); +} + +@test:Config {} +function testPostCreateMarketingCampaigns() returns error? { + PublicCampaign response = check baseClient->/.post( + payload = {properties: { + "hs_name": "campaign" + time:utcNow().toString() , + "hs_goal": "campaignGoalSpecified", + "hs_notes": "someNotesForTheCampaign" + }} + ); + test:assertTrue(response?.id != ""); + campaignGuid2 = response?.id; +} + +@test:Config {} +isolated function testGetReadACampaign() returns error? { + PublicCampaignWithAssets response = check baseClient->/[campaignGuid]; + test:assertTrue(response?.id == campaignGuid); +} + +@test:Config {} +isolated function testPatchUpdateCampaigns() returns error? { + PublicCampaign response = check baseClient->/[campaignGuid].patch( + payload = {properties: { + "hs_goal": "updatedCampaignGoal", + "hs_notes": "updatedNotesForTheCampaign" + }} + ); + test:assertTrue(response?.id == campaignGuid); +} + +@test:Config {} +isolated function testPostBatchCreate() returns error? { + BatchResponsePublicCampaign|BatchResponsePublicCampaignWithErrors response = check baseClient->/batch/create.post( + payload = { + "inputs": [ + { + "properties": { + "hs_name": "batchCampaign" + time:utcToString(time:utcNow()), + "hs_goal": "batchCampaignGoalSpecified" + } + } + ] + } + ); + test:assertTrue(response?.status == "COMPLETE"); +} + +@test:Config {} +isolated function testPostBatchRead() returns error? { + BatchResponsePublicCampaignWithAssets|BatchResponsePublicCampaignWithAssetsWithErrors response = check baseClient->/batch/read.post( + payload = { + "inputs": [ + { + "id": "ef46bced-1a75-42b5-9f5f-ebdd39cbfd3b" + } + ] + } + ); + test:assertTrue(response?.status == "COMPLETE"); +} + +@test:Config {} +isolated function testGetReportsRevenue() returns error? { + RevenueAttributionAggregate response = check baseClient->/[campaignGuid]/reports/revenue; + test:assertTrue(response?.revenueAmount is decimal); +} + +@test:Config {} +isolated function testGetReportsMetrics() returns error? { + MetricsCounters response = check baseClient->/[campaignGuid]/reports/metrics; + test:assertTrue(response?.sessions == 0); +} + +@test:Config {} +isolated function testGetListAssets() returns error? { + CollectionResponsePublicCampaignAssetForwardPaging response = check baseClient->/[campaignGuid]/assets/[assetType]; + test:assertTrue(response?.results.length() > 0); + +} + +@test:Config {} +isolated function testPutAddAssetAssociation() returns error? { + var response = check baseClient->/[campaignGuid]/assets/[assetType]/[assetID].put(); + test:assertTrue(response.statusCode == 204); +} + +@test:Config { + dependsOn: [testPutAddAssetAssociation, testGetListAssets] +} +isolated function testDeleteRemoveAssetAssociation() returns error? { + var response = check baseClient->/[campaignGuid]/assets/[assetType]/[assetID].delete(); + test:assertTrue(response.statusCode == 204); +} + +@test:Config { + dependsOn: [testPostCreateMarketingCampaigns] +} +function testDeleteCampaign() returns error? { + var response = check baseClient->/[campaignGuid2].delete(); + test:assertTrue(response.statusCode == 204); +} + +@test:Config {} +isolated function testPostDeleteABatchOfCampaigns() returns error? { + var response = check baseClient->/batch/archive.post( + payload = { + "inputs": [ + { + "id": "b3e493b0-9d5a-4b3e-a362-f4e0f015345d" + }, + { + "id": "96a87dab-554a-474c-853b-c78193a8b889" + } + ] + } + ); + test:assertTrue(response.statusCode == 204); +} diff --git a/ballerina/types.bal b/ballerina/types.bal index 48bf85c..b8f4a60 100644 --- a/ballerina/types.bal +++ b/ballerina/types.bal @@ -1,5 +1,18 @@ -// 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, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. import ballerina/http; @@ -227,16 +240,16 @@ public type GetMarketingV3CampaignsCampaignguidQueries record { string[] properties?; }; +public type BatchInputPublicCampaignInput record { + PublicCampaignInput[] inputs; +}; + public type CollectionResponseWithTotalPublicCampaignForwardPaging record { int:Signed32 total; ForwardPaging paging?; PublicCampaign[] results; }; -public type BatchInputPublicCampaignInput record { - PublicCampaignInput[] inputs; -}; - public type Paging record { NextPage next?; PreviousPage prev?; @@ -289,7 +302,7 @@ public type GetMarketingV3CampaignsCampaignguidAssetsAssettypeQueries record { public type PublicCampaignAsset record { string name?; string id; - record {||} metrics; + record {||} metrics?; }; public type RevenueAttributionAggregate record { diff --git a/ballerina/utils.bal b/ballerina/utils.bal index 1b492b2..b2aff1f 100644 --- a/ballerina/utils.bal +++ b/ballerina/utils.bal @@ -1,5 +1,18 @@ -// 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, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. import ballerina/url; diff --git a/docs/spec/campaignsPublicApi.json b/docs/spec/campaignsPublicApi.json index 1a2478b..8dc37bb 100644 --- a/docs/spec/campaignsPublicApi.json +++ b/docs/spec/campaignsPublicApi.json @@ -1,1713 +1,1713 @@ { - "openapi" : "3.0.1", - "info" : { - "title" : "Marketing Campaigns Public Api", - "version" : "v3", - "x-hubspot-product-tier-requirements" : { - "marketing" : "PROFESSIONAL" - }, - "x-hubspot-documentation-banner" : "NONE", - "x-hubspot-related-documentation" : [ { - "name" : "Campaigns", - "url" : "https://developers.hubspot.com/beta-docs/guides/api/marketing/campaigns" - } ], - "x-hubspot-introduction" : "You can use campaign endpoints to create, read, update, and delete marketing campaign data. For example, you can use these endpoints to create and manage HubSpot campaigns from your external applications. You can also transfer campaign data to external data warehouses for analytics." + "openapi" : "3.0.1", + "info" : { + "title" : "Marketing Campaigns Public Api", + "version" : "v3", + "x-hubspot-product-tier-requirements" : { + "marketing" : "PROFESSIONAL" }, - "servers" : [ { - "url" : "https://api.hubapi.com" - } ], - "tags" : [ { - "name" : "Basic" - }, { - "name" : "Search" - }, { - "name" : "Batch" - }, { - "name" : "Reports" - }, { - "name" : "Asset" - }, { - "name" : "Budget" + "x-hubspot-documentation-banner" : "NONE", + "x-hubspot-related-documentation" : [ { + "name" : "Campaigns", + "url" : "https://developers.hubspot.com/beta-docs/guides/api/marketing/campaigns" } ], - "paths" : { - "/marketing/v3/campaigns/" : { - "get" : { - "tags" : [ "Search" ], - "summary" : "Campaign search", - "description" : "This endpoint allows users to search for and return a page of campaigns based on various query parameters. Users can filter by name, sort, and paginate through the campaigns, as well as control which properties are returned in the response.", - "operationId" : "get-/marketing/v3/campaigns/", - "parameters" : [ { - "name" : "sort", - "in" : "query", - "description" : "The field by which to sort the results. Allowed values are hs_name, createdAt, updatedAt. An optional '-' before the property name can denote descending order\nDefault: hs_name", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "after", - "in" : "query", - "description" : "A cursor for pagination. If provided, the results will start after the given cursor.\nExample: NTI1Cg%3D%3D", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "limit", - "in" : "query", - "description" : "The maximum number of results to return. Allowed values range from 1 to 100\nDefault: 50", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "integer", - "format" : "int32" - } - }, { - "name" : "name", - "in" : "query", - "description" : "A filter to return campaigns whose names contain the specified substring. This allows partial matching of campaign names, returning all campaigns that include the given substring in their name. If this parameter is not provided, the search will return all campaigns", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { + "x-hubspot-introduction" : "You can use campaign endpoints to create, read, update, and delete marketing campaign data. For example, you can use these endpoints to create and manage HubSpot campaigns from your external applications. You can also transfer campaign data to external data warehouses for analytics." + }, + "servers" : [ { + "url" : "https://api.hubapi.com/marketing/v3/campaigns" + } ], + "tags" : [ { + "name" : "Basic" + }, { + "name" : "Search" + }, { + "name" : "Batch" + }, { + "name" : "Reports" + }, { + "name" : "Asset" + }, { + "name" : "Budget" + } ], + "paths" : { + "/" : { + "get" : { + "tags" : [ "Search" ], + "summary" : "Campaign search", + "description" : "This endpoint allows users to search for and return a page of campaigns based on various query parameters. Users can filter by name, sort, and paginate through the campaigns, as well as control which properties are returned in the response.", + "operationId" : "get-/marketing/v3/campaigns/", + "parameters" : [ { + "name" : "sort", + "in" : "query", + "description" : "The field by which to sort the results. Allowed values are hs_name, createdAt, updatedAt. An optional '-' before the property name can denote descending order\nDefault: hs_name", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "after", + "in" : "query", + "description" : "A cursor for pagination. If provided, the results will start after the given cursor.\nExample: NTI1Cg%3D%3D", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "limit", + "in" : "query", + "description" : "The maximum number of results to return. Allowed values range from 1 to 100\nDefault: 50", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "integer", + "format" : "int32" + } + }, { + "name" : "name", + "in" : "query", + "description" : "A filter to return campaigns whose names contain the specified substring. This allows partial matching of campaign names, returning all campaigns that include the given substring in their name. If this parameter is not provided, the search will return all campaigns", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "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", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "array", + "items" : { "type" : "string" } - }, { - "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", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "array", - "items" : { - "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CollectionResponseWithTotalPublicCampaignForwardPaging" + } } } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/CollectionResponseWithTotalPublicCampaignForwardPaging" - } - } + }, + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + }, + "post" : { + "tags" : [ "Basic" ], + "summary" : "Create a campaign", + "description" : "Create a campaign with the given properties and return the campaign object, including the campaignGuid and created properties. ", + "operationId" : "post-/marketing/v3/campaigns/", + "parameters" : [ ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PublicCampaignInput" } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] + "required" : true }, - "post" : { - "tags" : [ "Basic" ], - "summary" : "Create a campaign", - "description" : "Create a campaign with the given properties and return the campaign object, including the campaignGuid and created properties. ", - "operationId" : "post-/marketing/v3/campaigns/", - "parameters" : [ ], - "requestBody" : { + "responses" : { + "201" : { + "description" : "successful operation", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/PublicCampaignInput" - } - } - }, - "required" : true - }, - "responses" : { - "201" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/PublicCampaign" - } + "$ref" : "#/components/schemas/PublicCampaign" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/batch/read" : { - "post" : { - "tags" : [ "Batch" ], - "summary" : "Read a batch of campaigns", - "description" : "This endpoint reads a batch of campaigns based on the provided input data and returns the campaigns along with their associated assets. \nThe maximum number of items in a batch request is 50.\nThe campaigns in the response are not guaranteed to be in the same order as they were provided in the request.\nIf duplicate campaign IDs are provided in the request, duplicates will be ignored. The response will include only unique IDs and will be returned without duplicates.\n", - "operationId" : "post-/marketing/v3/campaigns/batch/read", - "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", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "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.", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/batch/read" : { + "post" : { + "tags" : [ "Batch" ], + "summary" : "Read a batch of campaigns", + "description" : "This endpoint reads a batch of campaigns based on the provided input data and returns the campaigns along with their associated assets. \nThe maximum number of items in a batch request is 50.\nThe campaigns in the response are not guaranteed to be in the same order as they were provided in the request.\nIf duplicate campaign IDs are provided in the request, duplicates will be ignored. The response will include only unique IDs and will be returned without duplicates.\n", + "operationId" : "post-/marketing/v3/campaigns/batch/read", + "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", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "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.", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "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.", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "array", + "items" : { "type" : "string" } - }, { - "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.", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "array", - "items" : { - "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/BatchInputPublicCampaignReadInput" } } - } ], - "requestBody" : { + }, + "required" : true + }, + "responses" : { + "200" : { + "description" : "successful operation", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/BatchInputPublicCampaignReadInput" - } - } - }, - "required" : true - }, - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithAssets" - } - } - } - }, - "207" : { - "description" : "multiple statuses", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithAssetsWithErrors" - } + "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithAssets" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/batch/update" : { - "post" : { - "tags" : [ "Batch" ], - "summary" : "Update a batch of campaigns", - "description" : "This endpoint updates a batch of campaigns based on the provided input data.\nThe maximum number of items in a batch request is 50.\nIf an empty string (\"\") is passed for any property in the Batch Update, it will reset that property's value.", - "operationId" : "post-/marketing/v3/campaigns/batch/update", - "parameters" : [ ], - "requestBody" : { + "207" : { + "description" : "multiple statuses", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/BatchInputPublicCampaignBatchUpdateItem" + "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithAssetsWithErrors" } } - }, - "required" : true - }, - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/BatchResponsePublicCampaign" - } - } + } + }, + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/batch/update" : { + "post" : { + "tags" : [ "Batch" ], + "summary" : "Update a batch of campaigns", + "description" : "This endpoint updates a batch of campaigns based on the provided input data.\nThe maximum number of items in a batch request is 50.\nIf an empty string (\"\") is passed for any property in the Batch Update, it will reset that property's value.", + "operationId" : "post-/marketing/v3/campaigns/batch/update", + "parameters" : [ ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/BatchInputPublicCampaignBatchUpdateItem" } - }, - "207" : { - "description" : "multiple statuses", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithErrors" - } + } + }, + "required" : true + }, + "responses" : { + "200" : { + "description" : "successful operation", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/BatchResponsePublicCampaign" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/{campaignGuid}/reports/metrics" : { - "get" : { - "tags" : [ "Reports" ], - "summary" : "Get Campaign Metrics\n", - "description" : "This endpoint retrieves key attribution metrics for a specified campaign, such as sessions, new contacts, and influenced contacts.", - "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/reports/metrics", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "startDate", - "in" : "query", - "description" : "The start date for the report data, formatted as YYYY-MM-DD.\nDefault value: 2006-01-01", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "endDate", - "in" : "query", - "description" : "End date for the report data, formatted as YYYY-MM-DD.\nDefault value: Current date", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/MetricsCounters" - } + "207" : { + "description" : "multiple statuses", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithErrors" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}" : { - "get" : { - "tags" : [ "Asset" ], - "summary" : "List assets", - "description" : "This endpoint lists all assets of the campaign by asset type. The assetType parameter is required, and each request can only fetch assets of a single type.\nAsset metrics can also be fetched along with the assets; they are available only if start and end dates are provided.", - "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "assetType", - "in" : "path", - "description" : "The type of asset to fetch.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "after", - "in" : "query", - "description" : "A cursor for pagination. If provided, the results will start after the given cursor.\nExample: NTI1Cg%3D%3D", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "limit", - "in" : "query", - "description" : "The maximum number of results to return.\nDefault: 10", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "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", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "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.", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/CollectionResponsePublicCampaignAssetForwardPaging" - } + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/{campaignGuid}/reports/metrics" : { + "get" : { + "tags" : [ "Reports" ], + "summary" : "Get Campaign Metrics\n", + "description" : "This endpoint retrieves key attribution metrics for a specified campaign, such as sessions, new contacts, and influenced contacts.", + "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/reports/metrics", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "startDate", + "in" : "query", + "description" : "The start date for the report data, formatted as YYYY-MM-DD.\nDefault value: 2006-01-01", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "endDate", + "in" : "query", + "description" : "End date for the report data, formatted as YYYY-MM-DD.\nDefault value: Current date", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/MetricsCounters" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/batch/archive" : { - "post" : { - "tags" : [ "Batch" ], - "summary" : "Delete a batch of campaigns", - "description" : "This endpoint deletes a batch of campaigns. \nThe maximum number of items in a batch request is 50.\nThe response will always be 204 No Content, regardless of whether the campaigns exist or not, whether they were successfully deleted or not, or if only some of the campaigns in the batch were deleted.", - "operationId" : "post-/marketing/v3/campaigns/batch/archive", - "parameters" : [ ], - "requestBody" : { + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/{campaignGuid}/assets/{assetType}" : { + "get" : { + "tags" : [ "Asset" ], + "summary" : "List assets", + "description" : "This endpoint lists all assets of the campaign by asset type. The assetType parameter is required, and each request can only fetch assets of a single type.\nAsset metrics can also be fetched along with the assets; they are available only if start and end dates are provided.", + "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "assetType", + "in" : "path", + "description" : "The type of asset to fetch.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "after", + "in" : "query", + "description" : "A cursor for pagination. If provided, the results will start after the given cursor.\nExample: NTI1Cg%3D%3D", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "limit", + "in" : "query", + "description" : "The maximum number of results to return.\nDefault: 10", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "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", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "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.", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/BatchInputPublicCampaignDeleteInput" + "$ref" : "#/components/schemas/CollectionResponsePublicCampaignAssetForwardPaging" } } - }, - "required" : true - }, - "responses" : { - "204" : { - "description" : "No content", - "content" : { } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}/{assetId}" : { - "put" : { - "tags" : [ "Asset" ], - "summary" : "Add asset association", - "description" : "Associate a specified asset with a campaign.\nImportant: Currently, only the following asset types can be associated and disassociated via the API: Forms, Static lists, External website pages", - "operationId" : "put-/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}/{assetId}", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "assetType", - "in" : "path", - "description" : "The type of asset\nImportant: Currently, only the following asset types are available for association via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "assetId", - "in" : "path", - "description" : "Id of the asset", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "204" : { - "description" : "No content", - "content" : { } - }, - "default" : { - "$ref" : "#/components/responses/Error" + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/batch/archive" : { + "post" : { + "tags" : [ "Batch" ], + "summary" : "Delete a batch of campaigns", + "description" : "This endpoint deletes a batch of campaigns. \nThe maximum number of items in a batch request is 50.\nThe response will always be 204 No Content, regardless of whether the campaigns exist or not, whether they were successfully deleted or not, or if only some of the campaigns in the batch were deleted.", + "operationId" : "post-/marketing/v3/campaigns/batch/archive", + "parameters" : [ ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/BatchInputPublicCampaignDeleteInput" + } } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] + "required" : true }, - "delete" : { - "tags" : [ "Asset" ], - "summary" : "Remove asset association", - "description" : "Disassociate a specified asset from a campaign.\nImportant: Currently, only the following asset types can be associated and disassociated via the API: Forms, Static lists, External website pages", - "operationId" : "delete-/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}/{assetId}", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "assetType", - "in" : "path", - "description" : "The type of asset\nImportant: Currently, only the following asset types are available for disassociation via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "assetId", - "in" : "path", - "description" : "Id of the asset", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "204" : { - "description" : "No content", - "content" : { } - }, - "default" : { - "$ref" : "#/components/responses/Error" - } + "responses" : { + "204" : { + "description" : "No content", + "content" : { } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/{campaignGuid}/assets/{assetType}/{assetId}" : { + "put" : { + "tags" : [ "Asset" ], + "summary" : "Add asset association", + "description" : "Associate a specified asset with a campaign.\nImportant: Currently, only the following asset types can be associated and disassociated via the API: Forms, Static lists, External website pages", + "operationId" : "put-/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}/{assetId}", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "assetType", + "in" : "path", + "description" : "The type of asset\nImportant: Currently, only the following asset types are available for association via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "assetId", + "in" : "path", + "description" : "Id of the asset", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "204" : { + "description" : "No content", + "content" : { } + }, + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] }, - "/marketing/v3/campaigns/{campaignGuid}/reports/revenue" : { - "get" : { - "tags" : [ "Reports" ], - "summary" : "Fetch revenue", - "description" : "Fetch revenue attribution report data for a specified campaign\n", - "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/reports/revenue", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "attributionModel", - "in" : "query", - "description" : "Allowed values: LINEAR, FIRST_INTERACTION, LAST_INTERACTION, FULL_PATH, U_SHAPED, W_SHAPED, TIME_DECAY, J_SHAPED, INVERSE_J_SHAPED\nDefault value: LINEAR", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "startDate", - "in" : "query", - "description" : "The start date for the report data, formatted as YYYY-MM-DD.\nDefault value: 2006-01-01", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "endDate", - "in" : "query", - "description" : "End date for the report data, formatted as YYYY-MM-DD.\nDefault value: Current date", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/RevenueAttributionAggregate" - } + "delete" : { + "tags" : [ "Asset" ], + "summary" : "Remove asset association", + "description" : "Disassociate a specified asset from a campaign.\nImportant: Currently, only the following asset types can be associated and disassociated via the API: Forms, Static lists, External website pages", + "operationId" : "delete-/marketing/v3/campaigns/{campaignGuid}/assets/{assetType}/{assetId}", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "assetType", + "in" : "path", + "description" : "The type of asset\nImportant: Currently, only the following asset types are available for disassociation via the API: FORM, OBJECT_LIST, EXTERNAL_WEB_URL", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "assetId", + "in" : "path", + "description" : "Id of the asset", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "204" : { + "description" : "No content", + "content" : { } + }, + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/{campaignGuid}/reports/revenue" : { + "get" : { + "tags" : [ "Reports" ], + "summary" : "Fetch revenue", + "description" : "Fetch revenue attribution report data for a specified campaign\n", + "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/reports/revenue", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "attributionModel", + "in" : "query", + "description" : "Allowed values: LINEAR, FIRST_INTERACTION, LAST_INTERACTION, FULL_PATH, U_SHAPED, W_SHAPED, TIME_DECAY, J_SHAPED, INVERSE_J_SHAPED\nDefault value: LINEAR", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "startDate", + "in" : "query", + "description" : "The start date for the report data, formatted as YYYY-MM-DD.\nDefault value: 2006-01-01", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "endDate", + "in" : "query", + "description" : "End date for the report data, formatted as YYYY-MM-DD.\nDefault value: Current date", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/RevenueAttributionAggregate" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "private_apps" : [ "marketing.campaigns.revenue.read" ] - }, { - "oauth2" : [ "marketing.campaigns.revenue.read" ] - } ] - } - }, - "/marketing/v3/campaigns/batch/create" : { - "post" : { - "tags" : [ "Batch" ], - "summary" : "Create a batch of campaigns", - "description" : "This endpoint creates a batch of campaigns. The maximum number of items in a batch request is 50.\nThe campaigns in the response are not guaranteed to be in the same order as they were provided in the request.", - "operationId" : "post-/marketing/v3/campaigns/batch/create", - "parameters" : [ ], - "requestBody" : { + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "private_apps" : [ "marketing.campaigns.revenue.read" ] + }, { + "oauth2" : [ "marketing.campaigns.revenue.read" ] + } ] + } + }, + "/batch/create" : { + "post" : { + "tags" : [ "Batch" ], + "summary" : "Create a batch of campaigns", + "description" : "This endpoint creates a batch of campaigns. The maximum number of items in a batch request is 50.\nThe campaigns in the response are not guaranteed to be in the same order as they were provided in the request.", + "operationId" : "post-/marketing/v3/campaigns/batch/create", + "parameters" : [ ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/BatchInputPublicCampaignInput" + } + } + }, + "required" : true + }, + "responses" : { + "201" : { + "description" : "successful operation", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/BatchInputPublicCampaignInput" - } - } - }, - "required" : true - }, - "responses" : { - "201" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/BatchResponsePublicCampaign" - } + "$ref" : "#/components/schemas/BatchResponsePublicCampaign" } } - }, - "207" : { - "description" : "multiple statuses", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithErrors" - } + } + }, + "207" : { + "description" : "multiple statuses", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/BatchResponsePublicCampaignWithErrors" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/{campaignGuid}/budget/totals" : { - "get" : { - "tags" : [ "Budget" ], - "summary" : "Read budget", - "description" : "Retrieve detailed information about the budget and spend items for a specified campaign, including the total budget, total spend, and remaining budget.\nBudget and Spend items may be returned in any order, but the order field specifies their sequence based on the creation date. The item with order 0 is the oldest, and items with higher order values are newer", - "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/budget/totals", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/PublicBudgetTotals" - } + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/{campaignGuid}/budget/totals" : { + "get" : { + "tags" : [ "Budget" ], + "summary" : "Read budget", + "description" : "Retrieve detailed information about the budget and spend items for a specified campaign, including the total budget, total spend, and remaining budget.\nBudget and Spend items may be returned in any order, but the order field specifies their sequence based on the creation date. The item with order 0 is the oldest, and items with higher order values are newer", + "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/budget/totals", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PublicBudgetTotals" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/{campaignGuid}" : { - "get" : { - "tags" : [ "Basic" ], - "summary" : "Read a campaign", - "description" : "Get a campaign identified by a specific campaignGuid with the given properties. Along with the campaign information, it also returns information about assets. Depending on the query parameters used, this can also be used to return information about the corresponding assets' metrics. Metrics are available only if startDate and endDate are provided.", - "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "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.", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "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.", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/{campaignGuid}" : { + "get" : { + "tags" : [ "Basic" ], + "summary" : "Read a campaign", + "description" : "Get a campaign identified by a specific campaignGuid with the given properties. Along with the campaign information, it also returns information about assets. Depending on the query parameters used, this can also be used to return information about the corresponding assets' metrics. Metrics are available only if startDate and endDate are provided.", + "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "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.", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "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.", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "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.", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "array", + "items" : { "type" : "string" } - }, { - "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.", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "array", - "items" : { - "type" : "string" - } - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/PublicCampaignWithAssets" - } + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PublicCampaignWithAssets" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] + "default" : { + "$ref" : "#/components/responses/Error" + } }, - "delete" : { - "tags" : [ "Basic" ], - "summary" : "Delete campaign ", - "description" : "Delete a specified campaign from the system.\nThis call will return a 204 No Content response regardless of whether the campaignGuid provided corresponds to an existing campaign or not.", - "operationId" : "delete-/marketing/v3/campaigns/{campaignGuid}", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "204" : { - "description" : "No content", - "content" : { } - }, - "default" : { - "$ref" : "#/components/responses/Error" - } + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + }, + "delete" : { + "tags" : [ "Basic" ], + "summary" : "Delete campaign ", + "description" : "Delete a specified campaign from the system.\nThis call will return a 204 No Content response regardless of whether the campaignGuid provided corresponds to an existing campaign or not.", + "operationId" : "delete-/marketing/v3/campaigns/{campaignGuid}", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "204" : { + "description" : "No content", + "content" : { } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] + "default" : { + "$ref" : "#/components/responses/Error" + } }, - "patch" : { - "tags" : [ "Basic" ], - "summary" : "Update campaign", - "description" : "Perform a partial update of a campaign identified by the specified campaignGuid. Provided property values will be overwritten. Read-only and non-existent properties will cause 400 error.\nIf an empty string is passed for any property in the Batch Update, it will reset that property's value.\n", - "operationId" : "patch-/marketing/v3/campaigns/{campaignGuid}", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.\n", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + }, + "patch" : { + "tags" : [ "Basic" ], + "summary" : "Update campaign", + "description" : "Perform a partial update of a campaign identified by the specified campaignGuid. Provided property values will be overwritten. Read-only and non-existent properties will cause 400 error.\nIf an empty string is passed for any property in the Batch Update, it will reset that property's value.\n", + "operationId" : "patch-/marketing/v3/campaigns/{campaignGuid}", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.\n", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + } ], + "requestBody" : { + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/PublicCampaignInput" + } } - } ], - "requestBody" : { + }, + "required" : true + }, + "responses" : { + "200" : { + "description" : "successful operation", "content" : { "application/json" : { "schema" : { - "$ref" : "#/components/schemas/PublicCampaignInput" - } - } - }, - "required" : true - }, - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/PublicCampaign" - } + "$ref" : "#/components/schemas/PublicCampaign" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } - }, - "/marketing/v3/campaigns/{campaignGuid}/reports/contacts/{contactType}" : { - "get" : { - "tags" : [ "Reports" ], - "summary" : "Fetch contact IDs", - "description" : "Fetch the list of contact IDs for the specified campaign and contact type", - "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/reports/contacts/{contactType}", - "parameters" : [ { - "name" : "campaignGuid", - "in" : "path", - "description" : "Unique identifier for the campaign, formatted as a UUID.", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "contactType", - "in" : "path", - "description" : "The type of metric to filter the influenced contacts. Allowed values: contactFirstTouch, contactLastTouch, influencedContacts", - "required" : true, - "style" : "simple", - "explode" : false, - "schema" : { - "type" : "string" - } - }, { - "name" : "startDate", - "in" : "query", - "description" : "The start date for the report data, formatted as YYYY-MM-DD.\nDefault value: 2006-01-01", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "endDate", - "in" : "query", - "description" : "End date for the report data, formatted as YYYY-MM-DD.\nDefault value: Current date", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - }, { - "name" : "limit", - "in" : "query", - "description" : "Limit for the number of contacts to fetch\nDefault: 100", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "integer", - "format" : "int32" - } - }, { - "name" : "after", - "in" : "query", - "description" : "A cursor for pagination. If provided, the results will start after the given cursor.\nExample: NTI1Cg%3D%3D", - "required" : false, - "style" : "form", - "explode" : true, - "schema" : { - "type" : "string" - } - } ], - "responses" : { - "200" : { - "description" : "successful operation", - "content" : { - "application/json" : { - "schema" : { - "$ref" : "#/components/schemas/CollectionResponseContactReferenceForwardPaging" - } + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] + } + }, + "/{campaignGuid}/reports/contacts/{contactType}" : { + "get" : { + "tags" : [ "Reports" ], + "summary" : "Fetch contact IDs", + "description" : "Fetch the list of contact IDs for the specified campaign and contact type", + "operationId" : "get-/marketing/v3/campaigns/{campaignGuid}/reports/contacts/{contactType}", + "parameters" : [ { + "name" : "campaignGuid", + "in" : "path", + "description" : "Unique identifier for the campaign, formatted as a UUID.", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "contactType", + "in" : "path", + "description" : "The type of metric to filter the influenced contacts. Allowed values: contactFirstTouch, contactLastTouch, influencedContacts", + "required" : true, + "style" : "simple", + "explode" : false, + "schema" : { + "type" : "string" + } + }, { + "name" : "startDate", + "in" : "query", + "description" : "The start date for the report data, formatted as YYYY-MM-DD.\nDefault value: 2006-01-01", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "endDate", + "in" : "query", + "description" : "End date for the report data, formatted as YYYY-MM-DD.\nDefault value: Current date", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + }, { + "name" : "limit", + "in" : "query", + "description" : "Limit for the number of contacts to fetch\nDefault: 100", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "integer", + "format" : "int32" + } + }, { + "name" : "after", + "in" : "query", + "description" : "A cursor for pagination. If provided, the results will start after the given cursor.\nExample: NTI1Cg%3D%3D", + "required" : false, + "style" : "form", + "explode" : true, + "schema" : { + "type" : "string" + } + } ], + "responses" : { + "200" : { + "description" : "successful operation", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/CollectionResponseContactReferenceForwardPaging" } } - }, - "default" : { - "$ref" : "#/components/responses/Error" } }, - "security" : [ { - "oauth2" : [ "marketing.campaigns.read" ] - }, { - "private_apps" : [ "marketing.campaigns.read" ] - } ] - } + "default" : { + "$ref" : "#/components/responses/Error" + } + }, + "security" : [ { + "oauth2" : [ "marketing.campaigns.read" ] + }, { + "private_apps" : [ "marketing.campaigns.read" ] + } ] } - }, - "components" : { - "schemas" : { - "StandardError" : { - "required" : [ "category", "context", "errors", "links", "message", "status" ], - "type" : "object", - "properties" : { - "subCategory" : { - "type" : "object", - "properties" : { } - }, - "context" : { - "type" : "object", - "additionalProperties" : { - "type" : "array", - "items" : { - "type" : "string" - } - } - }, - "links" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "id" : { - "type" : "string" - }, - "category" : { - "type" : "string" - }, - "message" : { - "type" : "string" - }, - "errors" : { + } + }, + "components" : { + "schemas" : { + "StandardError" : { + "required" : [ "category", "context", "errors", "links", "message", "status" ], + "type" : "object", + "properties" : { + "subCategory" : { + "type" : "object", + "properties" : { } + }, + "context" : { + "type" : "object", + "additionalProperties" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/ErrorDetail" + "type" : "string" } - }, - "status" : { + } + }, + "links" : { + "type" : "object", + "additionalProperties" : { "type" : "string" } + }, + "id" : { + "type" : "string" + }, + "category" : { + "type" : "string" + }, + "message" : { + "type" : "string" + }, + "errors" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ErrorDetail" + } + }, + "status" : { + "type" : "string" } - }, - "PublicCampaignBatchUpdateItem" : { - "required" : [ "id", "properties" ], - "type" : "object", + } + }, + "PublicCampaignBatchUpdateItem" : { + "required" : [ "id", "properties" ], + "type" : "object", + "properties" : { + "id" : { + "type" : "string" + }, "properties" : { - "id" : { + "type" : "object", + "additionalProperties" : { "type" : "string" - }, - "properties" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } } } - }, - "CollectionResponsePublicCampaignAssetForwardPaging" : { - "required" : [ "results" ], - "type" : "object", - "properties" : { - "paging" : { - "$ref" : "#/components/schemas/ForwardPaging" - }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignAsset" - } + } + }, + "CollectionResponsePublicCampaignAssetForwardPaging" : { + "required" : [ "results" ], + "type" : "object", + "properties" : { + "paging" : { + "$ref" : "#/components/schemas/ForwardPaging" + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignAsset" } } - }, - "PublicCampaignReadInput" : { - "required" : [ "id" ], - "type" : "object", - "properties" : { - "id" : { + } + }, + "PublicCampaignReadInput" : { + "required" : [ "id" ], + "type" : "object", + "properties" : { + "id" : { + "type" : "string" + } + } + }, + "BatchResponsePublicCampaignWithAssetsWithErrors" : { + "required" : [ "completedAt", "results", "startedAt", "status" ], + "type" : "object", + "properties" : { + "completedAt" : { + "type" : "string", + "format" : "date-time" + }, + "numErrors" : { + "type" : "integer", + "format" : "int32" + }, + "requestedAt" : { + "type" : "string", + "format" : "date-time" + }, + "startedAt" : { + "type" : "string", + "format" : "date-time" + }, + "links" : { + "type" : "object", + "additionalProperties" : { "type" : "string" } + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignWithAssets" + } + }, + "errors" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/StandardError" + } + }, + "status" : { + "type" : "string", + "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] } - }, - "BatchResponsePublicCampaignWithAssetsWithErrors" : { - "required" : [ "completedAt", "results", "startedAt", "status" ], - "type" : "object", - "properties" : { - "completedAt" : { - "type" : "string", - "format" : "date-time" - }, - "numErrors" : { - "type" : "integer", - "format" : "int32" - }, - "requestedAt" : { - "type" : "string", - "format" : "date-time" - }, - "startedAt" : { - "type" : "string", - "format" : "date-time" - }, - "links" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignWithAssets" - } - }, - "errors" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/StandardError" - } - }, - "status" : { - "type" : "string", - "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] + } + }, + "BatchInputPublicCampaignReadInput" : { + "required" : [ "inputs" ], + "type" : "object", + "properties" : { + "inputs" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignReadInput" } } - }, - "BatchInputPublicCampaignReadInput" : { - "required" : [ "inputs" ], - "type" : "object", - "properties" : { - "inputs" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignReadInput" - } + } + }, + "BatchResponsePublicCampaignWithAssets" : { + "required" : [ "completedAt", "results", "startedAt", "status" ], + "type" : "object", + "properties" : { + "completedAt" : { + "type" : "string", + "format" : "date-time" + }, + "requestedAt" : { + "type" : "string", + "format" : "date-time" + }, + "startedAt" : { + "type" : "string", + "format" : "date-time" + }, + "links" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" } + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignWithAssets" + } + }, + "status" : { + "type" : "string", + "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] } - }, - "BatchResponsePublicCampaignWithAssets" : { - "required" : [ "completedAt", "results", "startedAt", "status" ], - "type" : "object", - "properties" : { - "completedAt" : { - "type" : "string", - "format" : "date-time" - }, - "requestedAt" : { - "type" : "string", - "format" : "date-time" - }, - "startedAt" : { - "type" : "string", - "format" : "date-time" - }, - "links" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignWithAssets" - } - }, - "status" : { - "type" : "string", - "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] + } + }, + "BatchResponsePublicCampaignWithErrors" : { + "required" : [ "completedAt", "results", "startedAt", "status" ], + "type" : "object", + "properties" : { + "completedAt" : { + "type" : "string", + "format" : "date-time" + }, + "numErrors" : { + "type" : "integer", + "format" : "int32" + }, + "requestedAt" : { + "type" : "string", + "format" : "date-time" + }, + "startedAt" : { + "type" : "string", + "format" : "date-time" + }, + "links" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" + } + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaign" + } + }, + "errors" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/StandardError" } + }, + "status" : { + "type" : "string", + "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] } - }, - "BatchResponsePublicCampaignWithErrors" : { - "required" : [ "completedAt", "results", "startedAt", "status" ], - "type" : "object", - "properties" : { - "completedAt" : { - "type" : "string", - "format" : "date-time" - }, - "numErrors" : { - "type" : "integer", - "format" : "int32" - }, - "requestedAt" : { - "type" : "string", - "format" : "date-time" - }, - "startedAt" : { - "type" : "string", - "format" : "date-time" - }, - "links" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaign" - } - }, - "errors" : { + } + }, + "ErrorDetail" : { + "required" : [ "message" ], + "type" : "object", + "properties" : { + "subCategory" : { + "type" : "string", + "description" : "A specific category that contains more specific detail about the error" + }, + "code" : { + "type" : "string", + "description" : "The status code associated with the error detail" + }, + "in" : { + "type" : "string", + "description" : "The name of the field or parameter in which the error was found." + }, + "context" : { + "type" : "object", + "additionalProperties" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/StandardError" + "type" : "string" } }, - "status" : { - "type" : "string", - "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] + "description" : "Context about the error condition", + "example" : { + "missingScopes" : [ "scope1", "scope2" ] } + }, + "message" : { + "type" : "string", + "description" : "A human readable message describing the error along with remediation steps where appropriate" } - }, - "ErrorDetail" : { - "required" : [ "message" ], - "type" : "object", - "properties" : { - "subCategory" : { - "type" : "string", - "description" : "A specific category that contains more specific detail about the error" - }, - "code" : { - "type" : "string", - "description" : "The status code associated with the error detail" - }, - "in" : { - "type" : "string", - "description" : "The name of the field or parameter in which the error was found." - }, - "context" : { - "type" : "object", - "additionalProperties" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "description" : "Context about the error condition", - "example" : { - "missingScopes" : [ "scope1", "scope2" ] - } - }, - "message" : { - "type" : "string", - "description" : "A human readable message describing the error along with remediation steps where appropriate" - } + } + }, + "ForwardPaging" : { + "type" : "object", + "properties" : { + "next" : { + "$ref" : "#/components/schemas/NextPage" } - }, - "ForwardPaging" : { - "type" : "object", - "properties" : { - "next" : { - "$ref" : "#/components/schemas/NextPage" - } + } + }, + "PublicSpendItem" : { + "required" : [ "amount", "createdAt", "id", "name", "order", "updatedAt" ], + "type" : "object", + "properties" : { + "createdAt" : { + "type" : "integer", + "format" : "int32" + }, + "amount" : { + "type" : "number" + }, + "name" : { + "type" : "string" + }, + "description" : { + "type" : "string" + }, + "id" : { + "type" : "string" + }, + "order" : { + "type" : "integer", + "format" : "int32" + }, + "updatedAt" : { + "type" : "integer", + "format" : "int32" } - }, - "PublicSpendItem" : { - "required" : [ "amount", "createdAt", "id", "name", "order", "updatedAt" ], - "type" : "object", - "properties" : { - "createdAt" : { - "type" : "integer", - "format" : "int32" - }, - "amount" : { - "type" : "number" - }, - "name" : { - "type" : "string" - }, - "description" : { - "type" : "string" - }, - "id" : { + } + }, + "BatchResponsePublicCampaign" : { + "required" : [ "completedAt", "results", "startedAt", "status" ], + "type" : "object", + "properties" : { + "completedAt" : { + "type" : "string", + "format" : "date-time" + }, + "requestedAt" : { + "type" : "string", + "format" : "date-time" + }, + "startedAt" : { + "type" : "string", + "format" : "date-time" + }, + "links" : { + "type" : "object", + "additionalProperties" : { "type" : "string" - }, - "order" : { - "type" : "integer", - "format" : "int32" - }, - "updatedAt" : { - "type" : "integer", - "format" : "int32" } - } - }, - "BatchResponsePublicCampaign" : { - "required" : [ "completedAt", "results", "startedAt", "status" ], - "type" : "object", - "properties" : { - "completedAt" : { - "type" : "string", - "format" : "date-time" - }, - "requestedAt" : { - "type" : "string", - "format" : "date-time" - }, - "startedAt" : { - "type" : "string", - "format" : "date-time" - }, - "links" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaign" - } - }, - "status" : { - "type" : "string", - "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaign" } + }, + "status" : { + "type" : "string", + "enum" : [ "PENDING", "PROCESSING", "CANCELED", "COMPLETE" ] } - }, - "PublicCampaignWithAssets" : { - "required" : [ "assets", "createdAt", "id", "properties", "updatedAt" ], - "type" : "object", + } + }, + "PublicCampaignWithAssets" : { + "required" : [ "assets", "createdAt", "id", "properties", "updatedAt" ], + "type" : "object", + "properties" : { + "createdAt" : { + "type" : "string", + "format" : "date-time" + }, + "assets" : { + "type" : "object", + "additionalProperties" : { + "$ref" : "#/components/schemas/CollectionResponsePublicCampaignAsset" + } + }, + "id" : { + "type" : "string" + }, "properties" : { - "createdAt" : { - "type" : "string", - "format" : "date-time" - }, - "assets" : { - "type" : "object", - "additionalProperties" : { - "$ref" : "#/components/schemas/CollectionResponsePublicCampaignAsset" - } - }, - "id" : { + "type" : "object", + "additionalProperties" : { "type" : "string" - }, - "properties" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "updatedAt" : { - "type" : "string", - "format" : "date-time" } + }, + "updatedAt" : { + "type" : "string", + "format" : "date-time" } - }, - "PublicBudgetTotals" : { - "required" : [ "budgetItems", "currencyCode", "spendItems" ], - "type" : "object", - "properties" : { - "spendItems" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicSpendItem" - } - }, - "budgetTotal" : { - "type" : "number" - }, - "remainingBudget" : { - "type" : "number" - }, - "spendTotal" : { - "type" : "number" - }, - "currencyCode" : { - "type" : "string", - "enum" : [ "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" ] - }, - "budgetItems" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicBudgetItem" - } + } + }, + "PublicBudgetTotals" : { + "required" : [ "budgetItems", "currencyCode", "spendItems" ], + "type" : "object", + "properties" : { + "spendItems" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicSpendItem" + } + }, + "budgetTotal" : { + "type" : "number" + }, + "remainingBudget" : { + "type" : "number" + }, + "spendTotal" : { + "type" : "number" + }, + "currencyCode" : { + "type" : "string", + "enum" : [ "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" ] + }, + "budgetItems" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicBudgetItem" } } - }, - "BatchInputPublicCampaignDeleteInput" : { - "required" : [ "inputs" ], - "type" : "object", - "properties" : { - "inputs" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignDeleteInput" - } + } + }, + "BatchInputPublicCampaignDeleteInput" : { + "required" : [ "inputs" ], + "type" : "object", + "properties" : { + "inputs" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignDeleteInput" } } - }, - "CollectionResponsePublicCampaignAsset" : { - "required" : [ "results" ], - "type" : "object", - "properties" : { - "paging" : { - "$ref" : "#/components/schemas/Paging" - }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignAsset" - } + } + }, + "CollectionResponsePublicCampaignAsset" : { + "required" : [ "results" ], + "type" : "object", + "properties" : { + "paging" : { + "$ref" : "#/components/schemas/Paging" + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignAsset" } } - }, - "PublicCampaignDeleteInput" : { - "required" : [ "id" ], - "type" : "object", + } + }, + "PublicCampaignDeleteInput" : { + "required" : [ "id" ], + "type" : "object", + "properties" : { + "id" : { + "type" : "string" + } + } + }, + "PublicCampaignInput" : { + "required" : [ "properties" ], + "type" : "object", + "properties" : { "properties" : { - "id" : { + "type" : "object", + "additionalProperties" : { "type" : "string" } } - }, - "PublicCampaignInput" : { - "required" : [ "properties" ], - "type" : "object", - "properties" : { - "properties" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - } + } + }, + "MetricsCounters" : { + "required" : [ "influencedContacts", "newContactsFirstTouch", "newContactsLastTouch", "sessions" ], + "type" : "object", + "properties" : { + "sessions" : { + "type" : "integer", + "format" : "int32" + }, + "newContactsFirstTouch" : { + "type" : "integer", + "format" : "int32" + }, + "influencedContacts" : { + "type" : "integer", + "format" : "int32" + }, + "newContactsLastTouch" : { + "type" : "integer", + "format" : "int32" } - }, - "MetricsCounters" : { - "required" : [ "influencedContacts", "newContactsFirstTouch", "newContactsLastTouch", "sessions" ], - "type" : "object", - "properties" : { - "sessions" : { - "type" : "integer", - "format" : "int32" - }, - "newContactsFirstTouch" : { - "type" : "integer", - "format" : "int32" - }, - "influencedContacts" : { - "type" : "integer", - "format" : "int32" - }, - "newContactsLastTouch" : { - "type" : "integer", - "format" : "int32" - } + } + }, + "PublicBudgetItem" : { + "required" : [ "amount", "createdAt", "id", "name", "order", "updatedAt" ], + "type" : "object", + "properties" : { + "createdAt" : { + "type" : "integer", + "format" : "int32" + }, + "amount" : { + "type" : "number" + }, + "name" : { + "type" : "string" + }, + "description" : { + "type" : "string" + }, + "id" : { + "type" : "string" + }, + "order" : { + "type" : "integer", + "format" : "int32" + }, + "updatedAt" : { + "type" : "integer", + "format" : "int32" } - }, - "PublicBudgetItem" : { - "required" : [ "amount", "createdAt", "id", "name", "order", "updatedAt" ], - "type" : "object", - "properties" : { - "createdAt" : { - "type" : "integer", - "format" : "int32" - }, - "amount" : { - "type" : "number" - }, - "name" : { - "type" : "string" - }, - "description" : { - "type" : "string" - }, - "id" : { - "type" : "string" - }, - "order" : { - "type" : "integer", - "format" : "int32" - }, - "updatedAt" : { - "type" : "integer", - "format" : "int32" + } + }, + "BatchInputPublicCampaignInput" : { + "required" : [ "inputs" ], + "type" : "object", + "properties" : { + "inputs" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignInput" } } - }, - "BatchInputPublicCampaignInput" : { - "required" : [ "inputs" ], - "type" : "object", - "properties" : { - "inputs" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignInput" - } + } + }, + "CollectionResponseWithTotalPublicCampaignForwardPaging" : { + "required" : [ "results", "total" ], + "type" : "object", + "properties" : { + "total" : { + "type" : "integer", + "format" : "int32" + }, + "paging" : { + "$ref" : "#/components/schemas/ForwardPaging" + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaign" } } - }, - "CollectionResponseWithTotalPublicCampaignForwardPaging" : { - "required" : [ "results", "total" ], - "type" : "object", - "properties" : { - "total" : { - "type" : "integer", - "format" : "int32" - }, - "paging" : { - "$ref" : "#/components/schemas/ForwardPaging" - }, - "results" : { + } + }, + "Paging" : { + "type" : "object", + "properties" : { + "next" : { + "$ref" : "#/components/schemas/NextPage" + }, + "prev" : { + "$ref" : "#/components/schemas/PreviousPage" + } + } + }, + "Error" : { + "required" : [ "category", "correlationId", "message" ], + "type" : "object", + "properties" : { + "subCategory" : { + "type" : "string", + "description" : "A specific category that contains more specific detail about the error" + }, + "context" : { + "type" : "object", + "additionalProperties" : { "type" : "array", "items" : { - "$ref" : "#/components/schemas/PublicCampaign" + "type" : "string" } - } - } - }, - "Paging" : { - "type" : "object", - "properties" : { - "next" : { - "$ref" : "#/components/schemas/NextPage" }, - "prev" : { - "$ref" : "#/components/schemas/PreviousPage" + "description" : "Context about the error condition", + "example" : { + "missingScopes" : [ "scope1", "scope2" ], + "invalidPropertyName" : [ "propertyValue" ] } - } - }, - "Error" : { - "required" : [ "category", "correlationId", "message" ], - "type" : "object", - "properties" : { - "subCategory" : { - "type" : "string", - "description" : "A specific category that contains more specific detail about the error" - }, - "context" : { - "type" : "object", - "additionalProperties" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "description" : "Context about the error condition", - "example" : { - "missingScopes" : [ "scope1", "scope2" ], - "invalidPropertyName" : [ "propertyValue" ] - } - }, - "correlationId" : { - "type" : "string", - "description" : "A unique identifier for the request. Include this value with any error reports or support tickets", - "format" : "uuid", - "example" : "aeb5f871-7f07-4993-9211-075dc63e7cbf" - }, - "links" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - }, - "description" : "A map of link names to associated URIs containing documentation about the error or recommended remediation steps" - }, - "message" : { - "type" : "string", - "description" : "A human readable message describing the error along with remediation steps where appropriate", - "example" : "An error occurred" - }, - "category" : { - "type" : "string", - "description" : "The error category" + }, + "correlationId" : { + "type" : "string", + "description" : "A unique identifier for the request. Include this value with any error reports or support tickets", + "format" : "uuid", + "example" : "aeb5f871-7f07-4993-9211-075dc63e7cbf" + }, + "links" : { + "type" : "object", + "additionalProperties" : { + "type" : "string" }, - "errors" : { - "type" : "array", - "description" : "further information about the error", - "items" : { - "$ref" : "#/components/schemas/ErrorDetail" - } - } + "description" : "A map of link names to associated URIs containing documentation about the error or recommended remediation steps" + }, + "message" : { + "type" : "string", + "description" : "A human readable message describing the error along with remediation steps where appropriate", + "example" : "An error occurred" }, - "example" : { - "message" : "Invalid input (details will vary based on the error)", - "correlationId" : "aeb5f871-7f07-4993-9211-075dc63e7cbf", - "category" : "VALIDATION_ERROR", - "links" : { - "knowledge-base" : "https://www.hubspot.com/products/service/knowledge-base" + "category" : { + "type" : "string", + "description" : "The error category" + }, + "errors" : { + "type" : "array", + "description" : "further information about the error", + "items" : { + "$ref" : "#/components/schemas/ErrorDetail" } } }, - "CollectionResponseContactReferenceForwardPaging" : { - "required" : [ "results" ], - "type" : "object", - "properties" : { - "paging" : { - "$ref" : "#/components/schemas/ForwardPaging" - }, - "results" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/ContactReference" - } - } + "example" : { + "message" : "Invalid input (details will vary based on the error)", + "correlationId" : "aeb5f871-7f07-4993-9211-075dc63e7cbf", + "category" : "VALIDATION_ERROR", + "links" : { + "knowledge-base" : "https://www.hubspot.com/products/service/knowledge-base" } - }, - "PublicCampaignAsset" : { - "required" : [ "id", "metrics" ], - "type" : "object", - "properties" : { - "name" : { - "type" : "string" - }, - "id" : { - "type" : "string" - }, - "metrics" : { - "type" : "object", - "additionalProperties" : { - "type" : "number" - } + } + }, + "CollectionResponseContactReferenceForwardPaging" : { + "required" : [ "results" ], + "type" : "object", + "properties" : { + "paging" : { + "$ref" : "#/components/schemas/ForwardPaging" + }, + "results" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/ContactReference" } } - }, - "RevenueAttributionAggregate" : { - "type" : "object", - "properties" : { - "contactsNumber" : { - "type" : "integer", - "format" : "int32" - }, - "dealAmount" : { - "type" : "number" - }, - "dealsNumber" : { - "type" : "integer", - "format" : "int32" - }, - "revenueAmount" : { + } + }, + "PublicCampaignAsset" : { + "required" : [ "id"], + "type" : "object", + "properties" : { + "name" : { + "type" : "string" + }, + "id" : { + "type" : "string" + }, + "metrics" : { + "type" : "object", + "additionalProperties" : { "type" : "number" - }, - "currencyCode" : { - "type" : "string", - "enum" : [ "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" ] } } - }, - "BatchInputPublicCampaignBatchUpdateItem" : { - "required" : [ "inputs" ], - "type" : "object", - "properties" : { - "inputs" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/PublicCampaignBatchUpdateItem" - } - } + } + }, + "RevenueAttributionAggregate" : { + "type" : "object", + "properties" : { + "contactsNumber" : { + "type" : "integer", + "format" : "int32" + }, + "dealAmount" : { + "type" : "number" + }, + "dealsNumber" : { + "type" : "integer", + "format" : "int32" + }, + "revenueAmount" : { + "type" : "number" + }, + "currencyCode" : { + "type" : "string", + "enum" : [ "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" ] } - }, - "PreviousPage" : { - "required" : [ "before" ], - "type" : "object", - "properties" : { - "before" : { - "type" : "string" - }, - "link" : { - "type" : "string" + } + }, + "BatchInputPublicCampaignBatchUpdateItem" : { + "required" : [ "inputs" ], + "type" : "object", + "properties" : { + "inputs" : { + "type" : "array", + "items" : { + "$ref" : "#/components/schemas/PublicCampaignBatchUpdateItem" } } - }, - "ContactReference" : { - "required" : [ "id" ], - "type" : "object", - "properties" : { - "id" : { - "type" : "string" - } + } + }, + "PreviousPage" : { + "required" : [ "before" ], + "type" : "object", + "properties" : { + "before" : { + "type" : "string" + }, + "link" : { + "type" : "string" } - }, - "NextPage" : { - "required" : [ "after" ], - "type" : "object", - "properties" : { - "link" : { - "type" : "string" - }, - "after" : { - "type" : "string" - } + } + }, + "ContactReference" : { + "required" : [ "id" ], + "type" : "object", + "properties" : { + "id" : { + "type" : "string" } - }, - "PublicCampaign" : { - "required" : [ "createdAt", "id", "properties", "updatedAt" ], - "type" : "object", + } + }, + "NextPage" : { + "required" : [ "after" ], + "type" : "object", + "properties" : { + "link" : { + "type" : "string" + }, + "after" : { + "type" : "string" + } + } + }, + "PublicCampaign" : { + "required" : [ "createdAt", "id", "properties", "updatedAt" ], + "type" : "object", + "properties" : { + "createdAt" : { + "type" : "string", + "format" : "date-time" + }, + "id" : { + "type" : "string" + }, "properties" : { - "createdAt" : { - "type" : "string", - "format" : "date-time" - }, - "id" : { + "type" : "object", + "additionalProperties" : { "type" : "string" - }, - "properties" : { - "type" : "object", - "additionalProperties" : { - "type" : "string" - } - }, - "updatedAt" : { - "type" : "string", - "format" : "date-time" } + }, + "updatedAt" : { + "type" : "string", + "format" : "date-time" } } - }, - "responses" : { - "Error" : { - "description" : "An error occurred.", - "content" : { - "*/*" : { - "schema" : { - "$ref" : "#/components/schemas/Error" - } + } + }, + "responses" : { + "Error" : { + "description" : "An error occurred.", + "content" : { + "*/*" : { + "schema" : { + "$ref" : "#/components/schemas/Error" } } } - }, - "securitySchemes" : { - "oauth2" : { - "type" : "oauth2", - "flows" : { - "authorizationCode" : { - "authorizationUrl" : "https://app.hubspot.com/oauth/authorize", - "tokenUrl" : "https://api.hubapi.com/oauth/v1/token", - "scopes" : { - "marketing.campaigns.read" : "Read marketing campaigns", - "marketing.campaigns.revenue.read" : "Read campaigns attribution revenue" - } + } + }, + "securitySchemes" : { + "oauth2" : { + "type" : "oauth2", + "flows" : { + "authorizationCode" : { + "authorizationUrl" : "https://app.hubspot.com/oauth/authorize", + "tokenUrl" : "https://api.hubapi.com/oauth/v1/token", + "scopes" : { + "marketing.campaigns.read" : "Read marketing campaigns", + "marketing.campaigns.revenue.read" : "Read campaigns attribution revenue" } } - }, - "private_apps" : { - "type" : "apiKey", - "name" : "private-app", - "in" : "header" } + }, + "private_apps" : { + "type" : "apiKey", + "name" : "private-app", + "in" : "header" } } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/docs/spec/sanitations.md b/docs/spec/sanitations.md index 7036be3..6fea9bd 100644 --- a/docs/spec/sanitations.md +++ b/docs/spec/sanitations.md @@ -1,24 +1,96 @@ -_Author_: \ -_Created_: \ -_Updated_: \ +_Author_: Samudra Uduwaka \ +_Created_: 2025-01-02 \ +_Updated_: 2025-01-07 \ _Edition_: Swan Lake # Sanitation for OpenAPI specification This document records the sanitation done on top of the official OpenAPI specification from HubSpot Marketing Campaigns . -The OpenAPI specification is obtained from (TODO: Add source link). -These changes are done in order to improve the overall usability, and as workarounds for some known language limitations. +The OpenAPI specification is obtained from [Hubspot Marketing Campaings API](https://developers.hubspot.com/docs/reference/api/marketing/campaigns). + [//]: # (TODO: Add sanitation details) -1. -2. -3. +1. Change the url property of the servers object: + + Original: https://api.hubapi.com + + Updated: https://api.hubapi.com/marketing/v3/campaigns + + Reason: This change is made to ensure that all API paths are relative to the versioned base URL (/marketing/v3/campaigns), which improves the consistency and usability of the APIs. + +2. Update API Paths: + + Original: Paths included the version prefix in each endpoint (e.g., /marketing/v3/campaigns/batch/read ). + + Updated: Paths are modified to remove the version prefix from the endpoints, as it is now included in the base URL. For example: + + - Original: /marketing/v3/campaigns/batch/read + + - Updated: /batch/read + + Reason: This modification simplifies the API paths, making them shorter and more readable. It also centralizes the versioning to the base URL, which is a common best practice. + +3. Updated `PublicCampaignAsset` Object: + + Removed `metrics` property from the required properties. + + Definitions: + + - Previous Definition: + + ```json + "PublicCampaignAsset" : { + "required" : [ "id", "metrics"], + "type" : "object", + "properties" : { + "name" : { + "type" : "string" + }, + "id" : { + "type" : "string" + }, + "metrics" : { + "type" : "object", + "additionalProperties" : { + "type" : "number" + } + } + } + } + ``` + + - After + + ```json + "PublicCampaignAsset" : { + "required" : [ "id"], + "type" : "object", + "properties" : { + "name" : { + "type" : "string" + }, + "id" : { + "type" : "string" + }, + "metrics" : { + "type" : "object", + "additionalProperties" : { + "type" : "number" + } + } + } + } + ``` + + Reason: `metrics` property is not required when creating and retrieving. + + ## OpenAPI cli command The following command was used to generate the Ballerina client from the OpenAPI specification. The command should be executed from the repository root directory. ```bash -# TODO: Add OpenAPI CLI command used to generate the client +bal openapi -i docs/spec/openapi.json --mode client --license docs/license.txt -o ballerina ``` Note: The license year is hardcoded to 2024, change if necessary.