diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..9485214
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,5 @@
+## 1.9.0
+
+### New Features
+
+- **New Feature: App Icon Badge Count** - Show MRR, user counts, stock prices, and more on your ActivitySmith app icon.
diff --git a/README.md b/README.md
index d37ff09..48a5872 100644
--- a/README.md
+++ b/README.md
@@ -20,8 +20,9 @@ See [API reference](https://activitysmith.com/docs/api-reference/introduction).
- [Live Activity Action](#live-activity-action)
- [Icons and Badges](#icons-and-badges)
- [Live Activity Colors](#live-activity-colors)
-- [Channels](#channels)
- [Widgets](#widgets)
+- [App Icon Badge Count](#app-icon-badge-count)
+- [Channels](#channels)
## Installation
@@ -531,21 +532,6 @@ Choose from these colors for the Live Activity accent, including progress bars a
`lime`, `green`, `cyan`, `blue`, `purple`, `magenta`, `red`, `orange`, `yellow`, `gray`
-## Channels
-
-Channels are used to target specific team members or devices. Can be used for both push notifications and live activities.
-
-```go
-request := generated.NewPushNotificationRequest("New subscription 💸")
-request.SetMessage("Customer upgraded to Pro plan")
-request.SetTarget(generated.ChannelTarget{Channels: []string{"sales", "customer-success"}}) // Optional
-
-_, err := activitysmith.Notifications.Send(request)
-if err != nil {
- log.Fatal(err)
-}
-```
-
## Widgets
@@ -574,6 +560,58 @@ if err != nil {
}
```
+## App Icon Badge Count
+
+
+
+
+
+Show the number you care about on your ActivitySmith app icon. Track MRR, a customer count, a stock price, or any other value you want to keep in view.
+
+Set or update the badge value.
+
+```go
+activitysmith.BadgeCount(8333)
+```
+
+To clear the badge, set its value to 0.
+
+```go
+activitysmith.BadgeCount(0)
+```
+
+## Channels
+
+Use `channels` to target specific team members or devices
+
+### Push Notifications
+
+```go
+activitysmith.Notifications.Send(activitysmithsdk.PushNotificationInput{
+ Title: "New subscription 💸",
+ Message: "Customer upgraded to Pro plan",
+ Channels: []string{"sales", "customer-success"},
+})
+```
+
+### Live Activities
+
+```go
+activitysmith.LiveActivities.Start(activitysmithsdk.LiveActivityStartInput{
+ Title: "Nightly Database Backup",
+ Subtitle: "verify restore",
+ Type: "progress",
+ Percentage: 62,
+ Channels: []string{"sales", "customer-success"},
+})
+```
+
+### App Icon Badge Count
+
+```go
+activitysmith.BadgeCount(3, "sales", "customer-success")
+```
+
## Error Handling
SDK methods return `(response, error)`. Always check `error` on each call.
diff --git a/badge_count.go b/badge_count.go
new file mode 100644
index 0000000..6eb51fc
--- /dev/null
+++ b/badge_count.go
@@ -0,0 +1,27 @@
+package activitysmith
+
+import (
+ "fmt"
+ "math"
+
+ "github.com/ActivitySmithHQ/activitysmith-go/generated"
+)
+
+// BadgeCount sets the count shown on the ActivitySmith app icon. Pass 0 to clear it.
+func (c *Client) BadgeCount(value int, channels ...string) (*generated.AppIconBadgeCountUpdateResponse, error) {
+ if value < 0 || value > math.MaxInt32 {
+ return nil, fmt.Errorf("activitysmith: badge count must be between 0 and %d", math.MaxInt32)
+ }
+
+ request := *generated.NewAppIconBadgeCountUpdateRequest(int32(value))
+ if len(channels) > 0 {
+ request.SetTarget(generated.ChannelTarget{Channels: append([]string{}, channels...)})
+ }
+
+ response, _, err := c.apiClient.AppIconBadgesAPI.
+ UpdateAppIconBadgeCount(c.ctx).
+ AppIconBadgeCountUpdateRequest(request).
+ Execute()
+
+ return response, err
+}
diff --git a/generated/api/openapi.yaml b/generated/api/openapi.yaml
index c0e9ffc..83dfd66 100644
--- a/generated/api/openapi.yaml
+++ b/generated/api/openapi.yaml
@@ -11,11 +11,117 @@ security:
tags:
- description: Send push notifications to paired devices.
name: PushNotifications
+- description: Update App Icon Badge Counts on paired devices.
+ name: AppIconBadges
- description: "Start, update, stream, and end Live Activities."
name: LiveActivities
- description: Update metric values shown in ActivitySmith widgets.
name: Metrics
paths:
+ /badge:
+ post:
+ description: "Updates the App Icon Badge Count on devices matched by API key\
+ \ scope and optional target channels. Send `badge: 0` to clear the count.\
+ \ Badge updates are independent of push notifications and do not create a\
+ \ push notification history item."
+ operationId: updateAppIconBadgeCount
+ requestBody:
+ content:
+ application/json:
+ examples:
+ set_count:
+ value:
+ badge: 12
+ clear_count:
+ value:
+ badge: 0
+ channel_targeted:
+ value:
+ badge: 3
+ target:
+ channels:
+ - sales
+ - customer-success
+ schema:
+ $ref: '#/components/schemas/AppIconBadgeCountUpdateRequest'
+ required: true
+ responses:
+ "200":
+ content:
+ application/json:
+ examples:
+ default:
+ value:
+ success: true
+ badge: 12
+ devices_notified: 2
+ users_notified: 1
+ effective_channel_slugs: null
+ timestamp: 2026-07-10T12:00:00.000Z
+ channel_targeted:
+ value:
+ success: true
+ badge: 3
+ devices_notified: 2
+ users_notified: 1
+ effective_channel_slugs:
+ - sales
+ - customer-success
+ timestamp: 2026-07-10T12:00:00.000Z
+ schema:
+ $ref: '#/components/schemas/AppIconBadgeCountUpdateResponse'
+ description: App Icon Badge Count updated
+ "400":
+ content:
+ application/json:
+ examples:
+ invalid_badge:
+ value:
+ error: Invalid badge
+ message: badge must be a non-negative integer between 0 and 2147483647.
+ Use 0 to clear the badge.
+ schema:
+ $ref: '#/components/schemas/BadRequestError'
+ description: Bad request (invalid badge value or channel targeting input)
+ "403":
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ForbiddenError'
+ description: Forbidden (API key scope or channel assignment violation)
+ "404":
+ content:
+ application/json:
+ examples:
+ no_devices:
+ value:
+ error: No recipients found
+ message: No devices matched the effective channel target
+ badge: 12
+ effective_channel_slugs:
+ - sales
+ schema:
+ $ref: '#/components/schemas/NoRecipientsError'
+ description: No recipients found for effective channel target
+ "429":
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/RateLimitError'
+ description: Rate limit exceeded
+ summary: Update App Icon Badge Count
+ tags:
+ - AppIconBadges
+ x-codeSamples:
+ - lang: bash
+ label: cURL
+ source: |-
+ curl -X POST "https://activitysmith.com/api/badge" \
+ -H "Authorization: Bearer $ACTIVITYSMITH_API_KEY" \
+ -H "Content-Type: application/json" \
+ -d '{
+ "badge": 12
+ }'
/push-notification:
post:
description: "Sends a push notification to devices matched by API key scope\
@@ -1564,7 +1670,7 @@ paths:
components:
schemas:
ContentStateStart:
- additionalProperties: true
+ additionalProperties: false
description: "Start payload requires title and type. For segmented_progress\
\ include number_of_steps and current_step. For progress include percentage\
\ or value with upper_limit. For metrics and stats include a non-empty metrics\
@@ -1739,7 +1845,7 @@ components:
- title
- type
ContentStateUpdate:
- additionalProperties: true
+ additionalProperties: false
description: "Update payload requires title. For segmented_progress include\
\ current_step and optionally number_of_steps. For progress include percentage\
\ or value with upper_limit. For metrics and stats include a non-empty metrics\
@@ -1915,7 +2021,7 @@ components:
required:
- title
ContentStateEnd:
- additionalProperties: true
+ additionalProperties: false
description: "End payload requires title. For segmented_progress include current_step\
\ and optionally number_of_steps. For progress include percentage or value\
\ with upper_limit. For metrics and stats include a non-empty metrics array.\
@@ -2098,7 +2204,7 @@ components:
required:
- title
StreamContentState:
- additionalProperties: true
+ additionalProperties: false
description: "Current state for a managed Live Activity stream. Include type\
\ on the first PUT, and whenever the stream may need to start a fresh activity.\
\ Supports segmented_progress, progress, metrics, stats, alert, and timer\
@@ -2279,7 +2385,7 @@ components:
required:
- title
ActivityMetric:
- additionalProperties: true
+ additionalProperties: false
example:
unit: unit
color: lime
@@ -2324,7 +2430,7 @@ components:
- gray
type: string
LiveActivityAlertIcon:
- additionalProperties: true
+ additionalProperties: false
description: Optional SF Symbol icon for Live Activities.
example:
symbol: symbol
@@ -2339,7 +2445,7 @@ components:
required:
- symbol
LiveActivityAlertBadge:
- additionalProperties: true
+ additionalProperties: false
description: Optional badge for Live Activities.
example:
color: null
@@ -2353,7 +2459,7 @@ components:
required:
- title
AlertPayload:
- additionalProperties: true
+ additionalProperties: false
example:
title: title
body: body
@@ -2363,7 +2469,7 @@ components:
body:
type: string
ChannelTarget:
- additionalProperties: true
+ additionalProperties: false
example:
channels:
- channels
@@ -2397,8 +2503,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
properties:
title:
@@ -2413,7 +2518,7 @@ components:
method:
$ref: '#/components/schemas/PushNotificationWebhookMethod'
body:
- additionalProperties: true
+ additionalProperties: false
description: Optional webhook payload body. Used only when type=webhook.
required:
- title
@@ -2431,7 +2536,7 @@ components:
- POST
type: string
LiveActivityAction:
- additionalProperties: true
+ additionalProperties: {}
allOf:
- {}
- {}
@@ -2442,8 +2547,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
properties:
title:
@@ -2458,7 +2562,7 @@ components:
method:
$ref: '#/components/schemas/LiveActivityWebhookMethod'
body:
- additionalProperties: true
+ additionalProperties: false
description: Optional webhook payload body. Used only when type=webhook.
required:
- title
@@ -2468,8 +2572,7 @@ components:
additionalProperties: {}
example:
badge: 0
- payload:
- key: ""
+ payload: "{}"
subtitle: subtitle
sound: sound
media: https://openapi-generator.tech
@@ -2480,26 +2583,22 @@ components:
- method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
- method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
- method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
- method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
target:
channels:
@@ -2530,7 +2629,7 @@ components:
$ref: '#/components/schemas/PushNotificationAction'
maxItems: 4
payload:
- additionalProperties: true
+ additionalProperties: false
badge: {}
sound: {}
target:
@@ -2538,7 +2637,7 @@ components:
required:
- title
PushNotificationResponse:
- additionalProperties: true
+ additionalProperties: false
example:
success: true
users_notified: 6
@@ -2564,8 +2663,64 @@ components:
required:
- success
- timestamp
+ AppIconBadgeCountUpdateRequest:
+ additionalProperties: false
+ description: App Icon Badge Count update. Send badge 0 to clear the count.
+ example:
+ badge: 171976544
+ target:
+ channels:
+ - channels
+ - channels
+ properties:
+ badge:
+ description: The count to show on the ActivitySmith app icon. Send 0 to
+ clear it.
+ maximum: 2147483647
+ minimum: 0
+ type: integer
+ target:
+ $ref: '#/components/schemas/ChannelTarget'
+ required:
+ - badge
+ AppIconBadgeCountUpdateResponse:
+ additionalProperties: false
+ example:
+ badge: 171976544
+ success: true
+ users_notified: 1
+ devices_notified: 6
+ effective_channel_slugs:
+ - effective_channel_slugs
+ - effective_channel_slugs
+ timestamp: 2000-01-23T04:56:07.000+00:00
+ properties:
+ success:
+ type: boolean
+ badge:
+ maximum: 2147483647
+ minimum: 0
+ type: integer
+ devices_notified:
+ type: integer
+ users_notified:
+ type: integer
+ effective_channel_slugs:
+ items:
+ type: string
+ type: array
+ timestamp:
+ format: date-time
+ type: string
+ required:
+ - badge
+ - devices_notified
+ - effective_channel_slugs
+ - success
+ - timestamp
+ - users_notified
LiveActivityStartRequest:
- additionalProperties: true
+ additionalProperties: false
description: Start a new Live Activity. The response includes activity_id for
later update and end calls.
example:
@@ -2618,8 +2773,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
alert:
title: title
@@ -2628,8 +2782,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
target:
channels:
@@ -2649,7 +2802,7 @@ components:
required:
- content_state
LiveActivityStartResponse:
- additionalProperties: true
+ additionalProperties: false
description: Returned after a Live Activity starts. Save activity_id and use
it for all later updates and for the final end call.
example:
@@ -2682,7 +2835,7 @@ components:
- success
- timestamp
LiveActivityStreamRequest:
- additionalProperties: true
+ additionalProperties: false
description: "Send the latest state for a managed Live Activity stream. channels\
\ is the streamlined form for stream targeting. target.channels is also accepted\
\ for compatibility. If both are provided, they must match."
@@ -2738,8 +2891,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
channels:
- channels
@@ -2751,8 +2903,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
target:
channels:
@@ -2778,7 +2929,7 @@ components:
required:
- content_state
LiveActivityStreamPutResponse:
- additionalProperties: true
+ additionalProperties: false
description: Returned after a managed stream request is reconciled.
example:
devices_queued: 6
@@ -2830,7 +2981,7 @@ components:
- success
- timestamp
LiveActivityStreamDeleteRequest:
- additionalProperties: true
+ additionalProperties: false
description: "Optional payload for ending a managed stream. When omitted, ActivitySmith\
\ ends the stream using the latest known state when possible."
example:
@@ -2885,8 +3036,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
alert:
title: title
@@ -2895,8 +3045,7 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
properties:
content_state:
@@ -2908,7 +3057,7 @@ components:
alert:
$ref: '#/components/schemas/AlertPayload'
LiveActivityStreamDeleteResponse:
- additionalProperties: true
+ additionalProperties: false
description: Returned after a managed stream is ended and removed.
example:
devices_queued: 0
@@ -2943,7 +3092,7 @@ components:
- success
- timestamp
MetricValueUpdateRequest:
- additionalProperties: true
+ additionalProperties: false
description: Latest metric value to display in widgets.
example:
value: 0.8008281904610115
@@ -2959,7 +3108,7 @@ components:
required:
- value
MetricValueUpdateResponse:
- additionalProperties: true
+ additionalProperties: false
example:
success: true
properties:
@@ -2968,7 +3117,7 @@ components:
required:
- success
MetricError:
- additionalProperties: true
+ additionalProperties: false
example:
error: error
message: message
@@ -2980,7 +3129,7 @@ components:
required:
- error
BadRequestError:
- additionalProperties: true
+ additionalProperties: false
example:
error: error
message: message
@@ -2993,7 +3142,7 @@ components:
- error
- message
ForbiddenError:
- additionalProperties: true
+ additionalProperties: false
example:
error: error
message: message
@@ -3006,7 +3155,7 @@ components:
- error
- message
NoRecipientsError:
- additionalProperties: true
+ additionalProperties: false
example:
error: error
message: message
@@ -3026,7 +3175,7 @@ components:
- error
- message
NotFoundError:
- additionalProperties: true
+ additionalProperties: false
example:
error: error
message: message
@@ -3039,7 +3188,7 @@ components:
- error
- message
RateLimitError:
- additionalProperties: true
+ additionalProperties: false
example:
error: error
message: message
@@ -3052,7 +3201,7 @@ components:
- error
- message
LiveActivityLimitError:
- additionalProperties: true
+ additionalProperties: false
properties:
error:
type: string
@@ -3069,7 +3218,7 @@ components:
- limit
- message
LiveActivityUpdateRequest:
- additionalProperties: true
+ additionalProperties: false
description: Update an existing Live Activity by activity_id.
example:
content_state:
@@ -3121,16 +3270,14 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
activity_id: activity_id
action:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
properties:
activity_id:
@@ -3145,7 +3292,7 @@ components:
- activity_id
- content_state
LiveActivityUpdateResponse:
- additionalProperties: true
+ additionalProperties: false
description: Returned after a Live Activity update is sent or queued.
example:
devices_queued: 0
@@ -3170,7 +3317,7 @@ components:
- success
- timestamp
LiveActivityEndRequest:
- additionalProperties: true
+ additionalProperties: false
description: End an existing Live Activity by activity_id.
example:
content_state:
@@ -3223,16 +3370,14 @@ components:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
activity_id: activity_id
action:
method: POST
title: title
type: open_url
- body:
- key: ""
+ body: "{}"
url: https://openapi-generator.tech
properties:
activity_id:
@@ -3247,7 +3392,7 @@ components:
- activity_id
- content_state
LiveActivityEndResponse:
- additionalProperties: true
+ additionalProperties: false
description: Returned after a Live Activity end event is sent or queued.
example:
devices_queued: 0
diff --git a/generated/api_app_icon_badges.go b/generated/api_app_icon_badges.go
new file mode 100644
index 0000000..4eb8cf3
--- /dev/null
+++ b/generated/api_app_icon_badges.go
@@ -0,0 +1,176 @@
+/*
+ActivitySmith API
+
+Send push notifications and Live Activities to your own devices via a single API key.
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package generated
+
+import (
+ "bytes"
+ "context"
+ "io"
+ "net/http"
+ "net/url"
+)
+
+
+// AppIconBadgesAPIService AppIconBadgesAPI service
+type AppIconBadgesAPIService service
+
+type ApiUpdateAppIconBadgeCountRequest struct {
+ ctx context.Context
+ ApiService *AppIconBadgesAPIService
+ appIconBadgeCountUpdateRequest *AppIconBadgeCountUpdateRequest
+}
+
+func (r ApiUpdateAppIconBadgeCountRequest) AppIconBadgeCountUpdateRequest(appIconBadgeCountUpdateRequest AppIconBadgeCountUpdateRequest) ApiUpdateAppIconBadgeCountRequest {
+ r.appIconBadgeCountUpdateRequest = &appIconBadgeCountUpdateRequest
+ return r
+}
+
+func (r ApiUpdateAppIconBadgeCountRequest) Execute() (*AppIconBadgeCountUpdateResponse, *http.Response, error) {
+ return r.ApiService.UpdateAppIconBadgeCountExecute(r)
+}
+
+/*
+UpdateAppIconBadgeCount Update App Icon Badge Count
+
+Updates the App Icon Badge Count on devices matched by API key scope and optional target channels. Send `badge: 0` to clear the count. Badge updates are independent of push notifications and do not create a push notification history item.
+
+ @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
+ @return ApiUpdateAppIconBadgeCountRequest
+*/
+func (a *AppIconBadgesAPIService) UpdateAppIconBadgeCount(ctx context.Context) ApiUpdateAppIconBadgeCountRequest {
+ return ApiUpdateAppIconBadgeCountRequest{
+ ApiService: a,
+ ctx: ctx,
+ }
+}
+
+// Execute executes the request
+// @return AppIconBadgeCountUpdateResponse
+func (a *AppIconBadgesAPIService) UpdateAppIconBadgeCountExecute(r ApiUpdateAppIconBadgeCountRequest) (*AppIconBadgeCountUpdateResponse, *http.Response, error) {
+ var (
+ localVarHTTPMethod = http.MethodPost
+ localVarPostBody interface{}
+ formFiles []formFile
+ localVarReturnValue *AppIconBadgeCountUpdateResponse
+ )
+
+ localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AppIconBadgesAPIService.UpdateAppIconBadgeCount")
+ if err != nil {
+ return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
+ }
+
+ localVarPath := localBasePath + "/badge"
+
+ localVarHeaderParams := make(map[string]string)
+ localVarQueryParams := url.Values{}
+ localVarFormParams := url.Values{}
+ if r.appIconBadgeCountUpdateRequest == nil {
+ return localVarReturnValue, nil, reportError("appIconBadgeCountUpdateRequest is required and must be specified")
+ }
+
+ // to determine the Content-Type header
+ localVarHTTPContentTypes := []string{"application/json"}
+
+ // set Content-Type header
+ localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
+ if localVarHTTPContentType != "" {
+ localVarHeaderParams["Content-Type"] = localVarHTTPContentType
+ }
+
+ // to determine the Accept header
+ localVarHTTPHeaderAccepts := []string{"application/json"}
+
+ // set Accept header
+ localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
+ if localVarHTTPHeaderAccept != "" {
+ localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
+ }
+ // body params
+ localVarPostBody = r.appIconBadgeCountUpdateRequest
+ req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
+ if err != nil {
+ return localVarReturnValue, nil, err
+ }
+
+ localVarHTTPResponse, err := a.client.callAPI(req)
+ if err != nil || localVarHTTPResponse == nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
+ localVarHTTPResponse.Body.Close()
+ localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
+ if err != nil {
+ return localVarReturnValue, localVarHTTPResponse, err
+ }
+
+ if localVarHTTPResponse.StatusCode >= 300 {
+ newErr := &GenericOpenAPIError{
+ body: localVarBody,
+ error: localVarHTTPResponse.Status,
+ }
+ if localVarHTTPResponse.StatusCode == 400 {
+ var v BadRequestError
+ err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
+ newErr.model = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 403 {
+ var v ForbiddenError
+ err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
+ newErr.model = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 404 {
+ var v NoRecipientsError
+ err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
+ newErr.model = v
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ if localVarHTTPResponse.StatusCode == 429 {
+ var v RateLimitError
+ err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr.error = err.Error()
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+ newErr.error = formatErrorMessage(localVarHTTPResponse.Status, &v)
+ newErr.model = v
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
+ if err != nil {
+ newErr := &GenericOpenAPIError{
+ body: localVarBody,
+ error: err.Error(),
+ }
+ return localVarReturnValue, localVarHTTPResponse, newErr
+ }
+
+ return localVarReturnValue, localVarHTTPResponse, nil
+}
diff --git a/generated/client.go b/generated/client.go
index 45a90a6..c27e272 100644
--- a/generated/client.go
+++ b/generated/client.go
@@ -49,6 +49,8 @@ type APIClient struct {
// API Services
+ AppIconBadgesAPI *AppIconBadgesAPIService
+
LiveActivitiesAPI *LiveActivitiesAPIService
MetricsAPI *MetricsAPIService
@@ -72,6 +74,7 @@ func NewAPIClient(cfg *Configuration) *APIClient {
c.common.client = c
// API Services
+ c.AppIconBadgesAPI = (*AppIconBadgesAPIService)(&c.common)
c.LiveActivitiesAPI = (*LiveActivitiesAPIService)(&c.common)
c.MetricsAPI = (*MetricsAPIService)(&c.common)
c.PushNotificationsAPI = (*PushNotificationsAPIService)(&c.common)
diff --git a/generated/docs/AppIconBadgeCountUpdateRequest.md b/generated/docs/AppIconBadgeCountUpdateRequest.md
new file mode 100644
index 0000000..70aa5b1
--- /dev/null
+++ b/generated/docs/AppIconBadgeCountUpdateRequest.md
@@ -0,0 +1,77 @@
+# AppIconBadgeCountUpdateRequest
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Badge** | **int32** | The count to show on the ActivitySmith app icon. Send 0 to clear it. |
+**Target** | Pointer to [**ChannelTarget**](ChannelTarget.md) | | [optional]
+
+## Methods
+
+### NewAppIconBadgeCountUpdateRequest
+
+`func NewAppIconBadgeCountUpdateRequest(badge int32, ) *AppIconBadgeCountUpdateRequest`
+
+NewAppIconBadgeCountUpdateRequest instantiates a new AppIconBadgeCountUpdateRequest object
+This constructor will assign default values to properties that have it defined,
+and makes sure properties required by API are set, but the set of arguments
+will change when the set of required properties is changed
+
+### NewAppIconBadgeCountUpdateRequestWithDefaults
+
+`func NewAppIconBadgeCountUpdateRequestWithDefaults() *AppIconBadgeCountUpdateRequest`
+
+NewAppIconBadgeCountUpdateRequestWithDefaults instantiates a new AppIconBadgeCountUpdateRequest object
+This constructor will only assign default values to properties that have it defined,
+but it doesn't guarantee that properties required by API are set
+
+### GetBadge
+
+`func (o *AppIconBadgeCountUpdateRequest) GetBadge() int32`
+
+GetBadge returns the Badge field if non-nil, zero value otherwise.
+
+### GetBadgeOk
+
+`func (o *AppIconBadgeCountUpdateRequest) GetBadgeOk() (*int32, bool)`
+
+GetBadgeOk returns a tuple with the Badge field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetBadge
+
+`func (o *AppIconBadgeCountUpdateRequest) SetBadge(v int32)`
+
+SetBadge sets Badge field to given value.
+
+
+### GetTarget
+
+`func (o *AppIconBadgeCountUpdateRequest) GetTarget() ChannelTarget`
+
+GetTarget returns the Target field if non-nil, zero value otherwise.
+
+### GetTargetOk
+
+`func (o *AppIconBadgeCountUpdateRequest) GetTargetOk() (*ChannelTarget, bool)`
+
+GetTargetOk returns a tuple with the Target field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetTarget
+
+`func (o *AppIconBadgeCountUpdateRequest) SetTarget(v ChannelTarget)`
+
+SetTarget sets Target field to given value.
+
+### HasTarget
+
+`func (o *AppIconBadgeCountUpdateRequest) HasTarget() bool`
+
+HasTarget returns a boolean if a field has been set.
+
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/generated/docs/AppIconBadgeCountUpdateResponse.md b/generated/docs/AppIconBadgeCountUpdateResponse.md
new file mode 100644
index 0000000..99f184f
--- /dev/null
+++ b/generated/docs/AppIconBadgeCountUpdateResponse.md
@@ -0,0 +1,156 @@
+# AppIconBadgeCountUpdateResponse
+
+## Properties
+
+Name | Type | Description | Notes
+------------ | ------------- | ------------- | -------------
+**Success** | **bool** | |
+**Badge** | **int32** | |
+**DevicesNotified** | **int32** | |
+**UsersNotified** | **int32** | |
+**EffectiveChannelSlugs** | **[]string** | |
+**Timestamp** | **time.Time** | |
+
+## Methods
+
+### NewAppIconBadgeCountUpdateResponse
+
+`func NewAppIconBadgeCountUpdateResponse(success bool, badge int32, devicesNotified int32, usersNotified int32, effectiveChannelSlugs []string, timestamp time.Time, ) *AppIconBadgeCountUpdateResponse`
+
+NewAppIconBadgeCountUpdateResponse instantiates a new AppIconBadgeCountUpdateResponse object
+This constructor will assign default values to properties that have it defined,
+and makes sure properties required by API are set, but the set of arguments
+will change when the set of required properties is changed
+
+### NewAppIconBadgeCountUpdateResponseWithDefaults
+
+`func NewAppIconBadgeCountUpdateResponseWithDefaults() *AppIconBadgeCountUpdateResponse`
+
+NewAppIconBadgeCountUpdateResponseWithDefaults instantiates a new AppIconBadgeCountUpdateResponse object
+This constructor will only assign default values to properties that have it defined,
+but it doesn't guarantee that properties required by API are set
+
+### GetSuccess
+
+`func (o *AppIconBadgeCountUpdateResponse) GetSuccess() bool`
+
+GetSuccess returns the Success field if non-nil, zero value otherwise.
+
+### GetSuccessOk
+
+`func (o *AppIconBadgeCountUpdateResponse) GetSuccessOk() (*bool, bool)`
+
+GetSuccessOk returns a tuple with the Success field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetSuccess
+
+`func (o *AppIconBadgeCountUpdateResponse) SetSuccess(v bool)`
+
+SetSuccess sets Success field to given value.
+
+
+### GetBadge
+
+`func (o *AppIconBadgeCountUpdateResponse) GetBadge() int32`
+
+GetBadge returns the Badge field if non-nil, zero value otherwise.
+
+### GetBadgeOk
+
+`func (o *AppIconBadgeCountUpdateResponse) GetBadgeOk() (*int32, bool)`
+
+GetBadgeOk returns a tuple with the Badge field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetBadge
+
+`func (o *AppIconBadgeCountUpdateResponse) SetBadge(v int32)`
+
+SetBadge sets Badge field to given value.
+
+
+### GetDevicesNotified
+
+`func (o *AppIconBadgeCountUpdateResponse) GetDevicesNotified() int32`
+
+GetDevicesNotified returns the DevicesNotified field if non-nil, zero value otherwise.
+
+### GetDevicesNotifiedOk
+
+`func (o *AppIconBadgeCountUpdateResponse) GetDevicesNotifiedOk() (*int32, bool)`
+
+GetDevicesNotifiedOk returns a tuple with the DevicesNotified field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetDevicesNotified
+
+`func (o *AppIconBadgeCountUpdateResponse) SetDevicesNotified(v int32)`
+
+SetDevicesNotified sets DevicesNotified field to given value.
+
+
+### GetUsersNotified
+
+`func (o *AppIconBadgeCountUpdateResponse) GetUsersNotified() int32`
+
+GetUsersNotified returns the UsersNotified field if non-nil, zero value otherwise.
+
+### GetUsersNotifiedOk
+
+`func (o *AppIconBadgeCountUpdateResponse) GetUsersNotifiedOk() (*int32, bool)`
+
+GetUsersNotifiedOk returns a tuple with the UsersNotified field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetUsersNotified
+
+`func (o *AppIconBadgeCountUpdateResponse) SetUsersNotified(v int32)`
+
+SetUsersNotified sets UsersNotified field to given value.
+
+
+### GetEffectiveChannelSlugs
+
+`func (o *AppIconBadgeCountUpdateResponse) GetEffectiveChannelSlugs() []string`
+
+GetEffectiveChannelSlugs returns the EffectiveChannelSlugs field if non-nil, zero value otherwise.
+
+### GetEffectiveChannelSlugsOk
+
+`func (o *AppIconBadgeCountUpdateResponse) GetEffectiveChannelSlugsOk() (*[]string, bool)`
+
+GetEffectiveChannelSlugsOk returns a tuple with the EffectiveChannelSlugs field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetEffectiveChannelSlugs
+
+`func (o *AppIconBadgeCountUpdateResponse) SetEffectiveChannelSlugs(v []string)`
+
+SetEffectiveChannelSlugs sets EffectiveChannelSlugs field to given value.
+
+
+### GetTimestamp
+
+`func (o *AppIconBadgeCountUpdateResponse) GetTimestamp() time.Time`
+
+GetTimestamp returns the Timestamp field if non-nil, zero value otherwise.
+
+### GetTimestampOk
+
+`func (o *AppIconBadgeCountUpdateResponse) GetTimestampOk() (*time.Time, bool)`
+
+GetTimestampOk returns a tuple with the Timestamp field if it's non-nil, zero value otherwise
+and a boolean to check if the value has been set.
+
+### SetTimestamp
+
+`func (o *AppIconBadgeCountUpdateResponse) SetTimestamp(v time.Time)`
+
+SetTimestamp sets Timestamp field to given value.
+
+
+
+[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
+
+
diff --git a/generated/docs/AppIconBadgesAPI.md b/generated/docs/AppIconBadgesAPI.md
new file mode 100644
index 0000000..e0f80b5
--- /dev/null
+++ b/generated/docs/AppIconBadgesAPI.md
@@ -0,0 +1,75 @@
+# \AppIconBadgesAPI
+
+All URIs are relative to *https://activitysmith.com/api*
+
+Method | HTTP request | Description
+------------- | ------------- | -------------
+[**UpdateAppIconBadgeCount**](AppIconBadgesAPI.md#UpdateAppIconBadgeCount) | **Post** /badge | Update App Icon Badge Count
+
+
+
+## UpdateAppIconBadgeCount
+
+> AppIconBadgeCountUpdateResponse UpdateAppIconBadgeCount(ctx).AppIconBadgeCountUpdateRequest(appIconBadgeCountUpdateRequest).Execute()
+
+Update App Icon Badge Count
+
+
+
+### Example
+
+```go
+package main
+
+import (
+ "context"
+ "fmt"
+ "os"
+ openapiclient "github.com/GIT_USER_ID/GIT_REPO_ID"
+)
+
+func main() {
+ appIconBadgeCountUpdateRequest := *openapiclient.NewAppIconBadgeCountUpdateRequest(int32(123)) // AppIconBadgeCountUpdateRequest |
+
+ configuration := openapiclient.NewConfiguration()
+ apiClient := openapiclient.NewAPIClient(configuration)
+ resp, r, err := apiClient.AppIconBadgesAPI.UpdateAppIconBadgeCount(context.Background()).AppIconBadgeCountUpdateRequest(appIconBadgeCountUpdateRequest).Execute()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "Error when calling `AppIconBadgesAPI.UpdateAppIconBadgeCount``: %v\n", err)
+ fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
+ }
+ // response from `UpdateAppIconBadgeCount`: AppIconBadgeCountUpdateResponse
+ fmt.Fprintf(os.Stdout, "Response from `AppIconBadgesAPI.UpdateAppIconBadgeCount`: %v\n", resp)
+}
+```
+
+### Path Parameters
+
+
+
+### Other Parameters
+
+Other parameters are passed through a pointer to a apiUpdateAppIconBadgeCountRequest struct via the builder pattern
+
+
+Name | Type | Description | Notes
+------------- | ------------- | ------------- | -------------
+ **appIconBadgeCountUpdateRequest** | [**AppIconBadgeCountUpdateRequest**](AppIconBadgeCountUpdateRequest.md) | |
+
+### Return type
+
+[**AppIconBadgeCountUpdateResponse**](AppIconBadgeCountUpdateResponse.md)
+
+### Authorization
+
+[apiKeyAuth](../README.md#apiKeyAuth)
+
+### HTTP request headers
+
+- **Content-Type**: application/json
+- **Accept**: application/json
+
+[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
+[[Back to Model list]](../README.md#documentation-for-models)
+[[Back to README]](../README.md)
+
diff --git a/generated/model_activity_metric.go b/generated/model_activity_metric.go
index 659c36e..8a2727a 100644
--- a/generated/model_activity_metric.go
+++ b/generated/model_activity_metric.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -25,7 +26,6 @@ type ActivityMetric struct {
Unit *string `json:"unit,omitempty"`
// Optional per-metric accent color for metrics and stats activities.
Color *string `json:"color,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _ActivityMetric ActivityMetric
@@ -179,11 +179,6 @@ func (o ActivityMetric) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Color) {
toSerialize["color"] = o.Color
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -212,7 +207,9 @@ func (o *ActivityMetric) UnmarshalJSON(data []byte) (err error) {
varActivityMetric := _ActivityMetric{}
- err = json.Unmarshal(data, &varActivityMetric)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varActivityMetric)
if err != nil {
return err
@@ -220,16 +217,6 @@ func (o *ActivityMetric) UnmarshalJSON(data []byte) (err error) {
*o = ActivityMetric(varActivityMetric)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "label")
- delete(additionalProperties, "value")
- delete(additionalProperties, "unit")
- delete(additionalProperties, "color")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_alert_payload.go b/generated/model_alert_payload.go
index 2d58b0e..625a447 100644
--- a/generated/model_alert_payload.go
+++ b/generated/model_alert_payload.go
@@ -21,11 +21,8 @@ var _ MappedNullable = &AlertPayload{}
type AlertPayload struct {
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitempty"`
- AdditionalProperties map[string]interface{}
}
-type _AlertPayload AlertPayload
-
// NewAlertPayload instantiates a new AlertPayload object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
@@ -123,36 +120,9 @@ func (o AlertPayload) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Body) {
toSerialize["body"] = o.Body
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
-func (o *AlertPayload) UnmarshalJSON(data []byte) (err error) {
- varAlertPayload := _AlertPayload{}
-
- err = json.Unmarshal(data, &varAlertPayload)
-
- if err != nil {
- return err
- }
-
- *o = AlertPayload(varAlertPayload)
-
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "title")
- delete(additionalProperties, "body")
- o.AdditionalProperties = additionalProperties
- }
-
- return err
-}
-
type NullableAlertPayload struct {
value *AlertPayload
isSet bool
diff --git a/generated/model_app_icon_badge_count_update_request.go b/generated/model_app_icon_badge_count_update_request.go
new file mode 100644
index 0000000..838d1b0
--- /dev/null
+++ b/generated/model_app_icon_badge_count_update_request.go
@@ -0,0 +1,195 @@
+/*
+ActivitySmith API
+
+Send push notifications and Live Activities to your own devices via a single API key.
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package generated
+
+import (
+ "encoding/json"
+ "bytes"
+ "fmt"
+)
+
+// checks if the AppIconBadgeCountUpdateRequest type satisfies the MappedNullable interface at compile time
+var _ MappedNullable = &AppIconBadgeCountUpdateRequest{}
+
+// AppIconBadgeCountUpdateRequest App Icon Badge Count update. Send badge 0 to clear the count.
+type AppIconBadgeCountUpdateRequest struct {
+ // The count to show on the ActivitySmith app icon. Send 0 to clear it.
+ Badge int32 `json:"badge"`
+ Target *ChannelTarget `json:"target,omitempty"`
+}
+
+type _AppIconBadgeCountUpdateRequest AppIconBadgeCountUpdateRequest
+
+// NewAppIconBadgeCountUpdateRequest instantiates a new AppIconBadgeCountUpdateRequest object
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed
+func NewAppIconBadgeCountUpdateRequest(badge int32) *AppIconBadgeCountUpdateRequest {
+ this := AppIconBadgeCountUpdateRequest{}
+ this.Badge = badge
+ return &this
+}
+
+// NewAppIconBadgeCountUpdateRequestWithDefaults instantiates a new AppIconBadgeCountUpdateRequest object
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set
+func NewAppIconBadgeCountUpdateRequestWithDefaults() *AppIconBadgeCountUpdateRequest {
+ this := AppIconBadgeCountUpdateRequest{}
+ return &this
+}
+
+// GetBadge returns the Badge field value
+func (o *AppIconBadgeCountUpdateRequest) GetBadge() int32 {
+ if o == nil {
+ var ret int32
+ return ret
+ }
+
+ return o.Badge
+}
+
+// GetBadgeOk returns a tuple with the Badge field value
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateRequest) GetBadgeOk() (*int32, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Badge, true
+}
+
+// SetBadge sets field value
+func (o *AppIconBadgeCountUpdateRequest) SetBadge(v int32) {
+ o.Badge = v
+}
+
+// GetTarget returns the Target field value if set, zero value otherwise.
+func (o *AppIconBadgeCountUpdateRequest) GetTarget() ChannelTarget {
+ if o == nil || IsNil(o.Target) {
+ var ret ChannelTarget
+ return ret
+ }
+ return *o.Target
+}
+
+// GetTargetOk returns a tuple with the Target field value if set, nil otherwise
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateRequest) GetTargetOk() (*ChannelTarget, bool) {
+ if o == nil || IsNil(o.Target) {
+ return nil, false
+ }
+ return o.Target, true
+}
+
+// HasTarget returns a boolean if a field has been set.
+func (o *AppIconBadgeCountUpdateRequest) HasTarget() bool {
+ if o != nil && !IsNil(o.Target) {
+ return true
+ }
+
+ return false
+}
+
+// SetTarget gets a reference to the given ChannelTarget and assigns it to the Target field.
+func (o *AppIconBadgeCountUpdateRequest) SetTarget(v ChannelTarget) {
+ o.Target = &v
+}
+
+func (o AppIconBadgeCountUpdateRequest) MarshalJSON() ([]byte, error) {
+ toSerialize,err := o.ToMap()
+ if err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(toSerialize)
+}
+
+func (o AppIconBadgeCountUpdateRequest) ToMap() (map[string]interface{}, error) {
+ toSerialize := map[string]interface{}{}
+ toSerialize["badge"] = o.Badge
+ if !IsNil(o.Target) {
+ toSerialize["target"] = o.Target
+ }
+ return toSerialize, nil
+}
+
+func (o *AppIconBadgeCountUpdateRequest) UnmarshalJSON(data []byte) (err error) {
+ // This validates that all required properties are included in the JSON object
+ // by unmarshalling the object into a generic map with string keys and checking
+ // that every required field exists as a key in the generic map.
+ requiredProperties := []string{
+ "badge",
+ }
+
+ allProperties := make(map[string]interface{})
+
+ err = json.Unmarshal(data, &allProperties)
+
+ if err != nil {
+ return err;
+ }
+
+ for _, requiredProperty := range(requiredProperties) {
+ if _, exists := allProperties[requiredProperty]; !exists {
+ return fmt.Errorf("no value given for required property %v", requiredProperty)
+ }
+ }
+
+ varAppIconBadgeCountUpdateRequest := _AppIconBadgeCountUpdateRequest{}
+
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varAppIconBadgeCountUpdateRequest)
+
+ if err != nil {
+ return err
+ }
+
+ *o = AppIconBadgeCountUpdateRequest(varAppIconBadgeCountUpdateRequest)
+
+ return err
+}
+
+type NullableAppIconBadgeCountUpdateRequest struct {
+ value *AppIconBadgeCountUpdateRequest
+ isSet bool
+}
+
+func (v NullableAppIconBadgeCountUpdateRequest) Get() *AppIconBadgeCountUpdateRequest {
+ return v.value
+}
+
+func (v *NullableAppIconBadgeCountUpdateRequest) Set(val *AppIconBadgeCountUpdateRequest) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableAppIconBadgeCountUpdateRequest) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableAppIconBadgeCountUpdateRequest) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableAppIconBadgeCountUpdateRequest(val *AppIconBadgeCountUpdateRequest) *NullableAppIconBadgeCountUpdateRequest {
+ return &NullableAppIconBadgeCountUpdateRequest{value: val, isSet: true}
+}
+
+func (v NullableAppIconBadgeCountUpdateRequest) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableAppIconBadgeCountUpdateRequest) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+
diff --git a/generated/model_app_icon_badge_count_update_response.go b/generated/model_app_icon_badge_count_update_response.go
new file mode 100644
index 0000000..626f63e
--- /dev/null
+++ b/generated/model_app_icon_badge_count_update_response.go
@@ -0,0 +1,299 @@
+/*
+ActivitySmith API
+
+Send push notifications and Live Activities to your own devices via a single API key.
+
+API version: 1.0.0
+*/
+
+// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
+
+package generated
+
+import (
+ "encoding/json"
+ "time"
+ "bytes"
+ "fmt"
+)
+
+// checks if the AppIconBadgeCountUpdateResponse type satisfies the MappedNullable interface at compile time
+var _ MappedNullable = &AppIconBadgeCountUpdateResponse{}
+
+// AppIconBadgeCountUpdateResponse struct for AppIconBadgeCountUpdateResponse
+type AppIconBadgeCountUpdateResponse struct {
+ Success bool `json:"success"`
+ Badge int32 `json:"badge"`
+ DevicesNotified int32 `json:"devices_notified"`
+ UsersNotified int32 `json:"users_notified"`
+ EffectiveChannelSlugs []string `json:"effective_channel_slugs"`
+ Timestamp time.Time `json:"timestamp"`
+}
+
+type _AppIconBadgeCountUpdateResponse AppIconBadgeCountUpdateResponse
+
+// NewAppIconBadgeCountUpdateResponse instantiates a new AppIconBadgeCountUpdateResponse object
+// This constructor will assign default values to properties that have it defined,
+// and makes sure properties required by API are set, but the set of arguments
+// will change when the set of required properties is changed
+func NewAppIconBadgeCountUpdateResponse(success bool, badge int32, devicesNotified int32, usersNotified int32, effectiveChannelSlugs []string, timestamp time.Time) *AppIconBadgeCountUpdateResponse {
+ this := AppIconBadgeCountUpdateResponse{}
+ this.Success = success
+ this.Badge = badge
+ this.DevicesNotified = devicesNotified
+ this.UsersNotified = usersNotified
+ this.EffectiveChannelSlugs = effectiveChannelSlugs
+ this.Timestamp = timestamp
+ return &this
+}
+
+// NewAppIconBadgeCountUpdateResponseWithDefaults instantiates a new AppIconBadgeCountUpdateResponse object
+// This constructor will only assign default values to properties that have it defined,
+// but it doesn't guarantee that properties required by API are set
+func NewAppIconBadgeCountUpdateResponseWithDefaults() *AppIconBadgeCountUpdateResponse {
+ this := AppIconBadgeCountUpdateResponse{}
+ return &this
+}
+
+// GetSuccess returns the Success field value
+func (o *AppIconBadgeCountUpdateResponse) GetSuccess() bool {
+ if o == nil {
+ var ret bool
+ return ret
+ }
+
+ return o.Success
+}
+
+// GetSuccessOk returns a tuple with the Success field value
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateResponse) GetSuccessOk() (*bool, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Success, true
+}
+
+// SetSuccess sets field value
+func (o *AppIconBadgeCountUpdateResponse) SetSuccess(v bool) {
+ o.Success = v
+}
+
+// GetBadge returns the Badge field value
+func (o *AppIconBadgeCountUpdateResponse) GetBadge() int32 {
+ if o == nil {
+ var ret int32
+ return ret
+ }
+
+ return o.Badge
+}
+
+// GetBadgeOk returns a tuple with the Badge field value
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateResponse) GetBadgeOk() (*int32, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Badge, true
+}
+
+// SetBadge sets field value
+func (o *AppIconBadgeCountUpdateResponse) SetBadge(v int32) {
+ o.Badge = v
+}
+
+// GetDevicesNotified returns the DevicesNotified field value
+func (o *AppIconBadgeCountUpdateResponse) GetDevicesNotified() int32 {
+ if o == nil {
+ var ret int32
+ return ret
+ }
+
+ return o.DevicesNotified
+}
+
+// GetDevicesNotifiedOk returns a tuple with the DevicesNotified field value
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateResponse) GetDevicesNotifiedOk() (*int32, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.DevicesNotified, true
+}
+
+// SetDevicesNotified sets field value
+func (o *AppIconBadgeCountUpdateResponse) SetDevicesNotified(v int32) {
+ o.DevicesNotified = v
+}
+
+// GetUsersNotified returns the UsersNotified field value
+func (o *AppIconBadgeCountUpdateResponse) GetUsersNotified() int32 {
+ if o == nil {
+ var ret int32
+ return ret
+ }
+
+ return o.UsersNotified
+}
+
+// GetUsersNotifiedOk returns a tuple with the UsersNotified field value
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateResponse) GetUsersNotifiedOk() (*int32, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.UsersNotified, true
+}
+
+// SetUsersNotified sets field value
+func (o *AppIconBadgeCountUpdateResponse) SetUsersNotified(v int32) {
+ o.UsersNotified = v
+}
+
+// GetEffectiveChannelSlugs returns the EffectiveChannelSlugs field value
+func (o *AppIconBadgeCountUpdateResponse) GetEffectiveChannelSlugs() []string {
+ if o == nil {
+ var ret []string
+ return ret
+ }
+
+ return o.EffectiveChannelSlugs
+}
+
+// GetEffectiveChannelSlugsOk returns a tuple with the EffectiveChannelSlugs field value
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateResponse) GetEffectiveChannelSlugsOk() ([]string, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return o.EffectiveChannelSlugs, true
+}
+
+// SetEffectiveChannelSlugs sets field value
+func (o *AppIconBadgeCountUpdateResponse) SetEffectiveChannelSlugs(v []string) {
+ o.EffectiveChannelSlugs = v
+}
+
+// GetTimestamp returns the Timestamp field value
+func (o *AppIconBadgeCountUpdateResponse) GetTimestamp() time.Time {
+ if o == nil {
+ var ret time.Time
+ return ret
+ }
+
+ return o.Timestamp
+}
+
+// GetTimestampOk returns a tuple with the Timestamp field value
+// and a boolean to check if the value has been set.
+func (o *AppIconBadgeCountUpdateResponse) GetTimestampOk() (*time.Time, bool) {
+ if o == nil {
+ return nil, false
+ }
+ return &o.Timestamp, true
+}
+
+// SetTimestamp sets field value
+func (o *AppIconBadgeCountUpdateResponse) SetTimestamp(v time.Time) {
+ o.Timestamp = v
+}
+
+func (o AppIconBadgeCountUpdateResponse) MarshalJSON() ([]byte, error) {
+ toSerialize,err := o.ToMap()
+ if err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(toSerialize)
+}
+
+func (o AppIconBadgeCountUpdateResponse) ToMap() (map[string]interface{}, error) {
+ toSerialize := map[string]interface{}{}
+ toSerialize["success"] = o.Success
+ toSerialize["badge"] = o.Badge
+ toSerialize["devices_notified"] = o.DevicesNotified
+ toSerialize["users_notified"] = o.UsersNotified
+ toSerialize["effective_channel_slugs"] = o.EffectiveChannelSlugs
+ toSerialize["timestamp"] = o.Timestamp
+ return toSerialize, nil
+}
+
+func (o *AppIconBadgeCountUpdateResponse) UnmarshalJSON(data []byte) (err error) {
+ // This validates that all required properties are included in the JSON object
+ // by unmarshalling the object into a generic map with string keys and checking
+ // that every required field exists as a key in the generic map.
+ requiredProperties := []string{
+ "success",
+ "badge",
+ "devices_notified",
+ "users_notified",
+ "effective_channel_slugs",
+ "timestamp",
+ }
+
+ allProperties := make(map[string]interface{})
+
+ err = json.Unmarshal(data, &allProperties)
+
+ if err != nil {
+ return err;
+ }
+
+ for _, requiredProperty := range(requiredProperties) {
+ if _, exists := allProperties[requiredProperty]; !exists {
+ return fmt.Errorf("no value given for required property %v", requiredProperty)
+ }
+ }
+
+ varAppIconBadgeCountUpdateResponse := _AppIconBadgeCountUpdateResponse{}
+
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varAppIconBadgeCountUpdateResponse)
+
+ if err != nil {
+ return err
+ }
+
+ *o = AppIconBadgeCountUpdateResponse(varAppIconBadgeCountUpdateResponse)
+
+ return err
+}
+
+type NullableAppIconBadgeCountUpdateResponse struct {
+ value *AppIconBadgeCountUpdateResponse
+ isSet bool
+}
+
+func (v NullableAppIconBadgeCountUpdateResponse) Get() *AppIconBadgeCountUpdateResponse {
+ return v.value
+}
+
+func (v *NullableAppIconBadgeCountUpdateResponse) Set(val *AppIconBadgeCountUpdateResponse) {
+ v.value = val
+ v.isSet = true
+}
+
+func (v NullableAppIconBadgeCountUpdateResponse) IsSet() bool {
+ return v.isSet
+}
+
+func (v *NullableAppIconBadgeCountUpdateResponse) Unset() {
+ v.value = nil
+ v.isSet = false
+}
+
+func NewNullableAppIconBadgeCountUpdateResponse(val *AppIconBadgeCountUpdateResponse) *NullableAppIconBadgeCountUpdateResponse {
+ return &NullableAppIconBadgeCountUpdateResponse{value: val, isSet: true}
+}
+
+func (v NullableAppIconBadgeCountUpdateResponse) MarshalJSON() ([]byte, error) {
+ return json.Marshal(v.value)
+}
+
+func (v *NullableAppIconBadgeCountUpdateResponse) UnmarshalJSON(src []byte) error {
+ v.isSet = true
+ return json.Unmarshal(src, &v.value)
+}
+
+
diff --git a/generated/model_bad_request_error.go b/generated/model_bad_request_error.go
index 0b63db3..9ccbbec 100644
--- a/generated/model_bad_request_error.go
+++ b/generated/model_bad_request_error.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -22,7 +23,6 @@ var _ MappedNullable = &BadRequestError{}
type BadRequestError struct {
Error string `json:"error"`
Message string `json:"message"`
- AdditionalProperties map[string]interface{}
}
type _BadRequestError BadRequestError
@@ -106,11 +106,6 @@ func (o BadRequestError) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["error"] = o.Error
toSerialize["message"] = o.Message
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -139,7 +134,9 @@ func (o *BadRequestError) UnmarshalJSON(data []byte) (err error) {
varBadRequestError := _BadRequestError{}
- err = json.Unmarshal(data, &varBadRequestError)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varBadRequestError)
if err != nil {
return err
@@ -147,14 +144,6 @@ func (o *BadRequestError) UnmarshalJSON(data []byte) (err error) {
*o = BadRequestError(varBadRequestError)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "error")
- delete(additionalProperties, "message")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_channel_target.go b/generated/model_channel_target.go
index 2eec6a7..ff1964e 100644
--- a/generated/model_channel_target.go
+++ b/generated/model_channel_target.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -22,7 +23,6 @@ var _ MappedNullable = &ChannelTarget{}
type ChannelTarget struct {
// Channel slugs. When omitted, API key scope determines recipients.
Channels []string `json:"channels"`
- AdditionalProperties map[string]interface{}
}
type _ChannelTarget ChannelTarget
@@ -80,11 +80,6 @@ func (o ChannelTarget) MarshalJSON() ([]byte, error) {
func (o ChannelTarget) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["channels"] = o.Channels
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -112,7 +107,9 @@ func (o *ChannelTarget) UnmarshalJSON(data []byte) (err error) {
varChannelTarget := _ChannelTarget{}
- err = json.Unmarshal(data, &varChannelTarget)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varChannelTarget)
if err != nil {
return err
@@ -120,13 +117,6 @@ func (o *ChannelTarget) UnmarshalJSON(data []byte) (err error) {
*o = ChannelTarget(varChannelTarget)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "channels")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_content_state_end.go b/generated/model_content_state_end.go
index 19b71cc..7f71ea9 100644
--- a/generated/model_content_state_end.go
+++ b/generated/model_content_state_end.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -56,7 +57,6 @@ type ContentStateEnd struct {
StepColors []string `json:"step_colors,omitempty"`
// Optional. Minutes before the ended Live Activity is dismissed. Default 3. Set 0 for immediate dismissal. iOS will dismiss ended Live Activities after ~4 hours max.
AutoDismissMinutes *int32 `json:"auto_dismiss_minutes,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _ContentStateEnd ContentStateEnd
@@ -756,11 +756,6 @@ func (o ContentStateEnd) ToMap() (map[string]interface{}, error) {
if !IsNil(o.AutoDismissMinutes) {
toSerialize["auto_dismiss_minutes"] = o.AutoDismissMinutes
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -788,7 +783,9 @@ func (o *ContentStateEnd) UnmarshalJSON(data []byte) (err error) {
varContentStateEnd := _ContentStateEnd{}
- err = json.Unmarshal(data, &varContentStateEnd)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varContentStateEnd)
if err != nil {
return err
@@ -796,31 +793,6 @@ func (o *ContentStateEnd) UnmarshalJSON(data []byte) (err error) {
*o = ContentStateEnd(varContentStateEnd)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "title")
- delete(additionalProperties, "subtitle")
- delete(additionalProperties, "number_of_steps")
- delete(additionalProperties, "current_step")
- delete(additionalProperties, "percentage")
- delete(additionalProperties, "value")
- delete(additionalProperties, "upper_limit")
- delete(additionalProperties, "duration_seconds")
- delete(additionalProperties, "counts_down")
- delete(additionalProperties, "is_running")
- delete(additionalProperties, "metrics")
- delete(additionalProperties, "message")
- delete(additionalProperties, "icon")
- delete(additionalProperties, "badge")
- delete(additionalProperties, "type")
- delete(additionalProperties, "color")
- delete(additionalProperties, "step_color")
- delete(additionalProperties, "step_colors")
- delete(additionalProperties, "auto_dismiss_minutes")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_content_state_start.go b/generated/model_content_state_start.go
index 4d1f7df..cfad130 100644
--- a/generated/model_content_state_start.go
+++ b/generated/model_content_state_start.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -53,7 +54,6 @@ type ContentStateStart struct {
StepColor *string `json:"step_color,omitempty"`
// Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.
StepColors []string `json:"step_colors,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _ContentStateStart ContentStateStart
@@ -705,11 +705,6 @@ func (o ContentStateStart) ToMap() (map[string]interface{}, error) {
if !IsNil(o.StepColors) {
toSerialize["step_colors"] = o.StepColors
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -738,7 +733,9 @@ func (o *ContentStateStart) UnmarshalJSON(data []byte) (err error) {
varContentStateStart := _ContentStateStart{}
- err = json.Unmarshal(data, &varContentStateStart)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varContentStateStart)
if err != nil {
return err
@@ -746,30 +743,6 @@ func (o *ContentStateStart) UnmarshalJSON(data []byte) (err error) {
*o = ContentStateStart(varContentStateStart)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "title")
- delete(additionalProperties, "subtitle")
- delete(additionalProperties, "number_of_steps")
- delete(additionalProperties, "current_step")
- delete(additionalProperties, "percentage")
- delete(additionalProperties, "value")
- delete(additionalProperties, "upper_limit")
- delete(additionalProperties, "duration_seconds")
- delete(additionalProperties, "counts_down")
- delete(additionalProperties, "is_running")
- delete(additionalProperties, "metrics")
- delete(additionalProperties, "message")
- delete(additionalProperties, "icon")
- delete(additionalProperties, "badge")
- delete(additionalProperties, "type")
- delete(additionalProperties, "color")
- delete(additionalProperties, "step_color")
- delete(additionalProperties, "step_colors")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_content_state_update.go b/generated/model_content_state_update.go
index 90d35c4..d48dd3f 100644
--- a/generated/model_content_state_update.go
+++ b/generated/model_content_state_update.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -54,7 +55,6 @@ type ContentStateUpdate struct {
StepColor *string `json:"step_color,omitempty"`
// Optional. Colors for completed steps. When used with segmented_progress, the array length should match current_step.
StepColors []string `json:"step_colors,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _ContentStateUpdate ContentStateUpdate
@@ -715,11 +715,6 @@ func (o ContentStateUpdate) ToMap() (map[string]interface{}, error) {
if !IsNil(o.StepColors) {
toSerialize["step_colors"] = o.StepColors
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -747,7 +742,9 @@ func (o *ContentStateUpdate) UnmarshalJSON(data []byte) (err error) {
varContentStateUpdate := _ContentStateUpdate{}
- err = json.Unmarshal(data, &varContentStateUpdate)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varContentStateUpdate)
if err != nil {
return err
@@ -755,30 +752,6 @@ func (o *ContentStateUpdate) UnmarshalJSON(data []byte) (err error) {
*o = ContentStateUpdate(varContentStateUpdate)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "title")
- delete(additionalProperties, "subtitle")
- delete(additionalProperties, "number_of_steps")
- delete(additionalProperties, "current_step")
- delete(additionalProperties, "percentage")
- delete(additionalProperties, "value")
- delete(additionalProperties, "upper_limit")
- delete(additionalProperties, "duration_seconds")
- delete(additionalProperties, "counts_down")
- delete(additionalProperties, "is_running")
- delete(additionalProperties, "metrics")
- delete(additionalProperties, "message")
- delete(additionalProperties, "icon")
- delete(additionalProperties, "badge")
- delete(additionalProperties, "type")
- delete(additionalProperties, "color")
- delete(additionalProperties, "step_color")
- delete(additionalProperties, "step_colors")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_forbidden_error.go b/generated/model_forbidden_error.go
index 426c648..b4171d7 100644
--- a/generated/model_forbidden_error.go
+++ b/generated/model_forbidden_error.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -22,7 +23,6 @@ var _ MappedNullable = &ForbiddenError{}
type ForbiddenError struct {
Error string `json:"error"`
Message string `json:"message"`
- AdditionalProperties map[string]interface{}
}
type _ForbiddenError ForbiddenError
@@ -106,11 +106,6 @@ func (o ForbiddenError) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["error"] = o.Error
toSerialize["message"] = o.Message
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -139,7 +134,9 @@ func (o *ForbiddenError) UnmarshalJSON(data []byte) (err error) {
varForbiddenError := _ForbiddenError{}
- err = json.Unmarshal(data, &varForbiddenError)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varForbiddenError)
if err != nil {
return err
@@ -147,14 +144,6 @@ func (o *ForbiddenError) UnmarshalJSON(data []byte) (err error) {
*o = ForbiddenError(varForbiddenError)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "error")
- delete(additionalProperties, "message")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_alert_badge.go b/generated/model_live_activity_alert_badge.go
index 0e80688..421c573 100644
--- a/generated/model_live_activity_alert_badge.go
+++ b/generated/model_live_activity_alert_badge.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -23,7 +24,6 @@ type LiveActivityAlertBadge struct {
Title string `json:"title"`
// Optional badge color.
Color *LiveActivityColor `json:"color,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityAlertBadge LiveActivityAlertBadge
@@ -116,11 +116,6 @@ func (o LiveActivityAlertBadge) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Color) {
toSerialize["color"] = o.Color
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -148,7 +143,9 @@ func (o *LiveActivityAlertBadge) UnmarshalJSON(data []byte) (err error) {
varLiveActivityAlertBadge := _LiveActivityAlertBadge{}
- err = json.Unmarshal(data, &varLiveActivityAlertBadge)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityAlertBadge)
if err != nil {
return err
@@ -156,14 +153,6 @@ func (o *LiveActivityAlertBadge) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityAlertBadge(varLiveActivityAlertBadge)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "title")
- delete(additionalProperties, "color")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_alert_icon.go b/generated/model_live_activity_alert_icon.go
index 0ca94d6..0f58278 100644
--- a/generated/model_live_activity_alert_icon.go
+++ b/generated/model_live_activity_alert_icon.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -24,7 +25,6 @@ type LiveActivityAlertIcon struct {
Symbol string `json:"symbol"`
// Optional icon color.
Color *LiveActivityColor `json:"color,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityAlertIcon LiveActivityAlertIcon
@@ -117,11 +117,6 @@ func (o LiveActivityAlertIcon) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Color) {
toSerialize["color"] = o.Color
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -149,7 +144,9 @@ func (o *LiveActivityAlertIcon) UnmarshalJSON(data []byte) (err error) {
varLiveActivityAlertIcon := _LiveActivityAlertIcon{}
- err = json.Unmarshal(data, &varLiveActivityAlertIcon)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityAlertIcon)
if err != nil {
return err
@@ -157,14 +154,6 @@ func (o *LiveActivityAlertIcon) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityAlertIcon(varLiveActivityAlertIcon)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "symbol")
- delete(additionalProperties, "color")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_end_request.go b/generated/model_live_activity_end_request.go
index e1ac971..679387b 100644
--- a/generated/model_live_activity_end_request.go
+++ b/generated/model_live_activity_end_request.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -25,7 +26,6 @@ type LiveActivityEndRequest struct {
Action *LiveActivityAction `json:"action,omitempty"`
// Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
SecondaryAction *LiveActivityAction `json:"secondary_action,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityEndRequest LiveActivityEndRequest
@@ -179,11 +179,6 @@ func (o LiveActivityEndRequest) ToMap() (map[string]interface{}, error) {
if !IsNil(o.SecondaryAction) {
toSerialize["secondary_action"] = o.SecondaryAction
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -212,7 +207,9 @@ func (o *LiveActivityEndRequest) UnmarshalJSON(data []byte) (err error) {
varLiveActivityEndRequest := _LiveActivityEndRequest{}
- err = json.Unmarshal(data, &varLiveActivityEndRequest)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityEndRequest)
if err != nil {
return err
@@ -220,16 +217,6 @@ func (o *LiveActivityEndRequest) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityEndRequest(varLiveActivityEndRequest)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "activity_id")
- delete(additionalProperties, "content_state")
- delete(additionalProperties, "action")
- delete(additionalProperties, "secondary_action")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_end_response.go b/generated/model_live_activity_end_response.go
index e0ce4e9..7546e70 100644
--- a/generated/model_live_activity_end_response.go
+++ b/generated/model_live_activity_end_response.go
@@ -13,6 +13,7 @@ package generated
import (
"encoding/json"
"time"
+ "bytes"
"fmt"
)
@@ -26,7 +27,6 @@ type LiveActivityEndResponse struct {
DevicesQueued *int32 `json:"devices_queued,omitempty"`
DevicesNotified *int32 `json:"devices_notified,omitempty"`
Timestamp time.Time `json:"timestamp"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityEndResponse LiveActivityEndResponse
@@ -206,11 +206,6 @@ func (o LiveActivityEndResponse) ToMap() (map[string]interface{}, error) {
toSerialize["devices_notified"] = o.DevicesNotified
}
toSerialize["timestamp"] = o.Timestamp
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -240,7 +235,9 @@ func (o *LiveActivityEndResponse) UnmarshalJSON(data []byte) (err error) {
varLiveActivityEndResponse := _LiveActivityEndResponse{}
- err = json.Unmarshal(data, &varLiveActivityEndResponse)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityEndResponse)
if err != nil {
return err
@@ -248,17 +245,6 @@ func (o *LiveActivityEndResponse) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityEndResponse(varLiveActivityEndResponse)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "success")
- delete(additionalProperties, "activity_id")
- delete(additionalProperties, "devices_queued")
- delete(additionalProperties, "devices_notified")
- delete(additionalProperties, "timestamp")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_limit_error.go b/generated/model_live_activity_limit_error.go
index 54ca4a1..0637a83 100644
--- a/generated/model_live_activity_limit_error.go
+++ b/generated/model_live_activity_limit_error.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -25,7 +26,6 @@ type LiveActivityLimitError struct {
Limit int32 `json:"limit"`
// Current number of active Live Activities.
Active int32 `json:"active"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityLimitError LiveActivityLimitError
@@ -161,11 +161,6 @@ func (o LiveActivityLimitError) ToMap() (map[string]interface{}, error) {
toSerialize["message"] = o.Message
toSerialize["limit"] = o.Limit
toSerialize["active"] = o.Active
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -196,7 +191,9 @@ func (o *LiveActivityLimitError) UnmarshalJSON(data []byte) (err error) {
varLiveActivityLimitError := _LiveActivityLimitError{}
- err = json.Unmarshal(data, &varLiveActivityLimitError)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityLimitError)
if err != nil {
return err
@@ -204,16 +201,6 @@ func (o *LiveActivityLimitError) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityLimitError(varLiveActivityLimitError)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "error")
- delete(additionalProperties, "message")
- delete(additionalProperties, "limit")
- delete(additionalProperties, "active")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_start_request.go b/generated/model_live_activity_start_request.go
index e034345..cc6d33a 100644
--- a/generated/model_live_activity_start_request.go
+++ b/generated/model_live_activity_start_request.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -26,7 +27,6 @@ type LiveActivityStartRequest struct {
SecondaryAction *LiveActivityAction `json:"secondary_action,omitempty"`
Alert *AlertPayload `json:"alert,omitempty"`
Target *ChannelTarget `json:"target,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityStartRequest LiveActivityStartRequest
@@ -224,11 +224,6 @@ func (o LiveActivityStartRequest) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Target) {
toSerialize["target"] = o.Target
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -256,7 +251,9 @@ func (o *LiveActivityStartRequest) UnmarshalJSON(data []byte) (err error) {
varLiveActivityStartRequest := _LiveActivityStartRequest{}
- err = json.Unmarshal(data, &varLiveActivityStartRequest)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityStartRequest)
if err != nil {
return err
@@ -264,17 +261,6 @@ func (o *LiveActivityStartRequest) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityStartRequest(varLiveActivityStartRequest)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "content_state")
- delete(additionalProperties, "action")
- delete(additionalProperties, "secondary_action")
- delete(additionalProperties, "alert")
- delete(additionalProperties, "target")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_start_response.go b/generated/model_live_activity_start_response.go
index e9a840c..25f9850 100644
--- a/generated/model_live_activity_start_response.go
+++ b/generated/model_live_activity_start_response.go
@@ -13,6 +13,7 @@ package generated
import (
"encoding/json"
"time"
+ "bytes"
"fmt"
)
@@ -27,7 +28,6 @@ type LiveActivityStartResponse struct {
ActivityId string `json:"activity_id"`
EffectiveChannelSlugs []string `json:"effective_channel_slugs,omitempty"`
Timestamp time.Time `json:"timestamp"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityStartResponse LiveActivityStartResponse
@@ -242,11 +242,6 @@ func (o LiveActivityStartResponse) ToMap() (map[string]interface{}, error) {
toSerialize["effective_channel_slugs"] = o.EffectiveChannelSlugs
}
toSerialize["timestamp"] = o.Timestamp
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -276,7 +271,9 @@ func (o *LiveActivityStartResponse) UnmarshalJSON(data []byte) (err error) {
varLiveActivityStartResponse := _LiveActivityStartResponse{}
- err = json.Unmarshal(data, &varLiveActivityStartResponse)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityStartResponse)
if err != nil {
return err
@@ -284,18 +281,6 @@ func (o *LiveActivityStartResponse) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityStartResponse(varLiveActivityStartResponse)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "success")
- delete(additionalProperties, "devices_notified")
- delete(additionalProperties, "users_notified")
- delete(additionalProperties, "activity_id")
- delete(additionalProperties, "effective_channel_slugs")
- delete(additionalProperties, "timestamp")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_stream_delete_request.go b/generated/model_live_activity_stream_delete_request.go
index 28d4497..237160c 100644
--- a/generated/model_live_activity_stream_delete_request.go
+++ b/generated/model_live_activity_stream_delete_request.go
@@ -24,11 +24,8 @@ type LiveActivityStreamDeleteRequest struct {
// Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
SecondaryAction *LiveActivityAction `json:"secondary_action,omitempty"`
Alert *AlertPayload `json:"alert,omitempty"`
- AdditionalProperties map[string]interface{}
}
-type _LiveActivityStreamDeleteRequest LiveActivityStreamDeleteRequest
-
// NewLiveActivityStreamDeleteRequest instantiates a new LiveActivityStreamDeleteRequest object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
@@ -196,38 +193,9 @@ func (o LiveActivityStreamDeleteRequest) ToMap() (map[string]interface{}, error)
if !IsNil(o.Alert) {
toSerialize["alert"] = o.Alert
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
-func (o *LiveActivityStreamDeleteRequest) UnmarshalJSON(data []byte) (err error) {
- varLiveActivityStreamDeleteRequest := _LiveActivityStreamDeleteRequest{}
-
- err = json.Unmarshal(data, &varLiveActivityStreamDeleteRequest)
-
- if err != nil {
- return err
- }
-
- *o = LiveActivityStreamDeleteRequest(varLiveActivityStreamDeleteRequest)
-
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "content_state")
- delete(additionalProperties, "action")
- delete(additionalProperties, "secondary_action")
- delete(additionalProperties, "alert")
- o.AdditionalProperties = additionalProperties
- }
-
- return err
-}
-
type NullableLiveActivityStreamDeleteRequest struct {
value *LiveActivityStreamDeleteRequest
isSet bool
diff --git a/generated/model_live_activity_stream_delete_response.go b/generated/model_live_activity_stream_delete_response.go
index 59944d8..544210e 100644
--- a/generated/model_live_activity_stream_delete_response.go
+++ b/generated/model_live_activity_stream_delete_response.go
@@ -13,6 +13,7 @@ package generated
import (
"encoding/json"
"time"
+ "bytes"
"fmt"
)
@@ -28,7 +29,6 @@ type LiveActivityStreamDeleteResponse struct {
DevicesQueued *int32 `json:"devices_queued,omitempty"`
DevicesNotified *int32 `json:"devices_notified,omitempty"`
Timestamp time.Time `json:"timestamp"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityStreamDeleteResponse LiveActivityStreamDeleteResponse
@@ -279,11 +279,6 @@ func (o LiveActivityStreamDeleteResponse) ToMap() (map[string]interface{}, error
toSerialize["devices_notified"] = o.DevicesNotified
}
toSerialize["timestamp"] = o.Timestamp
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -314,7 +309,9 @@ func (o *LiveActivityStreamDeleteResponse) UnmarshalJSON(data []byte) (err error
varLiveActivityStreamDeleteResponse := _LiveActivityStreamDeleteResponse{}
- err = json.Unmarshal(data, &varLiveActivityStreamDeleteResponse)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityStreamDeleteResponse)
if err != nil {
return err
@@ -322,19 +319,6 @@ func (o *LiveActivityStreamDeleteResponse) UnmarshalJSON(data []byte) (err error
*o = LiveActivityStreamDeleteResponse(varLiveActivityStreamDeleteResponse)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "success")
- delete(additionalProperties, "operation")
- delete(additionalProperties, "stream_key")
- delete(additionalProperties, "activity_id")
- delete(additionalProperties, "devices_queued")
- delete(additionalProperties, "devices_notified")
- delete(additionalProperties, "timestamp")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_stream_put_response.go b/generated/model_live_activity_stream_put_response.go
index 03aa5e6..4a3e05a 100644
--- a/generated/model_live_activity_stream_put_response.go
+++ b/generated/model_live_activity_stream_put_response.go
@@ -13,6 +13,7 @@ package generated
import (
"encoding/json"
"time"
+ "bytes"
"fmt"
)
@@ -31,7 +32,6 @@ type LiveActivityStreamPutResponse struct {
UsersNotified *int32 `json:"users_notified,omitempty"`
EffectiveChannelSlugs []string `json:"effective_channel_slugs,omitempty"`
Timestamp time.Time `json:"timestamp"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityStreamPutResponse LiveActivityStreamPutResponse
@@ -387,11 +387,6 @@ func (o LiveActivityStreamPutResponse) ToMap() (map[string]interface{}, error) {
toSerialize["effective_channel_slugs"] = o.EffectiveChannelSlugs
}
toSerialize["timestamp"] = o.Timestamp
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -422,7 +417,9 @@ func (o *LiveActivityStreamPutResponse) UnmarshalJSON(data []byte) (err error) {
varLiveActivityStreamPutResponse := _LiveActivityStreamPutResponse{}
- err = json.Unmarshal(data, &varLiveActivityStreamPutResponse)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityStreamPutResponse)
if err != nil {
return err
@@ -430,22 +427,6 @@ func (o *LiveActivityStreamPutResponse) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityStreamPutResponse(varLiveActivityStreamPutResponse)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "success")
- delete(additionalProperties, "operation")
- delete(additionalProperties, "stream_key")
- delete(additionalProperties, "activity_id")
- delete(additionalProperties, "previous_activity_id")
- delete(additionalProperties, "devices_notified")
- delete(additionalProperties, "devices_queued")
- delete(additionalProperties, "users_notified")
- delete(additionalProperties, "effective_channel_slugs")
- delete(additionalProperties, "timestamp")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_stream_request.go b/generated/model_live_activity_stream_request.go
index 8218c52..02257a2 100644
--- a/generated/model_live_activity_stream_request.go
+++ b/generated/model_live_activity_stream_request.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -28,7 +29,6 @@ type LiveActivityStreamRequest struct {
// Channel slugs. When omitted, API key scope determines recipients.
Channels []string `json:"channels,omitempty"`
Target *ChannelTarget `json:"target,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityStreamRequest LiveActivityStreamRequest
@@ -261,11 +261,6 @@ func (o LiveActivityStreamRequest) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Target) {
toSerialize["target"] = o.Target
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -293,7 +288,9 @@ func (o *LiveActivityStreamRequest) UnmarshalJSON(data []byte) (err error) {
varLiveActivityStreamRequest := _LiveActivityStreamRequest{}
- err = json.Unmarshal(data, &varLiveActivityStreamRequest)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityStreamRequest)
if err != nil {
return err
@@ -301,18 +298,6 @@ func (o *LiveActivityStreamRequest) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityStreamRequest(varLiveActivityStreamRequest)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "content_state")
- delete(additionalProperties, "action")
- delete(additionalProperties, "secondary_action")
- delete(additionalProperties, "alert")
- delete(additionalProperties, "channels")
- delete(additionalProperties, "target")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_update_request.go b/generated/model_live_activity_update_request.go
index 5895d95..0011f9d 100644
--- a/generated/model_live_activity_update_request.go
+++ b/generated/model_live_activity_update_request.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -25,7 +26,6 @@ type LiveActivityUpdateRequest struct {
Action *LiveActivityAction `json:"action,omitempty"`
// Optional secondary action button. Supported only for alert, progress, and segmented_progress Live Activities. Uses the same open_url, shortcuts://, and webhook shapes as action.
SecondaryAction *LiveActivityAction `json:"secondary_action,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityUpdateRequest LiveActivityUpdateRequest
@@ -179,11 +179,6 @@ func (o LiveActivityUpdateRequest) ToMap() (map[string]interface{}, error) {
if !IsNil(o.SecondaryAction) {
toSerialize["secondary_action"] = o.SecondaryAction
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -212,7 +207,9 @@ func (o *LiveActivityUpdateRequest) UnmarshalJSON(data []byte) (err error) {
varLiveActivityUpdateRequest := _LiveActivityUpdateRequest{}
- err = json.Unmarshal(data, &varLiveActivityUpdateRequest)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityUpdateRequest)
if err != nil {
return err
@@ -220,16 +217,6 @@ func (o *LiveActivityUpdateRequest) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityUpdateRequest(varLiveActivityUpdateRequest)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "activity_id")
- delete(additionalProperties, "content_state")
- delete(additionalProperties, "action")
- delete(additionalProperties, "secondary_action")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_live_activity_update_response.go b/generated/model_live_activity_update_response.go
index dda1ff7..16bf886 100644
--- a/generated/model_live_activity_update_response.go
+++ b/generated/model_live_activity_update_response.go
@@ -13,6 +13,7 @@ package generated
import (
"encoding/json"
"time"
+ "bytes"
"fmt"
)
@@ -26,7 +27,6 @@ type LiveActivityUpdateResponse struct {
DevicesQueued *int32 `json:"devices_queued,omitempty"`
DevicesNotified *int32 `json:"devices_notified,omitempty"`
Timestamp time.Time `json:"timestamp"`
- AdditionalProperties map[string]interface{}
}
type _LiveActivityUpdateResponse LiveActivityUpdateResponse
@@ -206,11 +206,6 @@ func (o LiveActivityUpdateResponse) ToMap() (map[string]interface{}, error) {
toSerialize["devices_notified"] = o.DevicesNotified
}
toSerialize["timestamp"] = o.Timestamp
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -240,7 +235,9 @@ func (o *LiveActivityUpdateResponse) UnmarshalJSON(data []byte) (err error) {
varLiveActivityUpdateResponse := _LiveActivityUpdateResponse{}
- err = json.Unmarshal(data, &varLiveActivityUpdateResponse)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varLiveActivityUpdateResponse)
if err != nil {
return err
@@ -248,17 +245,6 @@ func (o *LiveActivityUpdateResponse) UnmarshalJSON(data []byte) (err error) {
*o = LiveActivityUpdateResponse(varLiveActivityUpdateResponse)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "success")
- delete(additionalProperties, "activity_id")
- delete(additionalProperties, "devices_queued")
- delete(additionalProperties, "devices_notified")
- delete(additionalProperties, "timestamp")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_metric_error.go b/generated/model_metric_error.go
index 5e63113..6ca589f 100644
--- a/generated/model_metric_error.go
+++ b/generated/model_metric_error.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -22,7 +23,6 @@ var _ MappedNullable = &MetricError{}
type MetricError struct {
Error string `json:"error"`
Message *string `json:"message,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _MetricError MetricError
@@ -115,11 +115,6 @@ func (o MetricError) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Message) {
toSerialize["message"] = o.Message
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -147,7 +142,9 @@ func (o *MetricError) UnmarshalJSON(data []byte) (err error) {
varMetricError := _MetricError{}
- err = json.Unmarshal(data, &varMetricError)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varMetricError)
if err != nil {
return err
@@ -155,14 +152,6 @@ func (o *MetricError) UnmarshalJSON(data []byte) (err error) {
*o = MetricError(varMetricError)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "error")
- delete(additionalProperties, "message")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_metric_value_update_request.go b/generated/model_metric_value_update_request.go
index 7db18c6..71ad1ed 100644
--- a/generated/model_metric_value_update_request.go
+++ b/generated/model_metric_value_update_request.go
@@ -13,6 +13,7 @@ package generated
import (
"encoding/json"
"time"
+ "bytes"
"fmt"
)
@@ -24,7 +25,6 @@ type MetricValueUpdateRequest struct {
Value MetricValueUpdateRequestValue `json:"value"`
// Optional ISO timestamp for when the metric value was measured. Defaults to the server receive time.
Timestamp *time.Time `json:"timestamp,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _MetricValueUpdateRequest MetricValueUpdateRequest
@@ -117,11 +117,6 @@ func (o MetricValueUpdateRequest) ToMap() (map[string]interface{}, error) {
if !IsNil(o.Timestamp) {
toSerialize["timestamp"] = o.Timestamp
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -149,7 +144,9 @@ func (o *MetricValueUpdateRequest) UnmarshalJSON(data []byte) (err error) {
varMetricValueUpdateRequest := _MetricValueUpdateRequest{}
- err = json.Unmarshal(data, &varMetricValueUpdateRequest)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varMetricValueUpdateRequest)
if err != nil {
return err
@@ -157,14 +154,6 @@ func (o *MetricValueUpdateRequest) UnmarshalJSON(data []byte) (err error) {
*o = MetricValueUpdateRequest(varMetricValueUpdateRequest)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "value")
- delete(additionalProperties, "timestamp")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_metric_value_update_response.go b/generated/model_metric_value_update_response.go
index ad8e0c9..96d411e 100644
--- a/generated/model_metric_value_update_response.go
+++ b/generated/model_metric_value_update_response.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -21,7 +22,6 @@ var _ MappedNullable = &MetricValueUpdateResponse{}
// MetricValueUpdateResponse struct for MetricValueUpdateResponse
type MetricValueUpdateResponse struct {
Success bool `json:"success"`
- AdditionalProperties map[string]interface{}
}
type _MetricValueUpdateResponse MetricValueUpdateResponse
@@ -79,11 +79,6 @@ func (o MetricValueUpdateResponse) MarshalJSON() ([]byte, error) {
func (o MetricValueUpdateResponse) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["success"] = o.Success
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -111,7 +106,9 @@ func (o *MetricValueUpdateResponse) UnmarshalJSON(data []byte) (err error) {
varMetricValueUpdateResponse := _MetricValueUpdateResponse{}
- err = json.Unmarshal(data, &varMetricValueUpdateResponse)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varMetricValueUpdateResponse)
if err != nil {
return err
@@ -119,13 +116,6 @@ func (o *MetricValueUpdateResponse) UnmarshalJSON(data []byte) (err error) {
*o = MetricValueUpdateResponse(varMetricValueUpdateResponse)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "success")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_no_recipients_error.go b/generated/model_no_recipients_error.go
index a145ce4..436654e 100644
--- a/generated/model_no_recipients_error.go
+++ b/generated/model_no_recipients_error.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -23,7 +24,6 @@ type NoRecipientsError struct {
Error string `json:"error"`
Message string `json:"message"`
EffectiveChannelSlugs []string `json:"effective_channel_slugs,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _NoRecipientsError NoRecipientsError
@@ -142,11 +142,6 @@ func (o NoRecipientsError) ToMap() (map[string]interface{}, error) {
if !IsNil(o.EffectiveChannelSlugs) {
toSerialize["effective_channel_slugs"] = o.EffectiveChannelSlugs
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -175,7 +170,9 @@ func (o *NoRecipientsError) UnmarshalJSON(data []byte) (err error) {
varNoRecipientsError := _NoRecipientsError{}
- err = json.Unmarshal(data, &varNoRecipientsError)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varNoRecipientsError)
if err != nil {
return err
@@ -183,15 +180,6 @@ func (o *NoRecipientsError) UnmarshalJSON(data []byte) (err error) {
*o = NoRecipientsError(varNoRecipientsError)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "error")
- delete(additionalProperties, "message")
- delete(additionalProperties, "effective_channel_slugs")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_not_found_error.go b/generated/model_not_found_error.go
index d7fb614..2db4918 100644
--- a/generated/model_not_found_error.go
+++ b/generated/model_not_found_error.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -22,7 +23,6 @@ var _ MappedNullable = &NotFoundError{}
type NotFoundError struct {
Error string `json:"error"`
Message string `json:"message"`
- AdditionalProperties map[string]interface{}
}
type _NotFoundError NotFoundError
@@ -106,11 +106,6 @@ func (o NotFoundError) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["error"] = o.Error
toSerialize["message"] = o.Message
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -139,7 +134,9 @@ func (o *NotFoundError) UnmarshalJSON(data []byte) (err error) {
varNotFoundError := _NotFoundError{}
- err = json.Unmarshal(data, &varNotFoundError)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varNotFoundError)
if err != nil {
return err
@@ -147,14 +144,6 @@ func (o *NotFoundError) UnmarshalJSON(data []byte) (err error) {
*o = NotFoundError(varNotFoundError)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "error")
- delete(additionalProperties, "message")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_push_notification_response.go b/generated/model_push_notification_response.go
index 2d8e313..4cd35f8 100644
--- a/generated/model_push_notification_response.go
+++ b/generated/model_push_notification_response.go
@@ -13,6 +13,7 @@ package generated
import (
"encoding/json"
"time"
+ "bytes"
"fmt"
)
@@ -26,7 +27,6 @@ type PushNotificationResponse struct {
UsersNotified *int32 `json:"users_notified,omitempty"`
EffectiveChannelSlugs []string `json:"effective_channel_slugs,omitempty"`
Timestamp time.Time `json:"timestamp"`
- AdditionalProperties map[string]interface{}
}
type _PushNotificationResponse PushNotificationResponse
@@ -215,11 +215,6 @@ func (o PushNotificationResponse) ToMap() (map[string]interface{}, error) {
toSerialize["effective_channel_slugs"] = o.EffectiveChannelSlugs
}
toSerialize["timestamp"] = o.Timestamp
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -248,7 +243,9 @@ func (o *PushNotificationResponse) UnmarshalJSON(data []byte) (err error) {
varPushNotificationResponse := _PushNotificationResponse{}
- err = json.Unmarshal(data, &varPushNotificationResponse)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varPushNotificationResponse)
if err != nil {
return err
@@ -256,17 +253,6 @@ func (o *PushNotificationResponse) UnmarshalJSON(data []byte) (err error) {
*o = PushNotificationResponse(varPushNotificationResponse)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "success")
- delete(additionalProperties, "devices_notified")
- delete(additionalProperties, "users_notified")
- delete(additionalProperties, "effective_channel_slugs")
- delete(additionalProperties, "timestamp")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_rate_limit_error.go b/generated/model_rate_limit_error.go
index 2fe6716..f6e21eb 100644
--- a/generated/model_rate_limit_error.go
+++ b/generated/model_rate_limit_error.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -22,7 +23,6 @@ var _ MappedNullable = &RateLimitError{}
type RateLimitError struct {
Error string `json:"error"`
Message string `json:"message"`
- AdditionalProperties map[string]interface{}
}
type _RateLimitError RateLimitError
@@ -106,11 +106,6 @@ func (o RateLimitError) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
toSerialize["error"] = o.Error
toSerialize["message"] = o.Message
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -139,7 +134,9 @@ func (o *RateLimitError) UnmarshalJSON(data []byte) (err error) {
varRateLimitError := _RateLimitError{}
- err = json.Unmarshal(data, &varRateLimitError)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varRateLimitError)
if err != nil {
return err
@@ -147,14 +144,6 @@ func (o *RateLimitError) UnmarshalJSON(data []byte) (err error) {
*o = RateLimitError(varRateLimitError)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "error")
- delete(additionalProperties, "message")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/generated/model_stream_content_state.go b/generated/model_stream_content_state.go
index 3d12411..5cce29f 100644
--- a/generated/model_stream_content_state.go
+++ b/generated/model_stream_content_state.go
@@ -12,6 +12,7 @@ package generated
import (
"encoding/json"
+ "bytes"
"fmt"
)
@@ -58,7 +59,6 @@ type StreamContentState struct {
AutoDismissSeconds *int32 `json:"auto_dismiss_seconds,omitempty"`
// Optional. Minutes before the ended Live Activity is dismissed.
AutoDismissMinutes *int32 `json:"auto_dismiss_minutes,omitempty"`
- AdditionalProperties map[string]interface{}
}
type _StreamContentState StreamContentState
@@ -789,11 +789,6 @@ func (o StreamContentState) ToMap() (map[string]interface{}, error) {
if !IsNil(o.AutoDismissMinutes) {
toSerialize["auto_dismiss_minutes"] = o.AutoDismissMinutes
}
-
- for key, value := range o.AdditionalProperties {
- toSerialize[key] = value
- }
-
return toSerialize, nil
}
@@ -821,7 +816,9 @@ func (o *StreamContentState) UnmarshalJSON(data []byte) (err error) {
varStreamContentState := _StreamContentState{}
- err = json.Unmarshal(data, &varStreamContentState)
+ decoder := json.NewDecoder(bytes.NewReader(data))
+ decoder.DisallowUnknownFields()
+ err = decoder.Decode(&varStreamContentState)
if err != nil {
return err
@@ -829,32 +826,6 @@ func (o *StreamContentState) UnmarshalJSON(data []byte) (err error) {
*o = StreamContentState(varStreamContentState)
- additionalProperties := make(map[string]interface{})
-
- if err = json.Unmarshal(data, &additionalProperties); err == nil {
- delete(additionalProperties, "title")
- delete(additionalProperties, "subtitle")
- delete(additionalProperties, "number_of_steps")
- delete(additionalProperties, "current_step")
- delete(additionalProperties, "percentage")
- delete(additionalProperties, "value")
- delete(additionalProperties, "upper_limit")
- delete(additionalProperties, "duration_seconds")
- delete(additionalProperties, "counts_down")
- delete(additionalProperties, "is_running")
- delete(additionalProperties, "type")
- delete(additionalProperties, "color")
- delete(additionalProperties, "step_color")
- delete(additionalProperties, "step_colors")
- delete(additionalProperties, "metrics")
- delete(additionalProperties, "message")
- delete(additionalProperties, "icon")
- delete(additionalProperties, "badge")
- delete(additionalProperties, "auto_dismiss_seconds")
- delete(additionalProperties, "auto_dismiss_minutes")
- o.AdditionalProperties = additionalProperties
- }
-
return err
}
diff --git a/inputs.go b/inputs.go
index c5ab3ea..a34f81a 100644
--- a/inputs.go
+++ b/inputs.go
@@ -47,36 +47,39 @@ func AlertBadge(title string, color ...string) LiveActivityAlertBadgeInput {
return badge
}
-func alertIconMap(icon LiveActivityAlertIconInput) map[string]interface{} {
+func alertIconValue(icon LiveActivityAlertIconInput) *generated.LiveActivityAlertIcon {
if icon.Symbol == "" {
return nil
}
- value := map[string]interface{}{"symbol": icon.Symbol}
+ value := generated.LiveActivityAlertIcon{Symbol: icon.Symbol}
if icon.Color != "" {
- value["color"] = icon.Color
+ color := generated.LiveActivityColor(icon.Color)
+ value.Color = &color
}
- return value
+ return &value
}
-func alertBadgeMap(badge LiveActivityAlertBadgeInput) map[string]interface{} {
+func alertBadgeValue(badge LiveActivityAlertBadgeInput) *generated.LiveActivityAlertBadge {
if badge.Title == "" {
return nil
}
- value := map[string]interface{}{"title": badge.Title}
+ value := generated.LiveActivityAlertBadge{Title: badge.Title}
if badge.Color != "" {
- value["color"] = badge.Color
+ color := generated.LiveActivityColor(badge.Color)
+ value.Color = &color
}
- return value
+ return &value
}
-func setAdditionalProperty(properties *map[string]interface{}, key string, value interface{}) {
- if value == nil {
- return
- }
- if *properties == nil {
- *properties = map[string]interface{}{}
- }
- (*properties)[key] = value
+type timerContentState interface {
+ SetDurationSeconds(float32)
+ SetCountsDown(bool)
+}
+
+type alertContentState interface {
+ SetMessage(string)
+ SetIcon(generated.LiveActivityAlertIcon)
+ SetBadge(generated.LiveActivityAlertBadge)
}
func Metric(label string, value any, options ...ActivityMetricOption) ActivityMetric {
@@ -293,21 +296,50 @@ func (in LiveActivityContentStateInput) isSet() bool {
in.autoDismissMinutesSet
}
-func (in LiveActivityContentStateInput) applyTimerFields(properties *map[string]interface{}) {
- if in.DurationSeconds != 0 || in.durationSecondsSet {
- setAdditionalProperty(properties, "duration_seconds", in.DurationSeconds)
+func (in LiveActivityContentStateInput) applyTimerFields(state timerContentState) {
+ applyTimerContentStateFields(
+ state,
+ in.DurationSeconds,
+ in.durationSecondsSet,
+ in.CountsDown,
+ in.countsDownSet,
+ )
+}
+
+func (in LiveActivityContentStateInput) applyAlertFields(state alertContentState) {
+ applyAlertContentStateFields(state, in.Message, in.Icon, in.Badge)
+}
+
+func applyTimerContentStateFields(
+ state timerContentState,
+ durationSeconds float32,
+ durationSecondsSet bool,
+ countsDown bool,
+ countsDownSet bool,
+) {
+ if durationSeconds != 0 || durationSecondsSet {
+ state.SetDurationSeconds(durationSeconds)
}
- if in.countsDownSet {
- setAdditionalProperty(properties, "counts_down", in.CountsDown)
+ if countsDownSet {
+ state.SetCountsDown(countsDown)
}
}
-func (in LiveActivityContentStateInput) applyAlertFields(properties *map[string]interface{}) {
- if in.Message != "" {
- setAdditionalProperty(properties, "message", in.Message)
+func applyAlertContentStateFields(
+ state alertContentState,
+ message string,
+ icon LiveActivityAlertIconInput,
+ badge LiveActivityAlertBadgeInput,
+) {
+ if message != "" {
+ state.SetMessage(message)
+ }
+ if generatedIcon := alertIconValue(icon); generatedIcon != nil {
+ state.SetIcon(*generatedIcon)
+ }
+ if generatedBadge := alertBadgeValue(badge); generatedBadge != nil {
+ state.SetBadge(*generatedBadge)
}
- setAdditionalProperty(properties, "icon", alertIconMap(in.Icon))
- setAdditionalProperty(properties, "badge", alertBadgeMap(in.Badge))
}
func (in LiveActivityContentStateInput) applyStart(state *generated.ContentStateStart) {
@@ -338,8 +370,8 @@ func (in LiveActivityContentStateInput) applyStart(state *generated.ContentState
if len(in.Metrics) > 0 {
state.SetMetrics(append([]generated.ActivityMetric{}, in.Metrics...))
}
- in.applyTimerFields(&state.AdditionalProperties)
- in.applyAlertFields(&state.AdditionalProperties)
+ in.applyTimerFields(state)
+ in.applyAlertFields(state)
}
func (in LiveActivityContentStateInput) applyUpdate(state *generated.ContentStateUpdate) {
@@ -373,8 +405,8 @@ func (in LiveActivityContentStateInput) applyUpdate(state *generated.ContentStat
if len(in.Metrics) > 0 {
state.SetMetrics(append([]generated.ActivityMetric{}, in.Metrics...))
}
- in.applyTimerFields(&state.AdditionalProperties)
- in.applyAlertFields(&state.AdditionalProperties)
+ in.applyTimerFields(state)
+ in.applyAlertFields(state)
}
func (in LiveActivityContentStateInput) applyEnd(state *generated.ContentStateEnd) {
@@ -415,8 +447,8 @@ func (in LiveActivityContentStateInput) applyEndBase(state *generated.ContentSta
if len(in.Metrics) > 0 {
state.SetMetrics(append([]generated.ActivityMetric{}, in.Metrics...))
}
- in.applyTimerFields(&state.AdditionalProperties)
- in.applyAlertFields(&state.AdditionalProperties)
+ in.applyTimerFields(state)
+ in.applyAlertFields(state)
}
func (in LiveActivityContentStateInput) applyStream(state *generated.StreamContentState) {
@@ -453,8 +485,8 @@ func (in LiveActivityContentStateInput) applyStream(state *generated.StreamConte
if in.AutoDismissMinutes != 0 || in.autoDismissMinutesSet {
state.SetAutoDismissMinutes(in.AutoDismissMinutes)
}
- in.applyTimerFields(&state.AdditionalProperties)
- in.applyAlertFields(&state.AdditionalProperties)
+ in.applyTimerFields(state)
+ in.applyAlertFields(state)
}
func (in LiveActivityContentStateInput) WithNumberOfSteps(v int32) LiveActivityContentStateInput {
@@ -567,20 +599,17 @@ func (in LiveActivityStartInput) toGenerated() generated.LiveActivityStartReques
if in.UpperLimit != 0 || in.upperLimitSet {
req.ContentState.SetUpperLimit(in.UpperLimit)
}
- if in.DurationSeconds != 0 || in.durationSecondsSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds)
- }
- if in.countsDownSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown)
- }
+ applyTimerContentStateFields(
+ &req.ContentState,
+ in.DurationSeconds,
+ in.durationSecondsSet,
+ in.CountsDown,
+ in.countsDownSet,
+ )
if in.Subtitle != "" {
req.ContentState.SetSubtitle(in.Subtitle)
}
- if in.Message != "" {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "message", in.Message)
- }
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "icon", alertIconMap(in.Icon))
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "badge", alertBadgeMap(in.Badge))
+ applyAlertContentStateFields(&req.ContentState, in.Message, in.Icon, in.Badge)
if in.Color != "" {
req.ContentState.SetColor(in.Color)
}
@@ -718,23 +747,20 @@ func (in LiveActivityUpdateInput) toGenerated() generated.LiveActivityUpdateRequ
if in.UpperLimit != 0 || in.upperLimitSet {
req.ContentState.SetUpperLimit(in.UpperLimit)
}
- if in.DurationSeconds != 0 || in.durationSecondsSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds)
- }
- if in.countsDownSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown)
- }
+ applyTimerContentStateFields(
+ &req.ContentState,
+ in.DurationSeconds,
+ in.durationSecondsSet,
+ in.CountsDown,
+ in.countsDownSet,
+ )
if in.Type != "" {
req.ContentState.SetType(in.Type)
}
if in.Subtitle != "" {
req.ContentState.SetSubtitle(in.Subtitle)
}
- if in.Message != "" {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "message", in.Message)
- }
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "icon", alertIconMap(in.Icon))
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "badge", alertBadgeMap(in.Badge))
+ applyAlertContentStateFields(&req.ContentState, in.Message, in.Icon, in.Badge)
if in.Color != "" {
req.ContentState.SetColor(in.Color)
}
@@ -874,23 +900,20 @@ func (in LiveActivityEndInput) toGenerated() generated.LiveActivityEndRequest {
if in.UpperLimit != 0 || in.upperLimitSet {
req.ContentState.SetUpperLimit(in.UpperLimit)
}
- if in.DurationSeconds != 0 || in.durationSecondsSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds)
- }
- if in.countsDownSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown)
- }
+ applyTimerContentStateFields(
+ &req.ContentState,
+ in.DurationSeconds,
+ in.durationSecondsSet,
+ in.CountsDown,
+ in.countsDownSet,
+ )
if in.Type != "" {
req.ContentState.SetType(in.Type)
}
if in.Subtitle != "" {
req.ContentState.SetSubtitle(in.Subtitle)
}
- if in.Message != "" {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "message", in.Message)
- }
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "icon", alertIconMap(in.Icon))
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "badge", alertBadgeMap(in.Badge))
+ applyAlertContentStateFields(&req.ContentState, in.Message, in.Icon, in.Badge)
if in.Color != "" {
req.ContentState.SetColor(in.Color)
}
@@ -1041,23 +1064,20 @@ func (in LiveActivityStreamInput) toGenerated() generated.LiveActivityStreamRequ
if in.UpperLimit != 0 || in.upperLimitSet {
req.ContentState.SetUpperLimit(in.UpperLimit)
}
- if in.DurationSeconds != 0 || in.durationSecondsSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "duration_seconds", in.DurationSeconds)
- }
- if in.countsDownSet {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "counts_down", in.CountsDown)
- }
+ applyTimerContentStateFields(
+ &req.ContentState,
+ in.DurationSeconds,
+ in.durationSecondsSet,
+ in.CountsDown,
+ in.countsDownSet,
+ )
if in.Type != "" {
req.ContentState.SetType(in.Type)
}
if in.Subtitle != "" {
req.ContentState.SetSubtitle(in.Subtitle)
}
- if in.Message != "" {
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "message", in.Message)
- }
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "icon", alertIconMap(in.Icon))
- setAdditionalProperty(&req.ContentState.AdditionalProperties, "badge", alertBadgeMap(in.Badge))
+ applyAlertContentStateFields(&req.ContentState, in.Message, in.Icon, in.Badge)
if in.Color != "" {
req.ContentState.SetColor(in.Color)
}
@@ -1196,23 +1216,20 @@ func (in LiveActivityStreamEndInput) toGenerated() generated.LiveActivityStreamD
if in.UpperLimit != 0 || in.upperLimitSet {
contentState.SetUpperLimit(in.UpperLimit)
}
- if in.DurationSeconds != 0 || in.durationSecondsSet {
- setAdditionalProperty(&contentState.AdditionalProperties, "duration_seconds", in.DurationSeconds)
- }
- if in.countsDownSet {
- setAdditionalProperty(&contentState.AdditionalProperties, "counts_down", in.CountsDown)
- }
+ applyTimerContentStateFields(
+ &contentState,
+ in.DurationSeconds,
+ in.durationSecondsSet,
+ in.CountsDown,
+ in.countsDownSet,
+ )
if in.Type != "" {
contentState.SetType(in.Type)
}
if in.Subtitle != "" {
contentState.SetSubtitle(in.Subtitle)
}
- if in.Message != "" {
- setAdditionalProperty(&contentState.AdditionalProperties, "message", in.Message)
- }
- setAdditionalProperty(&contentState.AdditionalProperties, "icon", alertIconMap(in.Icon))
- setAdditionalProperty(&contentState.AdditionalProperties, "badge", alertBadgeMap(in.Badge))
+ applyAlertContentStateFields(&contentState, in.Message, in.Icon, in.Badge)
if in.Color != "" {
contentState.SetColor(in.Color)
}
diff --git a/services_test.go b/services_test.go
index a72f930..1e51f53 100644
--- a/services_test.go
+++ b/services_test.go
@@ -65,6 +65,8 @@ func newAPITestServer(t *testing.T) (*httptest.Server, *[]capturedRequest) {
_, _ = w.Write([]byte(`{"success":true}`))
case "/metrics/prod.status/value":
_, _ = w.Write([]byte(`{"success":true}`))
+ case "/badge":
+ _, _ = w.Write([]byte(`{"success":true,"badge":3,"devices_notified":1,"users_notified":1,"effective_channel_slugs":["sales","customer-success"],"timestamp":"2026-02-07T00:00:00Z"}`))
default:
http.NotFound(w, r)
}
@@ -116,6 +118,43 @@ func TestNotificationsShortAndLegacyMethods(t *testing.T) {
}
}
+func TestBadgeCountClearsAndTargetsChannels(t *testing.T) {
+ server, requests := newAPITestServer(t)
+ defer server.Close()
+
+ client, err := New("test-api-key")
+ if err != nil {
+ t.Fatalf("expected no error, got %v", err)
+ }
+ overrideHostForTests(client, server.URL)
+
+ response, err := client.BadgeCount(3, "sales", "customer-success")
+ if err != nil {
+ t.Fatalf("BadgeCount returned error: %v", err)
+ }
+ if response.Badge != 3 {
+ t.Fatalf("badge mismatch: got=%d want=3", response.Badge)
+ }
+
+ if _, err := client.BadgeCount(0); err != nil {
+ t.Fatalf("BadgeCount clear returned error: %v", err)
+ }
+
+ if len(*requests) != 2 {
+ t.Fatalf("expected 2 requests, got %d", len(*requests))
+ }
+ if (*requests)[0].Path != "/badge" || (*requests)[1].Path != "/badge" {
+ t.Fatalf("badge request path mismatch: %#v", *requests)
+ }
+ if !strings.Contains((*requests)[0].Body, `"badge":3`) ||
+ !strings.Contains((*requests)[0].Body, `"channels":["sales","customer-success"]`) {
+ t.Fatalf("targeted badge body mismatch: %s", (*requests)[0].Body)
+ }
+ if !strings.Contains((*requests)[1].Body, `"badge":0`) {
+ t.Fatalf("clear badge body mismatch: %s", (*requests)[1].Body)
+ }
+}
+
func TestLiveActivitiesShortAndLegacyMethods(t *testing.T) {
server, requests := newAPITestServer(t)
defer server.Close()
diff --git a/version.go b/version.go
index 614a637..e92ee29 100644
--- a/version.go
+++ b/version.go
@@ -1,3 +1,3 @@
package activitysmith
-const Version = "1.8.0"
+const Version = "1.9.0"