// Use this for initialization
 void Start()
 {
     if (editorGradient == null)
     {
         editorGradient = new MegaGradient();
     }
     if (entityRequest == null)
     {
         // try and get the component from the GameObject
         entityRequest = this.GetComponent <RequestComponent>();
         if (entityRequest == null)
         {
             Debug.LogError("Failed to get RequestComponent from GameObject.");
         }
     }
 }
        private (Hl7.Fhir.Model.Bundle rawBundle, Hl7.Fhir.Model.Bundle bundle) CreateBundle(params ResourceElement[] resources)
        {
            string id        = Guid.NewGuid().ToString();
            var    rawBundle = new Hl7.Fhir.Model.Bundle();
            var    bundle    = new Hl7.Fhir.Model.Bundle();

            rawBundle.Id    = bundle.Id = id;
            rawBundle.Type  = bundle.Type = BundleType.Searchset;
            rawBundle.Entry = new List <EntryComponent>();
            rawBundle.Total = resources.Count();
            bundle.Entry    = new List <EntryComponent>();
            bundle.Total    = resources.Count();

            foreach (var resource in resources)
            {
                var poco = resource.ToPoco();
                poco.VersionId        = "1";
                poco.Meta.LastUpdated = Clock.UtcNow;
                poco.Meta.Tag         = new List <Hl7.Fhir.Model.Coding>
                {
                    new Hl7.Fhir.Model.Coding {
                        System = "testTag", Code = Guid.NewGuid().ToString()
                    },
                };
                var wrapper = _wrapperFactory.Create(poco.ToResourceElement(), deleted: false, keepMeta: true);
                wrapper.Version = "1";

                var requestComponent = new RequestComponent {
                    Method = HTTPVerb.POST, Url = "patient/"
                };
                var responseComponent = new ResponseComponent {
                    Etag = "W/\"1\"", LastModified = DateTimeOffset.UtcNow, Status = "201 Created"
                };
                rawBundle.Entry.Add(new RawBundleEntryComponent(wrapper)
                {
                    Request  = requestComponent,
                    Response = responseComponent,
                });
                bundle.Entry.Add(new EntryComponent {
                    Resource = poco, Request = requestComponent, Response = responseComponent
                });
            }

            return(rawBundle, bundle);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Request処理を行う
        /// 動作中ならば専用のオブジェクトを生成する
        /// </summary>
        internal static void Request(this UnityWebRequest self, Action success, Action <ErrorMessage> error)
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                self.RequestEditor(success, error);
                return;
            }
#endif
            if (_requestComponent == null)
            {
                var obj = new GameObject("RequestObject", typeof(RequestComponent))
                {
                    hideFlags = HideFlags.HideAndDontSave
                };

                _requestComponent = obj.GetComponent <RequestComponent>();
            }

            _requestComponent.StartCoroutine(RequestImpl(self, success, error));
        }
Exemplo n.º 4
0
 void Initilize()
 {
     rieltorRequest  = new RequestComponent <Rieltor>();
     rieltorsRequest = new RequestComponent <Rieltor[]>();
 }