const wsUrl = urljoin(options.baseUrl, options.uri, `?${queryParams}`) const protocol = 'base64.channel.k8s.io'
async listFollowing(ctx) { ctx.meta.$responseType = 'application/ld+json'; const collection = await ctx.call('activitypub.collection.get', { id: urlJoin(this.settings.actorsContainer, ctx.params.username, 'following'), dereferenceItems: false }); if (collection) { return collection; } else { ctx.meta.$statusCode = 404; } }
getClient(id) { return this.authenticate().then(() => request .get(urlj(this.endpoint,`/clients/${id}`)) .authBearer(this.token.token.access_token) .then((res) => !res.ok ? Promise.reject({ error: new Error('Status code is not 2xx'), message: 'Could not retrieve client.' }) : Promise.resolve(res.body) ) ) }
it('can find collection index.json', async () => { const file = urljoin(collection, '/index.json'); assert(await Utils.fileExists(file)); collectionJson = await Utils.readJson(file); });
promiseWrap(function(cb) { // GET :apigeecom/organizations/:org/specs/folder/home var conn = this.conn; common.insureFreshToken(conn, function(requestOptions) { requestOptions.url = urljoin(specUrlBase(conn), 'specs/folder/home'); if (conn.verbosity>0) { utility.logWrite(sprintf('GET %s', requestOptions.url)); } request.get(requestOptions, common.callback(conn, [200], cb)); }); })
const createUser = ({body}) => postRequest({ url: joinUrl(usersAPIUrl, 'users'), options: { body } })
getApiRoutes() { let routes = []; // Associate all containers in settings with the LDP service for (let containerPath of this.settings.containers) { routes.push(...getContainerRoutes(urlJoin(this.settings.baseUrl, containerPath))); } return routes; }
function resolveResourceFileUrlPath(conn, options) { if (options && (options.env || options.environment)) { return urljoin(conn.urlBase, 'e', (options.env || options.environment), 'resourcefiles'); } if (options && options.proxy && options.revision) { return urljoin(conn.urlBase, 'apis', options.proxy, 'revisions', options.revision, 'resourcefiles'); } return urljoin(conn.urlBase, 'resourcefiles'); }
/** * Properly joins paths together to create a URL. Takes a variable number of * arguments. */ function makeUrl() { let args = Array.from(arguments); return args.reduce(function (acc, cur) { return urljoin(acc, cur); }); }
async started() { for (let containerPath of this.settings.containers) { const containerUri = urlJoin(this.settings.baseUrl, containerPath); const exists = await this.actions.exist({ containerUri }); if (!exists) { console.log(`Container ${containerUri} doesn't exist, creating it...`); await this.actions.create({ containerUri }); } } }
function resolveKvmPath(conn, options) { if (options && (options.env || options.environment)) { return urljoin(conn.urlBase, 'e', (options.env || options.environment), 'keyvaluemaps'); } if (options && options.proxy) { return (options.revision) ? urljoin(conn.urlBase, 'apis', options.proxy, 'revisions', options.revision, 'keyvaluemaps') : urljoin(conn.urlBase, 'apis', options.proxy, 'keyvaluemaps'); } return urljoin(conn.urlBase, 'keyvaluemaps'); }
async started() { for (let containerPath of this.settings.containers) { const containerUri = urlJoin(this.settings.baseUrl, containerPath); const exists = await this.actions.exist({ containerUri }); if (!exists) { console.log(`Container ${containerUri} doesn't exist, creating it...`); await this.actions.create({ containerUri }); } } }
// should take less than a second it('can find ' + manifest + ' index.json', async () => { const file = urljoin(manifest, 'index.json'); assert(await Utils.fileExists(file)); manifestJson = await Utils.readJson(file); });
async listFollowers(ctx) { ctx.meta.$responseType = 'application/ld+json'; const collection = await ctx.call('activitypub.collection.get', { id: urlJoin(this.settings.actorsContainer, ctx.params.username, 'followers'), dereferenceItems: false }); if (collection) { return collection; } else { ctx.meta.$statusCode = 404; } }
async listFollowing(ctx) { ctx.meta.$responseType = 'application/ld+json'; const collection = await ctx.call('activitypub.collection.get', { id: urlJoin(this.settings.actorsContainer, ctx.params.username, 'following'), dereferenceItems: false }); if (collection) { return collection; } else { ctx.meta.$statusCode = 404; } }