Skip to content

Commit

Permalink
Добавил информацию о технологическом решении партнёра (#1110)
Browse files Browse the repository at this point in the history
* Добавил информацию о технологическом решении партнёра.

DDCORE-7682
  • Loading branch information
tkirill authored Mar 6, 2024
1 parent 3732078 commit b683721
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/ComDiadocApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@ public void SetProxyCredentialsSecure(string proxyUser, SecureString proxyPasswo
diadoc.SetProxyCredentials(proxyUser, proxyPassword);
}

public void SetSolutionInfo(string solutionInfo)
{
diadoc.SetSolutionInfo(solutionInfo);
}

public void EnableSystemProxyUsage()
{
diadoc.EnableSystemProxyUsage();
Expand Down
8 changes: 8 additions & 0 deletions src/DiadocApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ public void SetProxyCredentials([NotNull] string user, [NotNull] SecureString pa
diadocHttpApi.HttpClient.SetProxyCredentials(user, password);
}

/// <summary>
/// Установить информацию об интеграционном решении технологического партнера.
/// </summary>
public void SetSolutionInfo([NotNull] string solutionInfo)
{
diadocHttpApi.SolutionInfo = solutionInfo;
}

public string Authenticate(string login, string password, string key = null, string id = null)
{
return diadocHttpApi.Authenticate(login, password, key, id);
Expand Down
9 changes: 9 additions & 0 deletions src/DiadocHttpApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public DiadocHttpApi(
[NotNull] public IHttpClient HttpClient { get; }

[NotNull] public DocflowHttpApi Docflow { get; }

/// <summary>
/// Информация об интеграционном решении технологического партнера.
/// </summary>
[CanBeNull] public string SolutionInfo { get; set; }

[NotNull]
protected byte[] PerformHttpRequest(
Expand Down Expand Up @@ -150,6 +155,10 @@ protected virtual HttpRequest BuildRequest(
sb.AppendFormat(",ddauth_token={0}", token);
}
request.AddHeader("Authorization", sb.ToString());
if (!string.IsNullOrEmpty(SolutionInfo))
{
request.AddHeader("X-Solution-Info", SolutionInfo);
}
return request;
}

Expand Down
5 changes: 3 additions & 2 deletions tests/TaskAsyncronousPattern_Test.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ private static IEnumerable<MethodInfo> GetAllDiadocHttpApiMethods()
"SetProxyUri",
"EnableSystemProxyUsage",
"DisableSystemProxyUsage",
"SetProxyCredentials"
"SetProxyCredentials",
"SetSolutionInfo"
};

private static readonly string[] ObjectMethods = typeof(object).GetMethods().Select(x => x.Name).ToArray();
Expand All @@ -127,4 +128,4 @@ private static IEnumerable<MethodInfo> GetAllApiMethodsForType(Type type)
.Where(x => !ObjectMethods.Contains(x.Name));
}
}
}
}

0 comments on commit b683721

Please sign in to comment.