@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 3.12 kB
JavaScript
import{_ as t}from"../chunks/tslib.es6.js";import r from"../core/Error.js";import{JSONSupport as e}from"../core/JSONSupport.js";import{unwrapOrThrow as o}from"../core/maybe.js";import{property as s}from"../core/accessorSupport/decorators/property.js";import{ensureType as n}from"../core/accessorSupport/ensureType.js";import"../core/arrayUtils.js";import{subclass as i}from"../core/accessorSupport/decorators/subclass.js";import l from"./PortalQueryParams.js";let u=class extends e{constructor(t){super(t),this.access=null,this.created=null,this.description=null,this.id=null,this.isInvitationOnly=!1,this.modified=null,this.owner=null,this.portal=null,this.snippet=null,this.sortField=null,this.sortOrder=null,this.tags=null,this.title=null}get thumbnailUrl(){const t=this.url,r=this.thumbnail;return t&&r&&this.portal?this.portal?.normalizeUrl(`${t}/info/${r}?f=json`):null}get url(){const t=this.get("portal.restUrl");return t?t+"/community/groups/"+this.id:null}fetchCategorySchema(t){return o(this.portal).request(this.url+"/categorySchema",t).then((r=>{const e=r.categorySchema||[];return e.some((t=>"contentCategorySetsGroupQuery.LivingAtlas"===t.source))?this._fetchCategorySchemaSet("LivingAtlas",t):e}))}fetchMembers(t){return o(this.portal).request(this.url+"/users",t)}getThumbnailUrl(t){let r=this.thumbnailUrl;return r&&t&&(r+=`&w=${t}`),r}toJSON(){throw new r("internal:not-yet-implemented","PortalGroup.toJSON is not yet implemented")}queryItems(t,r){let e=n(l,t);const s=o(this.portal);return parseFloat(s.currentVersion)>5?(e=e||new l,s.queryPortal(`/content/groups/${this.id}/search`,e,"PortalItem",r)):(e=e?e.clone():new l,e.query="group:"+this.id+(e.query?" "+e.query:""),s.queryItems(e,r))}_fetchCategorySchemaSet(t,e){const s=o(this.portal);return s.fetchSelf(s.authMode,!0,e).then((t=>{const o=t.contentCategorySetsGroupQuery;if(o){const t=new l;return t.disableExtraQuery=!0,t.num=1,t.query=o,s.queryGroups(t,e)}throw new r("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery value not found")})).then((o=>{if(o.total){const r=o.results[0],s=new l;return s.num=1,s.query=`typekeywords:"${t}"`,r.queryItems(s,e)}throw new r("portal-group:fetchCategorySchema","contentCategorySetsGroupQuery group not found")})).then((t=>{if(t.total){return t.results[0].fetchData("json",e).then((t=>{const r=t&&t.categorySchema;return r&&r.length?r:[]}))}return[]}))}};t([s()],u.prototype,"access",void 0),t([s({type:Date})],u.prototype,"created",void 0),t([s()],u.prototype,"description",void 0),t([s()],u.prototype,"id",void 0),t([s()],u.prototype,"isInvitationOnly",void 0),t([s({type:Date})],u.prototype,"modified",void 0),t([s()],u.prototype,"owner",void 0),t([s()],u.prototype,"portal",void 0),t([s()],u.prototype,"snippet",void 0),t([s()],u.prototype,"sortField",void 0),t([s()],u.prototype,"sortOrder",void 0),t([s()],u.prototype,"tags",void 0),t([s()],u.prototype,"thumbnail",void 0),t([s({readOnly:!0})],u.prototype,"thumbnailUrl",null),t([s()],u.prototype,"title",void 0),t([s({readOnly:!0})],u.prototype,"url",null),u=t([i("esri.portal.PortalGroup")],u);const p=u;export{p as default};