diff --git a/README.md b/README.md index 451935e..cc29619 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,12 @@ $ openapi-generator generate \ ### Management SDK +Note to maintainers: The openapi-3.yaml file doesn't fully reference all of the +endpoints and schemas in the individual entity YAML files. For this reason, please make +sure to update both the individual entity YAML file AND the openapi-3.yaml file when +making changes. Bonus points for linking the 2 with `$ref` so that there is only one +place to make changes. + #### JavaScript ```sh @@ -82,4 +88,4 @@ $ openapi-generator generate \ -i ./management/openapi-3.yaml \ -o ./build/mgmt-ruby/ \ -c ./management/codegen-config/ruby.json -``` \ No newline at end of file +``` diff --git a/management/campaign.yaml b/management/campaign.yaml index 4ff9236..4fda3e1 100644 --- a/management/campaign.yaml +++ b/management/campaign.yaml @@ -9,6 +9,26 @@ tags: - name: campaign description: Manage Campaigns paths: + /v2/campaign: + post: + tags: + - campaign + description: Create Nested Campaign + operationId: createNested + security: + - ApiKeyAuth: [] + requestBody: + content: + application/json: + schema: + $ref: './schemas/campaign.yaml#/schemas/NestedCampaignInput' + responses: + 200: + description: Nested Campaign Created + content: + application/json: + schema: + $ref: './schemas/campaign.yaml#/schemas/NestedCampaignOutput' /v1/campaign: post: tags: @@ -21,57 +41,7 @@ paths: content: application/json: schema: - type: object - required: - - AdvertiserId - - Name - - StartDateISO - properties: - AdvertiserId: - type: integer - format: int32 - Name: - type: string - IsActive: - type: boolean - nullable: true - IsDeleted: - type: boolean - default: false - nullable: true - IsArchived: - type: boolean - default: false - nullable: true - FreqCap: - type: integer - format: int32 - nullable: true - FreqCapDuration: - type: integer - format: int32 - nullable: true - FreqCapType: - type: integer - format: int32 - enum: [1, 2, 3] - nullable: true - DontAffectParentFreqCap: - type: boolean - nullable: true - CapType: - type: integer - format: int32 - nullable: true - default: 4 - DailyCapAmount: - type: integer - format: int32 - nullable: true - LifetimeCapAmount: - type: integer - format: int32 - nullable: true + $ref: './schemas/campaign.yaml#/schemas/Campaign' responses: 200: description: Campaign Created @@ -235,4 +205,4 @@ paths: $ref: './schemas/campaign.yaml#/schemas/CampaignList' components: securitySchemes: - $ref: './components/security-schemes.yaml#/components/securitySchemes' \ No newline at end of file + $ref: './components/security-schemes.yaml#/components/securitySchemes' diff --git a/management/creative.yaml b/management/creative.yaml index ff3774c..e295b2b 100644 --- a/management/creative.yaml +++ b/management/creative.yaml @@ -21,68 +21,7 @@ paths: content: application/json: schema: - type: object - required: - - AdvertiserId - - AdTypeId - - IsActive - properties: - AdvertiserId: - type: integer - format: int32 - AdTypeId: - type: integer - format: int32 - IsActive: - type: boolean - default: false - Title: - type: string - nullable: true - ImageName: - type: string - nullable: true - Body: - type: string - nullable: true - Url: - type: string - nullable: true - format: url - Alt: - type: string - nullable: true - IsDeleted: - type: boolean - nullable: true - IsHTMLJS: - type: boolean - nullable: true - ScriptBody: - type: string - nullable: true - Metadata: - type: string - nullable: true - ImageLink: - type: string - nullable: true - SaveEmptyCreative: - type: boolean - nullable: true - IsNoTrack: - type: boolean - nullable: true - IsNetworkAd: - type: boolean - nullable: true - TemplateId: - type: integer - format: int32 - nullable: true - TemplateValues: - type: string - nullable: true + $ref: './schemas/creative.yaml#/schemas/Creative' responses: 200: description: Creative Created @@ -313,4 +252,4 @@ paths: $ref: './schemas/creative.yaml#/schemas/CreativeList' components: securitySchemes: - $ref: './components/security-schemes.yaml#/components/securitySchemes' \ No newline at end of file + $ref: './components/security-schemes.yaml#/components/securitySchemes' diff --git a/management/flight.yaml b/management/flight.yaml index d90c551..23d4e12 100644 --- a/management/flight.yaml +++ b/management/flight.yaml @@ -436,243 +436,7 @@ paths: content: application/json: schema: - type: object - required: - - Name - - StartDateISO - - CampaignId - - PriorityId - - GoalType - - Impressions - - IsActive - properties: - Name: - type: string - StartDateISO: - type: string - format: date-time - CampaignId: - type: integer - format: int32 - PriorityId: - type: integer - format: int32 - GoalType: - type: integer - format: int32 - enum: [1, 2, 3, 7, 8, 9, 10] - Impressions: - type: integer - format: int32 - IsActive: - type: boolean - default: false - EndDateISO: - type: string - format: date-time - nullable: true - IsDeleted: - type: boolean - nullable: true - RateType: - type: integer - format: int32 - enum: [1, 2, 3, 4, 5, 6] - nullable: true - Price: - type: number - format: float - nullable: true - CapType: - type: integer - format: int32 - enum: [1, 2, 3, 4] - nullable: true - DailyCapAmount: - type: integer - format: int32 - nullable: true - DailyCapAmountDecimal: - type: number - format: float - nullable: true - LifetimeCapAmount: - type: integer - format: int32 - nullable: true - LifetimeCapAmountDecimal: - type: number - format: float - nullable: true - Keywords: - type: string - nullable: true - CustomTargeting: - type: string - nullable: true - CustomFieldsJSON: - type: string - nullable: true - IsFreqCap: - type: boolean - nullable: true - FreqCap: - type: integer - format: int32 - nullable: true - FreqCapDuration: - type: integer - format: int32 - nullable: true - FreqCapType: - type: integer - format: int32 - nullable: true - enum: [1, 2, 3] - DontAffectParentFreqCap: - type: boolean - nullable: true - IsCompanion: - type: boolean - nullable: true - isNoDuplicates: - type: boolean - nullable: true - DuplicateMode: - type: integer - format: int32 - nullable: true - enum: [1, 2, 3, 4] - DeliveryStatus: - type: integer - format: int32 - nullable: true - enum: [1, 2, 3, 4, 5] - IsTrackingConversions: - type: boolean - nullable: true - CanPassback: - type: boolean - nullable: true - PassbackSortOrder: - type: integer - format: int32 - nullable: true - IsECPMOptimized: - type: boolean - nullable: true - ECPMOptimizePeriod: - type: integer - format: int32 - minimum: 1 - maximum: 90 - nullable: true - ECPMMultiplier: - type: number - format: float - nullable: true - FloorECPM: - type: number - format: float - nullable: true - CeilingECPM: - type: number - format: float - nullable: true - DefaultECPM: - type: number - format: float - nullable: true - ECPMBurnInImpressions: - type: integer - format: int32 - nullable: true - EffectiveCPMOverride: - type: number - format: float - nullable: true - DatePartingStartTimeISO: - type: string - format: date-time - nullable: true - DatePartingEndTimeISO: - type: string - format: date-time - nullable: true - IsSunday: - type: boolean - nullable: true - IsMonday: - type: boolean - nullable: true - IsTuesday: - type: boolean - nullable: true - IsWednesday: - type: boolean - nullable: true - IsThursday: - type: boolean - nullable: true - IsFriday: - type: boolean - nullable: true - IsSaturday: - type: boolean - nullable: true - IsArchived: - type: boolean - nullable: true - RequireStrictLocation: - type: boolean - nullable: true - TimeZone: - type: string - nullable: true - IsTargetingOptimization: - type: boolean - nullable: true - deprecated: true - TargetingOptimizationType: - type: integer - format: int32 - nullable: true - deprecated: true - TargetingOptimizationTargetType: - type: integer - format: int32 - nullable: true - deprecated: true - TargetingOptimizationTarget: - type: number - format: float - nullable: true - deprecated: true - TargetOptimizationBurnIn: - type: integer - format: int32 - nullable: true - deprecated: true - TargetingOptimizationCanMiss: - type: boolean - nullable: true - deprecated: true - AttributionClick: - type: object - nullable: true - required: - - MatchType - - LookbackWindow - AttributionView: - type: object - nullable: true - required: - - MatchType - - LookbackWindow - TargetROAS: - type: number - format: float - nullable: true + $ref: './schemas/flight.yaml#/schemas/Flight' responses: 200: description: Flight Created diff --git a/management/openapi-3.yaml b/management/openapi-3.yaml index c744ac1..cf0c933 100644 --- a/management/openapi-3.yaml +++ b/management/openapi-3.yaml @@ -171,6 +171,26 @@ paths: application/json: schema: $ref: './schemas/advertiser.yaml#/schemas/TrackingPixel' + /v2/campaign: + post: + tags: + - campaigns + description: Create Nested Campaign + operationId: createNestedCampaign + security: + - ApiKeyAuth: [] + requestBody: + content: + application/json: + schema: + $ref: './schemas/campaign.yaml#/schemas/NestedCampaignInput' + responses: + 200: + description: Nested Campaign Created + content: + application/json: + schema: + $ref: './schemas/campaign.yaml#/schemas/NestedCampaignOutput' /v1/campaign: post: tags: diff --git a/management/schemas/ad.yaml b/management/schemas/ad.yaml index 2383aee..fb58ad9 100644 --- a/management/schemas/ad.yaml +++ b/management/schemas/ad.yaml @@ -169,3 +169,28 @@ schemas: ImpressionPixelUrl: type: string format: uri + + NestedAdInput: + type: object + required: + - Creative + properties: + Creative: + $ref: './creative.yaml#/schemas/NestedCreativeInput' + IsActive: + type: boolean + default: false + ExternalMetadata: + type: string + nullable: true + + NestedAdOutput: + type: object + required: + - Id + properties: + Id: + type: integer + format: int32 + Creative: + $ref: './creative.yaml#/schemas/NestedCreativeOutput' diff --git a/management/schemas/campaign.yaml b/management/schemas/campaign.yaml index 5d2683d..85fb748 100644 --- a/management/schemas/campaign.yaml +++ b/management/schemas/campaign.yaml @@ -1,26 +1,18 @@ schemas: - Campaign: + CampaignBase: type: object required: - AdvertiserId - Name - - StartDate properties: AdvertiserId: type: integer format: int32 Name: type: string - StartDate: - type: string - default: 1/1/2018 - deprecated: true - Flights: - type: array - items: - type: object - nullable: true + minLength: 1 + maxLength: 200 IsActive: type: boolean default: false @@ -34,14 +26,17 @@ schemas: FreqCap: type: integer format: int32 + minimum: 1 nullable: true FreqCapDuration: type: integer format: int32 + minimum: 1 nullable: true FreqCapType: type: integer format: int32 + enum: [1, 2, 3] nullable: true DontAffectParentFreqCap: type: boolean @@ -49,14 +44,17 @@ schemas: CapType: type: integer format: int32 + enum: [4] nullable: true DailyCapAmount: type: integer format: int32 + minimum: 0 nullable: true LifetimeCapAmount: type: integer format: int32 + minimum: 0 nullable: true Id: type: integer @@ -71,34 +69,55 @@ schemas: IsFreqCap: type: boolean nullable: true - EndDateISO: - type: string - deprecated: true - nullable: true - Price: - type: number - deprecated: true - nullable: true - StartDateISO: - type: string - nullable: true - deprecated: true - Created: - type: string - format: date-time - nullable: true - LastModified: - type: string - format: date-time - nullable: true - Version: - type: integer - format: int32 - nullable: true - SalespersonId: - type: integer - format: int32 - nullable: true + + Campaign: + allOf: + - $ref: '#/schemas/CampaignBase' + - type: object + required: + - CampaignId + - StartDate + properties: + SalespersonId: + type: integer + format: int32 + nullable: true + StartDate: + type: string + default: 1/1/2018 + deprecated: true + Flights: + type: array + items: + type: object + nullable: true + EndDateISO: + type: string + deprecated: true + nullable: true + Price: + type: number + deprecated: true + nullable: true + StartDateISO: + type: string + nullable: true + deprecated: true + Created: + type: string + format: date-time + nullable: true + readOnly: true + LastModified: + type: string + format: date-time + nullable: true + readOnly: true + Version: + type: integer + format: int32 + nullable: true + readOnly: true CampaignList: type: object @@ -125,3 +144,27 @@ schemas: properties: campaignName: type: string + + NestedCampaignInput: + allOf: + - $ref: '#/schemas/CampaignBase' + - type: object + properties: + Flights: + type: array + nullable: true + items: + $ref: './flight.yaml#/schemas/NestedFlightInput' + + NestedCampaignOutput: + type: object + required: + - Id + properties: + Id: + type: integer + format: int32 + Flights: + type: array + items: + $ref: './flight.yaml#/schemas/NestedFlightOutput' diff --git a/management/schemas/creative.yaml b/management/schemas/creative.yaml index 7f89a0e..68b9c02 100644 --- a/management/schemas/creative.yaml +++ b/management/schemas/creative.yaml @@ -1,27 +1,20 @@ schemas: - - Creative: + CreativeBase: type: object required: - - AdvertiserId - AdTypeId - IsActive properties: - AdvertiserId: + Id: type: integer format: int32 - nullable: true + readOnly: true AdTypeId: type: integer format: int32 - nullable: true IsActive: type: boolean - nullable: true - Id: - type: integer - format: int32 - nullable: true + default: false Title: type: string nullable: true @@ -31,22 +24,18 @@ schemas: Body: type: string nullable: true - default: "" Url: type: string - format: uri - maxLength: 2000 nullable: true + format: url Alt: type: string nullable: true IsDeleted: type: boolean - default: false nullable: true IsHTMLJS: type: boolean - default: false nullable: true ScriptBody: type: string @@ -59,7 +48,6 @@ schemas: nullable: true SaveEmptyCreative: type: boolean - default: false nullable: true IsNoTrack: type: boolean @@ -75,6 +63,17 @@ schemas: type: string nullable: true + Creative: + allOf: + - $ref: '#/schemas/CreativeBase' + - type: object + required: + - AdvertiserId + properties: + AdvertiserId: + type: integer + format: int32 + CreativeList: type: object properties: @@ -93,4 +92,17 @@ schemas: items: type: array items: - $ref: '#/schemas/Creative' \ No newline at end of file + $ref: '#/schemas/Creative' + + NestedCreativeInput: + allOf: + - $ref: '#/schemas/CreativeBase' + + NestedCreativeOutput: + type: object + required: + - Id + properties: + Id: + type: integer + format: int32 diff --git a/management/schemas/flight.yaml b/management/schemas/flight.yaml index baaea37..e93a9b3 100644 --- a/management/schemas/flight.yaml +++ b/management/schemas/flight.yaml @@ -1,10 +1,9 @@ schemas: - Flight: + FlightBase: type: object required: - Name - StartDateISO - - CampaignId - PriorityId - GoalType - Impressions @@ -15,39 +14,30 @@ schemas: StartDateISO: type: string format: date-time - CampaignId: - type: integer - format: int32 PriorityId: type: integer format: int32 GoalType: type: integer format: int32 + enum: [1, 2, 3, 7, 8, 9, 10] Impressions: type: integer format: int32 IsActive: type: boolean default: false - Id: - type: integer - format: int32 - nullable: true EndDateISO: type: string format: date-time nullable: true - NoEndDate: - type: boolean - default: false - nullable: true IsDeleted: type: boolean default: false RateType: type: integer format: int32 + enum: [1, 2, 3, 4, 5, 6] nullable: true Price: type: number @@ -56,6 +46,7 @@ schemas: CapType: type: integer format: int32 + enum: [1, 2, 3, 4] nullable: true DailyCapAmount: type: integer @@ -96,6 +87,7 @@ schemas: FreqCapType: type: integer format: int32 + enum: [1, 2, 3] nullable: true DontAffectParentFreqCap: type: boolean @@ -109,10 +101,12 @@ schemas: DuplicateMode: type: integer format: int32 + enum: [1, 2, 3, 4] nullable: true DeliveryStatus: type: integer format: int32 + enum: [1, 2, 3, 4, 5] nullable: true IsTrackingConversions: type: boolean @@ -130,6 +124,8 @@ schemas: ECPMOptimizePeriod: type: integer format: int32 + minimum: 1 + maximum: 90 nullable: true ECPMMultiplier: type: number @@ -187,26 +183,9 @@ schemas: IsArchived: type: boolean nullable: true - BehavioralTargeting: - $ref: '#/schemas/BehavioralTarget' - GeoTargeting: - type: array - nullable: true - items: - $ref: './geo-target.yaml#/schemas/GeoTarget' - SiteZoneTargeting: - type: array - nullable: true - items: - $ref: './site-zone.yaml#/schemas/SiteZone' RequireStrictLocation: type: boolean nullable: true - CreativeMaps: - type: array - nullable: true - items: - $ref: './ad.yaml#/schemas/Ad' IsTargetingOptimization: type: boolean nullable: true @@ -251,19 +230,57 @@ schemas: type: number format: float nullable: true - Created: + TimeZone: type: string - format: date-time - nullable: true - LastModified: - type: string - format: date-time - nullable: true - Version: - type: integer - format: int32 nullable: true + Flight: + allOf: + - $ref: '#/schemas/FlightBase' + - type: object + required: + - CampaignId + properties: + Id: + type: integer + format: int32 + readOnly: true + CampaignId: + type: integer + format: int32 + NoEndDate: + type: boolean + default: false + nullable: true + BehavioralTargeting: + $ref: '#/schemas/BehavioralTarget' + GeoTargeting: + type: array + nullable: true + items: + $ref: './geo-target.yaml#/schemas/GeoTarget' + SiteZoneTargeting: + type: array + nullable: true + items: + $ref: './site-zone.yaml#/schemas/SiteZone' + CreativeMaps: + type: array + nullable: true + items: + $ref: './ad.yaml#/schemas/Ad' + Created: + type: string + format: date-time + nullable: true + LastModified: + type: string + format: date-time + nullable: true + Version: + type: integer + format: int32 + nullable: true BehavioralTarget: type: object @@ -318,3 +335,26 @@ schemas: type: array items: $ref: '#/schemas/Flight' + + NestedFlightInput: + allOf: + - $ref: '#/schemas/FlightBase' + - type: object + properties: + Ads: + type: array + items: + $ref: './ad.yaml#/schemas/NestedAdInput' + + NestedFlightOutput: + type: object + required: + - Id + properties: + Id: + type: integer + format: int32 + Ads: + type: array + items: + $ref: './ad.yaml#/schemas/NestedAdOutput' diff --git a/package-lock.json b/package-lock.json index ec33385..3fef4ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@adzerk/api-specification", - "version": "1.0.2", + "version": "1.0.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@adzerk/api-specification", - "version": "1.0.2", + "version": "1.0.6", "license": "Apache-2.0", "devDependencies": { "@openapitools/openapi-generator-cli": "^2.7.0" diff --git a/package.json b/package.json index 6524959..3586f19 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,9 @@ "build-decision-ruby": "npx @openapitools/openapi-generator-cli generate --input-spec ./decision/openapi-3.yaml --generator-name ruby --output ./.build/rb/decision --config ./decision/codegen-config/ruby.json", "build-decision-typescript": "npx @openapitools/openapi-generator-cli generate --input-spec ./decision/openapi-3.yaml --generator-name typescript-fetch --output ./.build/ts/decision --config ./decision/codegen-config/typescript-fetch.json", "build-management-all": "npm run build-management-csharp && npm run build-management-ruby && npm run build-management-typescript", - "build-management-csharp": "npx @openapitools/openapi-generator-cli generate --input-spec ./management/openapi-3.yaml --generator-name csharp --output ./.build/cs/management --config ./management/codegen-config/csharp-netcore.json --skip-validate-spec", - "build-management-ruby": "npx @openapitools/openapi-generator-cli generate --input-spec ./management/openapi-3.yaml --generator-name ruby --output ./.build/rb/management --config ./management/codegen-config/ruby.json --skip-validate-spec", - "build-management-typescript": "npx @openapitools/openapi-generator-cli generate --input-spec ./management/openapi-3.yaml --generator-name typescript-fetch --output ./.build/ts/management --config ./management/codegen-config/typescript-fetch.json --skip-validate-spec", + "build-management-csharp": "npx @openapitools/openapi-generator-cli generate --input-spec ./management/openapi-3.yaml --generator-name csharp --output ./.build/cs/management --config ./management/codegen-config/csharp-netcore.json", + "build-management-ruby": "npx @openapitools/openapi-generator-cli generate --input-spec ./management/openapi-3.yaml --generator-name ruby --output ./.build/rb/management --config ./management/codegen-config/ruby.json", + "build-management-typescript": "npx @openapitools/openapi-generator-cli generate --input-spec ./management/openapi-3.yaml --generator-name typescript-fetch --output ./.build/ts/management --config ./management/codegen-config/typescript-fetch.json", "clean": "rm -rf .build" }, "repository": {