Changeset 410


Ignore:
Timestamp:
Feb 22, 2023, 5:54:14 PM (21 months ago)
Author:
alloc
Message:

Base API class improvements

Location:
binary-improvements2/WebServer/src/WebAPI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • binary-improvements2/WebServer/src/WebAPI/AbsRestApi.cs

    r404 r410  
    88        public abstract class AbsRestApi : AbsWebAPI {
    99                private static readonly UnityEngine.Profiling.CustomSampler jsonDeserializeSampler = UnityEngine.Profiling.CustomSampler.Create ("JSON_Deserialize");
     10
     11                protected AbsRestApi (string _name = null) : this(null, _name) {
     12                }
     13
     14                protected AbsRestApi (Web _parentWeb, string _name = null) : base(_parentWeb, _name) {
     15                }
    1016
    1117                public sealed override void HandleRequest (RequestContext _context) {
  • binary-improvements2/WebServer/src/WebAPI/AbsWebAPI.cs

    r391 r410  
    22        public abstract class AbsWebAPI {
    33                public readonly string Name;
     4                protected readonly Web ParentWeb;
    45
    5                 protected AbsWebAPI (string _name = null) {
     6                protected AbsWebAPI (string _name = null) : this(null, _name) {
     7                }
     8
     9                protected AbsWebAPI (Web _parentWeb, string _name = null) {
    610                        Name = _name ?? GetType ().Name;
     11                        ParentWeb = _parentWeb;
    712                }
    813
    914                public abstract void HandleRequest (RequestContext _context);
    1015
    11                 public virtual int DefaultPermissionLevel () {
    12                         return 0;
    13                 }
     16                public virtual int DefaultPermissionLevel () => 0;
    1417        }
    1518}
Note: See TracChangeset for help on using the changeset viewer.