How to use the @esri/arcgis-rest-portal.updateItem function in @esri/arcgis-rest-portal

To help you get started, we’ve selected a few @esri/arcgis-rest-portal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Esri / solution.js / packages / common / src / restHelpers.ts View on Github external
return new Promise((resolve, reject) => {
    const updateOptions: portal.IUpdateItemOptions = {
      item: itemInfo,
      params: {
        text: data
      },
      authentication: authentication
    };
    portal.updateItem(updateOptions).then(
      () => {
        if (access && access !== "private") {
          // Set access if it is not AGOL default
          // Set the access manually since the access value in createItem appears to be ignored
          const accessOptions: portal.ISetAccessOptions = {
            id: serviceItemId,
            access: access === "public" ? "public" : "org", // need to use constants rather than string
            authentication: authentication
          };
          portal.setItemAccess(accessOptions).then(
            () => {
              progressTickCallback && progressTickCallback();
              resolve();
            },
            e => reject(generalHelpers.fail(e))
          );
github Esri / solution.js / packages / common / src / restHelpers.ts View on Github external
return new Promise((resolve, reject) => {
    const addMetadataOptions: portal.IUpdateItemOptions = {
      item: {
        id: itemId
      },
      params: {
        // Pass metadata in via params because item property is serialized, which discards a blob
        metadata: metadataFile
      },
      authentication: authentication
    };

    portal.updateItem(addMetadataOptions).then(resolve, reject);
  });
}
github Esri / solution.js / packages / common / src / resourceHelpers.ts View on Github external
isGroup: boolean = false
): Promise {
  const updateOptions: any = {
    params: {
      // Pass image in directly because item object is serialized, which discards a blob
      thumbnail: blob
    },
    authentication: authentication
  };
  updateOptions[isGroup ? "group" : "item"] = {
    id: itemId
  };

  return isGroup
    ? portal.updateGroup(updateOptions)
    : portal.updateItem(updateOptions);
}
github Esri / solution.js / packages / common / src / resourceHelpers.ts View on Github external
export function addMetadataFromBlob(
  blob: Blob,
  itemId: string,
  authentication: UserSession
): Promise {
  const updateOptions: any = {
    item: {
      id: itemId
    },
    params: {
      // Pass metadata in via params because item property is serialized, which discards a blob
      metadata: blob
    },
    authentication: authentication
  };
  return portal.updateItem(updateOptions);
}
github Esri / solution.js / packages / common / src / restHelpers.ts View on Github external
return new Promise((resolve, reject) => {
    // Update its URL
    const options = {
      item: {
        id,
        url
      },
      authentication: authentication
    };

    portal.updateItem(options).then(
      () => {
        resolve(id);
      },
      e => reject(generalHelpers.fail(e))
    );
  });
}
github Esri / solution.js / packages / common / src / resourceHelpers.ts View on Github external
export function addThumbnailFromUrl(
  url: string,
  itemId: string,
  authentication: UserSession,
  isGroup: boolean = false
): Promise {
  const updateOptions: any = {
    authentication: authentication
  };
  updateOptions[isGroup ? "group" : "item"] = {
    id: itemId,
    thumbnailurl: url
  };
  return isGroup
    ? portal.updateGroup(updateOptions)
    : portal.updateItem(updateOptions);
}
github Esri / solution.js / packages / common / src / restHelpers.ts View on Github external
return new Promise((resolve, reject) => {
    const updateOptions: portal.IUpdateItemOptions = {
      item: itemInfo,
      folderId: folderId,
      authentication: authentication
    };
    portal.updateItem(updateOptions).then(
      response => (response.success ? resolve(response) : reject(response)),
      err => reject(err)
    );
  });
}
github roemhildtg / vscode-arcgis-assistant / src / lib / PortalConnection.ts View on Github external
public async updateItem(item: IItem, data : any){
        return updateItem({
            item: {
                id: item.id,
                text: this.getSafeData(data),
            },
            portal: this.restURL,
            authentication: this.authentication,
        });
    }