From d396584e2912780baccf84af95ab937f78c84903 Mon Sep 17 00:00:00 2001 From: Rudolf the Rabbit Date: Thu, 23 Jul 2026 13:53:35 +0000 Subject: [PATCH] chore: update OpenAPI client to 2026.07.23.1339-c132cf8 --- openapi/schemas/campaign.openapi.json | 395 +++++++++++++----- .../schemas/rapidata.filtered.openapi.json | 392 ++++++++++++----- openapi/schemas/rapidata.openapi.json | 395 +++++++++++++----- src/rapidata/api_client/api/campaign_api.py | 15 +- .../api_client/models/i_campaign_details.py | 137 ++++++ ...mpaign_details_program_campaign_details.py | 178 ++++++++ ...ampaign_details_routed_campaign_details.py | 165 ++++++++ src/rapidata/api_client_README.md | 4 +- 8 files changed, 1361 insertions(+), 320 deletions(-) create mode 100644 src/rapidata/api_client/models/i_campaign_details.py create mode 100644 src/rapidata/api_client/models/i_campaign_details_program_campaign_details.py create mode 100644 src/rapidata/api_client/models/i_campaign_details_routed_campaign_details.py diff --git a/openapi/schemas/campaign.openapi.json b/openapi/schemas/campaign.openapi.json index efc7b72a4..9885fc902 100644 --- a/openapi/schemas/campaign.openapi.json +++ b/openapi/schemas/campaign.openapi.json @@ -250,6 +250,7 @@ "Campaign" ], "summary": "Retrieves the details of a specific campaign.", + "description": "The response is discriminated by campaign kind: a program campaign includes its stream\n program, a routed campaign includes its selections.", "parameters": [ { "name": "campaignId", @@ -267,7 +268,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetCampaignByIdEndpoint_Output" + "$ref": "#/components/schemas/ICampaignDetails" } } } @@ -2022,7 +2023,156 @@ } } }, - "GetCampaignByIdEndpoint_Output": { + "GetCampaignCacheEndpoint_CampaignEntry": { + "required": [ + "id", + "name", + "status", + "priority", + "filterCount", + "selectionCount", + "userScoreDimensionCount", + "featureFlagCount", + "rateLimitCount", + "isPreviewEnabled", + "boostingControlMode" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/CampaignStatus" + }, + "priority": { + "type": "integer", + "format": "int32" + }, + "filterCount": { + "type": "integer", + "format": "int32" + }, + "selectionCount": { + "type": "integer", + "format": "int32" + }, + "userScoreDimensionCount": { + "type": "integer", + "format": "int32" + }, + "featureFlagCount": { + "type": "integer", + "format": "int32" + }, + "rateLimitCount": { + "type": "integer", + "format": "int32" + }, + "isPreviewEnabled": { + "type": "boolean" + }, + "boostingControlMode": { + "$ref": "#/components/schemas/BoostingControlMode" + } + } + }, + "GetCampaignCacheEndpoint_Output": { + "required": [ + "count", + "campaigns" + ], + "type": "object", + "properties": { + "count": { + "type": "integer", + "description": "The total number of cached campaigns.", + "format": "int32" + }, + "campaigns": { + "allOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetCampaignCacheEndpoint_CampaignEntry" + } + } + ], + "description": "The list of cached campaign summaries." + } + } + }, + "GetFastBidMultiplierEndpoint_Output": { + "required": [ + "externalCampaignId", + "bidMultiplierValue" + ], + "type": "object", + "properties": { + "externalCampaignId": { + "type": "integer", + "description": "The external campaign id reported by the downstream system.", + "format": "int32" + }, + "bidMultiplierValue": { + "type": "number", + "description": "The current bid multiplier reported for the campaign.", + "format": "double" + } + } + }, + "GetUserScoreCacheEndpoint_Output": { + "required": [ + "count", + "scores" + ], + "type": "object", + "properties": { + "count": { + "type": "integer", + "description": "The total number of cached user scores.", + "format": "int32" + }, + "scores": { + "allOf": [ + { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + ], + "description": "The cached dimension-to-score mappings." + } + } + }, + "ICampaignDetails": { + "required": [ + "_t" + ], + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/ICampaignDetailsProgramCampaignDetails" + }, + { + "$ref": "#/components/schemas/ICampaignDetailsRoutedCampaignDetails" + } + ], + "description": "A campaign's details, identified by a discriminator. Implementations describe the\n type-specific configuration: a routed campaign's selections or a program campaign's\n stream program.", + "discriminator": { + "propertyName": "_t", + "mapping": { + "ProgramCampaign": "#/components/schemas/ICampaignDetailsProgramCampaignDetails", + "RoutedCampaign": "#/components/schemas/ICampaignDetailsRoutedCampaignDetails" + } + } + }, + "ICampaignDetailsProgramCampaignDetails": { "required": [ "id", "name", @@ -2034,13 +2184,23 @@ "boostLevel", "stickyConfig", "filters", - "selections", "featureFlags", "ownerMail", - "createdAt" + "createdAt", + "version", + "rootNodeId", + "nodes", + "maxRapids", + "maxDurationSeconds", + "_t" ], - "type": "object", "properties": { + "_t": { + "enum": [ + "ProgramCampaign" + ], + "type": "string" + }, "id": { "type": "string", "description": "The unique identifier of the campaign." @@ -2111,17 +2271,6 @@ ], "description": "The targeting filters for this campaign." }, - "selections": { - "allOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/ICampaignSelection" - } - } - ], - "description": "The rapid selections for this campaign." - }, "featureFlags": { "allOf": [ { @@ -2139,142 +2288,180 @@ }, "organizationId": { "type": "string", - "description": "The id of the organization that owns the entity.", + "description": "The id of the organization that owns the campaign.", "nullable": true }, "createdAt": { "type": "string", "description": "The timestamp when the campaign was created.", "format": "date-time" + }, + "version": { + "type": "integer", + "description": "The program's current version, for optimistic concurrency on save.", + "format": "int32" + }, + "rootNodeId": { + "type": "string", + "description": "The node the program's evaluation enters at." + }, + "nodes": { + "allOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/IProgramNode" + } + } + ], + "description": "The program's decision graph, keyed by node id." + }, + "maxRapids": { + "type": "integer", + "description": "The session ends after this many counted responses.", + "format": "int32" + }, + "maxDurationSeconds": { + "type": "integer", + "description": "The session ends after this many seconds.", + "format": "int32" } - } + }, + "description": "A program campaign: its sessions stream their rapids, driven by a stream program." }, - "GetCampaignCacheEndpoint_CampaignEntry": { + "ICampaignDetailsRoutedCampaignDetails": { "required": [ "id", "name", "status", "priority", - "filterCount", - "selectionCount", - "userScoreDimensionCount", - "featureFlagCount", - "rateLimitCount", - "isPreviewEnabled", - "boostingControlMode" + "boostingProfile", + "boostingControlMode", + "hasBooster", + "boostLevel", + "stickyConfig", + "filters", + "selections", + "featureFlags", + "ownerMail", + "createdAt", + "_t" ], - "type": "object", "properties": { - "id": { + "_t": { + "enum": [ + "RoutedCampaign" + ], "type": "string" }, + "id": { + "type": "string", + "description": "The unique identifier of the campaign." + }, "name": { - "type": "string" + "type": "string", + "description": "The name of the campaign." }, "status": { - "$ref": "#/components/schemas/CampaignStatus" + "allOf": [ + { + "$ref": "#/components/schemas/CampaignStatus" + } + ], + "description": "The current status of the campaign." }, "priority": { "type": "integer", + "description": "The priority level of the campaign.", "format": "int32" }, - "filterCount": { - "type": "integer", - "format": "int32" - }, - "selectionCount": { - "type": "integer", - "format": "int32" + "boostingProfile": { + "allOf": [ + { + "$ref": "#/components/schemas/BoostingProfile" + } + ], + "description": "The boosting profile configuration." }, - "userScoreDimensionCount": { - "type": "integer", - "format": "int32" + "boostingControlMode": { + "allOf": [ + { + "$ref": "#/components/schemas/BoostingControlMode" + } + ], + "description": "The boosting control mode." }, - "featureFlagCount": { - "type": "integer", - "format": "int32" + "hasBooster": { + "type": "boolean", + "description": "Whether the campaign has a booster." }, - "rateLimitCount": { + "boostLevel": { "type": "integer", + "description": "The campaign's effective boost level (0-10). 0 when no boost is active.\n Lets clients render and edit the level without unpacking the boosting profile.", "format": "int32" }, - "isPreviewEnabled": { - "type": "boolean" + "requiresBooster": { + "type": "boolean", + "description": "Whether the campaign requires a booster.", + "deprecated": true }, - "boostingControlMode": { - "$ref": "#/components/schemas/BoostingControlMode" - } - } - }, - "GetCampaignCacheEndpoint_Output": { - "required": [ - "count", - "campaigns" - ], - "type": "object", - "properties": { - "count": { - "type": "integer", - "description": "The total number of cached campaigns.", - "format": "int32" + "stickyConfig": { + "allOf": [ + { + "$ref": "#/components/schemas/StickyConfig" + } + ], + "description": "The sticky behavior configuration." }, - "campaigns": { + "filters": { "allOf": [ { "type": "array", "items": { - "$ref": "#/components/schemas/GetCampaignCacheEndpoint_CampaignEntry" + "$ref": "#/components/schemas/ICampaignFilter" } } ], - "description": "The list of cached campaign summaries." - } - } - }, - "GetFastBidMultiplierEndpoint_Output": { - "required": [ - "externalCampaignId", - "bidMultiplierValue" - ], - "type": "object", - "properties": { - "externalCampaignId": { - "type": "integer", - "description": "The external campaign id reported by the downstream system.", - "format": "int32" + "description": "The targeting filters for this campaign." }, - "bidMultiplierValue": { - "type": "number", - "description": "The current bid multiplier reported for the campaign.", - "format": "double" - } - } - }, - "GetUserScoreCacheEndpoint_Output": { - "required": [ - "count", - "scores" - ], - "type": "object", - "properties": { - "count": { - "type": "integer", - "description": "The total number of cached user scores.", - "format": "int32" + "selections": { + "allOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ICampaignSelection" + } + } + ], + "description": "The rapid selections for this campaign." }, - "scores": { + "featureFlags": { "allOf": [ { - "type": "object", - "additionalProperties": { - "type": "number", - "format": "double" + "type": "array", + "items": { + "$ref": "#/components/schemas/FeatureFlag" } } ], - "description": "The cached dimension-to-score mappings." + "description": "The feature flags configured for this campaign." + }, + "ownerMail": { + "type": "string", + "description": "The email of the campaign owner." + }, + "organizationId": { + "type": "string", + "description": "The id of the organization that owns the campaign.", + "nullable": true + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the campaign was created.", + "format": "date-time" } - } + }, + "description": "A routed campaign: its rapids are served from a fixed selection list." }, "ICampaignFilter": { "required": [ diff --git a/openapi/schemas/rapidata.filtered.openapi.json b/openapi/schemas/rapidata.filtered.openapi.json index 01d83ad24..a1ee08395 100644 --- a/openapi/schemas/rapidata.filtered.openapi.json +++ b/openapi/schemas/rapidata.filtered.openapi.json @@ -3331,6 +3331,7 @@ "Campaign" ], "summary": "Retrieves the details of a specific campaign.", + "description": "The response is discriminated by campaign kind: a program campaign includes its stream\n program, a routed campaign includes its selections.", "parameters": [ { "name": "campaignId", @@ -3348,7 +3349,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetCampaignByIdEndpoint_Output" + "$ref": "#/components/schemas/ICampaignDetails" } } } @@ -39326,7 +39327,156 @@ } } }, - "GetCampaignByIdEndpoint_Output": { + "GetCampaignCacheEndpoint_CampaignEntry": { + "required": [ + "id", + "name", + "status", + "priority", + "filterCount", + "selectionCount", + "userScoreDimensionCount", + "featureFlagCount", + "rateLimitCount", + "isPreviewEnabled", + "boostingControlMode" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/CampaignStatus" + }, + "priority": { + "type": "integer", + "format": "int32" + }, + "filterCount": { + "type": "integer", + "format": "int32" + }, + "selectionCount": { + "type": "integer", + "format": "int32" + }, + "userScoreDimensionCount": { + "type": "integer", + "format": "int32" + }, + "featureFlagCount": { + "type": "integer", + "format": "int32" + }, + "rateLimitCount": { + "type": "integer", + "format": "int32" + }, + "isPreviewEnabled": { + "type": "boolean" + }, + "boostingControlMode": { + "$ref": "#/components/schemas/BoostingControlMode" + } + } + }, + "GetCampaignCacheEndpoint_Output": { + "required": [ + "count", + "campaigns" + ], + "type": "object", + "properties": { + "count": { + "type": "integer", + "description": "The total number of cached campaigns.", + "format": "int32" + }, + "campaigns": { + "allOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetCampaignCacheEndpoint_CampaignEntry" + } + } + ], + "description": "The list of cached campaign summaries." + } + } + }, + "GetFastBidMultiplierEndpoint_Output": { + "required": [ + "externalCampaignId", + "bidMultiplierValue" + ], + "type": "object", + "properties": { + "externalCampaignId": { + "type": "integer", + "description": "The external campaign id reported by the downstream system.", + "format": "int32" + }, + "bidMultiplierValue": { + "type": "number", + "description": "The current bid multiplier reported for the campaign.", + "format": "double" + } + } + }, + "GetUserScoreCacheEndpoint_Output": { + "required": [ + "count", + "scores" + ], + "type": "object", + "properties": { + "count": { + "type": "integer", + "description": "The total number of cached user scores.", + "format": "int32" + }, + "scores": { + "allOf": [ + { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + ], + "description": "The cached dimension-to-score mappings." + } + } + }, + "ICampaignDetails": { + "required": [ + "_t" + ], + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/ICampaignDetailsProgramCampaignDetails" + }, + { + "$ref": "#/components/schemas/ICampaignDetailsRoutedCampaignDetails" + } + ], + "description": "A campaign's details, identified by a discriminator. Implementations describe the\n type-specific configuration: a routed campaign's selections or a program campaign's\n stream program.", + "discriminator": { + "propertyName": "_t", + "mapping": { + "ProgramCampaign": "#/components/schemas/ICampaignDetailsProgramCampaignDetails", + "RoutedCampaign": "#/components/schemas/ICampaignDetailsRoutedCampaignDetails" + } + } + }, + "ICampaignDetailsProgramCampaignDetails": { "required": [ "id", "name", @@ -39338,13 +39488,23 @@ "boostLevel", "stickyConfig", "filters", - "selections", "featureFlags", "ownerMail", - "createdAt" + "createdAt", + "version", + "rootNodeId", + "nodes", + "maxRapids", + "maxDurationSeconds", + "_t" ], - "type": "object", "properties": { + "_t": { + "enum": [ + "ProgramCampaign" + ], + "type": "string" + }, "id": { "type": "string", "description": "The unique identifier of the campaign." @@ -39410,17 +39570,6 @@ ], "description": "The targeting filters for this campaign." }, - "selections": { - "allOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/ICampaignSelection" - } - } - ], - "description": "The rapid selections for this campaign." - }, "featureFlags": { "allOf": [ { @@ -39438,142 +39587,175 @@ }, "organizationId": { "type": "string", - "description": "The id of the organization that owns the entity.", + "description": "The id of the organization that owns the campaign.", "nullable": true }, "createdAt": { "type": "string", "description": "The timestamp when the campaign was created.", "format": "date-time" + }, + "version": { + "type": "integer", + "description": "The program's current version, for optimistic concurrency on save.", + "format": "int32" + }, + "rootNodeId": { + "type": "string", + "description": "The node the program's evaluation enters at." + }, + "nodes": { + "allOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/IProgramNode" + } + } + ], + "description": "The program's decision graph, keyed by node id." + }, + "maxRapids": { + "type": "integer", + "description": "The session ends after this many counted responses.", + "format": "int32" + }, + "maxDurationSeconds": { + "type": "integer", + "description": "The session ends after this many seconds.", + "format": "int32" } - } + }, + "description": "A program campaign: its sessions stream their rapids, driven by a stream program." }, - "GetCampaignCacheEndpoint_CampaignEntry": { + "ICampaignDetailsRoutedCampaignDetails": { "required": [ "id", "name", "status", "priority", - "filterCount", - "selectionCount", - "userScoreDimensionCount", - "featureFlagCount", - "rateLimitCount", - "isPreviewEnabled", - "boostingControlMode" + "boostingProfile", + "boostingControlMode", + "hasBooster", + "boostLevel", + "stickyConfig", + "filters", + "selections", + "featureFlags", + "ownerMail", + "createdAt", + "_t" ], - "type": "object", "properties": { - "id": { + "_t": { + "enum": [ + "RoutedCampaign" + ], "type": "string" }, + "id": { + "type": "string", + "description": "The unique identifier of the campaign." + }, "name": { - "type": "string" + "type": "string", + "description": "The name of the campaign." }, "status": { - "$ref": "#/components/schemas/CampaignStatus" + "allOf": [ + { + "$ref": "#/components/schemas/CampaignStatus" + } + ], + "description": "The current status of the campaign." }, "priority": { "type": "integer", + "description": "The priority level of the campaign.", "format": "int32" }, - "filterCount": { - "type": "integer", - "format": "int32" - }, - "selectionCount": { - "type": "integer", - "format": "int32" + "boostingProfile": { + "allOf": [ + { + "$ref": "#/components/schemas/BoostingProfile" + } + ], + "description": "The boosting profile configuration." }, - "userScoreDimensionCount": { - "type": "integer", - "format": "int32" + "boostingControlMode": { + "allOf": [ + { + "$ref": "#/components/schemas/BoostingControlMode" + } + ], + "description": "The boosting control mode." }, - "featureFlagCount": { - "type": "integer", - "format": "int32" + "hasBooster": { + "type": "boolean", + "description": "Whether the campaign has a booster." }, - "rateLimitCount": { + "boostLevel": { "type": "integer", + "description": "The campaign's effective boost level (0-10). 0 when no boost is active.\n Lets clients render and edit the level without unpacking the boosting profile.", "format": "int32" }, - "isPreviewEnabled": { - "type": "boolean" - }, - "boostingControlMode": { - "$ref": "#/components/schemas/BoostingControlMode" - } - } - }, - "GetCampaignCacheEndpoint_Output": { - "required": [ - "count", - "campaigns" - ], - "type": "object", - "properties": { - "count": { - "type": "integer", - "description": "The total number of cached campaigns.", - "format": "int32" + "stickyConfig": { + "allOf": [ + { + "$ref": "#/components/schemas/StickyConfig" + } + ], + "description": "The sticky behavior configuration." }, - "campaigns": { + "filters": { "allOf": [ { "type": "array", "items": { - "$ref": "#/components/schemas/GetCampaignCacheEndpoint_CampaignEntry" + "$ref": "#/components/schemas/ICampaignFilter" } } ], - "description": "The list of cached campaign summaries." - } - } - }, - "GetFastBidMultiplierEndpoint_Output": { - "required": [ - "externalCampaignId", - "bidMultiplierValue" - ], - "type": "object", - "properties": { - "externalCampaignId": { - "type": "integer", - "description": "The external campaign id reported by the downstream system.", - "format": "int32" + "description": "The targeting filters for this campaign." }, - "bidMultiplierValue": { - "type": "number", - "description": "The current bid multiplier reported for the campaign.", - "format": "double" - } - } - }, - "GetUserScoreCacheEndpoint_Output": { - "required": [ - "count", - "scores" - ], - "type": "object", - "properties": { - "count": { - "type": "integer", - "description": "The total number of cached user scores.", - "format": "int32" + "selections": { + "allOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ICampaignSelection" + } + } + ], + "description": "The rapid selections for this campaign." }, - "scores": { + "featureFlags": { "allOf": [ { - "type": "object", - "additionalProperties": { - "type": "number", - "format": "double" + "type": "array", + "items": { + "$ref": "#/components/schemas/FeatureFlag" } } ], - "description": "The cached dimension-to-score mappings." + "description": "The feature flags configured for this campaign." + }, + "ownerMail": { + "type": "string", + "description": "The email of the campaign owner." + }, + "organizationId": { + "type": "string", + "description": "The id of the organization that owns the campaign.", + "nullable": true + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the campaign was created.", + "format": "date-time" } - } + }, + "description": "A routed campaign: its rapids are served from a fixed selection list." }, "ICampaignFilter": { "required": [ diff --git a/openapi/schemas/rapidata.openapi.json b/openapi/schemas/rapidata.openapi.json index 8fd4e661c..1a671405b 100644 --- a/openapi/schemas/rapidata.openapi.json +++ b/openapi/schemas/rapidata.openapi.json @@ -3381,6 +3381,7 @@ "Campaign" ], "summary": "Retrieves the details of a specific campaign.", + "description": "The response is discriminated by campaign kind: a program campaign includes its stream\n program, a routed campaign includes its selections.", "parameters": [ { "name": "campaignId", @@ -3398,7 +3399,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GetCampaignByIdEndpoint_Output" + "$ref": "#/components/schemas/ICampaignDetails" } } } @@ -41086,7 +41087,156 @@ } } }, - "GetCampaignByIdEndpoint_Output": { + "GetCampaignCacheEndpoint_CampaignEntry": { + "required": [ + "id", + "name", + "status", + "priority", + "filterCount", + "selectionCount", + "userScoreDimensionCount", + "featureFlagCount", + "rateLimitCount", + "isPreviewEnabled", + "boostingControlMode" + ], + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "$ref": "#/components/schemas/CampaignStatus" + }, + "priority": { + "type": "integer", + "format": "int32" + }, + "filterCount": { + "type": "integer", + "format": "int32" + }, + "selectionCount": { + "type": "integer", + "format": "int32" + }, + "userScoreDimensionCount": { + "type": "integer", + "format": "int32" + }, + "featureFlagCount": { + "type": "integer", + "format": "int32" + }, + "rateLimitCount": { + "type": "integer", + "format": "int32" + }, + "isPreviewEnabled": { + "type": "boolean" + }, + "boostingControlMode": { + "$ref": "#/components/schemas/BoostingControlMode" + } + } + }, + "GetCampaignCacheEndpoint_Output": { + "required": [ + "count", + "campaigns" + ], + "type": "object", + "properties": { + "count": { + "type": "integer", + "description": "The total number of cached campaigns.", + "format": "int32" + }, + "campaigns": { + "allOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/GetCampaignCacheEndpoint_CampaignEntry" + } + } + ], + "description": "The list of cached campaign summaries." + } + } + }, + "GetFastBidMultiplierEndpoint_Output": { + "required": [ + "externalCampaignId", + "bidMultiplierValue" + ], + "type": "object", + "properties": { + "externalCampaignId": { + "type": "integer", + "description": "The external campaign id reported by the downstream system.", + "format": "int32" + }, + "bidMultiplierValue": { + "type": "number", + "description": "The current bid multiplier reported for the campaign.", + "format": "double" + } + } + }, + "GetUserScoreCacheEndpoint_Output": { + "required": [ + "count", + "scores" + ], + "type": "object", + "properties": { + "count": { + "type": "integer", + "description": "The total number of cached user scores.", + "format": "int32" + }, + "scores": { + "allOf": [ + { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + ], + "description": "The cached dimension-to-score mappings." + } + } + }, + "ICampaignDetails": { + "required": [ + "_t" + ], + "type": "object", + "oneOf": [ + { + "$ref": "#/components/schemas/ICampaignDetailsProgramCampaignDetails" + }, + { + "$ref": "#/components/schemas/ICampaignDetailsRoutedCampaignDetails" + } + ], + "description": "A campaign's details, identified by a discriminator. Implementations describe the\n type-specific configuration: a routed campaign's selections or a program campaign's\n stream program.", + "discriminator": { + "propertyName": "_t", + "mapping": { + "ProgramCampaign": "#/components/schemas/ICampaignDetailsProgramCampaignDetails", + "RoutedCampaign": "#/components/schemas/ICampaignDetailsRoutedCampaignDetails" + } + } + }, + "ICampaignDetailsProgramCampaignDetails": { "required": [ "id", "name", @@ -41098,13 +41248,23 @@ "boostLevel", "stickyConfig", "filters", - "selections", "featureFlags", "ownerMail", - "createdAt" + "createdAt", + "version", + "rootNodeId", + "nodes", + "maxRapids", + "maxDurationSeconds", + "_t" ], - "type": "object", "properties": { + "_t": { + "enum": [ + "ProgramCampaign" + ], + "type": "string" + }, "id": { "type": "string", "description": "The unique identifier of the campaign." @@ -41175,17 +41335,6 @@ ], "description": "The targeting filters for this campaign." }, - "selections": { - "allOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/ICampaignSelection" - } - } - ], - "description": "The rapid selections for this campaign." - }, "featureFlags": { "allOf": [ { @@ -41203,142 +41352,180 @@ }, "organizationId": { "type": "string", - "description": "The id of the organization that owns the entity.", + "description": "The id of the organization that owns the campaign.", "nullable": true }, "createdAt": { "type": "string", "description": "The timestamp when the campaign was created.", "format": "date-time" + }, + "version": { + "type": "integer", + "description": "The program's current version, for optimistic concurrency on save.", + "format": "int32" + }, + "rootNodeId": { + "type": "string", + "description": "The node the program's evaluation enters at." + }, + "nodes": { + "allOf": [ + { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/IProgramNode" + } + } + ], + "description": "The program's decision graph, keyed by node id." + }, + "maxRapids": { + "type": "integer", + "description": "The session ends after this many counted responses.", + "format": "int32" + }, + "maxDurationSeconds": { + "type": "integer", + "description": "The session ends after this many seconds.", + "format": "int32" } - } + }, + "description": "A program campaign: its sessions stream their rapids, driven by a stream program." }, - "GetCampaignCacheEndpoint_CampaignEntry": { + "ICampaignDetailsRoutedCampaignDetails": { "required": [ "id", "name", "status", "priority", - "filterCount", - "selectionCount", - "userScoreDimensionCount", - "featureFlagCount", - "rateLimitCount", - "isPreviewEnabled", - "boostingControlMode" + "boostingProfile", + "boostingControlMode", + "hasBooster", + "boostLevel", + "stickyConfig", + "filters", + "selections", + "featureFlags", + "ownerMail", + "createdAt", + "_t" ], - "type": "object", "properties": { - "id": { + "_t": { + "enum": [ + "RoutedCampaign" + ], "type": "string" }, + "id": { + "type": "string", + "description": "The unique identifier of the campaign." + }, "name": { - "type": "string" + "type": "string", + "description": "The name of the campaign." }, "status": { - "$ref": "#/components/schemas/CampaignStatus" + "allOf": [ + { + "$ref": "#/components/schemas/CampaignStatus" + } + ], + "description": "The current status of the campaign." }, "priority": { "type": "integer", + "description": "The priority level of the campaign.", "format": "int32" }, - "filterCount": { - "type": "integer", - "format": "int32" - }, - "selectionCount": { - "type": "integer", - "format": "int32" + "boostingProfile": { + "allOf": [ + { + "$ref": "#/components/schemas/BoostingProfile" + } + ], + "description": "The boosting profile configuration." }, - "userScoreDimensionCount": { - "type": "integer", - "format": "int32" + "boostingControlMode": { + "allOf": [ + { + "$ref": "#/components/schemas/BoostingControlMode" + } + ], + "description": "The boosting control mode." }, - "featureFlagCount": { - "type": "integer", - "format": "int32" + "hasBooster": { + "type": "boolean", + "description": "Whether the campaign has a booster." }, - "rateLimitCount": { + "boostLevel": { "type": "integer", + "description": "The campaign's effective boost level (0-10). 0 when no boost is active.\n Lets clients render and edit the level without unpacking the boosting profile.", "format": "int32" }, - "isPreviewEnabled": { - "type": "boolean" + "requiresBooster": { + "type": "boolean", + "description": "Whether the campaign requires a booster.", + "deprecated": true }, - "boostingControlMode": { - "$ref": "#/components/schemas/BoostingControlMode" - } - } - }, - "GetCampaignCacheEndpoint_Output": { - "required": [ - "count", - "campaigns" - ], - "type": "object", - "properties": { - "count": { - "type": "integer", - "description": "The total number of cached campaigns.", - "format": "int32" + "stickyConfig": { + "allOf": [ + { + "$ref": "#/components/schemas/StickyConfig" + } + ], + "description": "The sticky behavior configuration." }, - "campaigns": { + "filters": { "allOf": [ { "type": "array", "items": { - "$ref": "#/components/schemas/GetCampaignCacheEndpoint_CampaignEntry" + "$ref": "#/components/schemas/ICampaignFilter" } } ], - "description": "The list of cached campaign summaries." - } - } - }, - "GetFastBidMultiplierEndpoint_Output": { - "required": [ - "externalCampaignId", - "bidMultiplierValue" - ], - "type": "object", - "properties": { - "externalCampaignId": { - "type": "integer", - "description": "The external campaign id reported by the downstream system.", - "format": "int32" + "description": "The targeting filters for this campaign." }, - "bidMultiplierValue": { - "type": "number", - "description": "The current bid multiplier reported for the campaign.", - "format": "double" - } - } - }, - "GetUserScoreCacheEndpoint_Output": { - "required": [ - "count", - "scores" - ], - "type": "object", - "properties": { - "count": { - "type": "integer", - "description": "The total number of cached user scores.", - "format": "int32" + "selections": { + "allOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/ICampaignSelection" + } + } + ], + "description": "The rapid selections for this campaign." }, - "scores": { + "featureFlags": { "allOf": [ { - "type": "object", - "additionalProperties": { - "type": "number", - "format": "double" + "type": "array", + "items": { + "$ref": "#/components/schemas/FeatureFlag" } } ], - "description": "The cached dimension-to-score mappings." + "description": "The feature flags configured for this campaign." + }, + "ownerMail": { + "type": "string", + "description": "The email of the campaign owner." + }, + "organizationId": { + "type": "string", + "description": "The id of the organization that owns the campaign.", + "nullable": true + }, + "createdAt": { + "type": "string", + "description": "The timestamp when the campaign was created.", + "format": "date-time" } - } + }, + "description": "A routed campaign: its rapids are served from a fixed selection list." }, "ICampaignFilter": { "required": [ diff --git a/src/rapidata/api_client/api/campaign_api.py b/src/rapidata/api_client/api/campaign_api.py index d6d62e0d5..649ab6676 100644 --- a/src/rapidata/api_client/api/campaign_api.py +++ b/src/rapidata/api_client/api/campaign_api.py @@ -23,8 +23,8 @@ from rapidata.api_client.models.create_program_campaign_endpoint_output import CreateProgramCampaignEndpointOutput from rapidata.api_client.models.get_boost_insights_endpoint_output import GetBoostInsightsEndpointOutput from rapidata.api_client.models.get_boost_status_endpoint_output import GetBoostStatusEndpointOutput -from rapidata.api_client.models.get_campaign_by_id_endpoint_output import GetCampaignByIdEndpointOutput from rapidata.api_client.models.get_fast_bid_multiplier_endpoint_output import GetFastBidMultiplierEndpointOutput +from rapidata.api_client.models.i_campaign_details import ICampaignDetails from rapidata.api_client.models.query_campaigns_endpoint_paged_result_of_output import QueryCampaignsEndpointPagedResultOfOutput from rapidata.api_client.models.set_fast_bid_multiplier_endpoint_input import SetFastBidMultiplierEndpointInput from rapidata.api_client.models.set_fast_bid_multiplier_endpoint_output import SetFastBidMultiplierEndpointOutput @@ -1670,9 +1670,10 @@ def campaign_campaign_id_get( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> GetCampaignByIdEndpointOutput: + ) -> ICampaignDetails: """Retrieves the details of a specific campaign. + The response is discriminated by campaign kind: a program campaign includes its stream program, a routed campaign includes its selections. :param campaign_id: The ID of the campaign. (required) :type campaign_id: str @@ -1707,7 +1708,7 @@ def campaign_campaign_id_get( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetCampaignByIdEndpointOutput", + '200': "ICampaignDetails", '400': "ValidationProblemDetails", '401': None, '403': None, @@ -1739,9 +1740,10 @@ def campaign_campaign_id_get_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[GetCampaignByIdEndpointOutput]: + ) -> ApiResponse[ICampaignDetails]: """Retrieves the details of a specific campaign. + The response is discriminated by campaign kind: a program campaign includes its stream program, a routed campaign includes its selections. :param campaign_id: The ID of the campaign. (required) :type campaign_id: str @@ -1776,7 +1778,7 @@ def campaign_campaign_id_get_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetCampaignByIdEndpointOutput", + '200': "ICampaignDetails", '400': "ValidationProblemDetails", '401': None, '403': None, @@ -1811,6 +1813,7 @@ def campaign_campaign_id_get_without_preload_content( ) -> RESTResponseType: """Retrieves the details of a specific campaign. + The response is discriminated by campaign kind: a program campaign includes its stream program, a routed campaign includes its selections. :param campaign_id: The ID of the campaign. (required) :type campaign_id: str @@ -1845,7 +1848,7 @@ def campaign_campaign_id_get_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "GetCampaignByIdEndpointOutput", + '200': "ICampaignDetails", '400': "ValidationProblemDetails", '401': None, '403': None, diff --git a/src/rapidata/api_client/models/i_campaign_details.py b/src/rapidata/api_client/models/i_campaign_details.py new file mode 100644 index 000000000..98ac85c33 --- /dev/null +++ b/src/rapidata/api_client/models/i_campaign_details.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + Rapidata Asset API + + The API for the Rapidata Asset service + + The version of the OpenAPI document: v1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import json +import pprint +from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator +from typing import Any, List, Optional +from rapidata.api_client.models.i_campaign_details_program_campaign_details import ICampaignDetailsProgramCampaignDetails +from rapidata.api_client.models.i_campaign_details_routed_campaign_details import ICampaignDetailsRoutedCampaignDetails +from pydantic import StrictStr, Field +from rapidata.api_client.lazy_model import LazyValidatedModel +from typing import Union, List, Set, Optional, Dict +from typing_extensions import Literal, Self + +ICAMPAIGNDETAILS_ONE_OF_SCHEMAS = ["ICampaignDetailsProgramCampaignDetails", "ICampaignDetailsRoutedCampaignDetails"] + +class ICampaignDetails(LazyValidatedModel): + """ + A campaign's details, identified by a discriminator. Implementations describe the type-specific configuration: a routed campaign's selections or a program campaign's stream program. + """ + # data type: ICampaignDetailsProgramCampaignDetails + oneof_schema_1_validator: Optional[ICampaignDetailsProgramCampaignDetails] = None + # data type: ICampaignDetailsRoutedCampaignDetails + oneof_schema_2_validator: Optional[ICampaignDetailsRoutedCampaignDetails] = None + actual_instance: Optional[Union[ICampaignDetailsProgramCampaignDetails, ICampaignDetailsRoutedCampaignDetails]] = None + one_of_schemas: Set[str] = { "ICampaignDetailsProgramCampaignDetails", "ICampaignDetailsRoutedCampaignDetails" } + + # model_config is inherited from LazyValidatedModel + + + discriminator_value_class_map: Dict[str, str] = { + } + + def __init__(self, *args, **kwargs) -> None: + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @field_validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = ICampaignDetails.model_construct() + error_messages = [] + match = 0 + # validate data type: ICampaignDetailsProgramCampaignDetails + if not isinstance(v, ICampaignDetailsProgramCampaignDetails): + error_messages.append(f"Error! Input type `{type(v)}` is not `ICampaignDetailsProgramCampaignDetails`") + else: + match += 1 + # validate data type: ICampaignDetailsRoutedCampaignDetails + if not isinstance(v, ICampaignDetailsRoutedCampaignDetails): + error_messages.append(f"Error! Input type `{type(v)}` is not `ICampaignDetailsRoutedCampaignDetails`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in ICampaignDetails with oneOf schemas: ICampaignDetailsProgramCampaignDetails, ICampaignDetailsRoutedCampaignDetails. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in ICampaignDetails with oneOf schemas: ICampaignDetailsProgramCampaignDetails, ICampaignDetailsRoutedCampaignDetails. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Returns the object represented by the json string""" + instance = cls.model_construct() + error_messages = [] + match = 0 + + # deserialize data into ICampaignDetailsProgramCampaignDetails + try: + instance.actual_instance = ICampaignDetailsProgramCampaignDetails.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into ICampaignDetailsRoutedCampaignDetails + try: + instance.actual_instance = ICampaignDetailsRoutedCampaignDetails.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into ICampaignDetails with oneOf schemas: ICampaignDetailsProgramCampaignDetails, ICampaignDetailsRoutedCampaignDetails. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into ICampaignDetails with oneOf schemas: ICampaignDetailsProgramCampaignDetails, ICampaignDetailsRoutedCampaignDetails. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> Optional[Union[Dict[str, Any], ICampaignDetailsProgramCampaignDetails, ICampaignDetailsRoutedCampaignDetails]]: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.model_dump()) + + diff --git a/src/rapidata/api_client/models/i_campaign_details_program_campaign_details.py b/src/rapidata/api_client/models/i_campaign_details_program_campaign_details.py new file mode 100644 index 000000000..7a6146375 --- /dev/null +++ b/src/rapidata/api_client/models/i_campaign_details_program_campaign_details.py @@ -0,0 +1,178 @@ +# coding: utf-8 + +""" + Rapidata Asset API + + The API for the Rapidata Asset service + + The version of the OpenAPI document: v1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from rapidata.api_client.models.boosting_control_mode import BoostingControlMode +from rapidata.api_client.models.boosting_profile import BoostingProfile +from rapidata.api_client.models.campaign_status import CampaignStatus +from rapidata.api_client.models.feature_flag import FeatureFlag +from rapidata.api_client.models.i_campaign_filter import ICampaignFilter +from rapidata.api_client.models.i_program_node import IProgramNode +from rapidata.api_client.models.sticky_config import StickyConfig +from pydantic import ValidationError +from rapidata.api_client.lazy_model import LazyValidatedModel +from typing import Optional, Set +from typing_extensions import Self + +class ICampaignDetailsProgramCampaignDetails(LazyValidatedModel): + """ + A program campaign: its sessions stream their rapids, driven by a stream program. + """ # noqa: E501 + t: StrictStr = Field(alias="_t") + id: StrictStr = Field(description="The unique identifier of the campaign.") + name: StrictStr = Field(description="The name of the campaign.") + status: CampaignStatus = Field(description="The current status of the campaign.") + priority: StrictInt = Field(description="The priority level of the campaign.") + boosting_profile: BoostingProfile = Field(description="The boosting profile configuration.", alias="boostingProfile") + boosting_control_mode: BoostingControlMode = Field(description="The boosting control mode.", alias="boostingControlMode") + has_booster: StrictBool = Field(description="Whether the campaign has a booster.", alias="hasBooster") + boost_level: StrictInt = Field(description="The campaign's effective boost level (0-10). 0 when no boost is active. Lets clients render and edit the level without unpacking the boosting profile.", alias="boostLevel") + sticky_config: StickyConfig = Field(description="The sticky behavior configuration.", alias="stickyConfig") + filters: List[ICampaignFilter] + feature_flags: List[FeatureFlag] = Field(alias="featureFlags") + owner_mail: StrictStr = Field(description="The email of the campaign owner.", alias="ownerMail") + organization_id: Optional[StrictStr] = Field(default=None, description="The id of the organization that owns the campaign.", alias="organizationId") + created_at: datetime = Field(description="The timestamp when the campaign was created.", alias="createdAt") + version: StrictInt = Field(description="The program's current version, for optimistic concurrency on save.") + root_node_id: StrictStr = Field(description="The node the program's evaluation enters at.", alias="rootNodeId") + nodes: Dict[str, IProgramNode] = Field(description="The program's decision graph, keyed by node id.") + max_rapids: StrictInt = Field(description="The session ends after this many counted responses.", alias="maxRapids") + max_duration_seconds: StrictInt = Field(description="The session ends after this many seconds.", alias="maxDurationSeconds") + __properties: ClassVar[List[str]] = ["_t", "id", "name", "status", "priority", "boostingProfile", "boostingControlMode", "hasBooster", "boostLevel", "stickyConfig", "filters", "featureFlags", "ownerMail", "organizationId", "createdAt", "version", "rootNodeId", "nodes", "maxRapids", "maxDurationSeconds"] + + @field_validator('t') + def t_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['ProgramCampaign']): + raise ValueError("must be one of enum values ('ProgramCampaign')") + return value + + # model_config is inherited from LazyValidatedModel + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ICampaignDetailsProgramCampaignDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of boosting_profile + if self.boosting_profile: + _dict['boostingProfile'] = self.boosting_profile.to_dict() + # override the default output from pydantic by calling `to_dict()` of sticky_config + if self.sticky_config: + _dict['stickyConfig'] = self.sticky_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in filters (list) + _items = [] + if self.filters: + for _item_filters in self.filters: + if _item_filters: + _items.append(_item_filters.to_dict()) + _dict['filters'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list) + _items = [] + if self.feature_flags: + for _item_feature_flags in self.feature_flags: + if _item_feature_flags: + _items.append(_item_feature_flags.to_dict()) + _dict['featureFlags'] = _items + # override the default output from pydantic by calling `to_dict()` of each value in nodes (dict) + _field_dict = {} + if self.nodes: + for _key_nodes in self.nodes: + if self.nodes[_key_nodes]: + _field_dict[_key_nodes] = self.nodes[_key_nodes].to_dict() + _dict['nodes'] = _field_dict + # set to None if organization_id (nullable) is None + # and model_fields_set contains the field + if self.organization_id is None and "organization_id" in self.model_fields_set: + _dict['organizationId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ICampaignDetailsProgramCampaignDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _data = { + "_t": obj.get("_t"), + "id": obj.get("id"), + "name": obj.get("name"), + "status": obj.get("status"), + "priority": obj.get("priority"), + "boostingProfile": BoostingProfile.from_dict(obj["boostingProfile"]) if obj.get("boostingProfile") is not None else None, + "boostingControlMode": obj.get("boostingControlMode"), + "hasBooster": obj.get("hasBooster"), + "boostLevel": obj.get("boostLevel"), + "stickyConfig": StickyConfig.from_dict(obj["stickyConfig"]) if obj.get("stickyConfig") is not None else None, + "filters": [ICampaignFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None, + "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None, + "ownerMail": obj.get("ownerMail"), + "organizationId": obj.get("organizationId"), + "createdAt": obj.get("createdAt"), + "version": obj.get("version"), + "rootNodeId": obj.get("rootNodeId"), + "nodes": dict( + (_k, IProgramNode.from_dict(_v)) + for _k, _v in obj["nodes"].items() + ) + if obj.get("nodes") is not None + else None, + "maxRapids": obj.get("maxRapids"), + "maxDurationSeconds": obj.get("maxDurationSeconds") + } + try: + _obj = cls.model_validate(_data) + except ValidationError as _val_error: + _obj = cls._lazy_construct(_data, _val_error) + return _obj + + diff --git a/src/rapidata/api_client/models/i_campaign_details_routed_campaign_details.py b/src/rapidata/api_client/models/i_campaign_details_routed_campaign_details.py new file mode 100644 index 000000000..4a8334a4c --- /dev/null +++ b/src/rapidata/api_client/models/i_campaign_details_routed_campaign_details.py @@ -0,0 +1,165 @@ +# coding: utf-8 + +""" + Rapidata Asset API + + The API for the Rapidata Asset service + + The version of the OpenAPI document: v1 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from rapidata.api_client.models.boosting_control_mode import BoostingControlMode +from rapidata.api_client.models.boosting_profile import BoostingProfile +from rapidata.api_client.models.campaign_status import CampaignStatus +from rapidata.api_client.models.feature_flag import FeatureFlag +from rapidata.api_client.models.i_campaign_filter import ICampaignFilter +from rapidata.api_client.models.i_campaign_selection import ICampaignSelection +from rapidata.api_client.models.sticky_config import StickyConfig +from pydantic import ValidationError +from rapidata.api_client.lazy_model import LazyValidatedModel +from typing import Optional, Set +from typing_extensions import Self + +class ICampaignDetailsRoutedCampaignDetails(LazyValidatedModel): + """ + A routed campaign: its rapids are served from a fixed selection list. + """ # noqa: E501 + t: StrictStr = Field(alias="_t") + id: StrictStr = Field(description="The unique identifier of the campaign.") + name: StrictStr = Field(description="The name of the campaign.") + status: CampaignStatus = Field(description="The current status of the campaign.") + priority: StrictInt = Field(description="The priority level of the campaign.") + boosting_profile: BoostingProfile = Field(description="The boosting profile configuration.", alias="boostingProfile") + boosting_control_mode: BoostingControlMode = Field(description="The boosting control mode.", alias="boostingControlMode") + has_booster: StrictBool = Field(description="Whether the campaign has a booster.", alias="hasBooster") + boost_level: StrictInt = Field(description="The campaign's effective boost level (0-10). 0 when no boost is active. Lets clients render and edit the level without unpacking the boosting profile.", alias="boostLevel") + sticky_config: StickyConfig = Field(description="The sticky behavior configuration.", alias="stickyConfig") + filters: List[ICampaignFilter] + selections: List[ICampaignSelection] + feature_flags: List[FeatureFlag] = Field(alias="featureFlags") + owner_mail: StrictStr = Field(description="The email of the campaign owner.", alias="ownerMail") + organization_id: Optional[StrictStr] = Field(default=None, description="The id of the organization that owns the campaign.", alias="organizationId") + created_at: datetime = Field(description="The timestamp when the campaign was created.", alias="createdAt") + __properties: ClassVar[List[str]] = ["_t", "id", "name", "status", "priority", "boostingProfile", "boostingControlMode", "hasBooster", "boostLevel", "stickyConfig", "filters", "selections", "featureFlags", "ownerMail", "organizationId", "createdAt"] + + @field_validator('t') + def t_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['RoutedCampaign']): + raise ValueError("must be one of enum values ('RoutedCampaign')") + return value + + # model_config is inherited from LazyValidatedModel + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ICampaignDetailsRoutedCampaignDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of boosting_profile + if self.boosting_profile: + _dict['boostingProfile'] = self.boosting_profile.to_dict() + # override the default output from pydantic by calling `to_dict()` of sticky_config + if self.sticky_config: + _dict['stickyConfig'] = self.sticky_config.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in filters (list) + _items = [] + if self.filters: + for _item_filters in self.filters: + if _item_filters: + _items.append(_item_filters.to_dict()) + _dict['filters'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in selections (list) + _items = [] + if self.selections: + for _item_selections in self.selections: + if _item_selections: + _items.append(_item_selections.to_dict()) + _dict['selections'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list) + _items = [] + if self.feature_flags: + for _item_feature_flags in self.feature_flags: + if _item_feature_flags: + _items.append(_item_feature_flags.to_dict()) + _dict['featureFlags'] = _items + # set to None if organization_id (nullable) is None + # and model_fields_set contains the field + if self.organization_id is None and "organization_id" in self.model_fields_set: + _dict['organizationId'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ICampaignDetailsRoutedCampaignDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _data = { + "_t": obj.get("_t"), + "id": obj.get("id"), + "name": obj.get("name"), + "status": obj.get("status"), + "priority": obj.get("priority"), + "boostingProfile": BoostingProfile.from_dict(obj["boostingProfile"]) if obj.get("boostingProfile") is not None else None, + "boostingControlMode": obj.get("boostingControlMode"), + "hasBooster": obj.get("hasBooster"), + "boostLevel": obj.get("boostLevel"), + "stickyConfig": StickyConfig.from_dict(obj["stickyConfig"]) if obj.get("stickyConfig") is not None else None, + "filters": [ICampaignFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None, + "selections": [ICampaignSelection.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None, + "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None, + "ownerMail": obj.get("ownerMail"), + "organizationId": obj.get("organizationId"), + "createdAt": obj.get("createdAt") + } + try: + _obj = cls.model_validate(_data) + except ValidationError as _val_error: + _obj = cls._lazy_construct(_data, _val_error) + return _obj + + diff --git a/src/rapidata/api_client_README.md b/src/rapidata/api_client_README.md index d5599f22a..148745121 100644 --- a/src/rapidata/api_client_README.md +++ b/src/rapidata/api_client_README.md @@ -611,7 +611,6 @@ Class | Method | HTTP request | Description - [GetBoostInsightsEndpointOutput](rapidata/api_client/docs/GetBoostInsightsEndpointOutput.md) - [GetBoostStatusEndpointOutput](rapidata/api_client/docs/GetBoostStatusEndpointOutput.md) - [GetBulkReconciliationStatusEndpointOutput](rapidata/api_client/docs/GetBulkReconciliationStatusEndpointOutput.md) - - [GetCampaignByIdEndpointOutput](rapidata/api_client/docs/GetCampaignByIdEndpointOutput.md) - [GetCampaignCacheEndpointCampaignEntry](rapidata/api_client/docs/GetCampaignCacheEndpointCampaignEntry.md) - [GetCampaignCacheEndpointOutput](rapidata/api_client/docs/GetCampaignCacheEndpointOutput.md) - [GetCapabilityGranteesEndpointCursorPagedResultOfOutput](rapidata/api_client/docs/GetCapabilityGranteesEndpointCursorPagedResultOfOutput.md) @@ -751,6 +750,9 @@ Class | Method | HTTP request | Description - [IBillingGroupOrderBillingGroup](rapidata/api_client/docs/IBillingGroupOrderBillingGroup.md) - [IBillingGroupRankingFlowBillingGroup](rapidata/api_client/docs/IBillingGroupRankingFlowBillingGroup.md) - [IBillingGroupValidationSetBillingGroup](rapidata/api_client/docs/IBillingGroupValidationSetBillingGroup.md) + - [ICampaignDetails](rapidata/api_client/docs/ICampaignDetails.md) + - [ICampaignDetailsProgramCampaignDetails](rapidata/api_client/docs/ICampaignDetailsProgramCampaignDetails.md) + - [ICampaignDetailsRoutedCampaignDetails](rapidata/api_client/docs/ICampaignDetailsRoutedCampaignDetails.md) - [ICampaignFilter](rapidata/api_client/docs/ICampaignFilter.md) - [ICampaignFilterAndFilter](rapidata/api_client/docs/ICampaignFilterAndFilter.md) - [ICampaignFilterAudienceStateFilter](rapidata/api_client/docs/ICampaignFilterAudienceStateFilter.md)