Skip to content

Commit d6b0bf8

Browse files
Added new sharing endpoints. Deprecated old sharing endpoints. (#115)
* Added new sharing endpoints. Deprecated old sharing endpoints. * test fixes * lint * lint * result -> items. * Change method sharing method signatures to be more consistent * Fix typo getSightPublshStatus to getSightPublishStatus, address nit in test, address ListShareOptions comment and queryParameter unpacking * Revert backward compatibility changes to reports, sheets, sights, workspaces shares, fix tests * Add dotenv, use dotenv in sharing-test * Fix lint errors, revert dotenv changes * Fix query parameters and sharing options for consistency * Make singular those query params interfaces that were plural * Remove empty ListSharesOption and use the QueryParams directly * prettier fix * Revert deletion of ListSharesOptions, add lint exception for empty interface --------- Co-authored-by: Miguel Martinez <[email protected]>
1 parent aebb35a commit d6b0bf8

File tree

14 files changed

+670
-6
lines changed

14 files changed

+670
-6
lines changed

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
## [4.7.0] - 2025-06-30
9+
### Added
10+
- Support for new asset-based sharing endpoints in a new `sharing` module:
11+
- `listAssetShares`: List all shares for a specified asset
12+
- `getAssetShare`: Get a specific share for a specified asset
13+
- `shareAsset`: Share an asset with specified users and/or groups
14+
- `updateAssetShare`: Update a specific share for a specified asset
15+
- `deleteAssetShare`: Delete a specific share for a specified asset
16+
- Added TypeScript interfaces and enums for the sharing API
17+
18+
### Updated
19+
- Deprecated old sharing endpoints in the `share` module
20+
- Added backward compatibility wrappers in sheets, reports, workspaces, and sights modules
21+
- Added deprecation notices and migration examples in documentation
22+
- Fix typo in SightsApi (`getSightPublshStatus` to `getSightPublishStatus`)
23+
824
## 4.6.0 - 2025-09-25
925
### Added
1026
- Support for upgrade/downgrade endpoints

index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { apiUrls } from './lib/utils/apis';
33
import { createContacts } from './lib/contacts';
44
import { createEvents } from './lib/events';
55
import { createSearch } from './lib/search';
6+
import { createSharing } from './lib/sharing';
67
import { createSights } from './lib/sights';
78

89
const _ = require('underscore');
@@ -112,6 +113,7 @@ export const createClient: CreateClient = function (clientOptions) {
112113
request: require('./lib/request/').create(options),
113114
search: createSearch(options),
114115
server: require('./lib/server/').create(options),
116+
sharing: createSharing(options),
115117
sheets: require('./lib/sheets/').create(options),
116118
sights: createSights(options),
117119
templates: require('./lib/templates/').create(options),
@@ -130,3 +132,4 @@ export const smartSheetURIs = {
130132

131133
export { CreateClient, CreateClientOptions, SmartsheetClient } from './lib/types';
132134
export * from './lib/events/types';
135+
export * from './lib/sharing';

lib/reports/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var _ = require('underscore');
22
var constants = require('../utils/constants.js');
33

44
exports.create = function (options) {
5+
// Legacy shares module (deprecated)
56
var shares = require('../share/share.js')(options.apiUrls.reports);
67
var requestor = options.requestor;
78

lib/share/share.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,59 @@
11
var _ = require('underscore');
22

3+
/**
4+
* @deprecated
5+
* The share module is deprecated. Please use the new sharing module instead.
6+
* The new sharing module provides asset-based sharing endpoints that support
7+
* all asset types (sheets, reports, sights, workspaces, etc.) through a unified API.
8+
*
9+
* Example migration:
10+
*
11+
* Old:
12+
* ```
13+
* client.sheets.getSheetShares({ sheetId: 123 });
14+
* ```
15+
*
16+
* New:
17+
* ```
18+
* client.sharing.listAssetShares({ assetType: 'sheet', assetId: 123 });
19+
* ```
20+
*/
321
module.exports = (url) => ({
22+
/**
23+
* @deprecated Use the new sharing module instead
24+
*/
425
create: function (options) {
526
var requestor = options.requestor;
627

728
var optionsToSend = _.extend({}, options.clientOptions);
829

30+
/**
31+
* @deprecated Use sharing.listAssetShares instead
32+
*/
933
var listShares = (getOptions, callback) => {
1034
var urlOptions = { url: buildUrl(getOptions) };
1135
return requestor.get(_.extend({}, optionsToSend, urlOptions, getOptions), callback);
1236
};
1337

38+
/**
39+
* @deprecated Use sharing.shareAsset instead
40+
*/
1441
var share = (postOptions, callback) => {
1542
var urlOptions = { url: buildUrl(postOptions) };
1643
return requestor.post(_.extend({}, optionsToSend, urlOptions, postOptions), callback);
1744
};
1845

46+
/**
47+
* @deprecated Use sharing.deleteShare instead
48+
*/
1949
var deleteShare = (deleteOptions, callback) => {
2050
var urlOptions = { url: buildUrl(deleteOptions) };
2151
return requestor.delete(_.extend({}, optionsToSend, urlOptions, deleteOptions), callback);
2252
};
2353

54+
/**
55+
* @deprecated Use sharing.updateShare instead
56+
*/
2457
var updateShare = (putOptions, callback) => {
2558
var urlOptions = { url: buildUrl(putOptions) };
2659
return requestor.put(_.extend({}, optionsToSend, urlOptions, putOptions), callback);
@@ -33,10 +66,25 @@ module.exports = (url) => ({
3366
(urlOptions.shareId || '');
3467

3568
return {
69+
/**
70+
* @deprecated Use sharing.getAssetShare instead
71+
*/
3672
getShare: listShares,
73+
/**
74+
* @deprecated Use sharing.listShares instead
75+
*/
3776
listShares: listShares,
77+
/**
78+
* @deprecated Use sharing.shareAsset instead
79+
*/
3880
share: share,
81+
/**
82+
* @deprecated Use sharing.deleteShare instead
83+
*/
3984
deleteShare: deleteShare,
85+
/**
86+
* @deprecated Use sharing.updateShare instead
87+
*/
4088
updateShare: updateShare,
4189
};
4290
},

0 commit comments

Comments
 (0)