Commit 5dd117cc authored by Sylvain Renault's avatar Sylvain Renault
Browse files

Scripts reviewed and updated for new WS Editor.

Extended some functionalities/inheritances.
parent 9188d5e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2022 ETSI
// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
+1 −1
Original line number Diff line number Diff line
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2022 ETSI
// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
+1 −1
Original line number Diff line number Diff line
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2022 ETSI
// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
+38 −0
Original line number Diff line number Diff line
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace ETSI.ARF.OpenAPI
{
    /// <summary>
    /// Simple class to debug the requests
    /// </summary>
    public class BaseClient
    {
        static public bool EnableClientLog = false;
        public string lastJsonText;
        public long lastPayload;

        protected void _prepareRequest(ETSI.ARF.OpenAPI.IHttpClient client, System.Net.Http.HttpRequestMessage request, string url)
        {
            if (EnableClientLog)
            {
                Debug.Log("[REST][URL] Send request: " + client.BaseAddress + url);
                Debug.Log("[REST][URL] Send request: " + request);
            }
        }

        protected void _processResponse(ETSI.ARF.OpenAPI.IHttpClient client, System.Net.Http.HttpResponseMessage response)
        {
            lastJsonText = response.Content.ReadAsStringAsync().Result.ToString();
            lastPayload = response.Content.Headers.ContentLength.Value;

            var status_ = (int)response.StatusCode;

            if (EnableClientLog)
            {
                Debug.Log("[REST][Data] Status: " + status_ + " Response: " + client.BaseAddress + " Len: " + lastPayload + " JSON: " + lastJsonText);
            }
        }
    }
}
 No newline at end of file
+11 −0
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: 2e0af995ecbb4654a9191f8157a1cf0e
MonoImporter:
  externalObjects: {}
  serializedVersion: 2
  defaultReferences: []
  executionOrder: 0
  icon: {instanceID: 0}
  userData: 
  assetBundleName: 
  assetBundleVariant: 
Loading