Alipay+ Super App PlatformAlipay+ Super App Platform

pullSpaceContents

Use the pullSpaceContents API to retrieve the contents of specified spaces based on given input parameters.

Method signature

The following code shows the method signature of the pullSpaceContents API:

copy
public func pullSpaceContents(_ inputs: [SpacePullInfo], completion: (Result<[SpaceContent]?, PullSpaceContentsError>) -> Void)

Request parameters

Name

Type

Description

Required

inputs

[SpacePullInfo]

An array of SpacePullInfo objects, each containing information about the requested space, including its code, pagination info, and any conditions or extended info.

Yes

completion

Result<SpaceContent,PullSpaceContentsError>)->Void

A closure that takes a Result containing either a SpaceContent object on success or a PullSpaceContentsError on failure.

The Result type helps to concisely represent success or failure without the need for separate error handling.

Yes

Response parameters

N/A

Exception

Error Code

Error message

1200

A network error has occurred.

1201

A backend error has occurred.

1202

User ID is empty.

1203

A response payload is unavailable.

Sample

Swift

copy
var spacePullInfo = SpacePullInfo(spaceCode: "SPACE_CODE_001")
spacePullInfo.pullOffsetInfo = PullOffsetInfo(overallOffset: 0, pullSize: 10)
spacePullInfo.conditions = ["longitude": "23.1234", "latitude": "100.4567"]
ComponentManager.ASAP.businessComponent.pullSpaceContents([spacePullInfo])
{ result in
     switch result {
         case .success(let success):
         print(success)
         case .failure(let failure):
         print(failure)
     }
}