X (Twitter) · Arazzo Workflow

X Pin the Authenticated User's First Owned List

Version 1.0.0

List the owned Lists, then pin the first one to the user's profile.

1 workflow 1 source API 1 provider
View Spec View on GitHub Social MediaMicrobloggingReal-Time DataStreamingAdvertisingContentArazzoWorkflows

Provider

twitter

Workflows

pin-owned-list
Find the user's first owned List and pin it.
Chains the owned-lists endpoint into the pin-list endpoint, branching to a no-op end when the user owns no Lists.
2 steps inputs: authUserId, authorization outputs: firstListId, pinned
1
ownedLists
getUsersOwnedLists
List the Lists owned by the authenticated user.
2
pinList
pinList
Pin the first owned List to the authenticated user's profile.

Source API Descriptions

Arazzo Workflow Specification

twitter-pin-owned-list-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: X Pin the Authenticated User's First Owned List
  summary: List the owned Lists, then pin the first one to the user's profile.
  description: >-
    Pins a List that the authenticated user owns without needing to know the
    List id in advance. The workflow enumerates the user's owned Lists, takes
    the first one, and pins it. The pin step inlines its list_id body so the
    chain reads and executes without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: xApi
  url: ../openapi/x-api-openapi.json
  type: openapi
workflows:
- workflowId: pin-owned-list
  summary: Find the user's first owned List and pin it.
  description: >-
    Chains the owned-lists endpoint into the pin-list endpoint, branching to a
    no-op end when the user owns no Lists.
  inputs:
    type: object
    required:
    - authUserId
    properties:
      authUserId:
        type: string
        description: The numeric id of the authenticated user who owns the Lists.
      authorization:
        type: string
        description: OAuth2 user token to authorize the requests (e.g. "Bearer xxx").
  steps:
  - stepId: ownedLists
    description: List the Lists owned by the authenticated user.
    operationId: getUsersOwnedLists
    parameters:
    - name: id
      in: path
      value: $inputs.authUserId
    - name: max_results
      in: query
      value: 100
    - name: list.fields
      in: query
      value: id,name,private
    - name: Authorization
      in: header
      value: $inputs.authorization
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      firstListId: $response.body#/data/0/id
    onSuccess:
    - name: hasLists
      type: goto
      stepId: pinList
      criteria:
      - context: $response.body
        condition: $.data.length > 0
        type: jsonpath
    - name: noLists
      type: end
      criteria:
      - context: $response.body
        condition: $.data.length == 0
        type: jsonpath
  - stepId: pinList
    description: Pin the first owned List to the authenticated user's profile.
    operationId: pinList
    parameters:
    - name: id
      in: path
      value: $inputs.authUserId
    - name: Authorization
      in: header
      value: $inputs.authorization
    requestBody:
      contentType: application/json
      payload:
        list_id: $steps.ownedLists.outputs.firstListId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      pinned: $response.body#/data/pinned
  outputs:
    firstListId: $steps.ownedLists.outputs.firstListId
    pinned: $steps.pinList.outputs.pinned