design methods for feature service attachments
See original GitHub issueWhat do you think about this @jgravois and @tomwayson?
A single attachments()
method with operation
param for the 6 attachment ops and corresponding interfaces for the request params. Down and dirty example below obviously needs much, but for a conceptual start. Just an idea I had while thinking about possibly tackling attachments.
import { request, IRequestOptions } from "@esri/arcgis-rest-request";
export interface IAddAttachmentParameters extends IRequestOptions {
/**
* Attachment file.
*/
attachment: File;
// other add attachment params
}
// parameter interfaces for the other attachment operations
export interface IAttachmentsOptions {
/**
* Feature service url.
*/
url: string;
/**
* Attachment operation to perform.
*/
operation: "query" | "get" | "infos" | "add" | "delete" | "update";
/**
* Attachment parameters for corresponding operation.
*/
params: IAddAttachmentParameters; // and othersParams
}
export function attachments(
options: IAttachmentsOptions
): Promise<any> {
// need to construct proper url based attachment operation and possibly params for some operations
const url = `${options.url}/addAttachment`;
const requestParams = options.params;
return request(url, requestParams);
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Author feature services—Documentation - ArcGIS Enterprise
Feature services allow you to query and edit attachments. An attachment is a media file associated with a feature or object in a...
Read more >Working with Attachments in Apps - YouTube
Attachments are a common way to associate images, videos, and PDFs with specific features in feature layers. These attachments can enhance ...
Read more >ArcGIS Online: Best Practices with Hosted Feature Services
In this session, you will learn how to make effective use of Hosted Feature Services in your apps. Learn how to take advantage...
Read more >How To: Download attachments from a hosted feature service
Click Create Replica and then use one of the options below to download the File Geodatabase. To get the output, extract the file...
Read more >ArcGIS Online: Best Practices for Hosted Feature Layers
Learn best practices for optimizing your ArcGIS Online hosted feature layers to support high-volume web traffic.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i think a terse, multi-operation supporting method could actually work quite well for attachments.
take a look at #214 though. we ended up updating the signatures for feature service methods to steer away from defining custom
params
and extendIRequestOptions
consistently instead.Thanks for the input. The single method idea came to me b/c I’m currently using a single
attachment
endpoint and request now for attachments. Perhaps a bit over simplified.If you’re amicable, I’ll make a start as time allows, and ding you for thoughts and comments on my branch.