Skip to content

Commit 8e077e2

Browse files
authored
Merge pull request #128 from erincdustin/10.0.2_new
10.0.2
2 parents df483b6 + 9e6eaad commit 8e077e2

127 files changed

Lines changed: 197 additions & 674 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to the ordercloud-javascript-sdk will be documented in this
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
# [10.0.2] - 2025-01-29
9+
- Bring SDK up to date with API [v1.0.377](https://ordercloud.io/release-notes/v1.0.377)
10+
811
# [10.0.1] - 2025-01-23
912
- Bring SDK up to date with API [v1.0.376](https://ordercloud.io/release-notes/v1.0.376)
1013

codegen/hooks.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ import {
66
PostFormatOperationHook,
77
PostFormatTemplateDataHook,
88
Operation,
9+
FilterResourcesHook,
910
} from '@ordercloud/oc-codegen'
1011

12+
const filterResources: FilterResourcesHook = function(resource) {
13+
// we want to manually remove Certs from the resource array so that we can add custom logic in the codegen template
14+
return resource.name !== 'Certs'
15+
}
16+
1117
const postFormatModel: PostFormatModelHook = function(model, models) {
1218
// add model.typeParams and prop.typeParams
1319
inspectModelForTypeParams(models, model, model)
@@ -117,6 +123,7 @@ module.exports = {
117123
postFormatModel,
118124
postFormatOperation,
119125
postFormatTemplateData,
126+
filterResources,
120127
}
121128

122129
/******************

codegen/templates/api/Certs.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { RequiredDeep } from '../models/RequiredDeep'
2+
import { RequestOptions } from '../models/RequestOptions'
3+
import http from '../utils/HttpClient'
4+
import OrderCloudError from '../utils/OrderCloudError'
5+
import { PublicKey } from '../models/PublicKey'
6+
7+
class Certs {
8+
private impersonating: boolean = false
9+
10+
/**
11+
* @ignore
12+
* not part of public api, don't include in generated docs
13+
*/
14+
constructor() {
15+
this.GetPublicKey = this.GetPublicKey.bind(this)
16+
}
17+
18+
/**
19+
* Get a single cert public key. Returns a JSON Web Key (JWK). Can be used for validating the token was signed by OrderCloud.
20+
* Check out the {@link https://ordercloud.io/api-reference/authentication-and-authorization/certs/get-public-key|api docs} for more info
21+
*
22+
* @param ID ID of the public key.
23+
* @param requestOptions.accessToken Provide an alternative token to the one stored in the sdk instance (useful for impersonation).
24+
* @param requestOptions.cancelToken Provide an [axios cancelToken](https://github.com/axios/axios#cancellation) that can be used to cancel the request.
25+
* @param requestOptions.requestType Provide a value that can be used to identify the type of request. Useful for error logs.
26+
*/
27+
public async GetPublicKey<TPublicKey extends PublicKey>(
28+
ID: string,
29+
requestOptions: RequestOptions = {}
30+
): Promise<RequiredDeep<TPublicKey>> {
31+
const impersonating = this.impersonating
32+
this.impersonating = false
33+
return await http
34+
.get(`oauth/certs/${ID}`, { ...requestOptions, impersonating })
35+
.catch(ex => {
36+
if (ex.response) {
37+
throw new OrderCloudError(ex)
38+
}
39+
throw ex
40+
})
41+
}
42+
43+
/**
44+
* @description
45+
* enables impersonation by calling the subsequent method with the stored impersonation token
46+
*
47+
* @example
48+
* Certs.As().List() // lists Certs using the impersonated users' token
49+
*/
50+
public As(): this {
51+
this.impersonating = true
52+
return this
53+
}
54+
}
55+
56+
export default new Certs()

codegen/templates/api/index.ts.hbs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import {{this.id}} from './{{this.id}}';
44
import Auth from './Auth';
55
import UserInfo from './UserInfo';
66
import Tokens from './Tokens';
7+
import Certs from './Certs';
78

89
export {
910
{{#resources}}
1011
{{this.id}},
1112
{{/resources}}
1213
Auth,
1314
UserInfo,
14-
Tokens
15+
Tokens,
16+
Certs
1517
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface PublicKey {
2+
kty?: string
3+
n?: string
4+
e?: string
5+
alg?: string
6+
use?: string
7+
kid?: string
8+
}

codegen/templates/models/index.ts.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export * from './OrderReturnCalculateResponse';
2929
export * from './OrderSubmitForApprovalPayload';
3030
export * from './OrderSubmitPayload';
3131
export * from './PartialDeep';
32+
export * from './PublicKey';
3233
export * from './RequestOptions';
3334
export * from './RequiredDeep';
3435
export * from './SdkConfiguration';

docs/assets/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/classes/Resources.Certs.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ <h4>Hierarchy</h4>
2121
<ul class="tsd-hierarchy">
2222
<li><span class="target">Certs</span></li></ul></section><aside class="tsd-sources">
2323
<ul>
24-
<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>
24+
<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>
2525
<section class="tsd-panel-group tsd-index-group">
2626
<section class="tsd-panel tsd-index-panel">
2727
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
@@ -42,7 +42,7 @@ <h2>Properties</h2>
4242
<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>
4343
<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">
4444
<ul>
45-
<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>
45+
<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>
4646
<section class="tsd-panel-group tsd-member-group">
4747
<h2>Methods</h2>
4848
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="As" class="tsd-anchor"></a>
@@ -58,7 +58,7 @@ <h3>Example</h3><pre><code class="language-ts"><span class="hl-0">Certs</span><s
5858
</div>
5959
<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">
6060
<ul>
61-
<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>
61+
<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>
6262
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="GetPublicKey" class="tsd-anchor"></a>
6363
<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>
6464
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
@@ -83,7 +83,7 @@ <h5>ID: <span class="tsd-signature-type">string</span></h5>
8383
<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>
8484
<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">
8585
<ul>
86-
<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>
86+
<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>
8787
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
8888
<div class="tsd-navigation settings">
8989
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">

docs/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ <h3 class="tsd-index-heading">Interfaces</h3>
3636
<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>
3737
<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>
3838
<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>
39-
<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>
4039
<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>
4140
<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>
4241
<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>
@@ -70,7 +69,6 @@ <h3 class="tsd-index-heading">Interfaces</h3>
7069
<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>
7170
<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>
7271
<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>
73-
<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>
7472
<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>
7573
<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>
7674
<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>

0 commit comments

Comments
 (0)