|
| 1 | +import "@azure-tools/typespec-azure-core"; |
| 2 | +import "@azure-tools/typespec-azure-resource-manager"; |
| 3 | +import "@typespec/openapi"; |
| 4 | +import "@typespec/rest"; |
| 5 | +import "./models.tsp"; |
| 6 | +import "./SupportTicketDetails.tsp"; |
| 7 | + |
| 8 | +using TypeSpec.Rest; |
| 9 | +using Azure.Core; |
| 10 | +using Azure.ResourceManager; |
| 11 | +using TypeSpec.Http; |
| 12 | +using TypeSpec.OpenAPI; |
| 13 | + |
| 14 | +namespace Microsoft.Support; |
| 15 | +/** |
| 16 | + * Object that represents a Communication resource. |
| 17 | + */ |
| 18 | +@parentResource(SupportTicketDetails) |
| 19 | +model CommunicationDetails |
| 20 | + is Azure.ResourceManager.ProxyResource< |
| 21 | + CommunicationDetailsProperties, |
| 22 | + false |
| 23 | + > { |
| 24 | + ...ResourceNameParameter< |
| 25 | + Resource = CommunicationDetails, |
| 26 | + KeyName = "communicationName", |
| 27 | + SegmentName = "communications", |
| 28 | + NamePattern = "" |
| 29 | + >; |
| 30 | +} |
| 31 | + |
| 32 | +/** |
| 33 | + * [Placeholder] Description for page model |
| 34 | + */ |
| 35 | +model CommunicationsListResult { |
| 36 | + /** |
| 37 | + * [Placeholder] Description for nextLink property |
| 38 | + */ |
| 39 | + @nextLink |
| 40 | + nextLink?: string; |
| 41 | + |
| 42 | + /** |
| 43 | + * [Placeholder] Description for value property |
| 44 | + */ |
| 45 | + @pageItems |
| 46 | + value?: CommunicationDetails[]; |
| 47 | +} |
| 48 | + |
| 49 | +@armResourceOperations |
| 50 | +interface CommunicationOps |
| 51 | + extends Azure.ResourceManager.Legacy.LegacyOperations< |
| 52 | + { |
| 53 | + ...ApiVersionParameter, |
| 54 | + ...SubscriptionIdParameter, |
| 55 | + ...Azure.ResourceManager.Legacy.Provider, |
| 56 | + ...KeysOf<ResourceNameParameter< |
| 57 | + Resource = SupportTicketDetails, |
| 58 | + KeyName = "supportTicketName", |
| 59 | + SegmentName = "supportTickets", |
| 60 | + NamePattern = "" |
| 61 | + >>, |
| 62 | + }, |
| 63 | + KeysOf<ResourceNameParameter< |
| 64 | + Resource = CommunicationDetails, |
| 65 | + KeyName = "communicationName", |
| 66 | + SegmentName = "communications", |
| 67 | + NamePattern = "" |
| 68 | + >> |
| 69 | + > {} |
| 70 | + |
| 71 | +@armResourceOperations |
| 72 | +interface Communications { |
| 73 | + /** |
| 74 | + * Returns communication details for a support ticket. |
| 75 | + */ |
| 76 | + get is CommunicationOps.Read<CommunicationDetails>; |
| 77 | + |
| 78 | + /** |
| 79 | + * Adds a new customer communication to an Azure support ticket. |
| 80 | + */ |
| 81 | + #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility" |
| 82 | + #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 83 | + @Azure.Core.useFinalStateVia("azure-async-operation") |
| 84 | + create is CommunicationOps.CreateOrUpdateAsync< |
| 85 | + CommunicationDetails, |
| 86 | + Response = ArmResourceUpdatedResponse<CommunicationDetails> | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader<FinalResult = CommunicationDetails> & |
| 87 | + Azure.Core.Foundations.RetryAfterHeader> |
| 88 | + >; |
| 89 | + |
| 90 | + /** |
| 91 | + * Lists all communications (attachments not included) for a support ticket. <br/></br> You can also filter support ticket communications by _CreatedDate_ or _CommunicationType_ using the $filter parameter. The only type of communication supported today is _Web_. Output will be a paged result with _nextLink_, using which you can retrieve the next set of Communication results. <br/><br/>Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. |
| 92 | + */ |
| 93 | + list is CommunicationOps.List< |
| 94 | + CommunicationDetails, |
| 95 | + Parameters = { |
| 96 | + /** |
| 97 | + * The number of values to return in the collection. Default is 10 and max is 10. |
| 98 | + */ |
| 99 | + @query("$top") |
| 100 | + $top?: int32; |
| 101 | + |
| 102 | + /** |
| 103 | + * The filter to apply on the operation. You can filter by communicationType and createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the CommunicationType and CreatedDate filters by Logical And ('and') operator. |
| 104 | + */ |
| 105 | + @query("$filter") |
| 106 | + $filter?: string; |
| 107 | + }, |
| 108 | + Response = CommunicationsListResult |
| 109 | + >; |
| 110 | +} |
| 111 | +@armResourceOperations |
| 112 | +interface CommunicationsNoSubscriptionOps |
| 113 | + extends Azure.ResourceManager.Legacy.LegacyOperations< |
| 114 | + { |
| 115 | + ...ApiVersionParameter, |
| 116 | + ...Azure.ResourceManager.Legacy.Provider, |
| 117 | + ...KeysOf<ResourceNameParameter< |
| 118 | + Resource = SupportTicketDetails, |
| 119 | + KeyName = "supportTicketName", |
| 120 | + SegmentName = "supportTickets", |
| 121 | + NamePattern = "" |
| 122 | + >>, |
| 123 | + }, |
| 124 | + KeysOf<ResourceNameParameter< |
| 125 | + Resource = CommunicationDetails, |
| 126 | + KeyName = "communicationName", |
| 127 | + SegmentName = "communications", |
| 128 | + NamePattern = "" |
| 129 | + >> |
| 130 | + > {} |
| 131 | + |
| 132 | +#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "For backward compatibility" |
| 133 | +@armResourceOperations |
| 134 | +interface CommunicationsNoSubscription { |
| 135 | + /** |
| 136 | + * Returns communication details for a support ticket. |
| 137 | + */ |
| 138 | + get is CommunicationsNoSubscriptionOps.Read<CommunicationDetails>; |
| 139 | + |
| 140 | + /** |
| 141 | + * Adds a new customer communication to an Azure support ticket. |
| 142 | + */ |
| 143 | + #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility" |
| 144 | + #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 145 | + @Azure.Core.useFinalStateVia("azure-async-operation") |
| 146 | + create is CommunicationsNoSubscriptionOps.CreateOrUpdateAsync< |
| 147 | + CommunicationDetails, |
| 148 | + Response = ArmResourceUpdatedResponse<CommunicationDetails> | ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader<FinalResult = CommunicationDetails> & |
| 149 | + Azure.Core.Foundations.RetryAfterHeader> |
| 150 | + >; |
| 151 | + |
| 152 | + /** |
| 153 | + * Lists all communications (attachments not included) for a support ticket. <br/></br> You can also filter support ticket communications by _CreatedDate_ or _CommunicationType_ using the $filter parameter. The only type of communication supported today is _Web_. Output will be a paged result with _nextLink_, using which you can retrieve the next set of Communication results. <br/><br/>Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. |
| 154 | + */ |
| 155 | + list is CommunicationsNoSubscriptionOps.List< |
| 156 | + CommunicationDetails, |
| 157 | + Parameters = { |
| 158 | + /** |
| 159 | + * The number of values to return in the collection. Default is 10 and max is 10. |
| 160 | + */ |
| 161 | + @query("$top") |
| 162 | + $top?: int32; |
| 163 | + |
| 164 | + /** |
| 165 | + * The filter to apply on the operation. You can filter by communicationType and createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the CommunicationType and CreatedDate filters by Logical And ('and') operator. |
| 166 | + */ |
| 167 | + @query("$filter") |
| 168 | + $filter?: string; |
| 169 | + }, |
| 170 | + Response = CommunicationsListResult |
| 171 | + >; |
| 172 | +} |
| 173 | + |
| 174 | +@@doc(CommunicationDetails.name, "Communication name."); |
| 175 | +@@doc(CommunicationDetails.properties, "Properties of the resource."); |
| 176 | +@@doc(Communications.create::parameters.resource, "Communication object."); |
| 177 | +@@doc(CommunicationsNoSubscription.create::parameters.resource, |
| 178 | + "Communication object." |
| 179 | +); |
0 commit comments