Skip to content

Commit

Permalink
Pluralize resources to avoid name conflicts (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericanderson authored May 20, 2024
1 parent 471a618 commit 7c72eb9
Show file tree
Hide file tree
Showing 20 changed files with 542 additions and 58 deletions.
4 changes: 2 additions & 2 deletions examples-extra/basic/cli/src/runFoundryPlatformApiTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import { client } from "./client.js";
import { logger } from "./logger.js";

export async function runFoundryPlatformApiTest() {
const myUser = await Foundry.Security.User.getCurrentUser(
const myUser = await Foundry.Security.Users.getCurrentUser(
client,
{ preview: true },
);
logger.info(myUser, "Loaded user");
console.log("User", myUser!.email);

const models = await Models.LanguageModel.listLanguageModels(client);
const models = await Models.LanguageModels.listLanguageModels(client);
logger.info({
models: models.data.map(m => `'${m.apiName}' in ${m.source}`),
}, "Loaded models");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export async function runFoundrySdkClientVerificationTest(
const pageSize = 10;

// will throw if dataset not found
const dataset = await Datasets.Dataset.getDataset(client, datasetRid);
const dataset = await Datasets.Datasets.getDataset(client, datasetRid);
logger.info({ dataset }, `Loaded dataset ${datasetRid}`);

const branchesResult = await Datasets.Branch.listBranches(
const branchesResult = await Datasets.Branches.listBranches(
client,
datasetRid,
{ pageSize },
Expand Down Expand Up @@ -60,7 +60,7 @@ export async function runFoundrySdkClientVerificationTest(
// We want to be sure the error is filled out nicely, so we can use the `master` branch
// now that we know it exists.
try {
await Datasets.Branch.createBranch(client, datasetRid, {
await Datasets.Branches.createBranch(client, datasetRid, {
branchId: "master",
});
throw new Error("createBranch(master) should have failed");
Expand All @@ -78,15 +78,15 @@ export async function runFoundrySdkClientVerificationTest(
}
}

const testBranch = await Datasets.Branch.createBranch(
const testBranch = await Datasets.Branches.createBranch(
client,
datasetRid,
{ branchId: branchToCreate },
);
logger.info({ testBranch }, "Created test branch");

// Returns Promise<void> and should not error
await Datasets.Branch.deleteBranch(
await Datasets.Branches.deleteBranch(
client,
datasetRid,
testBranch.branchId,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/actions/applyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export async function applyAction<
parameters?: OsdkActionParameters<AD["parameters"]>,
options: Op = {} as Op,
): Promise<ActionReturnTypeForOptions<Op>> {
const response = await OntologiesV2.Action.applyActionV2(
const response = await OntologiesV2.Actions.applyActionV2(
addUserAgent(client, action),
client.ontologyRid,
action.apiName,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/object/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export async function aggregate<
if (req.where) {
body.where = modernToLegacyWhereClause(req.where);
}
const result = await OntologiesV2.OntologyObjectSet.aggregateObjectSetV2(
const result = await OntologiesV2.OntologyObjectSets.aggregateObjectSetV2(
addUserAgent(clientCtx, objectType),
clientCtx.ontologyRid,
{
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/object/fetchPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async function fetchInterfacePage<
args: FetchPageArgs<Q, L, R>,
objectSet: ObjectSet,
): Promise<FetchPageResult<Q, L, R>> {
const result = await OntologiesV2.OntologyObjectV2.searchObjectsForInterface(
const result = await OntologiesV2.OntologyObjectsV2.searchObjectsForInterface(
addUserAgent(client, interfaceType),
client.ontologyRid,
interfaceType.apiName,
Expand Down Expand Up @@ -302,7 +302,7 @@ export async function fetchObjectPage<
args: FetchPageArgs<Q, L, R>,
objectSet: ObjectSet,
): Promise<FetchPageResult<Q, L, R>> {
const r = await OntologiesV2.OntologyObjectSet.loadObjectSetV2(
const r = await OntologiesV2.OntologyObjectSets.loadObjectSetV2(
addUserAgent(client, objectType),
client.ontologyRid,
applyFetchArgs<LoadObjectSetRequestV2>(args, {
Expand Down
13 changes: 7 additions & 6 deletions packages/client/src/objectSet/ObjectSetListenerWebsocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export class ObjectSetListenerWebsocket {
// look up the object type's rid and ensure that we have enabled object set watcher for that rid
// TODO ???
getObjectSetBaseType(sub.objectSet).then(baseType =>
OntologiesV2.ObjectTypeV2.getObjectTypeV2(
OntologiesV2.ObjectTypesV2.getObjectTypeV2(
this.#client,
this.#client.ontologyRid,
baseType,
Expand Down Expand Up @@ -625,11 +625,12 @@ async function getOntologyPropertyMappingForApiName(
);
}

const wireObjectType = await OntologiesV2.ObjectTypeV2.getObjectTypeV2(
client,
client.ontologyRid,
objectApiName,
);
const wireObjectType = await OntologiesV2.ObjectTypesV2
.getObjectTypeV2(
client,
client.ontologyRid,
objectApiName,
);

return getOntologyPropertyMappingForRid(
ctx,
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/ontology/StandardOntologyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ const alwaysRevalidateDefault = false;
// SLLLLLLOOOOOOOWWWW
async function fullOntologyLoad(client: MinimalClient) {
return await Promise.all([
OntologiesV2.OntologyObjectV2.listInterfaceTypes(
OntologiesV2.OntologyObjectsV2.listInterfaceTypes(
client,
client.ontologyRid,
{ pageSize: 200, preview: true },
),
OntologiesV2.OntologyV2.getOntologyFullMetadata(
OntologiesV2.OntologiesV2.getOntologyFullMetadata(
client,
client.ontologyRid,
),
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/ontology/loadFullObjectMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function loadFullObjectMetadata(
client: MinimalClient,
objtype: string,
): Promise<ObjectTypeDefinition<any, any> & { rid: string }> {
const full = await OntologiesV2.OntologyObjectV2.getObjectTypeFullMetadata(
const full = await OntologiesV2.OntologyObjectsV2.getObjectTypeFullMetadata(
client,
client.ontologyRid,
objtype,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/ontology/loadInterfaceDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export async function loadInterfaceDefinition(
client: MinimalClient,
objtype: string,
): Promise<InterfaceDefinition<any, any>> {
const r = await OntologiesV2.OntologyObjectV2.getInterfaceType(
const r = await OntologiesV2.OntologyObjectsV2.getInterfaceType(
client,
client.ontologyRid,
objtype,
Expand Down
43 changes: 42 additions & 1 deletion packages/foundry.core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,45 @@
* limitations under the License.
*/

export type * from "./_components.js";
export type {
ArchiveFileFormat,
AttributeName,
AttributeValue,
AttributeValues,
ContentLength,
ContentType,
CreatedBy,
CreatedTime,
DisplayName,
Distance,
DistanceUnit,
Duration,
FilePath,
FolderRid,
Group,
GroupMember,
GroupMembership,
GroupMembershipExpiration,
GroupName,
OrganizationRid,
PageSize,
PageToken,
PreviewMode,
PrincipalId,
PrincipalType,
Realm,
ReleaseStatus,
SizeBytes,
Subdomain,
ThirdPartyApplication,
ThirdPartyApplicationRid,
TimeUnit,
UpdatedBy,
UpdatedTime,
User,
UserId,
UserUsername,
Version,
VersionVersion,
Website,
} from "./_components.js";
16 changes: 11 additions & 5 deletions packages/foundry.security/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
* limitations under the License.
*/

export type * from "./_components.js";
export * as Group from "./public/Group.js";
export * as GroupMember from "./public/GroupMember.js";
export * as GroupMembership from "./public/GroupMembership.js";
export * as User from "./public/User.js";
export type {
AddGroupMembersRequest,
CreateGroupRequest,
ListGroupMembershipsResponse,
ListGroupMembersResponse,
RemoveGroupMembersRequest,
} from "./_components.js";
export * as Groups from "./public/Group.js";
export * as GroupMembers from "./public/GroupMember.js";
export * as GroupMemberships from "./public/GroupMembership.js";
export * as Users from "./public/User.js";
11 changes: 7 additions & 4 deletions packages/foundry.thirdpartyapplications/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/

export type * from "./_components.js";
export * as ThirdPartyApplication from "./public/ThirdPartyApplication.js";
export * as Version from "./public/Version.js";
export * as Website from "./public/Website.js";
export type {
DeployWebsiteRequest,
ListVersionsResponse,
} from "./_components.js";
export * as ThirdPartyApplications from "./public/ThirdPartyApplication.js";
export * as Versions from "./public/Version.js";
export * as Websites from "./public/Website.js";
Loading

0 comments on commit 7c72eb9

Please sign in to comment.