igpapi — Instagram private API Simulator for Node.js (API reference) 4.19.0
    Preparing search index...

    Function defineScreen

    • Declares a screen: its id in the core screen catalog (SCREEN_CATALOG), its kind, its schemas, the burst the app sends when it shows the screen, and what can be done from it. An item of a list is declared with defineScreenItem.

      • input and data are what an edge passes and what enter returns (the user's data, checked against data, shown under the handle's data).
      • identity (optional) names the screen's one main identifier, a field of its data the handle also shows on its top level (profile.userId). Every other field is only under data.
      • state: ({ input, data }) => State is what continuing from the screen needs — a token that came with the edge's input included; noScreenState for a screen that keeps none.
      • enter({ input, navigate }) is the burst, once per frame: the requests the app sends, and navigate — the screen's own navigation event, exactly once — at the point where the app writes it.
      • beforeLeave (optional) runs when a transition is about to cover or close the screen, while its chain is still in front (before the covering burst);
      • beforeResume (optional) runs when a transition is about to bring the screen back on top, before its chain moves (the tap-time work), with the cause of the return (via: a tab switch, or a covering screen closed);
      • leave and resume (optional) are a visit's end and a new visit's start: run each time the screen stops being on top and each time it is on top again after that.
      • actions are action((state, ...args) => Effect) (something done on the screen) and opens(id, (state, ...args) => ({ source, skipOrdinals?, relogs?, sourceModule?, restartChain?, input })) (a transition into another screen; with arguments, their schema comes third). Both see the state, not the data. Each is a call of the handle.
      • actionEdges (optional) are opens edges an action takes itself after the person's input: the trail names them and a retrace takes them again, but the handle does not show them (see ScreenShape.actionEdges).
      • items are the lists of items it shows, each a plain object over a field of its data: { at: 'threads', key: 'thread', item: ThreadItem }, or, for entries of several kinds, { at: 'media', key: 'pk', by: 'media_type', variants: { 1: PhotoItem, 2: VideoItem, 8: CarouselItem } } (see ScreenItemListCheck). key is the entries' identity field.

      The handle is a snapshot: { data, id, kind, origin, [identity], ...actions, ...items }, frozen all the way down; an action does not change its data — fresh data comes with opening the screen again. data is its one enumerable member and toJSON() returns it, so JSON.stringify(handle) is the data's JSON. A member key used twice, or a reserved key, is a type error.

      Type Parameters

      • const Id extends
            | "LoginHomepage"
            | "LoginHomeCds"
            | "LandingScreen"
            | "LoginTwoFactorEntrypoint"
            | "LoginTwoFactorMethodPicker"
            | "LoginTwoFactorEnterTotpCode"
            | "AccountRecoverySearchCds"
            | "AccountRecoverySearch"
            | "AccountRecoveryAuthenticationConfirmation"
            | "AccountRecoveryEmailCode"
            | "RegistrationPhoneNumber"
            | "RegistrationConfirmationCode"
            | "RegistrationPassword"
            | "RegistrationBirthday"
            | "RegistrationName"
            | "RegistrationUsername"
            | "RegistrationTermsOfService"
            | "SaveCredentials"
            | "AccountRecoverySuccessLocationPermission"
            | "OnboardingProfileCard"
            | "OnboardingFindFacebookFriendsPrompt"
            | "OnboardingDiscoverPeople"
            | "OnboardingAddEmail"
            | "OnboardingReelsTuning"
            | "FeedTimeline"
            | "PostOpenedFromLink"
            | "ReelsViewer"
            | "MediaComments"
            | "RepostNoteEditor"
            | "Explore"
            | "SearchInput"
            | "SearchResultsTopTab"
            | "SearchResultsAccountsTab"
            | "UserProfile"
            | "ProfileMediaTab"
            | "MyProfile"
            | "MyProfileMediaTab"
            | "EditProfile"
            | "EditProfileBio"
            | "EditProfileUsername"
            | "EditProfileLinks"
            | "EditProfileAddLink"
            | "ProfilePostsFeed"
            | "FeedTimelineFollowing"
            | "UserProfileReelsTab"
            | "DirectInbox"
            | "DirectRecipientPicker"
            | "DirectThread"
            | "DirectForwardingSheet"
            | "DirectMediaPickerPhotos"
            | "DirectStickerTabTray"
            | "DirectGifTray"
            | "DirectStickerPickerGrid"
            | "DirectImagineLoading"
            | "DirectImagineCreation"
            | "DirectDoodleEditor"
            | "DirectCustomizeChat"
            | "DirectThreadThemePicker"
            | "DirectThreadDetails"
            | "DirectThreadSharedMedia"
            | "DirectThreadNicknames"
            | "DirectThreadNicknameChange"
            | "DirectGroupNameAndPhotoEditor"
            | "DirectShareSheet"
            | "StoriesViewer"
            | "PostingGalleryPicker"
            | "PostingPostEdit"
            | "PostingNewPost"
            | "PostingCamera"
            | "PostingCameraGallery"
            | "PostingReelEditor"
            | "PostingNewReel"
            | "PostingPostVideoCameraGallery"
            | "PostingPostVideoCamera"
            | "PostingReelCamera"
            | "PostingStoryCameraHost"
            | "PostingStoryCameraGallery"
            | "PostingPostVideoNewReel"
            | "PostingStoryPhotoEditor"
            | "PostingStoryVideoEditor"
            | "PostingStoryStickerTray"
            | "PostingStoryMusicStickerEditor"
            | "PostingStoryShareSheet"
            | "PostingStoryAlsoShareTo"
            | "PostingStoryDoneCamera"
            | "PostingStoryMusicSearchHost"
            | "PostingMusicBrowser"
            | "PostingMusicSearchResults"
            | "PostingReelMusicOverlayDetail"
            | "PostingReelMusicEditor"
            | "ChallengeSelectVerifyMethod"
            | "ChallengeVerifyCode"
            | "ChallengeSubmitPhone"
            | "ChallengeSetNewPassword"
            | "ChallengeAddBirthday"
            | "ChallengeLoginReview"
            | "ChallengeAccountTemporarilyLocked"
            | "ChallengeEscalationInformation"
            | "ChallengeReviewContactPointChange"
            | "ChallengeScrapingWarning"
            | "ChallengeWebRecaptcha"
            | "ChallengeWebSetNewPassword"
            | "ChallengeTextCaptcha"
            | "ChallengeRecaptcha"
            | "ChallengeSetContactPoint"
            | "ChallengeContactPointCode"
            | "ChallengeAuthenticityWizard"
            | "ChallengeAwaitingReview"
            | "ChallengeThanksForProvidingInfo"
            | "ChallengeAccountSuspended"
      • const Kind extends EnterableScreenKind
      • Input
      • Data extends object
      • State
      • E
      • R
      • Actions extends ScreenMembers<Actions>
      • RL = never
      • RBL = never
      • RBR = never
      • const Items extends ScreenItemLists<Data, Items> = Record<never, never>
      • const Identity extends string = never
      • ActionEdges extends ScreenMembers<ActionEdges> = Record<never, never>

      Parameters

      Returns ScreenDefinition<
          Id,
          Kind,
          Input,
          Data,
          State,
          E,
          R
          | RL
          | RBL
          | RBR,
          Actions,
          Items,
          Extract<
              {
                  readonly [K in string
                  | number
                  | symbol]: ActionEdgeTargetId<ActionEdges[K]>
              }[keyof ActionEdges],
              | "LoginHomepage"
              | "LoginHomeCds"
              | "LandingScreen"
              | "LoginTwoFactorEntrypoint"
              | "LoginTwoFactorMethodPicker"
              | "LoginTwoFactorEnterTotpCode"
              | "AccountRecoverySearchCds"
              | "AccountRecoverySearch"
              | "AccountRecoveryAuthenticationConfirmation"
              | "AccountRecoveryEmailCode"
              | "RegistrationPhoneNumber"
              | "RegistrationConfirmationCode"
              | "RegistrationPassword"
              | "RegistrationBirthday"
              | "RegistrationName"
              | "RegistrationUsername"
              | "RegistrationTermsOfService"
              | "SaveCredentials"
              | "AccountRecoverySuccessLocationPermission"
              | "OnboardingProfileCard"
              | "OnboardingFindFacebookFriendsPrompt"
              | "OnboardingDiscoverPeople"
              | "OnboardingAddEmail"
              | "OnboardingReelsTuning"
              | "FeedTimeline"
              | "PostOpenedFromLink"
              | "ReelsViewer"
              | "MediaComments"
              | "RepostNoteEditor"
              | "Explore"
              | "SearchInput"
              | "SearchResultsTopTab"
              | "SearchResultsAccountsTab"
              | "UserProfile"
              | "ProfileMediaTab"
              | "MyProfile"
              | "MyProfileMediaTab"
              | "EditProfile"
              | "EditProfileBio"
              | "EditProfileUsername"
              | "EditProfileLinks"
              | "EditProfileAddLink"
              | "ProfilePostsFeed"
              | "FeedTimelineFollowing"
              | "UserProfileReelsTab"
              | "DirectInbox"
              | "DirectRecipientPicker"
              | "DirectThread"
              | "DirectForwardingSheet"
              | "DirectMediaPickerPhotos"
              | "DirectStickerTabTray"
              | "DirectGifTray"
              | "DirectStickerPickerGrid"
              | "DirectImagineLoading"
              | "DirectImagineCreation"
              | "DirectDoodleEditor"
              | "DirectCustomizeChat"
              | "DirectThreadThemePicker"
              | "DirectThreadDetails"
              | "DirectThreadSharedMedia"
              | "DirectThreadNicknames"
              | "DirectThreadNicknameChange"
              | "DirectGroupNameAndPhotoEditor"
              | "DirectShareSheet"
              | "StoriesViewer"
              | "PostingGalleryPicker"
              | "PostingPostEdit"
              | "PostingNewPost"
              | "PostingCamera"
              | "PostingCameraGallery"
              | "PostingReelEditor"
              | "PostingNewReel"
              | "PostingPostVideoCameraGallery"
              | "PostingPostVideoCamera"
              | "PostingReelCamera"
              | "PostingStoryCameraHost"
              | "PostingStoryCameraGallery"
              | "PostingPostVideoNewReel"
              | "PostingStoryPhotoEditor"
              | "PostingStoryVideoEditor"
              | "PostingStoryStickerTray"
              | "PostingStoryMusicStickerEditor"
              | "PostingStoryShareSheet"
              | "PostingStoryAlsoShareTo"
              | "PostingStoryDoneCamera"
              | "PostingStoryMusicSearchHost"
              | "PostingMusicBrowser"
              | "PostingMusicSearchResults"
              | "PostingReelMusicOverlayDetail"
              | "PostingReelMusicEditor"
              | "ChallengeSelectVerifyMethod"
              | "ChallengeVerifyCode"
              | "ChallengeSubmitPhone"
              | "ChallengeSetNewPassword"
              | "ChallengeAddBirthday"
              | "ChallengeLoginReview"
              | "ChallengeAccountTemporarilyLocked"
              | "ChallengeEscalationInformation"
              | "ChallengeReviewContactPointChange"
              | "ChallengeScrapingWarning"
              | "ChallengeWebRecaptcha"
              | "ChallengeWebSetNewPassword"
              | "ChallengeTextCaptcha"
              | "ChallengeRecaptcha"
              | "ChallengeSetContactPoint"
              | "ChallengeContactPointCode"
              | "ChallengeAuthenticityWizard"
              | "ChallengeAwaitingReview"
              | "ChallengeThanksForProvidingInfo"
              | "ChallengeAccountSuspended",
          >,
          Identity,
      >