取名小程序
This commit is contained in:
36
DouyinApi.Model/Security/ContentSecurityResult.cs
Normal file
36
DouyinApi.Model/Security/ContentSecurityResult.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DouyinApi.Model.Security
|
||||
{
|
||||
public class ContentSecurityResult
|
||||
{
|
||||
public bool IsSafe { get; init; }
|
||||
|
||||
public string RiskCode { get; init; } = string.Empty;
|
||||
|
||||
public string Message { get; init; } = string.Empty;
|
||||
|
||||
public IReadOnlyList<string> HitKeywords { get; init; } = Array.Empty<string>();
|
||||
|
||||
public static ContentSecurityResult Safe() => new ContentSecurityResult { IsSafe = true };
|
||||
|
||||
public static ContentSecurityResult Unsafe(string riskCode, string message) => Unsafe(riskCode, message, Array.Empty<string>());
|
||||
|
||||
public static ContentSecurityResult Unsafe(string riskCode, string message, IReadOnlyList<string> keywords)
|
||||
=> new ContentSecurityResult
|
||||
{
|
||||
IsSafe = false,
|
||||
RiskCode = riskCode,
|
||||
Message = message,
|
||||
HitKeywords = keywords ?? Array.Empty<string>()
|
||||
};
|
||||
|
||||
public static ContentSecurityResult Failure(string message)
|
||||
=> new ContentSecurityResult
|
||||
{
|
||||
IsSafe = true,
|
||||
Message = message
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user