Beispiel #1
0
    ///<summary>
    /// Create an DELETE request from _input.
    ///</summary>
    ///<param name="_obj">The OgreeObject to delete</param>
    public void CreateDeleteRequest(OgreeObject _obj)
    {
        SRequest request = new SRequest();

        request.type = "delete";
        request.path = $"/{_obj.category}s/{_obj.id}";
        requestsToSend.Enqueue(request);
    }
Beispiel #2
0
    ///<summary>
    /// Create an PUT request from _input.
    ///</summary>
    ///<param name="_obj">The OgreeObject to put</param>
    public void CreatePutRequest(OgreeObject _obj)
    {
        SRequest request = new SRequest();

        request.type = "put";

        SApiObject apiObj = new SApiObject(_obj);

        request.path = $"/{apiObj.category}s/{apiObj.id}";
        request.json = JsonConvert.SerializeObject(apiObj);
        requestsToSend.Enqueue(request);
    }
Beispiel #3
0
    ///<summary>
    /// Create OgreeObject of "tenant" category from given data.
    ///</summary>
    ///<param name="_tn">The tenant data to apply</param>
    ///<returns>The created Tenant</returns>
    public OgreeObject CreateTenant(SApiObject _tn)
    {
        if (GameManager.gm.allItems.Contains(_tn.name))
        {
            GameManager.gm.AppendLogLine($"{_tn.name} already exists.", true, eLogtype.error);
            return(null);
        }

        GameObject  newTenant = new GameObject(_tn.name);
        OgreeObject tenant    = newTenant.AddComponent <OgreeObject>();

        tenant.UpdateFromSApiObject(_tn);
        tenant.UpdateHierarchyName();
        GameManager.gm.allItems.Add(_tn.name, newTenant);

        return(tenant);
    }