Code Monkey home page Code Monkey logo

constructorio-client-swift's People

Contributors

adetch avatar crgee1 avatar danmcc avatar dependabot[bot] avatar edmundmok avatar esezen avatar hhhindawy avatar jjl014 avatar mocca102 avatar mudaafi avatar nmarkovic04 avatar rubikzube avatar sblaurock avatar stanlp1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

adetch stanlp1

constructorio-client-swift's Issues

Warning emitted from Swift Package

Hello,

We observed that a warning is being emitted when consuming the constructor client as a Swift Package.

<Redacted>/checkouts/constructorio-client-swift/Package.swift The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.2.99.


Would it be possible to bump the Swift Package support up to 9.0? I can even make the change if necessary. This would silence a warning in all consumers of the Swift Package's project.

Thanks!

Missing field in CIOBrowseResponse

Hello!

We identified one issue regarding a missing field in the CIOBrowseResponse object.
The field is called collection and it is being returned as part of the browse request for a query.

Repro steps

In order to reproduce the issue it is required to trigger a ConstructorIO.browse(forQuery:) request with a filtered by "collection_id":

let browseQuery = CIOBrowseQuery(
        filterName: "collection_id",
        filterValue: "....",
        filters: nil,
        page: 1,
        perPage: 30
)

ConstructorIO.browse(forQuery: browseQuery) { _ }

The response for the previous request would have the following high-level structure:

{
    "response": {
        "result_sources": { ... },
        "facets": [ ... ],
        "groups": [ ... ],
        "results": [ ... ],
        "sort_options": [ ... ],
        "total_num_results": ...,
        "features": [ ... ],
        "collection": { 
            "id": "...",
            "display_name": "...",
            "data":  ...,
        },
    },
    "result_id": "........"
    "request": { ... }
}

The above response would be handled by the BrowseResponseParser, which reads the JSON object and returns a CIOBrowseResponse.

Proposal

  • Adding a new object for the collection part of the response:
    i.e
public class CIOCollectionData: NSObject {
    public let id: String
    public let display_name: String
    public let data: ...

    init?(json: JSONObject?) {
        guard let json = json, let id = json["id"] as? String, let display_name = json["display_name"] as? String else {
            return nil
        }
        self.id = id
        self.display_name = display_name
    }
}
  • Adding the collection object as an optional field in CIOBrowseResponse giving that the field is not being returned for all type of browse results:
public class CIOBrowseResponse {
    ...
    public let collection: CIOCollectionData?
}
  • Adding to the BrowseResponseParser the additional decoder, and add the value to the CIOBrowseResponse initializer
    let collection: CIOCollectionData = CIOCollectionData(json: response["collection"])
    ....
    return CIOBrowseResponse(
        ....
        collection: collection
    )

Additional notes

It's counterpart in Android SDK already includes the collection field in the BrowseResponseInner.java:

public class BrowseResponseInner {
    ....
    @SerializedName("collection")
    private ItemCollection collection;
}

References

Add `result` information to the SearchResponse.

result data comes back in the overall response JSON from a search query, however this data isn't parsed by the SearchResponseParser. It contains information such as page and num_results_per_page which would be useful in the implementation of pagination. It would be great if results was parsed by the SearchResponseParser and at least the page, num_results_per_page, and term data was surfaced by the SDK. Thanks!

Add support for async await

We are currently implementing the SDK for an app we are working on. The app is using Swift concurrency via Async/Await. It would be nice if the SDK had support for this alongside closure based callbacks.

We are wrapping the SDK methods with withCheckedContinuation methods to bridge support. This isn't ideal.
https://developer.apple.com/documentation/swift/checkedcontinuation

public func trackBrowserResultsLoaded(filterName: String, filterValue: String, resultCount: Int, customerIDs: [String]?, resultID: String?) async throws {
    return try await withCheckedThrowingContinuation { continuation in
        constructorIO.trackBrowseResultsLoaded(filterName: filterName, filterValue: filterValue, resultCount: resultCount, customerIDs: customerIDs, resultID: resultID) { result in
            if let error = result.error {
                continuation.resume(throwing: error)
            }
            else if let _ = result.data {
                continuation.resume()
            }
        }
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.