public void Delete(ReleaseStatus request) { using (Execute) { Execute.Run(ssn => { if (!(request?.Id > 0)) { throw new HttpError(HttpStatusCode.NotFound, $"No Id provided for delete."); } var en = DocEntityReleaseStatus.GetReleaseStatus(request?.Id); if (null == en) { throw new HttpError(HttpStatusCode.NotFound, $"No ReleaseStatus could be found for Id {request?.Id}."); } if (en.IsRemoved) { return; } if (!DocPermissionFactory.HasPermission(en, currentUser, DocConstantPermission.DELETE)) { throw new HttpError(HttpStatusCode.Forbidden, "You do not have DELETE permission for this route."); } en.Remove(); DocCacheClient.RemoveSearch(DocConstantModelName.RELEASESTATUS); DocCacheClient.RemoveById(request.Id); }); } }
private ReleaseStatus GetReleaseStatus(ReleaseStatus request) { var id = request?.Id; ReleaseStatus ret = null; var query = DocQuery.ActiveQuery ?? Execute; DocPermissionFactory.SetVisibleFields <ReleaseStatus>(currentUser, "ReleaseStatus", request.VisibleFields); DocEntityReleaseStatus entity = null; if (id.HasValue) { entity = DocEntityReleaseStatus.GetReleaseStatus(id.Value); } if (null == entity) { throw new HttpError(HttpStatusCode.NotFound, $"No ReleaseStatus found for Id {id.Value}"); } if (!DocPermissionFactory.HasPermission(entity, currentUser, DocConstantPermission.VIEW)) { throw new HttpError(HttpStatusCode.Forbidden, "You do not have VIEW permission for this route."); } ret = entity?.ToDto(); return(ret); }
public static Task <Either <ActionResult, Release> > CheckCanUpdateReleaseStatus( this IUserService userService, Release release, ReleaseStatus status) { switch (status) { case ReleaseStatus.Draft: { return(userService.CheckCanMarkReleaseAsDraft(release)); } case ReleaseStatus.HigherLevelReview: { return(userService.CheckCanSubmitReleaseToHigherApproval(release)); } case ReleaseStatus.Approved: { return(userService.CheckCanApproveRelease(release)); } default: { return(Task.FromResult(new Either <ActionResult, Release>(release))); } } }
protected void UpdateNode(XML.NodeDesign nodeDesign, List <string> path, Action <XML.InstanceDesign, List <string> > createInstanceType) { string _defaultDisplay = string.IsNullOrEmpty(BrowseName) ? SymbolicName.Name : BrowseName; nodeDesign.BrowseName = BrowseName == SymbolicName.Name ? null : BrowseName; List <XML.NodeDesign> _Members = new List <XML.NodeDesign>(); path.Add(SymbolicName.Name); base.ExportNodes(_Members, path, createInstanceType); XML.InstanceDesign[] _items = _Members.Cast <XML.InstanceDesign>().ToArray <XML.InstanceDesign>(); nodeDesign.Category = Category == null ? null : string.Join(", ", Category); nodeDesign.Children = _items == null || _items.Length == 0 ? null : new XML.ListOfChildren() { Items = _items }; nodeDesign.Description = m_Description; nodeDesign.DisplayName = m_DisplayName == null || m_DisplayName.Value == _defaultDisplay ? null : m_DisplayName; nodeDesign.IsDeclaration = false; nodeDesign.NotInAddressSpace = false; nodeDesign.NumericId = 0; nodeDesign.NumericIdSpecified = false; nodeDesign.PartNo = 0; nodeDesign.Purpose = DataTypePurpose.ConvertToDataTypePurpose(); nodeDesign.References = m_References.Count == 0 ? null : m_References.Select <ReferenceFactoryBase, XML.Reference>(x => x.Export()).ToArray <XML.Reference>(); nodeDesign.ReleaseStatus = ReleaseStatus.ConvertToReleaseStatus(); nodeDesign.StringId = null; nodeDesign.SymbolicId = null; nodeDesign.SymbolicName = SymbolicName; nodeDesign.WriteAccess = WriteAccess; // AccessRestrictions _access = AccessRestrictions; model design doesn't support AccessRestrictions }
public ReleaseStatus Post(ReleaseStatus request) { if (request == null) { throw new HttpError(HttpStatusCode.NotFound, "Request cannot be null."); } request.VisibleFields = request.VisibleFields ?? new List <string>(); ReleaseStatus ret = null; using (Execute) { Execute.Run(ssn => { if (!DocPermissionFactory.HasPermissionTryAdd(currentUser, "ReleaseStatus")) { throw new HttpError(HttpStatusCode.Forbidden, "You do not have ADD permission for this route."); } ret = _AssignValues(request, DocConstantPermission.ADD, ssn); }); } return(ret); }
public static ReleaseInfoCollection FromRss(MemoryStream stream) { ReleaseInfoCollection releases = new ReleaseInfoCollection(); // regex to match a valid release version Regex regex = new Regex(@"\d+.\d+.\d+"); XDocument document = XDocument.Load(stream); foreach (var item in document.Element("rss").Element("channel").Descendants("item")) { string title = item.Element("title").Value; Match match = regex.Match(title); if (!match.Success) { continue; } string titleLower = title.ToLower(); if (titleLower.Contains("deleted") || titleLower.Contains("removed")) { continue; } ReleaseStatus status = ReleaseStatus.Stable; if (titleLower.Contains("alpha")) { status = ReleaseStatus.Alpha; } else if (titleLower.Contains("beta")) { status = ReleaseStatus.Beta; } Version version = new Version(match.Groups[0].Value); if (releases.Exists(r => r.Version == version)) { continue; } string link = item.Element("link").Value; ReleaseInfo release = new ReleaseInfo() { Status = status, Url = link, Version = version, }; releases.Add(release); } return(releases); }
public ArtistReleaseType(ReleaseType type, ReleaseStatus status, ReleaseArtistType artistType) { StringBuilder builder = new StringBuilder(); Format(builder, type, artistType); builder.Append('+'); Format(builder, status, artistType); str = builder.ToString(); }
public DataType() { this.allowArraysField = false; this.notInAddressSpaceField = false; this.partNoField = ((uint)(0)); this.categoryField = ""; this.releaseStatusField = ReleaseStatus.Released; this.purposeField = DataTypePurpose.Normal; }
public FirmwarePackageViewModel GetViewModel(string ElementKey, IRepositoryElement RepositoryElement, FirmwarePackageAvailabilityViewModel AvailabilityViewModel, ReleaseStatus Status) { var version = new FirmwareVersionViewModel(RepositoryElement.Information.FirmwareVersion.ToString(2), RepositoryElement.Information.FirmwareVersionLabel, RepositoryElement.Information.ReleaseDate); return new FirmwarePackageViewModel(ElementKey, version, AvailabilityViewModel, Status, RepositoryElement); }
public static ReleaseInfo GetLatest(List <ReleaseInfo> releases, ReleaseStatus minimumStatus) { if (releases.Count < 1) { return(null); } return(releases.Where(r => ((int)r.Status) >= ((int)minimumStatus)).OrderByDescending(r => r.Version).FirstOrDefault()); }
public FirmwarePackageViewModel(string Key, FirmwareVersionViewModel Version, FirmwarePackageAvailabilityViewModel Availability, ReleaseStatus Status, [NotNull] IFirmwarePackageProvider PackageProvider) { this.Key = Key; this.Status = Status; _packageProvider = PackageProvider; this.Availability = Availability; this.Version = Version; }
public static ReleaseInfoCollection FromJSON(MemoryStream stream) { ReleaseInfoCollection releases = new ReleaseInfoCollection(); // regex to match a valid release version Regex regex = new Regex(@"\d+.\d+.\d+.\d+"); StreamReader reader = new StreamReader(stream); JsonArray jArray = JsonValue.Load(stream) as JsonArray; foreach (JsonValue jValue in jArray) { string title = jValue["name"]; Match match = regex.Match(title); if (!match.Success) { continue; } ReleaseStatus status = ReleaseStatus.Stable; if (jValue["draft"]) { status = ReleaseStatus.Beta; } Version version = new Version(match.Groups[0].Value); if (releases.Exists(r => r.Version == version)) { continue; } string link = ""; if (jValue["assets"].Count > 0) { link = jValue["assets"][0]["browser_download_url"]; } else { continue; } ReleaseInfo release = new ReleaseInfo() { Status = status, Url = link, Version = version, }; releases.Add(release); } return(releases); }
public async Task <List <AvatarResponse> > List(ReleaseStatus releaseStatus = ReleaseStatus.All, int amount = 100, string user = null) { var sb = new StringBuilder(); if (!string.IsNullOrEmpty(user)) { sb.Append($"&user={user}"); } HttpResponseMessage response = await Global.HttpClient.GetAsync($"avatars?apiKey={Global.ApiKey}&releaseStatus={releaseStatus.GetDescription()}&n={amount}{sb.ToString()}"); return(await Utils.ParseResponse <List <AvatarResponse> >(response)); }
public override int GetHashCode() { int hash = 1; if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (Action.Length != 0) { hash ^= Action.GetHashCode(); } if (Id.Length != 0) { hash ^= Id.GetHashCode(); } if (RepoSource.Length != 0) { hash ^= RepoSource.GetHashCode(); } if (RepoOwner.Length != 0) { hash ^= RepoOwner.GetHashCode(); } if (ReleaseVersion.Length != 0) { hash ^= ReleaseVersion.GetHashCode(); } if (ReleaseStatus.Length != 0) { hash ^= ReleaseStatus.GetHashCode(); } hash ^= events_.GetHashCode(); if (insertedAtTime_ != null) { hash ^= InsertedAtTime.GetHashCode(); } if (updatedAtTime_ != null) { hash ^= UpdatedAtTime.GetHashCode(); } if (duration_ != null) { hash ^= Duration.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public ReleaseDataItem() { mMarket = ""; mVersion = ""; mPlatform = ""; mReleaseDate = ""; mReleaseLabel = ""; mSoftwareName = ""; mNotes = ""; mSha1 = ""; mHMAC = ""; mIsPlatform = false; mStatus = ReleaseStatus.NONE; }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } ReleaseStatus = await _context.ReleaseStatus.FirstOrDefaultAsync(m => m.Id == id); if (ReleaseStatus == null) { return(NotFound()); } return(Page()); }
public void should_filter_albums_by_release_status(ReleaseStatus type) { _metadataProfile.ReleaseStatuses = new List <ProfileReleaseStatusItem> { new ProfileReleaseStatusItem { ReleaseStatus = type, Allowed = true } }; var albums = GivenExampleAlbums(); Subject.FilterAlbums(albums, 1).SelectMany(x => x.ReleaseStatuses).Distinct() .Should().BeEquivalentTo(new List <string> { type.Name }); }
private Color ColorFromReleaseStatus(ReleaseStatus releaseStatus) { switch (releaseStatus) { case ReleaseStatus.Public: return(Color.Green); case ReleaseStatus.Private: return(Color.OrangeRed); case ReleaseStatus.Hidden: return(Color.Gray); default: return(Color.Orange); } }
private static async Task TestReportJobStarted(ReleaseStatus releaseStatus, bool returnNullRelease, int expectedEventCount) { // given VstsMessage vstsContext = new TestVstsMessage { VstsHub = HubType.Release, VstsUri = new Uri("http://vstsUri"), VstsPlanUri = new Uri("http://vstsPlanUri"), ReleaseProperties = new VstsReleaseProperties(), }; var mockBuildClient = new MockBuildClient() { MockBuild = new Build() { Status = BuildStatus.None }, ReturnNullBuild = false, }; var mockReleaseClient = new MockReleaseClient() { MockRelease = new Release() { Status = releaseStatus }, ReturnNullRelease = returnNullRelease, }; var mockTaskClient = new MockTaskClient(); var reportingHelper = new VstsReportingHelper(vstsContext, new TraceBrokerInstrumentation(), new Dictionary <string, string>()) { CreateReleaseClient = (uri, s) => ReturnMockReleaseClientIfUrlValid(uri, vstsContext, mockReleaseClient), CreateBuildClient = (uri, s) => mockBuildClient, CreateTaskHttpClient = (uri, s, i, r) => mockTaskClient }; // when await reportingHelper.ReportJobStarted(DateTime.UtcNow, "test message", default(CancellationToken)); // then Assert.AreEqual(expectedEventCount, mockTaskClient.EventsReceived.Count); if (expectedEventCount != 0) { var taskEvent = mockTaskClient.EventsReceived[0] as JobStartedEvent; Assert.IsNotNull(taskEvent); } }
//private static ReleaseInfoCollection FromRss(MemoryStream stream) //{ // ReleaseInfoCollection releases = new ReleaseInfoCollection(); // XPathDocument document = new XPathDocument(stream); // XPathNavigator navigator = document.CreateNavigator(); // foreach (XPathNavigator itemNavigator in navigator.Select("/rss/channel/item")) // { // try // { // string title = itemNavigator.Evaluate("string(title)") as string; // if (title == null) // continue; // Regex regex = new Regex(@"\d+.\d+.\d+"); // Match match = regex.Match(title); // if (!match.Success) // continue; // ReleaseInfo release = new ReleaseInfo(); // // update found, get release link // release.Url = itemNavigator.Evaluate("string(link)") as string; // if (string.IsNullOrEmpty(release.Url)) // continue; // release.Version = new Version(match.Groups[0].Value); // if (release.Version == null) // continue; // releases.Add(release); // } // catch (Exception ex) // { // Debug.WriteLine(ex); // } // } // return releases; //} #endregion public ReleaseInfo GetLatest(ReleaseStatus minimumStatus) { if (this.Count < 1) { return(null); } var filteredReleases = this.Where(r => ((int)r.Status) >= ((int)minimumStatus)).ToList(); if (filteredReleases.Count < 1) { return(null); } filteredReleases.Sort(this); return(filteredReleases[filteredReleases.Count - 1]); }
private static async Task TestReportJobStarted(ReleaseStatus releaseStatus, bool returnNullRelease, int expectedEventCount) { // given VstsMessage vstsContext = new TestVstsMessage { VstsHub = HubType.Release, VstsUri = new Uri("http://vstsUri"), VstsPlanUri = new Uri("http://vstsPlanUri"), ReleaseProperties = new VstsReleaseProperties(), }; var mockBuildClient = new MockBuildClient() { MockBuild = new Build() { Status = BuildStatus.None }, ReturnNullBuild = false, }; var mockReleaseClient = new MockReleaseClient() { MockRelease = new Release() { Status = releaseStatus }, ReturnNullRelease = returnNullRelease, }; var mockTaskClient = new MockTaskClient(); Assert.AreNotEqual(vstsContext.VstsUri, vstsContext.VstsPlanUri, "need to be different to ensure we can test correct one is used"); var reportingHelper = new TestableJobStatusReportingHelper(vstsContext, new TraceLogger(), mockTaskClient, mockReleaseClient, mockBuildClient); // when await reportingHelper.ReportJobStarted(DateTime.UtcNow, "test message", default(CancellationToken)); // then Assert.AreEqual(expectedEventCount, mockTaskClient.EventsReceived.Count); if (expectedEventCount != 0) { var taskEvent = mockTaskClient.EventsReceived[0] as JobStartedEvent; Assert.IsNotNull(taskEvent); } }
internal static XML.ReleaseStatus ConvertToReleaseStatus(this ReleaseStatus releaseStatus) { XML.ReleaseStatus _status = XML.ReleaseStatus.Released; switch (releaseStatus) { case ReleaseStatus.Released: _status = XML.ReleaseStatus.Released; break; case ReleaseStatus.Draft: _status = XML.ReleaseStatus.Draft; break; case ReleaseStatus.Deprecated: _status = XML.ReleaseStatus.Deprecated; break; } return(_status); }
public ReleaseStatus Patch(ReleaseStatus request) { if (true != (request?.Id > 0)) { throw new HttpError(HttpStatusCode.NotFound, "Please specify a valid Id of the ReleaseStatus to patch."); } request.VisibleFields = request.VisibleFields ?? new List <string>(); ReleaseStatus ret = null; using (Execute) { Execute.Run(ssn => { ret = _AssignValues(request, DocConstantPermission.EDIT, ssn); }); } return(ret); }
public override IList <string> ToMessage(BotElement bot, TextElement text, Func <string, string> transform) { var formatter = new { TeamProjectCollection = transform(TeamProjectCollection), ProjectName = transform(ProjectName), ReleaseDefinition = transform(ReleaseDefinition), ReleaseStatus = transform(ReleaseStatus.ToString()), ReleaseUrl, ReleaseName = transform(ReleaseName), ReleaseReason = transform(ReleaseReason.ToString()), CreatedBy = transform(CreatedByUniqueName), CreatedByDisplayName = transform(CreatedByDisplayName), DisplayName = transform(CreatedByDisplayName), CreatedOn, UserName = transform(UserName), MappedUser = bot.GetMappedUser(CreatedByUniqueName) }; return(new[] { text.ReleaseCreatedFormat.FormatWith(formatter) }); }
public async Task <List <AvatarResponse> > Personal(ReleaseStatus releaseStatus = ReleaseStatus.All, int amount = 100) => await List(releaseStatus : releaseStatus, amount : amount, user : "******");
private bool AddRelease(String Market, String Name, String Version, String Label, String Platform, String Date, String sha1, String hmac, String Notes, ReleaseStatus Status, bool isPlatform) { if (mFilePath == null) return false; if (Market == "") return false; ReleaseDataItem node = new ReleaseDataItem(); node.Market = Market; node.Version = Version; node.ReleaseLabel = Label; node.Platform = Platform; node.ReleaseDate = Date; node.SoftwareName = Name; node.IsPlatform = isPlatform; node.Status = Status; node.SHA1 = sha1; node.HMAC = hmac; node.Notes = Notes; mReleaseData.Add(node); return true; }
public bool Release(String Market, String Name, String Version, String Label, String Platform, String Date, String sha1, String hmac, String Notes, ReleaseStatus Status, bool isPlatform) { if (Market == "" || Name == "" || Version == "" || Label == "" || Platform == "" || Date == "" || sha1 == "" || hmac == "") { MessageBox.Show("Missing Release information:" + Environment.NewLine + "Market : " + Market + Environment.NewLine + "Game Name : " + Name + Environment.NewLine + "Version : " + Version + Environment.NewLine + "Label : " + Label + Environment.NewLine + "Platform : " + Platform + Environment.NewLine + "SHA1 : " + sha1 + Environment.NewLine + "HMAC : " + hmac + Environment.NewLine + "Date : " + Date + Environment.NewLine, "Release Data Incomplete", MessageBoxButtons.OK); return false; } foreach (ReleaseDataItem item in mReleaseData) { if (item.Version == Version && item.Market == Market) { // this is an update to an existing release. item.ReleaseLabel = Label; item.Platform = Platform; item.ReleaseDate = Date; item.SoftwareName = Name; item.IsPlatform = isPlatform; item.Status = Status; item.SHA1 = sha1; item.HMAC = hmac; item.Notes = Notes; return true; } } // No matching release in the indicated market, add new release data to the list return AddRelease(Market, Name, Version, Label, Platform, Date, sha1, hmac, Notes, Status, isPlatform); }
/// <summary>Инициализирует новый экземпляр класса <see cref="T:System.Object" />.</summary> public FakeRepositoryElement(PackageInformation Information, ICollection<ComponentTarget> Targets, ReleaseStatus Status) { this.Status = Status; this.Information = Information; this.Targets = Targets; }
public ArtistReleaseType (ReleaseType type, ReleaseStatus status, ReleaseArtistType artistType) { StringBuilder builder = new StringBuilder (); Format (builder, type, artistType); builder.Append ('+'); Format (builder, status, artistType); str = builder.ToString (); }
public ArtistReleaseType (ReleaseStatus status, ReleaseArtistType artistType) : this ((Enum)status, artistType) { }
public SearchVideos WithReleaseStatus(ReleaseStatus value) { AddQueryParameter(Constants.ReleaseStatus, value); return(this); }
private async Task UpdateStage(ReleaseStatus releaseStatus, ReleaseStatusPublishingStage stage, ReleaseStatusLogMessage logMessage = null) { await _releaseStatusService.UpdatePublishingStageAsync(releaseStatus.ReleaseId, releaseStatus.Id, stage, logMessage); }
public ReleaseStatus Put(ReleaseStatus request) { return(Patch(request)); }
public ReleaseStatus Post(ReleaseStatusCopy request) { ReleaseStatus ret = null; using (Execute) { Execute.Run(ssn => { var entity = DocEntityReleaseStatus.GetReleaseStatus(request?.Id); if (null == entity) { throw new HttpError(HttpStatusCode.NoContent, "The COPY request did not succeed."); } if (!DocPermissionFactory.HasPermission(entity, currentUser, DocConstantPermission.ADD)) { throw new HttpError(HttpStatusCode.Forbidden, "You do not have ADD permission for this route."); } var pBranch = entity.Branch; if (!DocTools.IsNullOrEmpty(pBranch)) { pBranch += " (Copy)"; } var pRelease = entity.Release; if (!DocTools.IsNullOrEmpty(pRelease)) { pRelease += " (Copy)"; } var pServer = entity.Server; if (!DocTools.IsNullOrEmpty(pServer)) { pServer += " (Copy)"; } var pURL = entity.URL; if (!DocTools.IsNullOrEmpty(pURL)) { pURL += " (Copy)"; } var pVersion = entity.Version; if (!DocTools.IsNullOrEmpty(pVersion)) { pVersion += " (Copy)"; } #region Custom Before copyReleaseStatus #endregion Custom Before copyReleaseStatus var copy = new DocEntityReleaseStatus(ssn) { Hash = Guid.NewGuid() , Branch = pBranch , Release = pRelease , Server = pServer , URL = pURL , Version = pVersion }; #region Custom After copyReleaseStatus #endregion Custom After copyReleaseStatus copy.SaveChanges(DocConstantPermission.ADD); ret = copy.ToDto(); }); } return(ret); }
public static void FetchList(Action <IEnumerable <ApiWorld> > successCallback, Action <string> errorCallback = null, SortHeading heading = SortHeading.Featured, SortOwnership owner = SortOwnership.Any, SortOrder order = SortOrder.Descending, int offset = 0, int count = 10, string search = "", string[] tags = null, string[] excludeTags = null, string[] userTags = null, string userId = "", ReleaseStatus releaseStatus = ReleaseStatus.Public, string includePlatforms = null, string excludePlatforms = null, bool disableCache = false, bool compatibleVersionsOnly = true) { string endpoint = "worlds"; Dictionary <string, object> dictionary = new Dictionary <string, object>(); switch (heading) { case SortHeading.Featured: dictionary.Add("sort", "order"); dictionary.Add("featured", "true"); break; case SortHeading.Trending: dictionary.Add("sort", "popularity"); dictionary.Add("featured", "false"); break; case SortHeading.Updated: dictionary.Add("sort", "updated"); break; case SortHeading.Created: dictionary.Add("sort", "created"); break; case SortHeading.Publication: dictionary.Add("sort", "publicationDate"); break; case SortHeading.Shuffle: dictionary.Add("sort", "shuffle"); break; case SortHeading.Active: endpoint = "worlds/active"; break; case SortHeading.Recent: endpoint = "worlds/recent"; break; case SortHeading.Playlist: endpoint = "worlds/favorites"; dictionary.Add("userId", userId); break; case SortHeading.Favorite: endpoint = "worlds/favorites"; break; case SortHeading.Labs: dictionary.Add("sort", "labsPublicationDate"); break; case SortHeading.Heat: dictionary.Add("sort", "heat"); dictionary.Add("featured", "false"); break; } switch (owner) { case SortOwnership.Mine: dictionary.Add("user", "me"); break; case SortOwnership.Friend: dictionary.Add("userId", userId); break; } dictionary.Add("n", count); switch (order) { case SortOrder.Ascending: dictionary.Add("order", "ascending"); break; case SortOrder.Descending: dictionary.Add("order", "descending"); break; } dictionary.Add("offset", offset); if (!string.IsNullOrEmpty(search)) { dictionary.Add("search", search); } int num = (tags != null) ? tags.Length : 0; int num2 = (userTags != null) ? userTags.Length : 0; if (num + num2 > 0) { string[] array = new string[num + num2]; if (num > 0) { tags.CopyTo(array, 0); } if (num2 > 0) { userTags.CopyTo(array, num); } dictionary.Add("tag", string.Join(",", array)); } if (excludeTags != null && excludeTags.Length > 0) { dictionary.Add("notag", string.Join(",", excludeTags)); } dictionary.Add("releaseStatus", releaseStatus.ToString().ToLower()); if (compatibleVersionsOnly) { dictionary.Add("maxUnityVersion", VERSION.UnityVersion); dictionary.Add("minUnityVersion", MIN_LOADABLE_VERSION.UnityVersion); dictionary.Add("maxAssetVersion", VERSION.ApiVersion); dictionary.Add("minAssetVersion", MIN_LOADABLE_VERSION.ApiVersion); } if (includePlatforms != null || excludePlatforms != null) { if (includePlatforms != null) { dictionary.Add("platform", includePlatforms); } if (excludePlatforms != null) { dictionary.Add("noplatform", excludePlatforms); } } ApiModelListContainer <ApiWorld> apiModelListContainer = new ApiModelListContainer <ApiWorld>(); apiModelListContainer.OnSuccess = delegate(ApiContainer c) { if (successCallback != null) { successCallback((c as ApiModelListContainer <ApiWorld>).ResponseModels); } }; apiModelListContainer.OnError = delegate(ApiContainer c) { Debug.LogError((object)("Could not fetch worlds, with error - " + c.Error)); if (errorCallback != null) { errorCallback(c.Error); } }; ApiModelListContainer <ApiWorld> responseContainer = apiModelListContainer; API.SendRequest(endpoint, HTTPMethods.Get, responseContainer, dictionary, authenticationRequired: true, disableCache, 180f); }
public object Get(ReleaseStatus request) => GetEntityWithCache <ReleaseStatus>(DocConstantModelName.RELEASESTATUS, request, GetReleaseStatus);
public ArtistReleaseType(ReleaseStatus status, ReleaseArtistType artistType) : this((Enum)status, artistType) { }
public FakeRepositoryElement(PackageInformation Information, ReleaseStatus Status = ReleaseStatus.Unknown) { this.Status = Status; this.Information = Information; Targets = new[] { new ComponentTarget(1, 1, 1, 1) }; }
private ReleaseStatus _AssignValues(ReleaseStatus request, DocConstantPermission permission, Session session) { if (permission != DocConstantPermission.ADD && (request == null || request.Id <= 0)) { throw new HttpError(HttpStatusCode.NotFound, $"No record"); } if (permission == DocConstantPermission.ADD && !DocPermissionFactory.HasPermissionTryAdd(currentUser, "ReleaseStatus")) { throw new HttpError(HttpStatusCode.Forbidden, "You do not have ADD permission for this route."); } request.VisibleFields = request.VisibleFields ?? new List <string>(); ReleaseStatus ret = null; request = _InitAssignValues <ReleaseStatus>(request, permission, session); //In case init assign handles create for us, return it if (permission == DocConstantPermission.ADD && request.Id > 0) { return(request); } var cacheKey = GetApiCacheKey <ReleaseStatus>(DocConstantModelName.RELEASESTATUS, nameof(ReleaseStatus), request); //First, assign all the variables, do database lookups and conversions var pBranch = request.Branch; var pRelease = request.Release; var pServer = request.Server; var pURL = request.URL; var pVersion = request.Version; DocEntityReleaseStatus entity = null; if (permission == DocConstantPermission.ADD) { var now = DateTime.UtcNow; entity = new DocEntityReleaseStatus(session) { Created = now, Updated = now }; } else { entity = DocEntityReleaseStatus.GetReleaseStatus(request.Id); if (null == entity) { throw new HttpError(HttpStatusCode.NotFound, $"No record"); } } //Special case for Archived var pArchived = true == request.Archived; if (DocPermissionFactory.IsRequestedHasPermission <bool>(currentUser, request, pArchived, permission, DocConstantModelName.RELEASESTATUS, nameof(request.Archived))) { if (DocPermissionFactory.IsRequested(request, pArchived, entity.Archived, nameof(request.Archived))) { if (DocResources.Metadata.IsInsertOnly(DocConstantModelName.RELEASESTATUS, nameof(request.Archived)) && DocConstantPermission.ADD != permission) { throw new HttpError(HttpStatusCode.Forbidden, $"{nameof(request.Archived)} cannot be modified once set."); } } if (DocTools.IsNullOrEmpty(pArchived) && DocResources.Metadata.IsRequired(DocConstantModelName.RELEASESTATUS, nameof(request.Archived))) { throw new HttpError(HttpStatusCode.BadRequest, $"{nameof(request.Archived)} requires a value."); } entity.Archived = pArchived; if (DocPermissionFactory.IsRequested <bool>(request, pArchived, nameof(request.Archived)) && !request.VisibleFields.Matches(nameof(request.Archived), ignoreSpaces: true)) { request.VisibleFields.Add(nameof(request.Archived)); } } if (DocPermissionFactory.IsRequestedHasPermission <string>(currentUser, request, pBranch, permission, DocConstantModelName.RELEASESTATUS, nameof(request.Branch))) { if (DocPermissionFactory.IsRequested(request, pBranch, entity.Branch, nameof(request.Branch))) { if (DocResources.Metadata.IsInsertOnly(DocConstantModelName.RELEASESTATUS, nameof(request.Branch)) && DocConstantPermission.ADD != permission) { throw new HttpError(HttpStatusCode.Forbidden, $"{nameof(request.Branch)} cannot be modified once set."); } } if (DocTools.IsNullOrEmpty(pBranch) && DocResources.Metadata.IsRequired(DocConstantModelName.RELEASESTATUS, nameof(request.Branch))) { throw new HttpError(HttpStatusCode.BadRequest, $"{nameof(request.Branch)} requires a value."); } entity.Branch = pBranch; if (DocPermissionFactory.IsRequested <string>(request, pBranch, nameof(request.Branch)) && !request.VisibleFields.Matches(nameof(request.Branch), ignoreSpaces: true)) { request.VisibleFields.Add(nameof(request.Branch)); } } if (DocPermissionFactory.IsRequestedHasPermission <string>(currentUser, request, pRelease, permission, DocConstantModelName.RELEASESTATUS, nameof(request.Release))) { if (DocPermissionFactory.IsRequested(request, pRelease, entity.Release, nameof(request.Release))) { if (DocResources.Metadata.IsInsertOnly(DocConstantModelName.RELEASESTATUS, nameof(request.Release)) && DocConstantPermission.ADD != permission) { throw new HttpError(HttpStatusCode.Forbidden, $"{nameof(request.Release)} cannot be modified once set."); } } if (DocTools.IsNullOrEmpty(pRelease) && DocResources.Metadata.IsRequired(DocConstantModelName.RELEASESTATUS, nameof(request.Release))) { throw new HttpError(HttpStatusCode.BadRequest, $"{nameof(request.Release)} requires a value."); } entity.Release = pRelease; if (DocPermissionFactory.IsRequested <string>(request, pRelease, nameof(request.Release)) && !request.VisibleFields.Matches(nameof(request.Release), ignoreSpaces: true)) { request.VisibleFields.Add(nameof(request.Release)); } } if (DocPermissionFactory.IsRequestedHasPermission <string>(currentUser, request, pServer, permission, DocConstantModelName.RELEASESTATUS, nameof(request.Server))) { if (DocPermissionFactory.IsRequested(request, pServer, entity.Server, nameof(request.Server))) { if (DocResources.Metadata.IsInsertOnly(DocConstantModelName.RELEASESTATUS, nameof(request.Server)) && DocConstantPermission.ADD != permission) { throw new HttpError(HttpStatusCode.Forbidden, $"{nameof(request.Server)} cannot be modified once set."); } } if (DocTools.IsNullOrEmpty(pServer) && DocResources.Metadata.IsRequired(DocConstantModelName.RELEASESTATUS, nameof(request.Server))) { throw new HttpError(HttpStatusCode.BadRequest, $"{nameof(request.Server)} requires a value."); } entity.Server = pServer; if (DocPermissionFactory.IsRequested <string>(request, pServer, nameof(request.Server)) && !request.VisibleFields.Matches(nameof(request.Server), ignoreSpaces: true)) { request.VisibleFields.Add(nameof(request.Server)); } } if (DocPermissionFactory.IsRequestedHasPermission <string>(currentUser, request, pURL, permission, DocConstantModelName.RELEASESTATUS, nameof(request.URL))) { if (DocPermissionFactory.IsRequested(request, pURL, entity.URL, nameof(request.URL))) { if (DocResources.Metadata.IsInsertOnly(DocConstantModelName.RELEASESTATUS, nameof(request.URL)) && DocConstantPermission.ADD != permission) { throw new HttpError(HttpStatusCode.Forbidden, $"{nameof(request.URL)} cannot be modified once set."); } } if (DocTools.IsNullOrEmpty(pURL) && DocResources.Metadata.IsRequired(DocConstantModelName.RELEASESTATUS, nameof(request.URL))) { throw new HttpError(HttpStatusCode.BadRequest, $"{nameof(request.URL)} requires a value."); } entity.URL = pURL; if (DocPermissionFactory.IsRequested <string>(request, pURL, nameof(request.URL)) && !request.VisibleFields.Matches(nameof(request.URL), ignoreSpaces: true)) { request.VisibleFields.Add(nameof(request.URL)); } } if (DocPermissionFactory.IsRequestedHasPermission <string>(currentUser, request, pVersion, permission, DocConstantModelName.RELEASESTATUS, nameof(request.Version))) { if (DocPermissionFactory.IsRequested(request, pVersion, entity.Version, nameof(request.Version))) { if (DocResources.Metadata.IsInsertOnly(DocConstantModelName.RELEASESTATUS, nameof(request.Version)) && DocConstantPermission.ADD != permission) { throw new HttpError(HttpStatusCode.Forbidden, $"{nameof(request.Version)} cannot be modified once set."); } } if (DocTools.IsNullOrEmpty(pVersion) && DocResources.Metadata.IsRequired(DocConstantModelName.RELEASESTATUS, nameof(request.Version))) { throw new HttpError(HttpStatusCode.BadRequest, $"{nameof(request.Version)} requires a value."); } entity.Version = pVersion; if (DocPermissionFactory.IsRequested <string>(request, pVersion, nameof(request.Version)) && !request.VisibleFields.Matches(nameof(request.Version), ignoreSpaces: true)) { request.VisibleFields.Add(nameof(request.Version)); } } if (request.Locked) { entity.Locked = request.Locked; } entity.SaveChanges(permission); DocPermissionFactory.SetVisibleFields <ReleaseStatus>(currentUser, nameof(ReleaseStatus), request.VisibleFields); ret = entity.ToDto(); var cacheExpires = DocResources.Metadata.GetCacheExpiration(DocConstantModelName.RELEASESTATUS); DocCacheClient.Set(key: cacheKey, value: ret, entityId: request.Id, entityType: DocConstantModelName.RELEASESTATUS, cacheExpires); return(ret); }