Skip to content

Update Function Docs to reflect new UI #558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Jan 29, 2020
Merged

Update Function Docs to reflect new UI #558

merged 33 commits into from
Jan 29, 2020

Conversation

misteryeo
Copy link
Contributor

Proposed changes

  • Updated naming and set-up redirects 🤞(checking with #segment-docs on the correct process)
  • Removed old notes and features that no longer apply in new UI
  • Added Legacy Source section highlighting changes in class vs instance model
  • Created alignment in structure across both docs

To Do

  • Update screenshots for new UI
  • Have team validate the technical functionality described in docs
  • Verify that redirects work

Related issues (optional)

Closes https://segment.atlassian.net/browse/FUN-460


- **Callback Return** - This shows what data the function returned, or the error it threw.
- **Log Output** - The raw log. Any messages to `console.log()` from the function appear here.

## Creation & Deployment

Once you're satisfied with your Destination Function, you can deploy your code by clicking the `Configure` button on the bottom right of the editor. This brings you to a screen to name your function and optionally add additional details that will be displayed in your workspace. Hit `Create Function` and your Destination Function will be ready to be used within your workspace.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once you're satisfied with your Destination Function, you can deploy your code by clicking the Configure button on the bottom right of the editor. - that's not accurate. When you create a destination function, you don't deploy it, you only create a class in the catalog. Then, users need to connect destinations to sources, which will deploy an instance. @chriso is this correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some updates here but would need clarification from @chriso on the piece when I'm editing a function and click Save & Deploy - what's the status. My understanding was even at that point, we're not deploying to instances so actually the button shouldn't say Save & Deploy technically speaking, right? cc: @vadimdemedes

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Destination function instances all use code from the class, so if you save your function, you're implicitly "deploying" it.

With source functions, the save and deploy steps are two separate things. Updating the class doesn't automatically update instances; you have to deploy changes to them.

Andy and others added 2 commits January 28, 2020 10:46
Co-Authored-By: Vadim Demedes <[email protected]>
Co-Authored-By: Vadim Demedes <[email protected]>
Copy link
Contributor

@sanscontext sanscontext left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh sorry these comments got stuck in "review limbo"

The JavaScript below builds a query string for the URL, sets a basic auth header, and sends a JSON body.

```js
const endpoint = "https://REDACTED.x.example.com"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use single quotes here and in the rest of examples for consistency.


```js
async function onGroup(event, settings) {
if (!event.company) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no company field on the group event (or any other event).


```js
async function onRequest(request, settings) {
let settingValue = settings.settingKey;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let settingValue = settings.settingKey;
// Retrieve value of a setting `settingKey`
const settingValue = settings.settingKey;

You can access header data using the `request.headers` property and the [Headers](https://developer.mozilla.org/en-US/docs/Web/API/Headers) interface. For example:"

```js
async function onRequest(request, settings) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
async function onRequest(request, settings) {
function onRequest(request, settings) {


```js
async function onRequest(request, settings) {
const requestHeader = request.headers.get('Content-Type')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const requestHeader = request.headers.get('Content-Type')
const contentType = request.headers.get('Content-Type')


```js
async function onRequest(request, settings) {
const requestHeader = request.headers.get('Content-Type')
let settingValue = settings.settingKey;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let settingValue = settings.settingKey;
// Retrieve value of a setting "settingKey"
const settingValue = settings.settingKey;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants