private static CommunicationCloudEnvironment Deserialize(CommunicationCloudEnvironmentModel cloud)
        {
            if (cloud == CommunicationCloudEnvironmentModel.Public)
            {
                return(CommunicationCloudEnvironment.Public);
            }
            if (cloud == CommunicationCloudEnvironmentModel.Gcch)
            {
                return(CommunicationCloudEnvironment.Gcch);
            }
            if (cloud == CommunicationCloudEnvironmentModel.Dod)
            {
                return(CommunicationCloudEnvironment.Dod);
            }

            return(new CommunicationCloudEnvironment(cloud.ToString()));
        }
示例#2
0
        internal static MicrosoftTeamsUserIdentifierModel DeserializeMicrosoftTeamsUserIdentifierModel(JsonElement element)
        {
            string          userId      = default;
            Optional <bool> isAnonymous = default;
            Optional <CommunicationCloudEnvironmentModel> cloud = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("userId"))
                {
                    userId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("isAnonymous"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    isAnonymous = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("cloud"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    cloud = new CommunicationCloudEnvironmentModel(property.Value.GetString());
                    continue;
                }
            }
            return(new MicrosoftTeamsUserIdentifierModel(userId, Optional.ToNullable(isAnonymous), Optional.ToNullable(cloud)));
        }