// @return (Natukaship.AppVersion) Receive the version that is currently live on the
 //  App Store. You can't modify all values there, so be careful.
 public AppVersion LiveVersion(string platform = null)
 {
     return(AppVersion.Find(this, appleId, true));
 }
 // @return (Natukaship.AppVersion) Receive the version that can fully be edited
 public AppVersion EditVersion(string platform = null)
 {
     return(AppVersion.Find(this, appleId, false));
 }
Beispiel #3
0
 public UploadFileResponseObject UploadAppReviewAttachment(AppVersion appVersion, UploadFile uploadFile, string contentProviderId, string ssoTokenForAttachment)
 {
     // TODO: Continue this method
     return(UploadFile(appVersion: appVersion, uploadFile: uploadFile, path: "/upload/app-resolution-file", contentProviderId: contentProviderId, ssoToken: ssoTokenForAttachment));
 }
Beispiel #4
0
        private UploadFileResponseObject UploadFile(AppVersion appVersion      = null,
                                                    UploadFile uploadFile      = null,
                                                    string path                = null,
                                                    string contentProviderId   = null,
                                                    string ssoToken            = null,
                                                    string duValidationRuleSet = null,
                                                    string appId               = null)
        {
            if (uploadFile.fileSize == 0)
            {
                throw new System.Exception($"File {uploadFile.filePath} is empty");
            }

            string  appType  = null;
            Version version  = null;
            string  referrer = null;

            if (!string.IsNullOrEmpty(appId))
            {
                appType  = null;
                version  = null;
                referrer = null;
            }
            else
            {
                version  = appVersion.version;
                appId    = appVersion.application.appleId;
                appType  = appVersion.appType;
                referrer = appVersion.application.url;
            }

            Dictionary <string, string> headers = new Dictionary <string, string>
            {
                { "Accept", "application/json, text/plain, */*" },
                { "Content-Type", uploadFile.contentType },
                { "X-Apple-Upload-AppleId", appId },
                { "X-Apple-Upload-itctoken", ssoToken },
                { "X-Apple-Upload-ContentProviderId", contentProviderId },
                { "Content-Length", uploadFile.fileSize.ToString() },
                { "X-Original-Filename", uploadFile.fileName },
                { "Connection", "keep-alive" },
            };

            if (!string.IsNullOrEmpty(referrer))
            {
                headers.Add("X-Apple-Upload-Referrer", referrer);
                headers.Add("Referrer", referrer);
            }

            if (!string.IsNullOrEmpty(appType))
            {
                headers.Add("X-Apple-Jingle-Correlation-Key", $"{appType}:AdamId={appId}:Version={version}");
            }

            if (!string.IsNullOrEmpty(duValidationRuleSet))
            {
                headers.Add("X-Apple-Upload-Validation-RuleSets", duValidationRuleSet);
            }

            Task <(string, int)> uploadTask = Task.Run(async() => await Account.SendRequestAsync("POST", $"{Hostname}{path}", uploadFile, headers: headers));

            (string uploadResponseResult, int uploadResponseCode) = uploadTask.Result;

            if (uploadResponseCode == 500 && uploadResponseResult.Contains("Server Error"))
            {
                UploadFile(appVersion: appVersion, uploadFile: uploadFile, path: path, contentProviderId: contentProviderId, ssoToken: ssoToken, duValidationRuleSet: duValidationRuleSet, appId: appId);
            }

            return(ParseUploadResponse(uploadResponseResult, uploadResponseCode));
        }
Beispiel #5
0
 public UploadFileResponseObject UploadTrailerPreview(AppVersion appVersion, UploadFile uploadFile, string contentProviderId, string ssoTokenForImage, string device)
 {
     return(UploadFile(appVersion: appVersion, uploadFile: uploadFile, path: "/upload/image", contentProviderId: contentProviderId, ssoToken: ssoTokenForImage, duValidationRuleSet: ScreenshotPictureType(device, false)));
 }
Beispiel #6
0
 public UploadFileResponseObject UploadTrailer(AppVersion appVersion, UploadFile uploadFile, string contentProviderId, string ssoTokenForVideo)
 {
     return(UploadFile(appVersion: appVersion, uploadFile: uploadFile, path: "/upload/purple-video", contentProviderId: contentProviderId, ssoToken: ssoTokenForVideo));
 }
Beispiel #7
0
 public UploadFileResponseObject UploadGeojson(AppVersion appVersion, UploadFile uploadFile, string contentProviderId, string ssoTokenForImage)
 {
     // TODO: Pushed back to a later iteration
     return(UploadFile(appVersion: appVersion, uploadFile: uploadFile, path: "/upload/geo-json", contentProviderId: contentProviderId, ssoToken: ssoTokenForImage));
 }
Beispiel #8
0
 public UploadFileResponseObject UploadWatchIcon(AppVersion appVersion, UploadFile uploadFile, string contentProviderId, string ssoTokenForImage)
 {
     // TODO: Pushed back to a later iteration
     return(UploadFile(appVersion: appVersion, uploadFile: uploadFile, path: "/upload/image", contentProviderId: contentProviderId, ssoToken: ssoTokenForImage, duValidationRuleSet: "MZPFT.GizmoAppIcon"));
 }
Beispiel #9
0
 public UploadFileResponseObject UploadLargeIcon(AppVersion appVersion, UploadFile uploadFile, string contentProviderId, string ssoTokenForImage)
 {
     return(UploadFile(appVersion: appVersion, uploadFile: uploadFile, path: "/upload/image", contentProviderId: contentProviderId, ssoToken: ssoTokenForImage, duValidationRuleSet: "MZPFT.LargeApplicationIcon"));
 }