This commit is contained in:
@@ -8,6 +8,8 @@ using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using biz = GZTW.AyaNova.BLL;
|
||||
|
||||
|
||||
|
||||
namespace AyaNova.PlugIn.V8
|
||||
@@ -159,6 +161,8 @@ namespace AyaNova.PlugIn.V8
|
||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async static Task<ApiResponse> PutAsync(string route, string putJson = null)
|
||||
{
|
||||
|
||||
@@ -181,6 +185,24 @@ namespace AyaNova.PlugIn.V8
|
||||
}
|
||||
|
||||
|
||||
public async static Task<ApiResponse> PostFormDataAsync(string route, MultipartFormDataContent formContent)
|
||||
{
|
||||
var requestMessage = new HttpRequestMessage(HttpMethod.Post, route);
|
||||
if (!string.IsNullOrWhiteSpace(JWT))
|
||||
requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", JWT);
|
||||
|
||||
requestMessage.Content = formContent;
|
||||
|
||||
HttpResponseMessage response = await client.SendAsync(requestMessage);
|
||||
var responseAsString = await response.Content.ReadAsStringAsync();
|
||||
if (!response.IsSuccessStatusCode)
|
||||
{
|
||||
throw new Exception("POST FORMDATA error, route: " + route + "\n" + responseAsString + "\n" + response.ReasonPhrase);
|
||||
}
|
||||
else
|
||||
return new ApiResponse() { HttpResponse = response, ObjectResponse = Parse(responseAsString) };
|
||||
}
|
||||
|
||||
//eoc
|
||||
public class ApiResponse
|
||||
{
|
||||
@@ -304,6 +326,45 @@ namespace AyaNova.PlugIn.V8
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static int RootObjectToAyaType(biz.RootObjectTypes rot)
|
||||
{
|
||||
|
||||
switch (rot)
|
||||
{
|
||||
case biz.RootObjectTypes.User:
|
||||
return (int)AyaType.User;
|
||||
default:
|
||||
throw new NotImplementedException("V8:util:RootObjectToAyaType -> type " + rot.ToString() + " is not coded yet");
|
||||
}
|
||||
}
|
||||
|
||||
public enum AyaType : int
|
||||
{
|
||||
|
||||
NoType = 0,
|
||||
Global = 1,
|
||||
Widget = 2,//attachable, wikiable, reviewable
|
||||
User = 3,//attachable, wikiable, reviewable
|
||||
ServerState = 4,
|
||||
License = 5,
|
||||
LogFile = 6,
|
||||
PickListTemplate = 7,
|
||||
DEPRECATED_REUSELATER_08 = 8,
|
||||
ServerJob = 9,
|
||||
AyaNova7Import = 10,
|
||||
TrialSeeder = 11,
|
||||
Metrics = 12,
|
||||
Translation = 13,
|
||||
UserOptions = 14,
|
||||
DEPRECATED_REUSELATER_15 = 15,
|
||||
DEPRECATED_REUSELATER_16 = 16,
|
||||
FileAttachment = 17,
|
||||
DataListView = 18,
|
||||
FormCustom = 19
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}//eoc
|
||||
|
||||
Reference in New Issue
Block a user