| 3202 | } |
| 3203 | |
| 3204 | func prepareNativeFanOutDesignations( |
| 3205 | input taskFanOutRunsInput, |
| 3206 | maxDesignations int, |
| 3207 | ) ([]nativePreparedFanOutDesignation, error) { |
| 3208 | if len(input.Designations) == 0 { |
| 3209 | return nil, errors.New("designations are required") |
| 3210 | } |
| 3211 | if len(input.Designations) > maxDesignations { |
| 3212 | return nil, fmt.Errorf("designations cannot exceed %d", maxDesignations) |
| 3213 | } |
| 3214 | prepared := make([]nativePreparedFanOutDesignation, 0, len(input.Designations)) |
| 3215 | for index, designation := range input.Designations { |
| 3216 | metadata, err := nativeFanOutDesignationMetadata(index, designation) |
| 3217 | if err != nil { |
| 3218 | return nil, err |
| 3219 | } |
| 3220 | idempotencyKey := nativeFanOutDesignationIdempotencyKey(input.IdempotencyKey, designation, index) |
| 3221 | if idempotencyKey == "" { |
| 3222 | return nil, fmt.Errorf( |
| 3223 | "designations[%d].idempotency_key is required when task fan-out idempotency_key is empty", |
| 3224 | index, |
| 3225 | ) |
| 3226 | } |
| 3227 | prepared = append(prepared, nativePreparedFanOutDesignation{ |
| 3228 | idempotencyKey: idempotencyKey, |
| 3229 | metadata: metadata, |
| 3230 | }) |
| 3231 | } |
| 3232 | return prepared, nil |
| 3233 | } |
| 3234 | |
| 3235 | func nativeNetworkThreadPromotionDigest( |
| 3236 | messages []store.NetworkConversationMessage, |