@gigadrive/sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/dist/index.d.mts +254 -1
- package/dist/index.d.ts +254 -1
- package/dist/index.js +135 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2027,6 +2027,83 @@ var OrganizationEnvVarsResource = class extends BaseResource {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
};
|
|
2029
2029
|
|
|
2030
|
+
// src/resources/organization-members.ts
|
|
2031
|
+
var OrganizationMembersResource = class extends BaseResource {
|
|
2032
|
+
/**
|
|
2033
|
+
* List the users who belong to an organization.
|
|
2034
|
+
*
|
|
2035
|
+
* @param organizationId - Organization whose members should be listed.
|
|
2036
|
+
* @param query - Optional pagination.
|
|
2037
|
+
* @returns A paginated list of organization members.
|
|
2038
|
+
*
|
|
2039
|
+
* @example
|
|
2040
|
+
* ```ts
|
|
2041
|
+
* const { items, total } = await client.organizations.members.list('org-id');
|
|
2042
|
+
* console.log(`Found ${total} members`);
|
|
2043
|
+
* ```
|
|
2044
|
+
*/
|
|
2045
|
+
async list(organizationId, query) {
|
|
2046
|
+
return this.httpClient.get(`/organizations/${organizationId}/members`, {
|
|
2047
|
+
query
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2052
|
+
// src/resources/organization-products.ts
|
|
2053
|
+
var OrganizationProductsResource = class extends BaseResource {
|
|
2054
|
+
/**
|
|
2055
|
+
* List effective product access for every organization-scoped product.
|
|
2056
|
+
*
|
|
2057
|
+
* @param organizationId - Organization whose product access should be listed.
|
|
2058
|
+
* @param query - Optional pagination.
|
|
2059
|
+
* @returns A paginated list of product access summaries.
|
|
2060
|
+
*
|
|
2061
|
+
* @example
|
|
2062
|
+
* ```ts
|
|
2063
|
+
* const { items } = await client.organizations.products.list('org-id');
|
|
2064
|
+
* for (const item of items) {
|
|
2065
|
+
* console.log(item.product.slug, item.hasAccess);
|
|
2066
|
+
* }
|
|
2067
|
+
* ```
|
|
2068
|
+
*/
|
|
2069
|
+
async list(organizationId, query) {
|
|
2070
|
+
return this.httpClient.get(`/organizations/${organizationId}/products`, {
|
|
2071
|
+
query
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
/**
|
|
2075
|
+
* Get effective access for one organization-scoped product.
|
|
2076
|
+
*
|
|
2077
|
+
* @param organizationId - Organization to inspect.
|
|
2078
|
+
* @param product - Product slug from the product registry.
|
|
2079
|
+
* @returns Product access summary including entitlement and subscription state.
|
|
2080
|
+
*
|
|
2081
|
+
* @example
|
|
2082
|
+
* ```ts
|
|
2083
|
+
* const access = await client.organizations.products.get('org-id', 'office');
|
|
2084
|
+
* console.log(access.hasAccess, access.subscription?.plan);
|
|
2085
|
+
* ```
|
|
2086
|
+
*/
|
|
2087
|
+
async get(organizationId, product) {
|
|
2088
|
+
return this.httpClient.get(`/organizations/${organizationId}/products/${product}`);
|
|
2089
|
+
}
|
|
2090
|
+
/**
|
|
2091
|
+
* Check whether an organization currently has access to a product.
|
|
2092
|
+
*
|
|
2093
|
+
* @param organizationId - Organization to check.
|
|
2094
|
+
* @param product - Product slug from the product registry.
|
|
2095
|
+
* @returns Compact entitlement check result.
|
|
2096
|
+
*
|
|
2097
|
+
* @example
|
|
2098
|
+
* ```ts
|
|
2099
|
+
* const { hasAccess } = await client.organizations.products.checkEntitlement('org-id', 'network');
|
|
2100
|
+
* ```
|
|
2101
|
+
*/
|
|
2102
|
+
async checkEntitlement(organizationId, product) {
|
|
2103
|
+
return this.httpClient.get(`/organizations/${organizationId}/products/${product}/entitlement`);
|
|
2104
|
+
}
|
|
2105
|
+
};
|
|
2106
|
+
|
|
2030
2107
|
// src/resources/organizations.ts
|
|
2031
2108
|
var OrganizationsResource = class extends BaseResource {
|
|
2032
2109
|
/**
|
|
@@ -2057,10 +2134,31 @@ var OrganizationsResource = class extends BaseResource {
|
|
|
2057
2134
|
* ```
|
|
2058
2135
|
*/
|
|
2059
2136
|
aiGateway;
|
|
2137
|
+
/**
|
|
2138
|
+
* List organization members and membership roles.
|
|
2139
|
+
*
|
|
2140
|
+
* @example
|
|
2141
|
+
* ```ts
|
|
2142
|
+
* const { items } = await client.organizations.members.list('org-id');
|
|
2143
|
+
* ```
|
|
2144
|
+
*/
|
|
2145
|
+
members;
|
|
2146
|
+
/**
|
|
2147
|
+
* Inspect organization product entitlements. Read-only through the public
|
|
2148
|
+
* API — plan changes happen in Gigadrive product surfaces, not via the SDK.
|
|
2149
|
+
*
|
|
2150
|
+
* @example
|
|
2151
|
+
* ```ts
|
|
2152
|
+
* const check = await client.organizations.products.checkEntitlement('org-id', 'office');
|
|
2153
|
+
* ```
|
|
2154
|
+
*/
|
|
2155
|
+
products;
|
|
2060
2156
|
constructor(...args) {
|
|
2061
2157
|
super(...args);
|
|
2062
2158
|
this.envVars = new OrganizationEnvVarsResource(this.httpClient);
|
|
2063
2159
|
this.aiGateway = new OrganizationAiGatewayResource(this.httpClient);
|
|
2160
|
+
this.members = new OrganizationMembersResource(this.httpClient);
|
|
2161
|
+
this.products = new OrganizationProductsResource(this.httpClient);
|
|
2064
2162
|
}
|
|
2065
2163
|
/**
|
|
2066
2164
|
* List organizations the authenticated actor has access to.
|
|
@@ -2079,6 +2177,39 @@ var OrganizationsResource = class extends BaseResource {
|
|
|
2079
2177
|
query
|
|
2080
2178
|
});
|
|
2081
2179
|
}
|
|
2180
|
+
/**
|
|
2181
|
+
* Get a single organization by ID.
|
|
2182
|
+
*
|
|
2183
|
+
* @param organizationId - Organization to retrieve.
|
|
2184
|
+
* @returns The organization.
|
|
2185
|
+
*
|
|
2186
|
+
* @example
|
|
2187
|
+
* ```ts
|
|
2188
|
+
* const org = await client.organizations.get('org-id');
|
|
2189
|
+
* console.log(org.name, org.slug);
|
|
2190
|
+
* ```
|
|
2191
|
+
*/
|
|
2192
|
+
async get(organizationId) {
|
|
2193
|
+
return this.httpClient.get(`/organizations/${organizationId}`);
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Create a new organization.
|
|
2197
|
+
*
|
|
2198
|
+
* Requires a user-backed token with the `platform:organizations:write` scope.
|
|
2199
|
+
* The authenticated user becomes the organization owner.
|
|
2200
|
+
*
|
|
2201
|
+
* @param input - Organization creation input.
|
|
2202
|
+
* @returns The created organization.
|
|
2203
|
+
*
|
|
2204
|
+
* @example
|
|
2205
|
+
* ```ts
|
|
2206
|
+
* const org = await client.organizations.create({ name: 'Acme Corp' });
|
|
2207
|
+
* console.log(org.id, org.slug);
|
|
2208
|
+
* ```
|
|
2209
|
+
*/
|
|
2210
|
+
async create(input) {
|
|
2211
|
+
return this.httpClient.post("/organizations", input);
|
|
2212
|
+
}
|
|
2082
2213
|
};
|
|
2083
2214
|
|
|
2084
2215
|
// src/client.ts
|
|
@@ -2138,6 +2269,8 @@ export {
|
|
|
2138
2269
|
GigadriveError,
|
|
2139
2270
|
OrganizationAiGatewayResource,
|
|
2140
2271
|
OrganizationEnvVarsResource,
|
|
2272
|
+
OrganizationMembersResource,
|
|
2273
|
+
OrganizationProductsResource,
|
|
2141
2274
|
OrganizationsResource,
|
|
2142
2275
|
StorageBucketsResource,
|
|
2143
2276
|
StorageObjectsResource,
|