Skip to content

Commit

Permalink
Merge pull request #128 from erincdustin/10.0.2_new
Browse files Browse the repository at this point in the history
10.0.2
  • Loading branch information
erincdustin authored Jan 29, 2025
2 parents df483b6 + 9e6eaad commit 8e077e2
Show file tree
Hide file tree
Showing 127 changed files with 197 additions and 674 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ All notable changes to the ordercloud-javascript-sdk will be documented in this
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [10.0.2] - 2025-01-29
- Bring SDK up to date with API [v1.0.377](https://ordercloud.io/release-notes/v1.0.377)

# [10.0.1] - 2025-01-23
- Bring SDK up to date with API [v1.0.376](https://ordercloud.io/release-notes/v1.0.376)

Expand Down
7 changes: 7 additions & 0 deletions codegen/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ import {
PostFormatOperationHook,
PostFormatTemplateDataHook,
Operation,
FilterResourcesHook,
} from '@ordercloud/oc-codegen'

const filterResources: FilterResourcesHook = function(resource) {
// we want to manually remove Certs from the resource array so that we can add custom logic in the codegen template
return resource.name !== 'Certs'
}

const postFormatModel: PostFormatModelHook = function(model, models) {
// add model.typeParams and prop.typeParams
inspectModelForTypeParams(models, model, model)
Expand Down Expand Up @@ -117,6 +123,7 @@ module.exports = {
postFormatModel,
postFormatOperation,
postFormatTemplateData,
filterResources,
}

/******************
Expand Down
56 changes: 56 additions & 0 deletions codegen/templates/api/Certs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { RequiredDeep } from '../models/RequiredDeep'
import { RequestOptions } from '../models/RequestOptions'
import http from '../utils/HttpClient'
import OrderCloudError from '../utils/OrderCloudError'
import { PublicKey } from '../models/PublicKey'

class Certs {
private impersonating: boolean = false

/**
* @ignore
* not part of public api, don't include in generated docs
*/
constructor() {
this.GetPublicKey = this.GetPublicKey.bind(this)
}

/**
* Get a single cert public key. Returns a JSON Web Key (JWK). Can be used for validating the token was signed by OrderCloud.
* Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/certs/get-public-key|api docs} for more info
*
* @param ID ID of the public key.
* @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation).
* @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request.
* @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs.
*/
public async GetPublicKey<TPublicKey extends PublicKey>(
ID: string,
requestOptions: RequestOptions = {}
): Promise<RequiredDeep<TPublicKey>> {
const impersonating = this.impersonating
this.impersonating = false
return await http
.get(`oauth/certs/${ID}`, { ...requestOptions, impersonating })
.catch(ex => {
if (ex.response) {
throw new OrderCloudError(ex)
}
throw ex
})
}

/**
* @description
* enables impersonation by calling the subsequent method with the stored impersonation token
*
* @example
* Certs.As().List() // lists Certs using the impersonated users' token
*/
public As(): this {
this.impersonating = true
return this
}
}

export default new Certs()
4 changes: 3 additions & 1 deletion codegen/templates/api/index.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import {{this.id}} from './{{this.id}}';
import Auth from './Auth';
import UserInfo from './UserInfo';
import Tokens from './Tokens';
import Certs from './Certs';

export {
{{#resources}}
{{this.id}},
{{/resources}}
Auth,
UserInfo,
Tokens
Tokens,
Certs
}
8 changes: 8 additions & 0 deletions codegen/templates/models/PublicKey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface PublicKey {
kty?: string
n?: string
e?: string
alg?: string
use?: string
kid?: string
}
1 change: 1 addition & 0 deletions codegen/templates/models/index.ts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export * from './OrderReturnCalculateResponse';
export * from './OrderSubmitForApprovalPayload';
export * from './OrderSubmitPayload';
export * from './PartialDeep';
export * from './PublicKey';
export * from './RequestOptions';
export * from './RequiredDeep';
export * from './SdkConfiguration';
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/search.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/classes/Resources.Certs.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">Certs</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L8">api/Certs.ts:8</a></li></ul></aside>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L7">api/Certs.ts:7</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand All @@ -42,7 +42,7 @@ <h2>Properties</h2>
<h3 class="tsd-anchor-link"><code class="tsd-tag ts-flagPrivate">Private</code> <span>impersonating</span><a href="#impersonating" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
<div class="tsd-signature">impersonating<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L9">api/Certs.ts:9</a></li></ul></aside></section></section>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L8">api/Certs.ts:8</a></li></ul></aside></section></section>
<section class="tsd-panel-group tsd-member-group">
<h2>Methods</h2>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="As" class="tsd-anchor"></a>
Expand All @@ -58,7 +58,7 @@ <h3>Example</h3><pre><code class="language-ts"><span class="hl-0">Certs</span><s
</div>
<h4 class="tsd-returns-title">Returns <a href="Resources.Certs.html" class="tsd-signature-type" data-tsd-kind="Class">Certs</a></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L47">api/Certs.ts:47</a></li></ul></aside></li></ul></section>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L50">api/Certs.ts:50</a></li></ul></aside></li></ul></section>
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="GetPublicKey" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>Get<wbr/>Public<wbr/>Key</span><a href="#GetPublicKey" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
Expand All @@ -83,7 +83,7 @@ <h5>ID: <span class="tsd-signature-type">string</span></h5>
<h5>requestOptions: <a href="../interfaces/RequestOptions.html" class="tsd-signature-type" data-tsd-kind="Interface">RequestOptions</a><span class="tsd-signature-symbol"> = {}</span></h5></li></ul></div>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol">&lt;</span><a href="../types/RequiredDeep.html" class="tsd-signature-type" data-tsd-kind="Type alias">RequiredDeep</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type" data-tsd-kind="Type parameter">TPublicKey</span><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">&gt;</span></h4><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L28">api/Certs.ts:28</a></li></ul></aside></li></ul></section></section></div>
<li>Defined in <a href="https://github.com/ordercloud-api/ordercloud-javascript-sdk/blob/master/src/api/Certs.ts#L27">api/Certs.ts:27</a></li></ul></aside></li></ul></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
2 changes: 0 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ <h3 class="tsd-index-heading">Interfaces</h3>
<a href="interfaces/ApiClientSecretCreateResponse.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Api<wbr/>Client<wbr/>Secret<wbr/>Create<wbr/>Response</span></a>
<a href="interfaces/ApprovalInfo.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Approval<wbr/>Info</span></a>
<a href="interfaces/ApprovalRule.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Approval<wbr/>Rule</span></a>
<a href="interfaces/Authentication.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Authentication</span></a>
<a href="interfaces/AzureBlobConfig.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Azure<wbr/>Blob<wbr/>Config</span></a>
<a href="interfaces/AzureTableConfig.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Azure<wbr/>Table<wbr/>Config</span></a>
<a href="interfaces/Bundle.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Bundle</span></a>
Expand Down Expand Up @@ -70,7 +69,6 @@ <h3 class="tsd-index-heading">Interfaces</h3>
<a href="interfaces/ErrorConfig.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Error<wbr/>Config</span></a>
<a href="interfaces/EventHubConfig.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Event<wbr/>Hub<wbr/>Config</span></a>
<a href="interfaces/ExtendedLineItem.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Extended<wbr/>Line<wbr/>Item</span></a>
<a href="interfaces/ExtendedOrder.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Extended<wbr/>Order</span></a>
<a href="interfaces/HttpConfig.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Http<wbr/>Config</span></a>
<a href="interfaces/IdentityToken.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Identity<wbr/>Token</span></a>
<a href="interfaces/ImpersonateTokenRequest.html" class="tsd-index-link tsd-kind-interface"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-256-path"></use><use href="#icon-256-text"></use></svg><span>Impersonate<wbr/>Token<wbr/>Request</span></a>
Expand Down
Loading

0 comments on commit 8e077e2

Please sign in to comment.