Skip to content

oracle-samples/content-management-swift

Repository files navigation

About Oracle Content Management - Content SDK (Swift)

The Content SDK for Oracle Content Management is a swift package that interacts with the Content REST APIs. This read-only SDK retrieves structured content, digital assets and taxonomies that are managed in Oracle Content Management.

Installation

You can add the Content SDK to an Xcode project by adding it as a package dependency.

  1. From the File menu, select Add Packages...
  2. Enter "https://github.com/oracle-samples/content-management-swift" into the package repository URL text field
  3. Depending on how your project is structured:
    • If you have a single application target that needs access to the library, then add OracleContentCore and OracleContentDelivery directly to your application.
    • If you want to use this library from multiple Xcode targets, or mix Xcode targets and SPM targets, you must create a shared framework that depends on OracleContentCore and OracleContentManagement and then depend on that framework in all of your targets.
    • Do not include OracleContentTest in your application targets. Only include OracleContentTest in testing targets.

Documentation

Examples

In addition to these examples please see this package's Examples directory.

Generating a list of assets:

First create the service, specifying a URL that points to your Oracle Content Management server and providing a channel token to which assets have been published.

let service = DeliveryAPI.listAssets()
                         .overrideURL(url, headers: [])  
                         .channelToken(channelToken) 

You may then submit the request using one of the available invocation verbs.

For an async/await operation, you may submit the request as follows. Note that "result" will be of type Assets (plural):

let result: Assets = try await service.fetchNextAsync()

Reading information about a specific asset:

Create the service:

let service = DeliveryAPI.readAsset()
                         .overrideURL(url, headers: [])
                         .channelToken(channelToken)

Submit the request using one of the available invocation verbs.

For an async/await operation, you may submit the request as follows. Note that "result" will be of type Asset (singular):

let result: Asset = try await service.fetchAsync()

More detailed examples illustrating the use of Onboarding are available in the Oracle Content Delivery documentation distributed with this package. Additionally, many different examples are available in the unit tests associated with each library.

Contributing

This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide.

Security

Please consult the security guide for our responsible security vulnerability disclosure process.

License

Copyright (c) 2023, Oracle and/or its affiliates.

Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.