question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

design methods for feature service attachments

See original GitHub issue

What 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:closed
  • Created 5 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
jgravoiscommented, Jun 19, 2018

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 extend IRequestOptions consistently instead.

1reaction
COV-GIScommented, Jun 19, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found