-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hub-discussions): adds Discussions package to Hub.js (#479)
adds "discussions" package for interfacing with hub-discussions api (in beta)
- Loading branch information
Chase Gruber
authored
Jul 7, 2021
1 parent
a64b488
commit 6117cb3
Showing
25 changed files
with
11,594 additions
and
8,761 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
[![npm version][npm-img]][npm-url] | ||
[![build status][travis-img]][travis-url] | ||
[![gzip bundle size][gzip-image]][npm-url] | ||
[![Coverage Status][coverage-img]][coverage-url] | ||
[![apache licensed](https://img.shields.io/badge/license-Apache-green.svg?style=flat-square)](https://github.com/raw/Esri/hub.js/master/LICENSE) | ||
|
||
[npm-img]: https://img.shields.io/npm/v/@esri/hub-discussions.svg?style=flat-square | ||
[npm-url]: https://www.npmjs.com/package/@esri/hub-discussions | ||
[travis-img]: https://img.shields.io/travis/Esri/hub.js/master.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/Esri/hub.js | ||
[gzip-image]: https://img.badgesize.io/https://unpkg.com/@esri/hub-discussions/dist/umd/discussions.umd.min.js?compression=gzip | ||
[coverage-img]: https://codecov.io/gh/Esri/hub.js/branch/master/graph/badge.svg | ||
[coverage-url]: https://codecov.io/gh/Esri/hub.js | ||
|
||
# THIS PACKAGE IS ACTIVELY UNDER DEVELOPMENT AND IS NOT TO BE USED IN A PRODUCTION ENVIRONMENT | ||
# @esri/hub-discussions | ||
|
||
> Module to interact with ArcGIS Hub Discussions API in Node.js and modern browsers. | ||
### Example | ||
|
||
```bash | ||
npm install @esri/hub-discussions @esri/arcgis-rest-auth @esri/arcgis-rest-request @esri/hub-common | ||
``` | ||
```js | ||
import { searchPosts } from "@esri/hub-discussions"; | ||
|
||
// get posts for org | ||
searchPosts({ access: ['org'], orgs: ['3ef']}).then(response => { | ||
return response.items; | ||
// [ | ||
// IPost{}, | ||
// ... | ||
// ] | ||
}); | ||
``` | ||
|
||
## [API Reference](https://esri.github.io/hub.js/api/discussions/) | ||
|
||
### Issues | ||
|
||
If something isn't working the way you expected, please take a look at [previously logged issues](https://github.com/Esri/hub.js/issues) first. Have you found a new bug? Want to request a new feature? We'd [**love**](https://github.com/Esri/hub.js/issues/new) to hear from you. | ||
|
||
If you're looking for help you can also post issues on [GIS Stackexchange](http://gis.stackexchange.com/questions/ask?tags=esri-oss). | ||
|
||
### Versioning | ||
|
||
For transparency into the release cycle and in striving to maintain backward compatibility, @esri/hub.js is maintained under Semantic Versioning guidelines and will adhere to these rules whenever possible. | ||
|
||
For more information on SemVer, please visit <http://semver.org/>. | ||
|
||
### Contributing | ||
|
||
Esri welcomes contributions from anyone and everyone. Please see our [guidelines for contributing](CONTRIBUTING.md). | ||
|
||
### License | ||
|
||
Copyright © 2021 Esri | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
> http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
|
||
A copy of the license is available in the repository's [LICENSE](../../LICENSE) file. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"name": "@esri/hub-discussions", | ||
"version": "8.8.2", | ||
"description": "Module to interact with ArcGIS Hub Discussions API in Node.js and modern browsers.", | ||
"main": "dist/node/index.js", | ||
"unpkg": "dist/umd/discussions.umd.js", | ||
"module": "dist/esm/index.js", | ||
"es2017": "dist/es2017/index.js", | ||
"sideEffects": false, | ||
"types": "dist/types/index.d.ts", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"tslib": "^1.13.0", | ||
"url-parse": "^1.5.1" | ||
}, | ||
"peerDependencies": { | ||
"@esri/arcgis-rest-auth": "^2.13.0 || 3", | ||
"@esri/arcgis-rest-request": "^2.13.0 || 3", | ||
"@esri/hub-common": "^7.0.1" | ||
}, | ||
"devDependencies": { | ||
"@esri/arcgis-rest-auth": "^2.21.0", | ||
"@esri/arcgis-rest-request": "^2.21.0", | ||
"@esri/arcgis-rest-types": "^2.15.0", | ||
"@esri/hub-common": "^7.3.0", | ||
"@rollup/plugin-commonjs": "^15.0.0", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^9.0.0", | ||
"@types/geojson": "^7946.0.7", | ||
"@types/url-parse": "^1.4.3", | ||
"rollup": "^2.26.5", | ||
"rollup-plugin-filesize": "^9.0.2", | ||
"rollup-plugin-typescript2": "^0.27.2", | ||
"rollup-plugin-uglify": "^6.0.4", | ||
"typescript": "^3.8.1" | ||
}, | ||
"files": [ | ||
"dist/**" | ||
], | ||
"scripts": { | ||
"prepare": "npm run build", | ||
"build": "npm run build:node && npm run build:esm", | ||
"local_build": "npm run build:node && npm run build:esm && npm run build:umd", | ||
"build:esm": "tsc --outDir ./dist/es2017 --declaration --declarationDir ./dist/types", | ||
"build:esm:es5": "tsc --module es2015 --target es5 --outDir ./dist/esm", | ||
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js", | ||
"build:node": "tsc --module commonjs --outDir ./dist/node", | ||
"dev:esm": "npm run build:esm -- -w", | ||
"dev:node": "npm run build:node -- -w", | ||
"format": "prettier --write ./{src,test}/**/*.ts", | ||
"format:check": "prettier --check ./{src,test}/**/*.ts" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Esri/hub.js.git" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "Chase Gruber", | ||
"email": "cgruber@esri.com" | ||
} | ||
], | ||
"bugs": { | ||
"url": "https://github.com/Esri/hub.js/issues" | ||
}, | ||
"homepage": "https://github.com/Esri/hub.js#readme", | ||
"gitHead": "37f3a4e0e1c26399f6597697601d115d727540d9", | ||
"volta": { | ||
"extends": "../../package.json" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { request } from "./request"; | ||
import { | ||
ISearchChannelsOptions, | ||
ICreateChannelOptions, | ||
IFetchChannelOptions, | ||
IUpdateChannelOptions, | ||
IRemoveChannelOptions, | ||
IChannel, | ||
IPagedResponse, | ||
IRemoveChannelResponse | ||
} from "./types"; | ||
|
||
/** | ||
* search channels | ||
* | ||
* @export | ||
* @param {ISearchChannelsOptions} options | ||
* @return {*} {Promise<IPagedResponse<IChannel>>} | ||
*/ | ||
export function searchChannels( | ||
options: ISearchChannelsOptions | ||
): Promise<IPagedResponse<IChannel>> { | ||
options.httpMethod = "GET"; | ||
return request(`/channels`, options); | ||
} | ||
|
||
/** | ||
* create channel | ||
* | ||
* @export | ||
* @param {ICreateChannelOptions} options | ||
* @return {*} {Promise<IChannel>} | ||
*/ | ||
export function createChannel( | ||
options: ICreateChannelOptions | ||
): Promise<IChannel> { | ||
options.httpMethod = "POST"; | ||
return request(`/channels`, options); | ||
} | ||
|
||
/** | ||
* fetch channel | ||
* | ||
* @export | ||
* @param {IFetchChannelOptions} options | ||
* @return {*} {Promise<IChannel>} | ||
*/ | ||
export function fetchChannel(options: IFetchChannelOptions): Promise<IChannel> { | ||
options.httpMethod = "GET"; | ||
return request(`/channels/${options.channelId}`, options); | ||
} | ||
|
||
/** | ||
* update channel | ||
* NOTE: only updates channel settings properties (softDelete, allowedReactions, etc). A Channel's | ||
* access and groups cannot be updated. | ||
* | ||
* @export | ||
* @param {IUpdateChannelOptions} options | ||
* @return {*} {Promise<IChannel>} | ||
*/ | ||
export function updateChannel( | ||
options: IUpdateChannelOptions | ||
): Promise<IChannel> { | ||
options.httpMethod = "PATCH"; | ||
return request(`/channels/${options.channelId}`, options); | ||
} | ||
|
||
/** | ||
* remove channel | ||
* | ||
* @export | ||
* @param {IRemoveChannelOptions} options | ||
* @return {*} | ||
*/ | ||
export function removeChannel( | ||
options: IRemoveChannelOptions | ||
): Promise<IRemoveChannelResponse> { | ||
options.httpMethod = "DELETE"; | ||
return request(`/channels/${options.channelId}`, options); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc. | ||
* Apache-2.0 */ | ||
|
||
export * from "./posts"; | ||
export * from "./channels"; | ||
export * from "./reactions"; | ||
export * from "./types"; | ||
|
||
export * from "./utils/posts"; | ||
export * from "./utils/channels"; | ||
export * from "./utils/reactions"; | ||
export * from "./utils/platform"; |
Oops, something went wrong.