Feed

A runnable Geblang example.

Path
gebweb/examples/services_yaml/src/feed.gb
Category
Services Yaml

Source

module feed;

export interface FeedClient {
    func fetch(): list<string>;
}

export class HttpFeedClient implements FeedClient {
    string endpoint;
    string apiKey;
    func HttpFeedClient(string endpoint, string apiKey) {
        this.endpoint = endpoint;
        this.apiKey = apiKey;
    }
    func fetch(): list<string> {
        return ["live:" + this.endpoint + "?key=" + this.apiKey];
    }
}

export class StubFeedClient implements FeedClient {
    func StubFeedClient() {}
    func fetch(): list<string> {
        return ["stub:item-a", "stub:item-b", "stub:item-c"];
    }
}